Example #1
0
 public function actionList($status, $flags, $q)
 {
     if ($status) {
         $this->songy = $this->songList->findByStatus($status);
     } else {
         $this->songy = $this->songList->findAll();
     }
     //Simple song searching
     if ($q) {
         $searcher = new \Searcher();
         $searcher->setModel($this->songy);
         $searcher->setMask("%?%");
         $searcher->setColumns(array("name", "interpret_name"));
         $searcher->search($q);
         $this->template->q = $q;
     }
     //Filtering by flags
     if ($flags) {
         $this->setFilterDefaults($flags);
         $filter = new \FlagFilter();
         $filter->setModel($this->songy);
         $filter->setFlags(array("r" => "remix", "i" => "instro", "p" => "pecka", "w" => "wishlist_only", "n" => array("column" => "note", "by" => " != ''")));
         $filter->filter($flags);
     }
     //Store list page and filtering
     $this->getSession()->getSection("SongList")->listing = $this->getHttpRequest()->getQuery();
     $this->template->summary = $this->songList->getSummary();
     $this->template->status = $status;
 }
Example #2
0
 public function beforeRender()
 {
     $stats = $this->songy->findAll()->select("status, COUNT(id) AS score")->group("status")->fetchPairs("status", "score");
     $stats["all"] = count($this->songy->findAll());
     $this->template->navigation = $this->navigation;
     $this->template->songy = $this->songy;
     $this->template->songStats = $stats;
     $this->template->songGraph = $this->songy->findAll()->select("DATE(datum) AS datum, COUNT(datum) AS score")->group("DATE(datum)")->order("datum DESC");
 }
 public function renderDefault($filter)
 {
     //If filter is empty => redirect to default filter
     if (!$filter) {
         $this->redirect('this', ['filter' => 'last-month']);
     }
     $this->template->filter = $filter;
     //Filter mapping
     switch ($filter) {
         case 'last-month':
             $filter = '1 month';
             break;
         case 'last-week':
             $filter = '1 week';
             break;
         case 'last-day':
             $filter = '24 hour';
             break;
         default:
             $filter = null;
     }
     $this->template->songs = $this->songList->getTopSongs(10, $filter);
     $this->template->newest = $this->songList->findAll()->order("datum DESC")->limit(5);
 }