Esempio n. 1
0
 /**
  * Looks up the list of options from the DB
  * This is the only place where themes are 'categorized', which is purely for presentation in the walk create form
  *
  * @param string $type Which type of tag to return (e.g. theme, accessible)
  * @return array
  */
 public static function getSelectOptions($type = 'all')
 {
     $options = array();
     $satc = new SelectAttributeTypeController(AttributeType::getByHandle('select'));
     if ($type === 'all' || $type === 'theme') {
         $satc->setAttributeKey(CollectionAttributeKey::getByHandle('theme'));
         $themeAK = CollectionAttributeKey::getByHandle('theme');
         foreach ($satc->getOptions() as $v) {
             $category = $this->getCategory($v->value);
             $options['theme'][$category][] = ['handle' => $v->value, 'name' => self::getName($v->value)];
         }
     }
     if ($type === 'all' || $type === 'accessibile') {
         $satc->setAttributeKey(CollectionAttributeKey::getByHandle('accessible'));
         foreach ($satc->getOptions() as $v) {
             $options['accessible'][] = ['handle' => $v->value, 'name' => self::getName($v->value)];
         }
     }
     return $options;
 }
$num = (int) $row['num'];
$pl->setItemsPerPage($num);
if ($paginate_list == 1) {
    $current_page_get_var = 'ccm_paging_p_b' . $bID;
    $current_page = intval($_GET[$current_page_get_var]);
    // Page of results requested in query string
    $current_page = empty($current_page) ? 1 : $current_page;
    // PageList object returns this page of results
    $pages = $pl->getPage($current_page);
} else {
    $pages = $pl->getPage(1);
}
// Display attribute filter links
if (count($row['displayAttributes']) > 0) {
    Loader::model('attribute/categories/collection');
    $satc = new SelectAttributeTypeController(AttributeType::getByHandle('select'));
    // Get existing query string to pass through filtering parameters
    $request = $_SERVER['REQUEST_URI'];
    $url_parts = parse_url($request);
    $url_params = array();
    parse_str($url_parts['query'], $url_params);
    $query_string = http_build_query($url_params);
    // Display select attributes (and their options) specified in ajax_page_list.php as lists of links
    echo '<div class="page-list-filters">';
    echo '<p><strong>' . t('Filter by:') . '</strong></p>';
    foreach ($row['displayAttributes'] as $attribute_handle) {
        $ak = CollectionAttributeKey::getByHandle($attribute_handle);
        $satc->setAttributeKey($ak);
        $options = $satc->getOptions();
        if (count($options) > 0) {
            echo '<div class="page-list-filter">';