Exemple #1
0
function JB_list_jobs($list_mode)
{
    if (func_num_args() > 1) {
        // what kind of posts to show
        $show = func_get_arg(1);
    }
    global $label;
    global $post_count;
    $post_count = null;
    // reset post count.
    #############################################
    # Build the apporved SQL part
    $approved_sql = " approved='Y' ";
    if ($show == "WA") {
        // waiting
        $approved_sql = " approved='N' ";
        $where_sql .= " AND `reason` ='' ";
    } elseif ($show == "NA") {
        // not approved
        $approved_sql = " approved ='N' ";
        $where_sql .= " AND `reason` !='' ";
    } elseif ($show == "EX") {
        // expired
        $approved_sql = ' 1=1 ';
    } elseif ($show == "EMP") {
        // expired
        $approved_sql = ' 1=1 ';
    }
    #############################################
    # Build the ORDER BY part
    $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, 1)) {
        // by default, order by the post_date, if the field is invalid
        $order = " `post_date` ";
    } elseif ($order == 'summary') {
        // order by title instead
        $order = JB_get_template_field_id('TITLE', 1);
    } else {
        $order = " `" . jb_escape_sql($order) . "` ";
    }
    ############################################
    # Search Posts
    $where_sql .= JB_generate_search_sql(1);
    ############################################
    # PREMIUM list mode
    # To list only premium jobs, call like this: JB_list_jobs('PREMIUM')
    if (!defined('JB_SHOW_PREMIUM_LIST')) {
        // new setting since 3.4.13, may not be in config.php
        JB_SHOW_PREMIUM_LIST == 'YES';
    }
    # Set $premium_sql
    # This determines whether to:
    # - include only premium posts to the list
    # - include only standard posts to the list
    # - do not show the premium list at all, return the call
    if ($list_mode == 'PREMIUM') {
        if (JB_SHOW_PREMIUM_LIST != 'YES') {
            // PREMIUM list is turned off in Admin->Main Config
            // do not show the premium list at all, return the call
            return;
        }
        // - include only premium posts to the list
        $premium_sql = "AND ( " . "post_mode " . "= 'premium'" . ") ";
        $post_count = JB_get_post_count('PAP');
        // PAP - Approved premium posts, not expired
    } elseif (JB_DONT_REPEAT_PREMIUM == 'YES') {
        // Premium posts are listed on top in a seperate list
        // This ensures that when listing the standard posts, the premium
        // posts are not repeated.
        // If listing jobs on the front page, no search executed and the page is index.php
        global $JB_HOME_PAGE, $JOB_LIST_PAGE;
        if ($JB_HOME_PAGE | $JOB_LIST_PAGE && $list_mode == 'ALL' && JB_SHOW_PREMIUM_LIST == 'YES') {
            // - include only standard posts to the list
            $premium_sql .= "AND ( " . "post_mode " . "!= 'premium'" . ") ";
            $post_count = JB_get_post_count('SAP');
            // Approved, not premium, not expired
        }
    }
    #############################################
    # Show posts by employer?
    $_REQUEST['show_emp'] = (int) $_REQUEST['show_emp'];
    if ($_REQUEST['show_emp'] > 0) {
        // is user_id > 0 ?
        $show_emp_sql = " AND user_id='" . jb_escape_sql($_REQUEST['show_emp']) . "' ";
    }
    #############################################
    # Get todays date (in GMT)
    $now = gmdate("Y-m-d");
    #############################################
    # build the LIMIT part
    $offset = (int) $_REQUEST['offset'];
    if ($offset < 0) {
        $offset = abs($offset);
    }
    $limit_sql = " LIMIT {$offset}, ";
    if ($list_mode == 'PREMIUM') {
        if (JB_PREMIUM_POSTS_LIMIT == 'YES') {
            $limit_sql .= JB_PREMIUM_POSTS_PER_PAGE;
        } else {
            // there's no limit
            $limit_sql = '';
        }
    } elseif ($list_mode == 'EMPLOYER') {
        $limit_sql .= JB_MANAGER_POSTS_PER_PAGE;
    } else {
        $limit_sql .= JB_POSTS_PER_PAGE;
    }
    # Include a SQL_CALC_FOUND_ROWS option to count the number of posts returned
    # See http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_found-rows
    if ($where_sql != '' || $show_emp_sql != '' || $post_count === null) {
        // If its not a search, or by listing employer, and the post count
        // is unknown, we need to tell MySQL to count the posts returned without
        // the LIMIT clause
        $calc_found_rows_sql = 'SQL_CALC_FOUND_ROWS';
    }
    #############################################
    # Glue the SQL query, basted on $list_mode
    if ($list_mode == 'SAVED') {
        $calc_found_rows_sql = 'SQL_CALC_FOUND_ROWS';
        $sql = "SELECT {$calc_found_rows_sql} *, posts_table.user_id as user_id FROM `posts_table`, `saved_jobs` WHERE saved_jobs.user_id='" . jb_escape_sql($_SESSION['JB_ID']) . "' AND (saved_jobs.post_id=posts_table.post_id) AND  expired='N' ORDER BY {$order} {$ord} {$limit_sql}";
    } elseif ($list_mode == 'BY_CATEGORY' || $list_mode == "BY_CATEGORY_ADMIN") {
        $calc_found_rows_sql = 'SQL_CALC_FOUND_ROWS';
        $cat = JB_search_category_tree_for_posts();
        $sql = "SELECT {$calc_found_rows_sql} * FROM posts_table where {$approved_sql}  {$where_sql} {$show_emp_sql} AND  expired='N' {$cat} ORDER BY ({$order}) {$ord} {$limit_sql}";
    } elseif ($list_mode == 'EMPLOYER') {
        // employer's post manager.
        $calc_found_rows_sql = 'SQL_CALC_FOUND_ROWS';
        if ($show == "OFFLINE") {
            $date_range_sql = '';
            // include posts that are expired.
            $date_range_sql = "AND  expired='Y'  ";
            $approved_sql = " OR  (approved='N' AND  user_id='" . jb_escape_sql($_SESSION['JB_ID']) . "')  ";
        } else {
            // show current posts
            $date_range_sql = "AND  expired='N' ";
            $approved_sql = " AND  approved='Y' ";
        }
        $sql = "SELECT {$calc_found_rows_sql} * FROM posts_table where (1=1 {$where_sql}  {$date_range_sql} AND user_id='" . jb_escape_sql($_SESSION['JB_ID']) . "') {$approved_sql} ORDER BY ({$order}) {$ord} {$limit_sql}";
    } else {
        if ($show == 'EX') {
            // show expired?
            $expired_sql = " AND expired='Y' ";
        } else {
            $expired_sql = " AND expired='N' ";
        }
        $sql = "SELECT {$calc_found_rows_sql} * FROM posts_table where {$approved_sql} {$expired_sql} {$premium_sql} {$where_sql} {$show_emp_sql}  ORDER BY ({$order}) {$ord}  {$limit_sql}  ";
    }
    //echo '<hr>sql:'.$sql." where_sql:[$where_sql] show_emp:[$show_emp_sql] cat:[$cat] calc_found_rows_sql:[$calc_found_rows_sql] (LM: $list_mode)<br>";
    // some debugging & performance test
    //$result = JB_mysql_query("EXPLAIN ".$sql) or die ("[$sql]".mysql_error());
    //$row = mysql_fetch_array($result, MYSQL_ASSOC);
    //echo "<pre>";print_r($row);echo "</pre>";
    //echo "<br>".$sql."<br>";
    #################################
    # Execute the SQL query
    if (!JBPLUG_do_callback('job_list_custom_query', $result, $sql)) {
        // A plugin can modify the result with a custom query
        $result = JB_mysql_query($sql);
    }
    #################################
    # Get the post_count
    # If $calc_found_rows_sql was not used, then we assume that the post
    # was is cashed in the database.
    if ($calc_found_rows_sql == '') {
        // MySQL did not count the number of posts
        // that were returned, then get the cached number.
        if ($list_mode == 'PREMIUM') {
            $post_count = JB_get_post_count('PAP');
            // premium approved
        } elseif ($post_count == '') {
            if ($show == 'NA') {
                // not approved (admin)
                $post_count = JB_get_post_count('NA');
                // get non approved posts count, admin list
            } elseif ($show == 'ALL') {
                $post_count = JB_get_post_count('AP');
                // AP - Approved (expired='N' AND approved='Y'), admin list
            } elseif ($show == "WA") {
                // waiting count, admin list
                $post_count = JB_get_post_count('WA');
            } elseif ($show == "EX") {
                // expired count, admin list
                $post_count = JB_get_post_count('EX');
            } else {
                // get all the count of all apporved and not expired
                $post_count = JB_get_post_count('AP');
                // AP - Approved (expired='N' AND approved='Y')
            }
        }
    } else {
        # Ask MySQL to get the number of rows from the last query
        # Even though the last query had a LIMIT clause
        $row = mysql_fetch_row(jb_mysql_query("SELECT FOUND_ROWS()"));
        $post_count = $row[0];
    }
    JBPLUG_do_callback('job_list_set_count', $post_count, $list_mode);
    // A plugin can modify the post count
    ########################################
    # Print how many jobs returned
    $PLM =& JB_get_PostListMarkupObject();
    // load the ListMarkup Class
    if ($post_count == 0) {
        if ($list_mode == "PREMIUM") {
            //echo "<p>&nbsp;</p>";
        } elseif ($list_mode == "SAVED") {
            //echo "<p>&nbsp;</p>";
        } elseif ($list_mode == "BY_CATEGORY") {
            //echo "<p>&nbsp;</p>";
        } elseif ($list_mode == "EMPLOYER") {
            $PLM->no_posts_employer();
        } else {
            $PLM->no_posts();
        }
    } else {
        if ($list_mode == "PREMIUM") {
            $PLM->sponsored_heading($post_count);
        } elseif ($list_mode == "ALL") {
            $label['post_list_count'] = str_replace("%COUNT%", $post_count, $label['post_list_count']);
            $label['post_list_count'] = str_replace("%POSTS_DISPLAY_DAYS%", JB_POSTS_DISPLAY_DAYS, $label['post_list_count']);
            $PLM->post_count($post_count);
        } elseif ($list_mode == "BY_CATEGORY") {
            $label['post_list_cat_count'] = str_replace("%COUNT%", $post_count, $label['post_list_cat_count']);
            $label['post_list_cat_count'] = str_replace("%POSTS_DISPLAY_DAYS%", JB_POSTS_DISPLAY_DAYS, $label['post_list_cat_count']);
            $PLM->post_count_category($post_count);
        }
        #################################################
        JB_display_post_list($result, $list_mode, $show);
    }
    // end else if mysql num rows > 0
    return $post_count;
}
Exemple #2
0
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>&nbsp;</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&amp;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&amp;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>";
    }
}
Exemple #3
0
}
if ($_REQUEST['q_news'] != '') {
    $where_sql .= " AND `Newsletter`='1' ";
}
if ($_REQUEST['q_alerts'] != '') {
    $where_sql .= " AND `Notification1`='1' ";
}
if ($_REQUEST['ord'] == 'asc') {
    $ord = 'ASC';
} elseif ($_REQUEST['ord'] == 'desc') {
    $ord = 'DESC';
} else {
    $ord = 'DESC';
    // sort descending by default
}
if ($_REQUEST['order_by'] == '' || !JB_is_field_valid($_REQUEST['order_by'], 5)) {
    // by default, order by the post_date
    $order = " `SignupDate` ";
} else {
    $order = " `" . jb_escape_sql($_REQUEST['order_by']) . "` ";
}
$_REQUEST['offset'] = (int) $_REQUEST['offset'];
if ($_REQUEST['offset'] < 0) {
    $_REQUEST['offset'] = abs($_REQUEST['offset']);
}
$records_per_page = 20;
$sql = "select SQL_CALC_FOUND_ROWS * FROM `users` WHERE 1=1 " . $where_sql . " ORDER BY {$order} " . jb_escape_sql($ord) . "  LIMIT " . jb_escape_sql($_REQUEST['offset']) . ", " . jb_escape_html($records_per_page) . "";
$result = JB_mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_row(jb_mysql_query("SELECT FOUND_ROWS()"));
$count = $row[0];
if ($_REQUEST['action'] == 'search') {
Exemple #4
0
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 = "&amp;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();
    }
}
Exemple #5
0
}
if ($q_news != '') {
    $where_sql .= " AND `Newsletter`='1' ";
}
if ($q_resumes != '') {
    $where_sql .= " AND `Notification1`='1' ";
}
if ($_REQUEST['ord'] == 'asc') {
    $ord = 'ASC';
} elseif ($_REQUEST['ord'] == 'desc') {
    $ord = 'DESC';
} else {
    $ord = 'DESC';
    // sort descending by default
}
if ($_REQUEST['order'] == '' || !JB_is_field_valid($_REQUEST['order'], 4)) {
    // by default, order by the post_date
    $order = " `SignupDate` ";
} else {
    $order = " `" . jb_escape_sql($_REQUEST['order']) . "` ";
}
$records_per_page = 20;
$offset = (int) $_REQUEST['offset'];
if ($offset < 0) {
    $offset = abs($offset);
}
$sql = "select SQL_CALC_FOUND_ROWS * FROM `employers` WHERE 1=1 {$where_sql} ORDER BY {$order} {$ord} LIMIT {$offset},{$records_per_page}";
if ($_REQUEST['order_by'] == 'posts') {
    // need to order the list by the number of jobs each employer posted
    $sql = " select t1.*, count(post_id) as post_count from employers as t1 LEFT JOIN posts_table as t2 ON t1.ID=t2.user_id GROUP by t2.user_id ORDER BY Validated, post_count {$ord}";
}