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>"; } }
$cur_page = $_REQUEST['offset'] / $records_per_page; $cur_page++; echo "<center>"; ?> <center><b><?php echo $count; ?> Subscriptions Returned (<?php echo $pages; ?> pages) </b></center> <?php echo "Page {$cur_page} of {$pages} - "; $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 "</center>"; } ?> <table cellSpacing="1" cellPadding="3" style="margin: 0 auto; background-color: #d9d9d9; width:100%; border:0px" > <tr bgColor="#eaeaea"> <td><b><font face="Arial" size="2">Order Date</font></b></td> <td><b><font face="Arial" size="2">Order ID</font></b></td> <td><b><font face="Arial" size="2">Client Name</font></b></td> <td><b><font face="Arial" size="2">Item Name</font></b></td> <td><b><font face="Arial" size="2">Subscr Date</font></b></td> <td><b><font face="Arial" size="2">Subscr End</font></b></td> <td><b><font face="Arial" size="2">Status</font></b></td> <td><b><font face="Arial" size="2">Pmt Meth.</font></b></td>
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(); } }