function JB_display_post_list(&$posts, $lm) { global $JobListAttributes; global $list_mode; $list_mode = $lm; global $post_count; global $post_id; global $label; global $column_list; // - this is initialized in lists.inc.php using the JB_echo_list_head_data() function global $column_info; // - same as above $PLM =& JB_get_PostListMarkupObject(); // load the ListMarkup Class $PLM->set_list_mode($lm); if (func_num_args() > 2) { // what kind of posts to show $show = func_get_arg(2); $_REQUEST['show'] = $show; } $PLM->set_show($show); $JobListAttributes = new JobListAttributes($list_mode, $show); $JobListAttributes->set_list_mode($lm); if ($list_mode == 'ADMIN') { $admin = true; } if ($list_mode == "BY_CATEGORY_ADMIN") { $list_mode = "ADMIN"; } if ($list_mode == 'ADMIN' || $list_mode == 'SAVED' || $list_mode == 'EMPLOYER') { $PLM->open_form($JobListAttributes); } if ($list_mode == 'PREMIUM') { if (JB_PREMIUM_POSTS_LIMIT == 'YES') { $pp_page = JB_PREMIUM_POSTS_PER_PAGE; } else { $pp_page = 200; } } elseif ($list_mode == 'EMPLOYER') { if (defined('JB_MANAGER_POSTS_PER_PAGE')) { $pp_page = JB_MANAGER_POSTS_PER_PAGE; } else { $pp_page = 20; } } else { $pp_page = JB_POSTS_PER_PAGE; } if ($list_mode != 'PREMIUM') { JB_nav_pages($result, $q_string, $pp_page); } $css_id = $PLM->get_list_css_id(); $PLM->list_start($css_id); ################ # Generate output for the head <tr> row of the table # Dynamic columns are generated by Jb_echo_list_head_data() in lists.inc.php and # placed in the $head_data variable # The $head_data is cached, otherwise if conditions are used # to generate the output for the <td> parts $COLSPAN = ''; // 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(1, $admin); $list_head_data = ob_get_contents(); ob_end_clean(); JBPLUG_do_callback('job_list_set_colspan', $COLSPAN); // set the colspan value $PLM->set_colspan($COLSPAN); if ($list_mode == 'SAVED') { $PLM->saved_list_controls(); } elseif ($list_mode == 'ADMIN') { $PLM->admin_list_controls(); } elseif ($list_mode == 'EMPLOYER') { $PLM->employer_list_controls(); } JBPLUG_do_callback('job_list_controls', $PLM); // plugins can render any undefined list controls ####################################### # Open the list heading section $PLM->list_head_open(); if ($list_mode == 'ADMIN') { $PLM->list_head_admin_action(); JBPLUG_do_callback('job_list_head_admin_action', $A = false); // plugin for addition action column } elseif ($list_mode == 'EMPLOYER') { $PLM->list_head_employer_action(); } elseif ($list_mode == 'SAVED') { $PLM->list_head_saved_action(); } JBPLUG_do_callback('joblist_list_head_action', $PLM); ######################################################################## echo $list_head_data; // output the header columns that were buffered before. ######################################################################## if ($list_mode == 'EMPLOYER') { // Here we make sure that the 'views' and 'applications' columns // appear in manager.php, regardless how the list is configured. $PLM->list_head_employer_extras(); JBPLUG_do_callback('job_list_head_employer_extra_col', $A = false); // plugin for the additional columns seen by the employer's Application manager } if ($list_mode == 'PREMIUM' && JB_SHOW_PREMIUM_HITS == 'YES') { $PLM->list_head_premium_extras(); } ###################################### # Close the list heading section $PLM->list_head_close(); $i = 0; $current_day = JB_get_local_time(gmdate("r")); // local time form GMT # Output the data rows JBPLUG_do_callback('job_list_pre_fill', $i, $list_mode); //A plugin can list its own records before, and adjust the $i // init a week ago from first post while (($row = mysql_fetch_array($posts, MYSQL_ASSOC)) && $i < $pp_page) { $PLM->set_values($row); JBPLUG_do_callback('job_list_set_data', $row, $i, $list_mode); // A plugin can modify the prams $i++; $post_id = $row['post_id']; $POST_MODE = $row['post_mode']; $class_name = $PLM->get_item_class_name($POST_MODE); $class_postfix = $PLM->get_item_class_postfix($POST_MODE); //$DATE_TIME = JB_get_local_time($row['post_date']." GMT"); # display day of week if ($list_mode == 'ALL' && JB_POSTS_SHOW_DAYS_ELAPSED == "YES" || $list_mode == 'PREMIUM' && JB_P_POSTS_SHOW_DAYS_ELAPSED == "YES") { $DATE_TIME = JB_get_local_time($row['post_date'] . " GMT"); # display day of week if ($list_mode == 'ALL' && JB_POSTS_SHOW_DAYS_ELAPSED == "YES" || $list_mode == 'PREMIUM' && JB_P_POSTS_SHOW_DAYS_ELAPSED == "YES") { $day_and_week = JB_get_day_and_week($row['post_date']); if ($day_and_week !== $prev_day_and_week) { // new day? if ($day_and_week != '') { $PLM->list_day_of_week($day_and_week, $class_postfix); } } $prev_day_and_week = $day_and_week; } } ######################################## # Open the list data items $PLM->list_item_open($POST_MODE, $class_name); # Action cells # Here the action buttons are displayed, eg. 'Delete', 'Approve', checkboxes to select, etc if ($list_mode == 'ADMIN') { $PLM->list_data_admin_action($class_postfix, $row['post_mode']); JBPLUG_do_callback('job_list_data_admin_action', $A = false); // plugin for the additional controls for the Admin } elseif ($list_mode == 'SAVED') { $PLM->list_data_saved_action(); } elseif ($list_mode == 'EMPLOYER') { // EMPLOYER MODE ONLY! $PLM->list_data_employer_action($class_postfix, $row['post_mode']); JBPLUG_do_callback('job_list_data_employer_buttons', $A = false); // plugin for the additional controls for the Admin } JBPLUG_do_callback('joblist_list_data_user_action', $A = false); ######################################################################## JB_echo_job_list_data($admin); // display the data cells ######################################################################## if ($list_mode == 'EMPLOYER') { // displayed on manager.php $app_count = $row['applications']; // change the app_count in to a link if ($app_count > 0) { $app_count = $PLM->get_emp_app_link('app.php?post_id=' . $row['post_id'], $app_count); } $PLM->list_data_employer_extras($app_count); JBPLUG_do_callback('job_list_data_employer_extra_col', $A = false); // plugin for the additional fields seen by the employer's Application manager } if ($list_mode == 'PREMIUM' && JB_SHOW_PREMIUM_HITS == 'YES') { $PLM->list_data_premium_extras(); } $PLM->list_item_close(); } ############ end while() JBPLUG_do_callback('job_list_back_fill', $i, $list_mode); // A plugin can list its own records after $PLM->list_end(); if ($list_mode == 'ADMIN' || $list_mode == 'SAVED' || $list_mode == 'EMPLOYER') { $PLM->close_form(); } if ($list_mode == 'PREMIUM') { if (JB_PREMIUM_POSTS_LIMIT == 'YES') { JB_nav_pages($result, $q_string, $pp_page); } } else { JB_nav_pages($result, $q_string, $pp_page); } }
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(); } }
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>"; } }
<input type="submit" name="action" value="Delete" onClick="if (!confirmLink(this, 'Delete this Account, are you sure?')) { return false; }" > </td></tr> <tr bgColor="#eaeaea"> <td><b><font face="Arial" size="2">Action</font></b></td> <td><b><font face="Arial" size="2"><?php echo $ListMarkup->get_select_all_checkbox('users'); ?> </td> <?php $admin = true; JB_echo_list_head_data(5, $admin); ?> </tr> <?php $q_string = JB_generate_candidate_q_string(); $i = 0; while (($row = mysql_fetch_array($result, MYSQL_ASSOC)) && $i < $records_per_page) { $CandidateForm->set_values($row); $i++; ?> <tr onmouseover="old_bg=this.getAttribute('bgcolor');this.setAttribute('bgcolor', '#FBFDDB', 0);" onmouseout="this.setAttribute('bgcolor', old_bg, 0);" bgColor="#ffffff"> <td><?php if ($row['Validated'] == 0) {