function JobListAttributes($list_mode = 'ALL', $show = '') { $this->set_list_mode($list_mode); $this->params = array(); $q_string = JB_generate_q_string(1); // Split up the $q_string in to key/val pairs and place in to $this->params if ($q_string) { $parts = explode('&', $q_string); if (is_array($parts) && sizeof(is_array($parts)) > 0) { $this->params['action'] = 'search'; foreach ($parts as $pair_str) { if ($pair_str) { $pair = explode('=', $pair_str); if (strpos($pair[0], '3%5B%5D') === strlen($pair[0]) - 7) { // does it end with square brackets? [] is 3%5B%5D // its an array $key = substr($pair[0], 0, strlen($pair[0]) - 6); // remove the square brackets $this->params[$key][] = $pair[1]; } else { $this->params[$pair[0]] = $pair[1]; } } } } } if (isset($_REQUEST['post_permalink'])) { // came from a permalink // so remove redundant variables from the $q_string // which are already encoded in the permalink global $post_tag_to_field_id; $parts = explode('/', JB_MOD_REWRITE_JOB_DIR); foreach ($parts as $part) { if (strpos($part, '%', 0) !== false) { $template_tag = substr($part, 1, strlen($part) - 2); $key = $post_tag_to_field_id[$template_tag]['field_id']; unset($this->params['action']); unset($this->params[$key]); } } } if ($_REQUEST['offset'] != '') { $_REQUEST['offset'] = (int) $_REQUEST['offset']; $this->params['offset'] = $_REQUEST['offset']; } if ($_REQUEST['show_emp'] != '') { $_REQUEST['show_emp'] = (int) $_REQUEST['show_emp']; $this->params['show_emp'] = $_REQUEST['show_emp']; } if ($_REQUEST['cat'] != '') { $_REQUEST['cat'] = (int) $_REQUEST['cat']; $this->params['cat'] = $_REQUEST['cat']; } if ($_REQUEST['order_by'] != '') { $ord = jb_alpha_numeric($_REQUEST['ord']); $_REQUEST['order_by'] = jb_alpha_numeric($_REQUEST['order_by']); $this->params['order_by'] = $_REQUEST['order_by']; $this->params['ord'] = $ord; } if ($_REQUEST['show'] != '') { $_REQUEST['show'] = preg_match('#[a-z]+#i', $_REQUEST['show'], $m); $_REQUEST['show'] = $m[0]; $this->params['show'] = $_REQUEST['show']; } $this->internal_page = strpos($_SERVER['PHP_SELF'], JB_CANDIDATE_FOLDER) !== false || strpos($_SERVER['PHP_SELF'], JB_EMPLOYER_FOLDER) !== false || strpos($_SERVER['PHP_SELF'], 'posts.php') !== false; // eg. 1 http://loaclhost/index.php?post_id=3&search=1 (prefix is &) // eg. 2 http://loaclhost/job/3?search=1 (prefix is ?) if ($this->list_mode == 'PREMIUM') { $this->params['p'] = '1'; } }
} break; case 'NO': $REQUEST_FEATURE = false; break; } if ($key_test_passed) { // viewing form an special that came form an application. if ($_REQUEST['a'] == 'N') { // Anonymous is N, turn off the request feature $REQUEST_FEATURE = false; } $DynamicForm->set_value('anon', $_REQUEST['a']); } if ($_REQUEST['action'] == 'search') { $q_string = JB_generate_q_string(2); } /* Display the resume */ if ($_REQUEST['resume_id'] != '') { // The following will put all the variables in $JBPage->vars // in to the local scope. This includes $admin, $DynamicForm, // resume_id extract($JBPage->get_vars(), EXTR_REFS); $data =& $DynamicForm->get_values(); /* Only increment the view tally if: - there is enough quota, $enough_quota - subscriptions are enabled, ($subscr_row['can_view_resumes']=='Y') - the subscriber can view resumes, ($subscr_row['can_view_resumes']=='Y')
function JB_echo_resume_list_data($admin) { global $label, $cur_offset; # HTML output for this function comes from ListMarkup Class # include/themes/default/JBListMarkup.php # Any HTML customizations should be done there. # Please copy this class in to your custom theme directory, and # customize form there $LM =& JB_get_ListMarkupObject(2); // load the ListMarkup Class $Form =& JB_get_DynamicFormObject(2); $ttf =& $Form->get_tag_to_field_id(); if ($_REQUEST['order_by'] != '') { $ord = jb_alpha_numeric($_REQUEST['ord']); if ($ord == 'asc') { $ord = 'desc'; } elseif ($ord == 'desc') { $ord = 'asc'; } else { $ord = 'asc'; } $order_str = "&order_by=" . JB_escape_html($_REQUEST['order_by']) . "&ord=" . $ord; } $q_string = JB_generate_q_string(2); $cur_offset = jb_alpha_numeric($_REQUEST['offset']); foreach ($LM->column_list as $template_tag) { if ($LM->column_info[$template_tag]['admin'] == 'Y' && !$admin) { continue; // do not render this column in admin } $val = $Form->get_value($ttf[$template_tag]['field_id']); // process the value depending on what kind of template tag it was given. switch ($template_tag) { case 'DATE': $val = JB_get_local_time($val); $init_date = strtotime(jb_trim_date($val)); $dst_date = strtotime(jb_trim_date(JB_get_local_time(gmdate("Y-m-d H:i:s")))); $val = JB_get_formatted_date($val); if (!$init_date) { $days = "x"; } else { $diff = $dst_date - $init_date; $days = floor($diff / 86400); } $val .= $LM->get_resume_data_line_break(); if ($days == 0) { $val = $val . $LM->get_resume_label_today(); } elseif ($days > 0 && $days < 2) { $val = $val . $LM->get_resume_label_day_agao($days); } elseif ($days > 1 && $days < 8) { $val = $val . $LM->get_resume_label_days_ago($days); } elseif ($days >= 8) { $val = $val . $LM->get_resume_label_more_days_ago($days); } break; default: if ($LM->column_info[$template_tag]['trunc'] > 0) { $val = JB_truncate_html_str($val, $LM->column_info[$template_tag]['trunc'], $trunc_str_len); } $val = JB_get_list_template_value($ttf[$template_tag], $val, $admin, 2); if ($LM->column_info[$template_tag]['clean'] == 'Y') { // fix up punctuation spacing $val = preg_replace(JB_CLEAN_PUN_REGEX, '$1 ', $val); } } if ($LM->column_info[$template_tag]['is_bold'] == 'Y') { $b1 = $LM->get_resume_open_bold(); $b2 = $LM->get_resume_close_bold(); } else { $b1 = ''; $b2 = ''; } if ($LM->column_info[$template_tag]['link'] == 'Y') { // Render as a Link to the record? $url = htmlentities($_SERVER['PHP_SELF']) . '?resume_id=' . $Form->get_value('resume_id') . '&offset=' . $cur_offset . $order_str . $q_string; $val = $LM->get_resume_open_link($url) . $val . $LM->get_resume_close_link(); } JBPLUG_do_callback('resume_list_column_data_filter', $val, $template_tag); $LM->resume_open_cell($template_tag); // eg <td nowarp> $LM->echo_resume_data($val, $b1, $b2); $LM->resume_close_cell(); // eg </td> } }
function JB_list_profiles($admin = false, $order, $offset) { global $label; // languages array $records_per_page = 40; // process search result if ($_REQUEST['action'] == 'search') { $q_string = JB_generate_q_string(3); $where_sql = JB_generate_search_sql(3); } // JB_DATE_FORMAT(`adate`, '%d-%b-%Y') AS formatted_date $order = $_REQUEST['order_by']; if ($_REQUEST['ord'] == 'asc') { $ord = 'ASC'; } elseif ($_REQUEST['ord'] == 'desc') { $ord = 'DESC'; } else { $ord = 'DESC'; // sort descending by default } if ($order == '' || !JB_is_field_valid($order, 3)) { // by default, order by the post_date $order = " `profile_date` "; } else { $order = " `" . jb_escape_sql($order) . "` "; } $offset = (int) $_REQUEST['offset']; if ($offset < 0) { $offset = abs($offset); } $sql = "Select SQL_CALC_FOUND_ROWS *, DATE_FORMAT(`profile_date`, '%d-%b-%Y') AS formatted_profile_date FROM `profiles_table` WHERE 1=1 {$where_sql} ORDER BY {$order} {$ord} LIMIT {$offset}, {$records_per_page}"; //echo "[".$sql."]"; $result = JB_mysql_query($sql) or die(mysql_error()); ############ # get the count /* $count = mysql_num_rows($result); if ($count > $records_per_page) { mysql_data_seek($result, $offset); } */ $row = mysql_fetch_row(jb_mysql_query("SELECT FOUND_ROWS()")); $count = $row[0]; if ($count > 0) { if ($pages == 1) { } else { $pages = ceil($count / $records_per_page); $cur_page = $_REQUEST['offset'] / $records_per_page; $cur_page++; echo '<p class="nav_page_links">'; //echo "Page $cur_page of $pages - "; $label["navigation_page"] = str_replace("%CUR_PAGE%", $cur_page, $label["navigation_page"]); $label["navigation_page"] = str_replace("%PAGES%", $pages, $label["navigation_page"]); echo "<span > " . $label["navigation_page"] . "</span> "; $nav = JB_nav_pages_struct($result, $q_string, $count, $records_per_page); $LINKS = 10; JB_render_nav_pages($nav, $LINKS, $q_string, $show_emp, $cat); echo "</p>"; } ?> <table style="margin: 0 auto; width:100%; border:0px; background-color:d9d9d9; " cellspacing="1" cellpadding="5" > <tr bgcolor="#EAEAEA"> <?php if ($admin == true) { echo '<td> </td>'; JBPLUG_do_callback('profile_list_head_admin_action', $A = false); } JBPLUG_do_callback('profile_list_head_user_action', $A = false); JB_echo_list_head_data(3, $admin); ?> </tr> <?php $i = 0; $ProfileForm =& JB_get_DynamicFormObject(3); while (($row = mysql_fetch_array($result, MYSQL_ASSOC)) && $i < $records_per_page) { $ProfileForm->set_values($row); $i++; ?> <tr bgcolor="<?php echo JB_LIST_BG_COLOR; ?> " onmouseover="old_bg=this.getAttribute('bgcolor');this.setAttribute('bgcolor', '<?php echo JB_LIST_HOVER_COLOR; ?> ', 0);" onmouseout="this.setAttribute('bgcolor', old_bg, 0);"> <?php if ($admin == true) { echo '<td>'; ?> <input style="font-size: 8pt" type="button" value="Delete" onClick="if (!confirmLink(this, 'Delete, are you sure?')) {return false;} window.location='<?php echo htmlentities($_SERVER['PHP_SELF']); ?> ?action=delete&profile_id=<?php echo $row['profile_id']; ?> '"><br> <input type="button" style="font-size: 8pt" value="Edit" onClick="window.location='<?php echo htmlentities($_SERVER['PHP_SELF']); ?> ?action=edit&profile_id=<?php echo $row['profile_id']; ?> '"> <?php echo '</td>'; JBPLUG_do_callback('profile_list_data_admin_action', $A = false); } JBPLUG_do_callback('profile_list_data_user_action', $A = false); JB_echo_proile_list_data($admin); ?> </tr> <?php //$data[file_photo] = ''; // $new_name=''; } echo "</table>"; } else { echo "<p class='profiles_no_result'>" . $label["profiles_not_found"] . "</p>"; } }
// If it does have a CATEGORY, display the category tree and // break out from the loop if ($field['field_type'] == 'CATEGORY') { $cat_exists = true; $categories = JB_getCatStruct($_REQUEST['cat'], $_SESSION["LANG"], 3); JB_display_categories($categories, JB_CAT_COLS); break; } } ?> <div style="float: right;"> <font size="2"><a href="get_csv.php?table=profiles_table&form_id=3">Download CSV</a></font> </div> <?php if ($action == 'search') { $q_string = JB_generate_q_string(3); } $admin = true; $ProfileForm =& JB_get_DynamicFormObject(3); $ProfileForm->set_mode('edit'); if ($_REQUEST['save'] != "") { // saving $errors = $ProfileForm->validate(); if ($errors) { // we have an error $mode = "edit"; $ProfileForm->display_form('edit', true); } else { $mode = "edit"; $profile_id = $ProfileForm->save(true); $JBMarkup->ok_msg('Profile Saved');
function JB_list_resumes($list_mode, $show = '') { global $resume_tag_to_field_id; global $tag_to_search; global $label; // languages array $LM =& JB_get_ResumeListMarkupObject(); // load the ListMarkup Class $LM->set_list_mode($list_mode); $LM->set_show($show); if ($list_mode == 'ADMIN') { $admin = true; } ########################################### # initialize # if (!defined('JB_RESUMES_PER_PAGE')) { $resumes_per_page = 30; } else { $resumes_per_page = JB_RESUMES_PER_PAGE; } $order = jb_alpha_numeric($_REQUEST['order_by']); if ($_REQUEST['ord'] == 'asc') { $ord = 'ASC'; } elseif ($_REQUEST['ord'] == 'desc') { $ord = 'DESC'; } else { $ord = 'DESC'; // sort descending by default } if ($order == '' || !JB_is_field_valid($order, 2)) { // by default, order by the post_date $order = " `resume_date` "; } else { $order = " `" . jb_escape_sql($order) . "` "; } $offset = (int) $_REQUEST['offset']; if ($offset < 0) { $offset = abs($offset); } if ($offset == '') { $offset = 0; } // build the search query string global $action; // process search result if ($_REQUEST['action'] == 'search') { $q_string = JB_generate_q_string(2); $where_sql = JB_generate_search_sql(2); } $cat = (int) $_REQUEST['cat']; if ($cat != '') { $cat = "&cat={$cat}"; $cat_sql = JB_search_category_tree_for_resumes(); } if ($admin) { $where_status = " `status` != 'x' "; } else { $where_status = " `status`='ACT' "; } $approved = ""; if ($show == 'WA') { // Admin is true, WA will show posts waiting to be approved $where_sql = " AND approved='N' "; } else { $approved = "t1.approved='Y' AND "; } #####################3 # Set the LIMIT part of the sql query $limit_sql = "LIMIT " . jb_escape_sql($offset) . "," . jb_escape_sql($resumes_per_page) . " "; ################################## # How to get the resume count # If not searching by category, then if ($where_sql == '' && $cat_sql == '') { if ($admin) { // showing all resumes, active, not approved and suspended $resume_count = JB_get_resume_count('ALL'); } else { // showing active & approved $resume_count = JB_get_resume_count('ACT'); } if ($resume_count === null) { $calc_found_rows_sql = 'SQL_CALC_FOUND_ROWS'; } } else { $calc_found_rows_sql = 'SQL_CALC_FOUND_ROWS'; } if ($list_mode == 'SAVED') { $order = 'save_date'; $calc_found_rows_sql = 'SQL_CALC_FOUND_ROWS'; $sql = "SELECT {$calc_found_rows_sql} * FROM `saved_resumes` AS t1\n\t\tLEFT JOIN `resumes_table` as t2 on t2.resume_id=t1.resume_id\n\t\t WHERE t1.user_id='" . jb_escape_sql($_SESSION['JB_ID']) . "' ORDER BY {$order} {$ord} {$limit_sql}"; } elseif ($tag_to_search['smx_exists']) { // a skill matrix exists.. use the JOIN version of the query (Slower) // Using a LEFT JOIN because we want to have null values if no data for skill_matrix_data $sql = "Select {$calc_found_rows_sql} *, t1.user_id AS user_id FROM `resumes_table` AS t1 LEFT JOIN `skill_matrix_data` AS t2 ON t1.resume_id=t2.object_id WHERE {$approved} {$where_status} {$where_sql} {$cat_sql} group by t1.resume_id ORDER BY {$order} {$ord} {$appr_order} {$limit_sql} "; } else { $sql = "Select {$calc_found_rows_sql} * FROM `resumes_table` as t1 WHERE {$approved} {$where_status} {$where_sql} {$cat_sql} ORDER BY {$order} {$ord} {$limit_sql} "; } $result = JB_mysql_query($sql) or die(mysql_error()); ############ # get the count if not initialized # Ask MySQL to get the number of rows from the last query if ($calc_found_rows_sql) { # Even though the last query had a LIMIT clause $row = mysql_fetch_row(jb_mysql_query("SELECT FOUND_ROWS()")); $resume_count = $row[0]; } if ($resume_count > 0) { // estimate number of pages. $pages = ceil($resume_count / $resumes_per_page); if ($pages == 1) { // only one page - no need to show page navigation links } else { $pages = ceil($resume_count / $resumes_per_page); $cur_page = $offset / $resumes_per_page; $cur_page++; $LM->nav_pages_start(); //echo "Page $cur_page of $pages - "; $label["navigation_page"] = str_replace("%CUR_PAGE%", $cur_page, $label["navigation_page"]); $label["navigation_page"] = str_replace("%PAGES%", $pages, $label["navigation_page"]); $LM->nav_pages_status(); $nav = JB_nav_pages_struct($result, $q_string, $resume_count, $resumes_per_page); $LINKS = 10; JB_render_nav_pages($nav, $LINKS, $q_string, $show_emp, $cat); $LM->nav_pages_end(); } // How many columns? (the hits column does not count here...) ob_start(); // buffer the output, so that we can calculate the colspan. $colspan = JB_echo_list_head_data(2, $admin); // output the header columns $list_head_data = ob_get_contents(); ob_end_clean(); JBPLUG_do_callback('resume_list_set_colspan', $colspan); // set the colspan value $LM->set_colspan($colspan); if ($list_mode == 'EMPLOYER' || $list_mode == 'ADMIN' || $list_mode == 'SAVED') { $LM->open_form(); } $LM->list_start(); if ($list_mode == 'ADMIN') { // controls (approve button / disapprove button) $LM->admin_list_controls(); } elseif ($list_mode == 'EMPLOYER') { $LM->employer_list_controls(); } elseif ($list_mode == 'SAVED') { $LM->saved_list_controls(); } ####################################### # Open the list heading section $LM->list_head_open(); if ($list_mode == 'ADMIN') { $LM->list_head_admin_action(); JBPLUG_do_callback('resume_list_head_admin_action', $A = false); } elseif ($list_mode == 'EMPLOYER') { $LM->list_head_employer_action(); } elseif ($list_mode == 'SAVED') { $LM->list_head_saved_action(); } JBPLUG_do_callback('resume_list_head_user_action', $A = false); ####################################### echo $list_head_data; ####################################### # Close the list heading section $LM->list_head_close(); $i = 0; JBPLUG_do_callback('resume_list_pre_fill', $i, $admin); //A plugin can list its own records before, and adjust the $i while (($row = mysql_fetch_array($result, MYSQL_ASSOC)) && $i < $resumes_per_page) { $LM->set_values($row); JBPLUG_do_callback('resume_list_set_data', $row, $i, $list_mode); // A plugin can modify the prams $i++; if ($admin) { // If Administrator, then can view private details. $row['anon'] = 'N'; } $LM->list_item_open($admin); if ($list_mode == 'ADMIN') { $LM->list_data_admin_action(); JBPLUG_do_callback('resume_list_data_admin_action', $LM); } elseif ($list_mode == 'SAVED') { $LM->list_data_saved_action(); } elseif ($list_mode == 'EMPLOYER') { $LM->list_data_employer_action(); } JBPLUG_do_callback('resume_list_data_user_action', $LM); JB_echo_resume_list_data($admin); $LM->list_item_close(); } JBPLUG_do_callback('resume_list_back_fill', $i, $admin); // A plugin can list its own records after $LM->list_end(); if ($list_mode == 'EMPLOYER' || $list_mode == 'ADMIN') { $LM->close_form(); } $LM->nav_pages_start(); JB_render_nav_pages($nav, $LINKS, $q_string, $show_emp, $cat); $LM->nav_pages_end(); } else { $LM->no_resumes(); } }