Example #1
0
 public static function generateElseInput($filter, $name, $value, $alias)
 {
     $check = (isset($filter[$alias]) and in_array($value, $filter[$alias]));
     $checked = Filter::checked($value, $alias);
     $disabled = (!$check and !$checked) ? 'disabled' : '';
     $input = '';
     $input .= '<label class="checkBlock" for="' . $alias . $value . '">';
     if (!$disabled) {
         $input .= '<a href="' . Filter::generateLinkWithFilter($alias, $value) . '">';
     }
     $input .= '<input  id="' . $alias . $value . '" value="' . $value . '" type="checkbox" ' . $checked . $disabled . ' />';
     $input .= '<ins></ins>';
     $input .= '<p>' . $name . '</p>';
     if (!$disabled) {
         $input .= '</a>';
     }
     $input .= '</label>';
     return $input;
 }
Example #2
0
 public function listAction()
 {
     $this->_template = 'ItemsList';
     Route::factory()->setAction('list');
     // Filter parameters to array if need
     Filter::setFilterParameters();
     // Set filter elements sortable
     Filter::setSortElements();
     $page = !(int) Route::param('page') ? 1 : (int) Route::param('page');
     // Check for existance
     $group = DB::select()->from('catalog_tree')->where('alias', '=', Route::param('alias'))->where('status', '=', 1)->as_object()->execute()->current();
     if (!$group) {
         return Config::error();
     }
     // Seo
     $this->setSeoForGroup($group);
     // Add plus one to views
     DB::update('catalog_tree')->set(array('views' => (int) $group->views + 1))->where('id', '=', $group->id)->execute();
     // Get items list
     $result = Filter::getFilteredItemsList($this->limit, ($page - 1) * $this->limit, $this->sort, $this->type);
     // Generate filter add for sql queries
     $add = Filter::getSql();
     // Count of parent groups
     $count = DB::query(Database::SELECT, 'SELECT COUNT(DISTINCT catalog.id) AS count FROM catalog ' . $add['join'] . 'WHERE catalog.parent_id = "' . $group->id . '" AND catalog.status = "1"' . $add['where'])->as_object()->execute()->current();
     if ($count) {
         $count = $count->count;
     } else {
         $count = 0;
     }
     // Generate pagination
     $pager = Pager::factory($page, $count, $this->limit)->create();
     // Render page
     $this->_content = View::tpl(array('result' => $result, 'pager' => $pager), 'Catalog/ItemsList');
 }