Skip to content

Instantly share code, notes, and snippets.

Created May 26, 2012 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2795108 to your computer and use it in GitHub Desktop.
Save anonymous/2795108 to your computer and use it in GitHub Desktop.
<?php error_reporting(E_ALL); ?>
<!--<script type="text/javascript" src="/js/jqre/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/js/jqre/jquery.bgiframe.min.js"></script>-->
<link rel="stylesheet" href="/js/jwysiwyg/jquery.wysiwyg.css" type="text/css"/>
<link rel="stylesheet" href="../css/position_styles.css" type="text/css"/>
<!--<script type="text/javascript" src="/js/jwysiwyg/lib/jquery.js"></script>
<script type="text/javascript" src="/js/jwysiwyg/jquery.wysiwyg.js"></script>
<script type="text/javascript" src="/js/jwysiwyg/controls/wysiwyg.image.js"></script>
<script type="text/javascript" src="/js/jwysiwyg/controls/wysiwyg.link.js"></script>
<script type="text/javascript" src="/js/jwysiwyg/controls/wysiwyg.table.js"></script>
-->
<script type="text/javascript" src="/js/tiny_mce/jquery.tinymce.js"></script>
<script>
var stat= <?php echo json_encode($status) ?>;
</script>
<script src="../js/zip-decoder.js"></script>
<script type="text/javascript">
$().ready(function() {
$('textarea.tinymce').tinymce({
// Location of TinyMCE script
script_url : '/js/tiny_mce/tiny_mce.js',
// General options
theme : "simple"
//plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
// Theme options
/* theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
*/
//theme_advanced_resizing : true,
// Example content CSS (should be your site CSS)
//content_css : "css/content.css",
});
});
</script>
<script type="text/javascript">
var popup_text='Your Job Posting has been created.';
function setValue(val){
oFormObject = document.forms['positions_create_form'];
oFormObject.elements["openPost"].value = val;
if(val== 'Pending'){
popup_text = 'Your Job Posting has been saved and is pending.';
}
return ture;
}
$(document).ready(function() {
$("input[name=zip_code]").zipDecode({
service: '../profile/zip-decoder.php',
cityEl : 'city',
stateEl: 'state'
});
$('#positions_create_form').submit(function() {
var options = {
dataType: 'json',
beforeSubmit: validatePost,
success: postReturn,
url: '../postings/save_position_data.php',
type: 'POST'
};
$(this).ajaxSubmit(options);
return false;
});
$('#positions_update_form').submit(function() {
var options1 = {
dataType: 'json',
beforeSubmit: validatePost,
success: postReturn,
url: '../postings/update_position_data.php',
type: 'POST'
};
$(this).ajaxSubmit(options1);
return false;
});
function postReturn(data){
if(data.error){
alert('Error: '+data.msg);
}else {
//var choose = confirm(popup_text+" Click OK to manage your postings or Cancel to enter another Job Posting");
window.location ='manage_postings.php?status='+stat;
/*if(choose){
window.location ='manage_postings.php';
} else {
window.location ='create.php';
}*/
}
}
function validatePost(formData, jqForm, options) {
var result=true;
if (!jqForm[0].job_title.value) {
$('#positions_create_form input[name=job_title]').addClass('input_error').focus();
result = false;
}
else {
$('#positions_create_form input[name=job_title]').removeClass('input_error');
}
if (!jqForm[0].city.value ) {
$('#positions_create_form input[name=city]').addClass('input_error').focus();
result = false;
}
else {
$('#positions_create_form input[name=city]').removeClass('input_error');
}
if (!jqForm[0].state.value) {
$('#positions_create_form select[name=state]').addClass('input_error').focus();
result = false;
}
else {
$('#positions_create_form select[name=state]').removeClass('input_error');
}
if (!jqForm[0].zip_code.value) {
$('#positions_create_form input[name=zip_code]').addClass('input_error').focus();
result = false;
}
else {
$('#positions_create_form input[name=zip_code]').removeClass('input_error');
}
if (!jqForm[0].degree.selectedIndex) {
$('#positions_create_form select[name=degree]').addClass('input_error').focus();
result = false;
}
else {
$('#positions_create_form select[name=degree]').removeClass('input_error');
}
if (!jqForm[0].travel_id.selectedIndex) {
$('#positions_create_form select[name=travel_id]').addClass('input_error').focus();
result = false;
}
else {
$('#positions_create_form select[name=travel_id]').removeClass('input_error');
}
if (!jqForm[0].bill_rate.selectedIndex) {
$('#positions_create_form select[name=bill_rate]').addClass('input_error').focus();
result = false;
}
else {
$('#positions_create_form select[name=bill_rate]').removeClass('input_error');
}
if (!jqForm[0].years.selectedIndex) {
$('#positions_create_form select[name=years]').addClass('input_error').focus();
result = false;
}
else {
$('#positions_create_form select[name=years]').removeClass('input_error');
}
if (jqForm[0].summary_skills.value=='0') {
$('#positions_create_form select[name=summary_skills]').addClass('input_error').focus();
result = false;
}
else {
$('#positions_create_form select[name=summary_skills]').removeClass('input_error');
}
if (jqForm[0].secexpertise.value=='0') {
$('#positions_create_form select[name=secexpertise]').addClass('input_error').focus();
result = false;
}
else {
$('#positions_create_form select[name=secexpertise]').removeClass('input_error');
}
if (jqForm[0].priexpertise.value == '0') {
$('#positions_create_form select[name=priexpertise]').addClass('input_error').focus();
result = false;
}
else {
$('#positions_create_form select[name=priexpertise]').removeClass('input_error');
}
if (result == false) {
$('#post_msg_icon').attr('class', 'message_failed');
$('#post_msg').html('please enter required fields and try again.');
}
var text = tinyMCE.get('job_description').getContent();
var div = document.createElement("div");
div.innerHTML = text;
var jobdesc = div.textContent || div.innerText || "";
if (!jobdesc) {
//$('#positions_create_form input[name=job_description]').addClass('input_error').focus();
result = false;
}
return result;
}
});
</script>
<?php
/* get the status for the current job (so that when the "Back to jobs manage jobs >>" link is clicked,
* it'll go back to the section the user was viewing)
*/
$status = isset($_REQUEST['status'])? $_REQUEST['status'] : '';
?>
<!-- POSTING INFORMATION -->
<br/>
<div class="prof_edit_box_top">
<h1>Create New Job Posting </h1>
<a href="manage_postings.php?status=<?php echo $status; ?>" style="position: absolute; right: 35px; top: 5px;">Back to manage jobs >></a>
<div class="collapse_button">
<a href="#" rel="toggle[positions_create]" data-openimage="../css/images/buttons/collapse_close.png" data-closedimage="../css/images/buttons/collapse_open.png"><img src="../css/images/buttons/collapse_close.png" width="20" height="20" alt="" /></a></div>
<div class="clear"></div>
</div>
<div class="prof_edit_box" id="positions_create">
<form id="<?php echo $formnm; ?>" name="<?php echo $formnm; ?>" action="" method="post">
<input type="hidden" name="user_id" value="<?php echo $current_user->user_id; ?>"/>
<input type="hidden" name="openPost" value="0"/>
<input type="hidden" name="job_posting_id" value="<?php echo isset($_REQUEST['job_posting_id'])? $_REQUEST['job_posting_id'] : ''; ?>"/>
<span><div class="required_field_title_block">Job Title</div><input style="width: 350px;" type="text" name="job_title" value="<?php echo isset($details->job_title)? $details->job_title : ''; ?>" /></span>
<span>Client<br /><input style="width: 200px;" type="text" id="client" name="client" value="<?php echo isset($details->client_name)? $details->client_name : ''; ?>" /></span>
<?php if(isset($_REQUEST["job_posting_id"])){ ?>
<span>Status<br />
<select style="width: 150px;" id="job_status" name="job_status">
<option value="Open" <?php if($details->job_status == 'Open') echo 'selected';?>>Open</option>
<option value="Pending" <?php if($details->job_status == 'Pending') echo 'selected';?>>Pending</option>
<option value="Closed" <?php if($details->job_status == 'Closed') echo 'selected';?>>Closed</option>
</select>
</span>
<? } ?>
<br />
<span><div class="required_field_title_block">Job Location (City)</div><input style="width: 250px;" value="<?php echo isset($_REQUEST['job_city']) ? trim($_REQUEST['job_city']) : (($details->city != '') ? $details->city : ''); ?>" type="text" id="city" name="city"></span>
<span><div class="required_field_title_block">State</div>
<select style="width: 150px;" name="state" id="state" >
<?php
foreach($system_states as $state_abbr => $state_name) {
?>
<option value="<?php echo $state_abbr; ?>" <?php if((isset($details->state_abbr) && $details->state_abbr == $state_abbr) || isset($_REQUEST['job_state']) && $_REQUEST['job_state'] == $state_abbr) echo 'selected'; ?>><?php echo $state_name; ?></option>
<?php } ?>
</select></span>
<span><div class="required_field_title_block">Zip Code</div><input style="width: 77px;" type="text" class="zip" id="zip_code" value="<?php echo isset($_REQUEST["job_zip"]) ? trim($_REQUEST["job_zip"]) : (($details->zipcode != '') ? $details->zipcode : ''); ?>" name="zip_code" />
</span>
<span><div class="required_field_title_block">Education Requirements</div>
<select style="width: 200px;" name="degree" id="degree" >
<?php
foreach($system_degrees as $degree_id => $degree_name) {
?>
<option value="<?php echo $degree_id; ?>" <?php if(isset($details->maxdegree_id) && ($details->maxdegree_id == $degree_id)) echo 'selected'; ?>><?php echo $degree_name; ?></option>
<?php } ?>
</select>
</span>
<br />
<span><div class="required_field_title_block">Travel Requirements</div>
<select style="width: 255px;" name="travel_id" >
<option value="0">Choose</option>
<?php
foreach($system_travel as $field_value => $val) {
?>
<option value="<?php echo $field_value+1; ?>" <?php if(isset($details->travel_id) && $details->travel_id == ($field_value + 1)) echo 'selected'; ?>><?php echo $val; ?></option>
<?php } ?>
</select>
</span>
<span><div class="required_field_title_block">Rate Range</div>
<select style="width: 255px;" name="bill_rate" >
<option value="0">Choose</option>
<?php
foreach($system_rates as $rate_id => $rate_name) {
?>
<option value="<?php echo $rate_id; ?>" <?php if((isset($details->bill_rate)) && ($details->bill_rate == $rate_id)) echo 'selected'; ?>><?php echo $rate_name; ?></option>
<?php } ?>
</select>
</span>
<span><div class="required_field_title_block">Minimum Years Experience</div>
<select style="width: 300px;" name="years">
<option value="0">Choose</option>
<?php
foreach($system_years_experience as $years_experience_id => $years_experience) {
?>
<option value="<?php echo $years_experience_id; ?>" <?php if((isset($details->years_experience_id)) && ($details->years_experience_id == $years_experience_id)) echo 'selected'; ?>><?php echo $years_experience; ?></option>
<?php } ?>
</select>
</span>
<br/>
<span><div class="required_field_title_block">Job Description (cut and paste)</div>
<textarea style="width:940px" rows="10" class="tinymce" name="job_description" " id="job_description"><?php echo isset($details->job_description)? $details->job_description : ''; ?></textarea>
</span>
<br/>
<span style="margin-top: 200px">
<span><div class="required_field_title_block">Summary Skills</div>
<select style="width: 200px;" name="summary_skills" id="summary_skills" >
<option value="0">Choose</option>
<?php
foreach($system_skills as $skill_id => $skill) {
?>
<option value="<?php echo $skill_id; ?>" <?php if(isset($details->skills_id) && $details->skills_id == $skill_id) echo 'selected'; ?>><?php echo $skill; ?></option>
<?php } ?>
</select>
</span>
<span><div class="required_field_title_block">Primary Area of Expertise</div>
<select style="width: 200px;" name="priexpertise" id="priexpertise" >
<option value="0">Choose</option>
<?php
foreach($system_expertise as $expertise_id => $expertise_name) {
?>
<option value="<?php echo $expertise_id; ?>" <?php if((isset($details->priexpertise_id)) && $details->priexpertise_id == $expertise_id) echo 'selected'; ?>><?php echo $expertise_name; ?></option>
<?php } ?>
</select>
</span>
<span><div class="required_field_title_block">Secondary Area of Expertise</div>
<select style="width: 200px;" name="secexpertise" id="secexpertise" >
<option value="0">Choose</option>
<?php
foreach($system_expertise as $expertise_id => $expertise_name) {
?>
<option value="<?php echo $expertise_id; ?>" <?php if(isset($details->secexpertise_id) && $details->secexpertise_id == $expertise_id) echo 'selected'; ?>><?php echo $expertise_name; ?></option>
<?php } ?>
</select>
</span>
</span>
<br/>
<span class="required_field_title" style="color: #FF0000; margin-left: 700px;">Required Fields</span>
<!--span style="margin-left: 700px">
<span>
<div class="required_field_title_block"></div>
</span>
<div class="required_field_title" style="color: #FF0000; ">Required Fields</div>
</span-->
<div>
<?php if(isset($_REQUEST["job_posting_id"])){ ?>
<table class="message_section" cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign="top" width="100">
<input type="submit" class="button_update" name="update_post" id="update_post" value="" />
</td>
<td valign="top" width="100">
</td>
<td valign="middle" align="right" width="20">
<div id="post_msg_icon" class="message_blank"></div>
</td>
<td valign="middle" width="90%">
<div id="post_msg" class="message_text"></div>
</td>
</tr>
</table>
<?php }else{ ?>
<p>Clicking "Post" will give the job a status of "Open". It will be visible to others.</p>
<p>Clicking "Save" will give the job a status of "Pending". It will not be visible to others.</p>
<table class="message_section" cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign="top" width="100">
<input type="submit" class="button_save" name="save_post" id="save_post" value="" onclick="setValue('Pending');" />
</td>
<td valign="top" width="100">
<input type="submit" class="button_post" name="post_post" id="post_post" value="" onclick="setValue('Open');" />
</td>
<td valign="middle" align="right" width="20">
<div id="post_msg_icon" class="message_blank"></div>
</td>
<td valign="middle" width="90%">
<div id="post_msg" class="message_text"></div>
</td>
</tr>
</table>
<?php }?>
</div>
</form>
</div>
<div class="prof_edit_box_bottom"></div>
<!-- PROFILE EDIT CONTACT INFORMATION -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment