示例#1
0
 /**
  *
  */
 public function update_response_job($job)
 {
     $fields = JEP_Field::get_all_fields();
     $return = array();
     foreach ($fields as $field) {
         switch ($field->type) {
             case 'text':
             case 'select':
             default:
                 $return[] = array('ID' => $field->ID, 'type' => $field->type, 'value' => get_post_meta($job['ID'], 'cfield-' . $field->ID, true));
                 break;
             case 'date':
                 $time = get_post_meta($job['ID'], 'cfield-' . $field->ID, true);
                 if ($time === '' || strtotime($time) === 0) {
                     $time = '';
                 } else {
                     $time = date(get_option('date_format'), strtotime($time));
                 }
                 $return[] = array('ID' => $field->ID, 'type' => $field->type, 'value' => $time);
                 break;
         }
     }
     $job['fields'] = $return;
     return $job;
 }
示例#2
0
    public function add_view($args)
    {
        if (isset($_GET['id'])) {
            $field = JEP_Field::get_field($_GET['id']);
        } else {
            $field = (object) array('name' => '', 'desc' => '', 'type' => 'text', 'options' => array(), 'required' => false, 'slug' => '', 'label' => '');
        }
        ?>
		<div class="et-main-header">
			<div class="title font-quicksand"><?php 
        echo $args->menu_title;
        ?>
</div>
			<?php 
        if (!isset($_REQUEST['type'])) {
            ?>
				<div class="desc"><?php 
            _e("Add a new job information field in Post a Job page.", ET_DOMAIN);
            ?>
</div>
			<?php 
        } else {
            ?>
				<div class="desc"><?php 
            _e("Add a new resume information field in Jobseeker Signup page.", ET_DOMAIN);
            ?>
</div>
			<?php 
        }
        ?>

		</div>
		<div class="et-main-main et-main-full no-menu clearfix inner-content" id="job-fields-add">
			<div class="title font-quicksand">
				<a href="<?php 
        echo remove_query_arg(array('action', 'id'));
        ?>
" class="back-link"> <span class="icon" data-icon="["></span>&nbsp;&nbsp;<?php 
        _e('Back to custom fields list', ET_DOMAIN);
        ?>
</a>
				<?php 
        if (isset($_GET['id'])) {
            _e('Edit a field', ET_DOMAIN);
        } else {
            _e('Add a new field', ET_DOMAIN);
        }
        ?>
			</div>
			<div class="desc">
				<form action="" method="post" id="fadd" class="et-form<?php 
        if (isset($_GET['type'])) {
            echo ' form-resume';
        }
        ?>
">
					<?php 
        if (isset($_REQUEST['type'])) {
            echo '<input type="hidden" name="resume_fields" value="1">';
        }
        if (isset($field->ID)) {
            echo '<input type="hidden" name="ID" value="' . $field->ID . '">';
        }
        if ($_GET['action'] == 'add') {
            echo '<input type="hidden" name="_nonce" value="' . wp_create_nonce('add_field') . '">';
        } else {
            if ($_GET['action'] == 'edit') {
                echo '<input type="hidden" name="_nonce" value="' . wp_create_nonce('edit_field') . '">';
            }
        }
        //field for resume  -->
        if (isset($_REQUEST['type'])) {
            ?>
						<div class="form-item">
							<label for="name"><?php 
            _e("Field Label", ET_DOMAIN);
            ?>
</label>
							<input required type="text" class="field_label" name="field_label" placeholder="<?php 
            _e('Enter a field label', ET_DOMAIN);
            ?>
" value="<?php 
            echo $field->label;
            ?>
">
						</div>
					<?php 
        }
        ?>

					<div class="form-item">
						<label for="name"><?php 
        _e("Field name", ET_DOMAIN);
        ?>
</label>
						<input id="field_name" <?php 
        if (isset($field->ID) && isset($_REQUEST['type'])) {
            echo 'readonly="readonly"';
        }
        ?>
 required type="text" name="name" placeholder="<?php 
        _e('Enter a field name', ET_DOMAIN);
        ?>
" value="<?php 
        echo $field->name;
        ?>
">
					</div>


					<?php 
        if (isset($_REQUEST['type'])) {
            ?>

						<div class="form-item">
							<label for="name"><?php 
            _e("Field Slug", ET_DOMAIN);
            ?>
</label>
							<input required type="text" name="field_slug" placeholder="<?php 
            _e('Enter a field slug', ET_DOMAIN);
            ?>
" value="<?php 
            echo $field->slug;
            ?>
">
						</div>
					<?php 
        }
        ?>


					<div class="form-item">
						<label for="name"><?php 
        _e("Field Description", ET_DOMAIN);
        ?>
</label>
						<textarea name="desc" placeholder="<?php 
        _e("Enter field's description", ET_DOMAIN);
        ?>
" cols="30" rows="10"><?php 
        echo $field->desc;
        ?>
</textarea>
					</div>
					<div class="form-item">
						<label for="name"><?php 
        _e("Field type", ET_DOMAIN);
        ?>
</label>
						<span class="cb-field">
							<input id="field-text" type="radio" name="type" value="text" <?php 
        echo $field->type == 'text' ? 'checked="checked"' : '';
        ?>
>
							<label class="field-type field-text" for="field-text"><?php 
        _e('Text', ET_DOMAIN);
        ?>
</label>
						</span>

						<span class="cb-field">
							<input id="field-url" type="radio" name="type" value="url" <?php 
        echo $field->type == 'url' ? 'checked="checked"' : '';
        ?>
>
							<label for="field-url" class="field-type field-text"><?php 
        _e('Url', ET_DOMAIN);
        ?>
</label>
						</span>

						<!-- radio !-->
						<span class="cb-field">
							<input id="field-radio" type="radio" name="type" value="radio" <?php 
        echo $field->type == 'radio' ? 'checked="checked"' : '';
        ?>
>
							<label for="field-radio" class="field-type field-text"><?php 
        _e('Radio', ET_DOMAIN);
        ?>
</label>
						</span>
						<!-- end radio !-->
						<span class="cb-field">
							<input id ="field-drop" type="radio" name="type" value="select" <?php 
        echo $field->type == 'select' ? 'checked="checked"' : '';
        ?>
>
							<label for="field-drop" class="field-type field-text"><?php 
        _e('Drop', ET_DOMAIN);
        ?>
</label>
						</span>

						<?php 
        if (isset($_REQUEST['type'])) {
            ?>
						<span class="cb-field">
							<input id="field-checkbox" type="radio" name="type" value="checkbox" <?php 
            echo $field->type == 'checkbox' ? 'checked="checked"' : '';
            ?>
>
							<label for="field-checkbox" class="field-type field-text"><?php 
            _e('Checkbox', ET_DOMAIN);
            ?>
</label>
						</span>

						<span class="cb-field">
							<input id ="field-textarea" type="radio" name="type" value="textarea" <?php 
            echo $field->type == 'textarea' ? 'checked="checked"' : '';
            ?>
>
							<label for="field-textarea" class="field-type field-text"><?php 
            _e('Textarea', ET_DOMAIN);
            ?>
</label>
						</span>

						<span class="cb-field">
							<input id="field-multi" type="radio" name="type" value="multi-text" <?php 
            echo $field->type == 'multi-text' ? 'checked="checked"' : '';
            ?>
>
							<label for="field-multi" class="field-type field-text"><?php 
            _e('Multivalue Text', ET_DOMAIN);
            ?>
</label>
						</span>

						<span class="cb-field">
							<input id ="field-image" type="radio" name="type" value="image" <?php 
            echo $field->type == 'image' ? 'checked="checked"' : '';
            ?>
>
							<label for="field-image" class="field-type field-text"><?php 
            _e('Image', ET_DOMAIN);
            ?>
</label>
						</span>
						<span class="cb-field">
							<input id ="field-file" type="radio" name="type" value="file" <?php 
            echo $field->type == 'file' ? 'checked="checked"' : '';
            ?>
>
							<label for="field-file" class="field-type field-text"><?php 
            _e('File', ET_DOMAIN);
            ?>
</label>
						</span>
						<?php 
        }
        ?>
						<span class="cb-field">
								<input id="field-date" type="radio" name="type" value="date" <?php 
        echo $field->type == 'date' ? 'checked="checked"' : '';
        ?>
>
								<label for="field-date" class="field-type field-text"><?php 
        _e('Date', ET_DOMAIN);
        ?>
</label>
						</span>

						<?php 
        if (isset($_REQUEST['type'])) {
            $class = 'hide';
            $limit_file = 1;
            if ($field->type == 'file' || $field->type == 'image') {
                $limit_file = get_post_meta($_GET['id'], 'limit_file', true);
                $class = '';
            }
            ?>
							<span class="cb-field file-limit <?php 
            echo $class;
            ?>
">
								<span><?php 
            _e('Limit number of files', ET_DOMAIN);
            ?>
</span>
								<input id ="field-file" size="3" style="width:30px; height:20px;" value="<?php 
            echo $limit_file;
            ?>
" placeholder="<?php 
            echo $limit_file;
            ?>
" type="text" name="limit_file" >

							</span>
							<?php 
        }
        ?>

					</div>
					<?php 
        if (!isset($_REQUEST['type'])) {
            ?>
					<div class="form-item form-drop" <?php 
            if (!in_array($field->type, array('select', 'checkbox', 'radio'))) {
                echo 'style="display:none"';
            }
            ?>
>
						<label for="option"></label>
						<ul class="form-options">
							<?php 
            $count = 0;
            if ($field->type == 'select' || $field->type == 'checkbox' || $field->type == 'radio') {
                $options = JEP_Field::get_options($field->ID);
            } else {
                $options = array();
            }
            if (!empty($options)) {
                foreach ($options as $option) {
                    ?>
									<li class="form-option">
										<input type="hidden" name="options[<?php 
                    echo $count;
                    ?>
][id]" value="<?php 
                    echo $option->ID;
                    ?>
">
										<input type="text" name="options[<?php 
                    echo $count;
                    ?>
][name]" value="<?php 
                    echo $option->name;
                    ?>
">
										<div class="controls controls-2">
											<a class="button act-open-form del-opt" rel="33" title="<?php 
                    _e('Delete this option');
                    ?>
">
												<span class="icon" data-icon="*"></span>
											</a>
										</div>
									</li>
									<?php 
                    $count++;
                }
            }
            ?>
							<li class="form-option">
								<input type="text" name="options[<?php 
            echo $count;
            ?>
]">
								<div class="controls controls-2">
									<a class="button act-open-form del-opt" rel="33" title="<?php 
            _e('Delete this option');
            ?>
">
										<span class="icon" data-icon="*"></span>
									</a>
								</div>
							</li>
						</ul>
						<script type="text/template" id="tl_option">
							<li class="form-option">
								<input type="text" name="options[{{ id }}]">
								<div class="controls controls-2">
									<a class="button act-open-form" title="<?php 
            _e('Delete this option');
            ?>
">
										<span class="icon" data-icon="*"></span>
									</a>
								</div>
							</li>
						</script>
					</div>
					<div class="form-item">
						<label for="required"><?php 
            _e('Required');
            ?>
</label>
						<input type="hidden" name="required" value="0">
						<input type="checkbox" name="required" value="1" id="required" <?php 
            if ($field->required) {
                echo 'checked="checked"';
            }
            ?>
 > 
						<label for="required" style="display:inline;" >
							<?php 
            _e("Check this if field is required", ET_DOMAIN);
            ?>
						</label>
					</div>
					<?php 
        } else {
            echo '<input type="hidden" value="" name="options" />';
        }
        ?>
					<input type="submit" class="et-button btn-button load-more" value="<?php 
        _e('Save', ET_DOMAIN);
        ?>
">
				</form>
			</div>
		</div>
		<?php 
    }
示例#3
0
 function je_resume_edit_form($resume)
 {
     $fields = JEP_Field::get_all_fields('resume');
     if ($fields) {
         foreach ($fields as $key => $field) {
             $this->show_resume_field_on_mobile($resume, $field);
         }
         echo '<input type="hidden" id="field_current_date" value="' . date(get_option("date_format"), time()) . '" />';
     }
 }