Esempio n. 1
0
                        if (user_access('staff request')) {
                            print sopac_put_staff_request_link($locum_result['_id']);
                        }
                    }
                }
            }
        }
    }
    if ($user->uid && $locum_result['mat_code'] != 'z' && $locum_result['mat_code'] != 'q') {
        include_once 'sopac_user.php';
        print sopac_put_list_links($locum_result['_id'], $list_display);
    }
    if ($list_display) {
        // PART OF A LIST, SHOW ADDITIONAL ACTIONS
        $list_id = intval(str_replace('list', '', $locum_result['namespace']));
        if (sopac_lists_access($list_id)) {
            $value = $locum_result['value'];
            $bnum = $locum_result['_id'];
            if (!$locum_result['freeze']) {
                print '<li class="button green">' . l('Move to Top of List', "user/listmovetop/{$list_id}/{$value}", array('alias' => TRUE)) . '</li>';
            }
            print '<li class="button red">' . l('Remove from List', "user/listdelete/{$list_id}/{$bnum}", array('alias' => TRUE)) . '</li>';
        }
    }
    ?>
      </ul>
    </div>
  <?php 
}
?>
  </div>
Esempio n. 2
0
function theme_sopac_list($list, $expanded = FALSE, $minimal = NULL)
{
    global $user;
    if ($expanded) {
        $title = $list['title'];
        $description = nl2br(filter_xss($list['description']));
    } else {
        $title = l($list['title'], 'user/lists/' . $list['list_id']);
        $description = filter_xss($list['description']);
        if (strlen($description) > 256) {
            $description = substr($description, 0, 256) . '...';
        }
    }
    $list_class = "sopac-list";
    if (sopac_lists_access($list['list_id'])) {
        $actions .= '<ul class="sopac-list-actions">';
        $actions .= '<li class="button green">' . l('Edit List Details', 'user/lists/edit/' . $list['list_id']) . '</li>';
        $actions .= '<li class="button red">' . l('Delete List', 'user/lists/delete/' . $list['list_id']) . '</li>';
        $actions .= '</ul>';
    }
    $top .= "<div class=\"sopac-list-title\">";
    $top .= "<h2>{$title}</h2>";
    $list_user = user_load($list['uid']);
    $list_username = $list_user->name;
    $staff_roles = variable_get('sopac_lists_staff_roles', array());
    foreach (array_keys($list_user->roles) as $role_id) {
        if (in_array($role_id, $staff_roles)) {
            $list_username = "******" . $list_username;
            break;
        }
    }
    $list_username = l($list_username, 'user/' . $list_user->uid . '/lists', array('attributes' => array('title' => 'View other Lists from this user')));
    $top .= "<span> by {$list_username}</span>";
    $top .= "</div>";
    $top .= '<p class="sopac-list-details">';
    $top .= '<strong>Description</strong>: ' . $description . '<br />';
    $top .= ($list['public'] ? 'This list is <strong>publicly viewable</strong>' : 'This list is <strong>private</strong>') . '<br />';
    if ($expanded) {
        $list_class = "sopac-list-expanded";
        $locum = sopac_get_locum();
        $formats = $locum->locum_config['formats'];
        $no_circ = $locum->csv_parser($locum_cfg['location_limits']['no_request']);
        $avail_count = 0;
        if ($list_count = count($list['items'])) {
            include_once 'sopac_catalog.php';
            $last_updated = 0;
            $total_count = $list['total_items'];
            $content .= '<table class="hitlist-content">';
            foreach ($list['items'] as $item) {
                $item['bib'] = $locum->get_bib_item($item['bnum']);
                $item['cover_img'] = $item['bib']['cover_img'];
                // Check updated date
                if (($tag_date = strtotime($item['tag_date'])) > $last_updated) {
                    $last_updated = $tag_date;
                }
                if (!$minimal) {
                    // Grab item status
                    $item['status'] = $locum->get_item_status($item['bnum']);
                    if ($item['status']['avail']) {
                        $avail_count++;
                    }
                    // Grab Syndetics reviews, etc..
                    $review_links = $locum->get_syndetics($item['stdnum'][0]);
                    if (count($review_links)) {
                        $item['review_links'] = $review_links;
                    }
                }
                // Check if list display order should be frozen
                if ($list['title'] == "Checkout History") {
                    $item['freeze'] = TRUE;
                }
                $content .= theme('sopac_results_hitlist', $item['value'], $item['cover_img'], $item, $locum->locum_config, $no_circ, $minimal);
            }
            $content .= '</table>';
            $top .= '<strong>Last updated:</strong> ' . date("F j, Y, g:i a", $last_updated) . '<br />';
            $sortopts = array('value' => t('Default Order'), 'title' => t('Title'), 'author' => t('Author'), 'date' => t('Date Added - Oldest'), 'date_newest' => t('Date Added - Newest'), 'mat_code' => t('Material Type'));
            $top .= '<div class="hitlist-range">';
            $top .= "<span class=\"range\">Showing <strong>{$list_count}</strong> of <strong>{$total_count}</strong> items ( <strong>{$avail_count}</strong> currently available";
            if ($avail_count > 0) {
                $top .= ' - <span id="showavailable">Show Me</span> ';
            }
            $top .= ' )</span>';
            $top .= '<span class="hitlist-sorter">';
            $top .= '<script>';
            $top .= 'jQuery(document).ready(function() {$(\'#sortlist\').change(function(){ location.href = $(this).val();});});';
            $top .= '</script>';
            $top .= 'Sort by: <select name="sort" id="sortlist">';
            foreach ($sortopts as $key => $value) {
                $top .= '<option value="' . url($_GET['q'], array('query' => array('sort' => $key))) . '" ';
                if ($_GET['sort'] == $key) {
                    $top .= 'selected';
                }
                $top .= '>' . $value . '</option>';
            }
            $top .= '</select>';
            $top .= '</span>';
            $top .= '<span class="pagination">' . l('List/Print View', 'user/lists/' . $list['list_id'] . '/print') . '</span>';
            $top .= '</div>';
            if ($expanded) {
                $top .= drupal_get_form('sopac_list_item_search_form', $_GET['search']);
            }
        } else {
            $content .= '<p>This list is currently empty</p>';
        }
        if ($expanded && $list['uid'] != $user->uid && sopac_lists_access($list['list_id'])) {
            $content .= drupal_get_form('sopac_list_manual_add_form', $list['list_id']);
        }
        $content .= '<ul><li class="button green">' . l('back to lists overview', 'user/lists') . '</li></ul>';
    } else {
        // overview
        if ($list_count = count($list['items'])) {
            $last_updated = 0;
            foreach ($list['items'] as $item) {
                if (empty($cover)) {
                    if ($item['cover_img'] == 'CACHE') {
                        $cover = '<img class="sopac-list-cover" src="http://media.aadl.org/covers/' . $item['bnum'] . '_50.jpg">';
                    }
                }
                if (($tag_date = strtotime($item['tag_date'])) > $last_updated) {
                    $last_updated = $tag_date;
                }
            }
            $top .= '<strong>Last updated:</strong> ' . date("F j, Y, g:i a", $last_updated) . '<br />';
            $top .= "<strong>{$list_count}</strong> items listed</p>";
        } else {
            $top .= 'This list is currently <strong>empty</strong></p>';
        }
    }
    $top .= '<div style="clear: both"></div>';
    $output = "<div class=\"{$list_class}\">" . $actions . $cover . $top . $content . '</div><div style="clear:both"></div>';
    return $output;
}