Example #1
0
 public function print_automatic()
 {
     global $PH;
     if (!($this->active_block_function = $this->getBlockStyleFromCookie())) {
         $this->active_block_function = 'list';
     }
     $this->query_options['alive_only'] = false;
     $this->group_by = get("blockstyle_{$PH->cur_page->id}_{$this->id}_grouping");
     $s_cookie = "sort_{$PH->cur_page->id}_{$this->id}_{$this->active_block_function}";
     if ($sort = get($s_cookie)) {
         $this->query_options['order_by'] = $sort;
     }
     ### add filter options ###
     foreach ($this->filters as $f) {
         foreach ($f->getQuerryAttributes() as $k => $v) {
             $this->query_options[$k] = $v;
         }
     }
     ### grouped view ###
     if ($this->active_block_function == 'grouped') {
         /**
          * @@@ later use only once...
          *
          *   $this->columns= filterOptions($this->columns,"CURPAGE.BLOCKS[{$this->id}].STYLE[{$this->active_block_function}].COLUMNS");
          */
         if (isset($this->columns[$this->group_by])) {
             unset($this->columns[$this->group_by]);
         }
         ### prepend key to sorting ###
         if (isset($this->query_options['order_by'])) {
             $this->query_options['order_by'] = $this->groupings->getActiveFromCookie() . "," . $this->query_options['order_by'];
         } else {
             $this->query_options['order_by'] = $this->groupings->getActiveFromCookie();
         }
     } else {
         $pass = true;
     }
     $changes = DbProjectItem::getChanges($this->query_options);
     $this->render_list($changes);
 }