/** * @fn date * @short Action method that returns a list of articles written before a particular date. */ public function date() { if (!empty($_REQUEST['day'])) { $the_time = mktime(0, 0, 0, $_REQUEST['month'], $_REQUEST['day'] + 1, $_REQUEST['year']); } else { if (!empty($_REQUEST['month'])) { $the_time = mktime(0, 0, 0, $_REQUEST['month'] + 1, 1, $_REQUEST['year']); } else { $the_time = mktime(0, 0, 0, 1, 1, $_REQUEST['year'] + 1); } } $the_date = date("Y-m-d H:i:s", $the_time); $article = new DiarioPost(); $this->articles = $article->find_all(array('where_clause' => "`created_at` < '{$the_date}' AND `status` = 'pubblicato' ", 'order_by' => '`created_at` DESC', 'limit' => '10', 'start' => @$_REQUEST['start'])); if (isset($_REQUEST['layout']) && $_REQUEST['layout'] == 'false') { $this->render(array('layout' => FALSE, 'action' => 'index')); } else { $this->render(array('action' => 'index')); } }
/** * @fn diario_post_list * @short Action method to show the list of articles. */ public function diario_post_list() { $post_factory = new DiarioPost(); $this->posts = $post_factory->find_all(array('order_by' => '`id` DESC', 'start' => isset($_REQUEST['page']) && is_numeric($_REQUEST['page']) ? 20 * ($_REQUEST['page'] - 1) : 0, 'limit' => 20)); }