Exemple #1
0
 if ($show_interest_column) {
     echo $xajax->printJavascript();
 }
 $listingObject = new HTML_Listing($PHP_SELF, $HTTP_VARS);
 $listingObject->startListing($page_title);
 if ($show_checkbox_column) {
     $listingObject->addHeaderColumn(NULL, 'item_id_instance_no', FALSE, 'checkbox');
 }
 for ($i = 0; $i < count($v_column_display_config_rs); $i++) {
     if ($v_column_display_config_rs[$i]['include_in_listing'] !== FALSE) {
         $listingObject->addHeaderColumn($v_column_display_config_rs[$i]['prompt'], $v_column_display_config_rs[$i]['fieldname'], $v_column_display_config_rs[$i]['orderby_support_ind'] === 'Y');
     }
 }
 // If no items Per Page - we are listing everything.
 if (is_numeric($listingObject->getItemsPerPage())) {
     $listingObject->setTotalItems(fetch_item_listing_cnt($HTTP_VARS, $v_column_display_config_rs));
 }
 // -------------------------------------- Process the Query here -----------------------------------------------------------------
 if ($result = fetch_item_listing_rs($HTTP_VARS, $v_column_display_config_rs, $listingObject->getCurrentOrderBy(), $listingObject->getCurrentSortOrder(), $listingObject->getStartIndex(), $listingObject->getItemsPerPage())) {
     // ----------------------------------------------------------------------------
     // Save current url string, so we can return to last listings page if required.
     // ----------------------------------------------------------------------------
     // The Listing class has already removed any $HTTP_VARS which should not
     // be passed onto the next request.
     $v_listing_url_vars = $HTTP_VARS;
     $v_listing_url_vars['mode'] = NULL;
     // These are listing specific - we do not want to save them.
     $v_listing_url_vars['item_id_instance_no'] = NULL;
     $v_listing_url_vars['checked_item_id_instance_no'] = NULL;
     $v_listing_url_vars['checked_item_id_instance_no_list'] = NULL;
     register_opendb_session_var('listing_url_vars', $v_listing_url_vars);
Exemple #2
0
function get_whats_new_details($update_on, $user_id = NULL)
{
    $whats_new_conf_r = get_opendb_config_var('welcome.whats_new');
    if ($whats_new_conf_r['enable'] !== FALSE) {
        $whats_new_rs = NULL;
        // Get the list of valid status_types, which we can display in this whatsnew page.
        $results = fetch_status_type_rs();
        if ($results) {
            if ($whats_new_conf_r['restrict_last_login'] !== TRUE) {
                $update_on = NULL;
            }
            $search_vars_r['update_on'] = $update_on;
            if ($whats_new_conf_r['exclude_current_user'] !== FALSE) {
                $search_vars_r['not_owner_id'] = $user_id;
            }
            $whats_new_r['heading'] = get_opendb_lang_var('item_stats');
            while ($status_type_r = db_fetch_assoc($results)) {
                $search_vars_r['s_status_type'] = $status_type_r['s_status_type'];
                $status_items_updated = fetch_item_listing_cnt($search_vars_r);
                $status_title = get_opendb_lang_var('cnt_item(s)_added_updated', array('count' => $status_items_updated, 's_status_type_desc' => $status_type_r['description']));
                if ($status_items_updated > 0) {
                    $item_r['class'] = 'tick';
                    $item_r['content'] = '<a href="listings.php?' . (strlen($search_vars_r['not_owner_id']) > 0 ? 'not_owner_id=' . $search_vars_r['not_owner_id'] . '&' : '') . 's_status_type=' . $status_type_r['s_status_type'] . '&update_on=' . urlencode($update_on) . '">' . $status_title . '</a>';
                } else {
                    $item_r['class'] = 'cross';
                    $item_r['content'] = $status_title;
                }
                $whats_new_r['items'][] = $item_r;
            }
            db_free_result($results);
            if (is_array($whats_new_r)) {
                $whats_new_rs[] = $whats_new_r;
            }
        }
        if (get_opendb_config_var('borrow', 'enable') !== FALSE && $whats_new_conf_r['borrow_stats'] !== FALSE) {
            $whats_new_r['heading'] = get_opendb_lang_var('borrow_stats');
            $whats_new_r['items'] = NULL;
            $returned_cnt = fetch_borrowed_item_status_atdate_cnt('C', $update_on);
            if ($returned_cnt > 0) {
                $item_r['class'] = 'tick';
            } else {
                $item_r['class'] = 'cross';
            }
            $item_r['content'] = get_opendb_lang_var('cnt_item(s)_returned', 'count', $returned_cnt);
            $whats_new_r['items'][] = $item_r;
            $borrowed_cnt = fetch_borrowed_item_status_atdate_cnt('B', $update_on);
            if ($borrowed_cnt > 0) {
                $item_r['class'] = 'tick';
            } else {
                $item_r['class'] = 'cross';
            }
            $item_r['content'] = get_opendb_lang_var('cnt_item(s)_borrowed', 'count', $borrowed_cnt);
            $whats_new_r['items'][] = $item_r;
            $reserved_cnt = fetch_borrowed_item_status_atdate_cnt('R', $update_on);
            if ($reserved_cnt > 0) {
                $item_r['class'] = 'tick';
            } else {
                $item_r['class'] = 'cross';
            }
            $item_r['content'] = get_opendb_lang_var('cnt_item(s)_reserved', 'count', $reserved_cnt);
            $whats_new_r['items'][] = $item_r;
            if (is_array($whats_new_r)) {
                $whats_new_rs[] = $whats_new_r;
            }
        }
        if (get_opendb_config_var('item_review', 'enable') !== FALSE && $whats_new_conf_r['review_stats'] !== FALSE) {
            $whats_new_r['heading'] = get_opendb_lang_var('review(s)');
            $whats_new_r['items'] = NULL;
            $block = '';
            $review_cnt = fetch_review_atdate_cnt($update_on);
            if ($review_cnt > 0) {
                $item_r['class'] = 'tick';
            } else {
                $item_r['class'] = 'cross';
            }
            $item_r['content'] = get_opendb_lang_var('cnt_review(s)', 'count', $review_cnt);
            $whats_new_r['items'][] = $item_r;
            if (is_array($whats_new_r)) {
                $whats_new_rs[] = $whats_new_r;
            }
        }
        return $whats_new_rs;
    } else {
        return NULL;
    }
}