function jobman_display_conf() { if (array_key_exists('jobmandisplaysubmit', $_REQUEST)) { check_admin_referer('jobman-display-updatedb'); jobman_display_updatedb(); } else { if (array_key_exists('jobmansortsubmit', $_REQUEST)) { check_admin_referer('jobman-sort-updatedb'); jobman_sort_updatedb(); } else { if (array_key_exists('jobmantemplatesubmit', $_REQUEST)) { check_admin_referer('jobman-template-updatedb'); jobman_template_updatedb(); } else { if (array_key_exists('jobmanappformsubmit', $_REQUEST)) { check_admin_referer('jobman-appform-updatedb'); jobman_appform_updatedb(); } else { if (array_key_exists('jobmanapptemplatesubmit', $_REQUEST)) { check_admin_referer('jobman-app-template-updatedb'); jobman_app_template_updatedb(); } else { if (array_key_exists('jobmanwraptextsubmit', $_REQUEST)) { check_admin_referer('jobman-wraptext-updatedb'); jobman_wrap_text_updatedb(); } else { if (array_key_exists('jobmanmisctextsubmit', $_REQUEST)) { check_admin_referer('jobman-misctext-updatedb'); jobman_misc_text_updatedb(); } } } } } } } ?> <div class="wrap"> <?php jobman_print_settings_tabs(); if (!get_option('pento_consulting')) { $widths = array('78%', '20%'); $functions = array(array('jobman_print_display_settings_box', 'jobman_print_sort_box', 'jobman_print_template_box', 'jobman_print_app_settings_box', 'jobman_print_app_template_box', 'jobman_print_misc_text_box', 'jobman_print_wrap_text_box'), array('jobman_print_donate_box', 'jobman_print_about_box')); $titles = array(array(__('Display Settings', 'jobman'), __('Job List Sorting', 'jobman'), __('Job Templates', 'jobman'), __('Application Form Settings', 'jobman'), __('Application Form Template', 'jobman'), __('Miscellaneous Text', 'jobman'), __('Page Text', 'jobman')), array(__('Donate', 'jobman'), __('About This Plugin', 'jobman'))); } else { $widths = array('49%', '49%'); $functions = array(array('jobman_print_display_settings_box', 'jobman_print_misc_text_box', 'jobman_print_wrap_text_box'), array('jobman_print_sort_box', 'jobman_print_template_box', 'jobman_print_app_settings_box', 'jobman_print_app_template_box')); $titles = array(array(__('Display Settings', 'jobman'), __('Miscellaneous Text', 'jobman'), __('Page Text', 'jobman')), array(__('Job List Sorting', 'jobman'), __('Job Templates', 'jobman'), __('Application Form Settings', 'jobman'), __('Application Form Template', 'jobman'))); } jobman_create_dashboard($widths, $functions, $titles); }
function jobman_conf() { global $jobman_formats; $options = get_option('jobman_options'); if (array_key_exists('tab', $_REQUEST)) { switch ($_REQUEST['tab']) { case 'display': jobman_display_conf(); return; case 'appform': jobman_application_setup(); return; case 'jobform': jobman_job_setup(); return; } } if (array_key_exists('jobmanconfsubmit', $_REQUEST)) { // Configuration form as been submitted. Updated the database. check_admin_referer('jobman-conf-updatedb'); jobman_conf_updatedb(); } else { if (array_key_exists('jobmanresumesubmit', $_REQUEST)) { check_admin_referer('jobman-resume-settings-updatedb'); jobman_resume_settings_updatedb(); } else { if (array_key_exists('jobmancatsubmit', $_REQUEST)) { check_admin_referer('jobman-categories-updatedb'); jobman_categories_updatedb(); } else { if (array_key_exists('jobmaniconsubmit', $_REQUEST)) { check_admin_referer('jobman-icons-updatedb'); jobman_icons_updatedb(); } else { if (array_key_exists('jobmanusersubmit', $_REQUEST)) { check_admin_referer('jobman-users-updatedb'); jobman_users_updatedb(); } else { if (array_key_exists('jobmanappemailsubmit', $_REQUEST)) { check_admin_referer('jobman-application-email-updatedb'); jobman_application_email_updatedb(); } else { if (array_key_exists('jobmaninterviewsubmit', $_REQUEST)) { check_admin_referer('jobman-interview-updatedb'); jobman_interview_updatedb(); } else { if (array_key_exists('jobmanotherpluginssubmit', $_REQUEST)) { check_admin_referer('jobman-other-plugins-updatedb'); jobman_other_plugins_updatedb(); } else { if (array_key_exists('jobmanuninstallsubmit', $_REQUEST)) { check_admin_referer('jobman-uninstall-updatedb'); jobman_uninstall_updatedb(); } } } } } } } } } ?> <div class="wrap"> <?php jobman_print_settings_tabs(); if (!get_option('smb_consulting')) { $widths = array('78%', '20%'); $functions = array(array('jobman_print_settings_box', 'jobman_print_categories_box', 'jobman_print_icons_box', 'jobman_print_user_box', 'jobman_print_application_email_box', 'jobman_print_other_plugins_box', 'jobman_print_uninstall_box'), array('jobman_print_survey_box', 'jobman_print_donate_box', 'jobman_print_about_box', 'jobman_print_translators_box')); $titles = array(array(__('Settings', 'jobman'), __('Categories', 'jobman'), __('Icons', 'jobman'), __('User Settings', 'jobman'), __('Application Email Settings', 'jobman'), __('Other Plugins', 'jobman'), __('Uninstall Settings', 'jobman')), array(__('Job Manager - SURVEY -', 'jobman'), __('Donate', 'jobman'), __('About This Plugin', 'jobman'), __('Translators', 'jobman'))); if ($options['interviews']) { $functions[0] = array_insert($functions[0], 5, 'jobman_print_interview_box'); $titles[0] = array_insert($titles[0], 5, __('Interview Settings', 'jobman')); } } else { $widths = array('49%', '49%'); $functions = array(array('jobman_print_settings_box', 'jobman_print_categories_box', 'jobman_print_other_plugins_box'), array('jobman_print_icons_box', 'jobman_print_user_box', 'jobman_print_application_email_box', 'jobman_print_uninstall_box')); $titles = array(array(__('Settings', 'jobman'), __('Categories', 'jobman'), __('Other Plugins', 'jobman')), array(__('Icons', 'jobman'), __('User Settings', 'jobman'), __('Application Email Settings', 'jobman'), __('Uninstall Settings', 'jobman'))); if ($options['interviews']) { $functions[1] = array_insert($functions[1], 3, 'jobman_print_interview_box'); $titles[1] = array_insert($titles[1], 3, __('Interview Settings', 'jobman')); } } jobman_create_dashboard($widths, $functions, $titles); ?> </div> <?php }
function jobman_application_setup() { if (array_key_exists('jobmansubmit', $_REQUEST)) { check_admin_referer('jobman-application-setup'); jobman_application_setup_updatedb(); } $options = get_option('jobman_options'); $fieldtypes = array('text' => __('Text Input', 'jobman'), 'radio' => __('Radio Buttons', 'jobman'), 'select' => __('Select Dropdown', 'jobman'), 'checkbox' => __('Checkboxes', 'jobman'), 'textarea' => __('Large Text Input (textarea)', 'jobman'), 'date' => __('Date Selector', 'jobman'), 'file' => __('File Upload', 'jobman'), 'geoloc' => __('Geolocation', 'jobman'), 'heading' => __('Heading', 'jobman'), 'html' => __('HTML Code', 'jobman'), 'blank' => __('Blank Space', 'jobman')); $categories = get_terms('jobman_category', 'hide_empty=0'); ?> <form action="" method="post"> <input type="hidden" name="jobmansubmit" value="1" /> <?php wp_nonce_field('jobman-application-setup'); ?> <div class="wrap"> <?php jobman_print_settings_tabs(); ?> <br/> <table id="jobman-application-setup" class="widefat page fixed"> <thead> <tr> <th scope="col"><?php _e('Field Label/Type', 'jobman'); ?> </th> <th scope="col"><?php _e('Categories', 'jobman'); ?> </th> <th scope="col"><?php _e('Data', 'jobman'); ?> </th> <th scope="col"><?php _e('Submit Filter/Filter Error Message', 'jobman'); ?> </th> <th scope="col" class="jobman-fieldsortorder"><?php _e('Sort Order', 'jobman'); ?> </th> <th scope="col" class="jobman-fielddelete"><?php _e('Delete', 'jobman'); ?> </th> </tr> </thead> <?php $fields = $options['fields']; if (count($fields) > 0) { uasort($fields, 'jobman_sort_fields'); foreach ($fields as $id => $field) { ?> <tr class="form-table"> <td> <input type="hidden" name="jobman-fieldid[]" value="<?php echo $id; ?> " /> <input class="regular-text code" type="text" name="jobman-label[]" value="<?php echo $field['label']; ?> " /><br/> <select name="jobman-type[]"> <?php foreach ($fieldtypes as $type => $label) { if ($field['type'] == $type) { $selected = ' selected="selected"'; } else { $selected = ''; } ?> <option value="<?php echo $type; ?> "<?php echo $selected; ?> ><?php echo $label; ?> </option> <?php } ?> </select><br /> <?php if (1 == $field['listdisplay']) { $checked = ' checked="checked"'; } else { $checked = ''; } ?> <input type="checkbox" name="jobman-listdisplay[<?php echo $id; ?> ]" value="1"<?php echo $checked; ?> /> <?php _e('Show this field in the Application List?', 'jobman'); ?> <br/> <?php if (1 == $field['emailblock']) { $checked = ' checked="checked"'; } else { $checked = ''; } ?> <input type="checkbox" name="jobman-emailblock[<?php echo $id; ?> ]" value="1"<?php echo $checked; ?> /> <?php _e('Block this field from application emails?', 'jobman'); ?> </td> <td><div class="jobman-categories-list"> <?php if (count($categories) > 0) { foreach ($categories as $cat) { $checked = ''; if (array_key_exists('categories', $field) && in_array($cat->term_id, $field['categories'])) { $checked = ' checked="checked"'; } ?> <input type="checkbox" name="jobman-categories[<?php echo $id; ?> ][]" value="<?php echo $cat->term_id; ?> "<?php echo $checked; ?> /> <?php echo $cat->name; ?> <br/> <?php } } ?> </div></td> <td><textarea class="large-text code" name="jobman-data[]"><?php echo $field['data']; ?> </textarea></td> <td> <?php if (1 == $field['mandatory']) { $checked = ' checked="checked"'; } else { $checked = ''; } ?> <input type="checkbox" name="jobman-mandatory[<?php echo $id; ?> ]" value="1"<?php echo $checked; ?> /> <?php _e('Mandatory field?', 'jobman'); ?> <br/> <textarea class="large-text code" name="jobman-filter[]"><?php echo $field['filter']; ?> </textarea><br/> <input class="regular-text code" type="text" name="jobman-error[]" value="<?php echo esc_attr($field['error']); ?> " /> </td> <td><a href="#" onclick="jobman_sort_field_up( this ); return false;"><?php _e('Up', 'jobman'); ?> </a> <a href="#" onclick="jobman_sort_field_down( this ); return false;"><?php _e('Down', 'jobman'); ?> </a></td> <td><a href="#" onclick="jobman_delete( this, 'jobman-fieldid', 'jobman-delete-list' ); return false;"><?php _e('Delete', 'jobman'); ?> </a></td> </tr> <?php } } $template = '<tr class="form-table">'; $template .= '<td><input type="hidden" name="jobman-fieldid[]" value="-1" /><input class="regular-text code" type="text" name="jobman-label[]" /><br/>'; $template .= '<select name="jobman-type[]">'; foreach ($fieldtypes as $type => $label) { $template .= '<option value="' . $type . '">' . $label . '</option>'; } $template .= '</select><br/>'; $template .= '<input type="checkbox" name="jobman-listdisplay" value="1" />' . __('Show this field in the Application List?', 'jobman') . '<br/>'; $template .= '<input type="checkbox" name="jobman-emailblock" value="1" />' . __('Block this field from application emails?', 'jobman') . '</td>'; $template .= '<td>'; if (count($categories) > 0) { foreach ($categories as $cat) { $template .= '<input type="checkbox" name="jobman-categories" class="jobman-categories" value="' . $cat->term_id . '" />' . $cat->name . '<br/>'; } } $template .= '</td>'; $template .= '<td><textarea class="large-text code" name="jobman-data[]"></textarea></td>'; $template .= '<td><input type="checkbox" name="jobman-mandatory" value="1" />' . __('Mandatory field?', 'jobman') . '<br/>'; $template .= '<textarea class="large-text code" name="jobman-filter[]"></textarea><br/>'; $template .= '<input class="regular-text code" type="text" name="jobman-error[]" /></td>'; $template .= '<td><a href="#" onclick="jobman_sort_field_up( this ); return false;">' . __('Up', 'jobman') . '</a> <a href="#" onclick="jobman_sort_field_down( this ); return false;">' . __('Down', 'jobman') . '</a></td>'; $template .= '<td><a href="#" onclick="jobman_delete( this, \\\'jobman-fieldid\\\', \\\'jobman-delete-list\\\' ); return false;">' . __('Delete', 'jobman') . '</a></td></tr>'; // Replace names for the empty version being displayed $display_template = str_replace('jobman-categories', 'jobman-categories[new][0][]', $template); $display_template = str_replace('jobman-listdisplay', 'jobman-listdisplay[new][0][]', $display_template); $display_template = str_replace('jobman-emailblock', 'jobman-emailblock[new][0][]', $display_template); $display_template = str_replace('jobman-mandatory', 'jobman-mandatory[new][0][]', $display_template); $display_template = str_replace("\\'", "'", $display_template); echo $display_template; ?> <tr id="jobman-fieldnew"> <td colspan="6" style="text-align: right;"> <input type="hidden" name="jobman-delete-list" id="jobman-delete-list" value="" /> <a href="#" onclick="jobman_new( 'jobman-fieldnew', 'field' ); return false;"><?php _e('Add New Field', 'jobman'); ?> </a> </td> </tr> </table> <p class="submit"><input type="submit" name="submit" class="button-primary" value="<?php _e('Update Application Form', 'jobman'); ?> " /></p> <script type="text/javascript"> //<![CDATA[ jobman_templates['field'] = '<?php echo $template; ?> '; //]]> </script> </div> </form> <?php }