<?php
/*
Template Name: Create a Job
*/
?>
<?php
if($_REQUEST['backedit']=='')
{
$_SESSION['ads_information_session'] = array(); }
if(!$current_user->data->ID)
{
wp_redirect(get_settings('home').($location='/wp-login.php'));
}
global $wpdb,$General;
$generalinfo = $General->get_general_settings();
$pid = $_REQUEST['pid'];
if($_SESSION['ads_information_session']['post'])
{
$post_info = $_SESSION['ads_information_session']['post'];
$data['post_title'] = $post_info['post_title'];
$data['description'] = $post_info['description'];
$data['post_location'] = $post_info['post_location'];
$data['post_url'] = $post_info['post_url'];
$data['owner_name'] = $post_info['owner_name'];
$data['owner_email'] = $post_info['owner_email'];
$data['owner_phone'] = $post_info['owner_phone'];
$data['zona'] = $post_info['zona'];
$data['termid'] = $post_info['termid'];
$data['main_cat'] = $post_info['termid'];
$data['post_tags'] = $post_info['post_tags'];
$data['coupon_code'] = $post_info['coupon_code'];
$data['feature_prd'] = $post_info['feature_prd'];
if($_SESSION['ads_information_session']['images'])
{
$post_images = implode(',',$_SESSION['ads_information_session']['images']); }
}
elseif($pid)
{
$post_info = $General->get_post_info($pid);
$data['post_title'] = $post_info['post_title'];
$data['description'] = $post_info['post_content'];
$catinfoarr = get_the_category($post_info['ID']);
$isfeature = '';
for($c=0;$c<count($catinfoarr);$c++) {
if($catinfoarr[$c]->term_id == $generalinfo['feature_catid'])
{
$isfeature = 'checked="checked"';
}else
{
$data['termid'] = $catinfoarr[$c]->term_id;
}
}
$isfeature = '';
for($c=0;$c<count($catinfoarr);$c++) {
if($catinfoarr[$c]->term_id == $generalinfo['feature_catid'])
{
$isfeature = 'checked="checked"';
}else
{
$data['main_cat'] = $catinfoarr[$c]->term_id;
}
}
$isfeature = '';
for($c=0;$c<count($catinfoarr);$c++) {
if($catinfoarr[$c]->term_id == $generalinfo['feature_catid'])
{
$isfeature = 'checked="checked"';
}else
{
$data['zona'] = $catinfoarr[$c]->term_id;
}
}
$data['post_location'] = get_post_meta($post_info['ID'], 'post_location', $single = true);
$data['post_url'] = get_post_meta($post_info['ID'], 'post_url', $single = true);
$data['owner_name'] = get_post_meta($post_info['ID'], 'owner_name', $single = true);
$data['owner_email'] = get_post_meta($post_info['ID'], 'owner_email', $single = true);
$data['owner_phone'] = get_post_meta($post_info['ID'], 'owner_phone', $single = true);
$post_images = get_post_meta($post_info['ID'], 'post_images', $single = true);
$tagsarr = get_the_tags($post_info['ID']);
if($tagsarr)
{
foreach($tagsarr as $key=>$val)
{
$tags[] = $val->name;
}
$data['post_tags'] = $post_tags;
}
}
//echo "<pre>";
//print_r($_SESSION['ads_information_session']);
?>
<div class="upload">
<input name="fileId" id="fileId" value="" type="hidden">
<input name="fileTitle" id="fileTitle" value="" type="hidden">
<input value="1" name="Count" id="Count" type="hidden">
<input name="images[]" value="" type="file" class="textfield" />
<div id="file_div"> </div>
<input type="button" name="AddNew" value="Añadir nueva imagen" class=" addnew" onClick="customClick('file','','','');" />
</div>
<div style="clear:both;">
<?php
if($post_images!='')
{
$post_images_arr = explode(',',$post_images); for($i=0;$i<count($post_images_arr);$i++) {
?>
<div style="width:50px; float:left; margin:0 11px 11px 0; " id="img_<?php echo $i;?>" >
<img src="<?php bloginfo('template_directory'); ?>/thumb.php?src=<?php echo $post_images_arr[$i]; ?>&w=50&h=50&zc=1<?php echo $thumb_url;?>" alt="<?php the_title(); ?>" />
<input type="hidden" name="hidden_image[]" value="<?php echo $post_images_arr[$i]; ?>" />
<a href="javascript:void(0);" onClick="removeImage('<?php echo $post_images_arr[$i]; ?>','img_<?php echo $i;?>');"><?php _e(REMOVE_LINK_TEXT);?></a>
</div>
<?php
}
}
?>
</div>
</div>
<input type="hidden" name="type" value="<?php echo $_REQUEST['type'];?>" />
<?php
if($_REQUEST['pid'])
{
if($isfeature!='')
{
?>
<input type="hidden" name="feature_prd" value="1" />
<strong><?php _e(POST_ADS_FEATURE_MSG1);?></strong>
<?php
}
}else
{
?>
<div class="create_post_row clearfix" style="display:none"> <label> <?php _e(COUPON_CODE_TEXT);?> : </label>
<input name="coupon_code" value="<?php echo $data['coupon_code'];?>" type="text" class="textfield" />
<span class="note"> <?php _e(COUPON_CODE_TEXT_NOTE);?> </span>
</div>
<?php
if($generalinfo['feature_catid'])
{
?>
<div class="create_post_row clearfix"> <span class="pay_basic"><?php _e(POST_ADS_FEATURE_MSG2);?> <strong> <?php echo $generalinfo['currencysym'].$generalinfo['ads_price'];?>.</strong></span></div>
<div class="create_post_row clearfix row_spacer"> <span class="featured_ads_price"> <input type="checkbox" <?php echo $isfeature;?> <?php if($data['feature_prd']){ echo 'checked="checked"';}?> name="feature_prd" value="1" /> <?php _e(POST_ADS_FEATURE_MSG3);?>
<?php if($isfeature ==''){?>
<?php _e(POST_ADS_FEATURE_MSG4);?> <strong class="extra_price"> <?php echo $generalinfo['currencysym'].$generalinfo['feature_ads_price'];?> </strong> <?php _e(POST_ADS_FEATURE_MSG5);?>
<?php }?> </span>
</div>
<?php
}
}
?>
<input type="submit" name="submit" value="<?php _e(PREVIEW_BUTTON);?>" class="normal_button preview" />
</form>