Example #1
0
 /**
  * The backend index hanlder.
  * 
  * @access public
  * @return string The HTML code.
  */
 public function index()
 {
     $Item = new Gallery_Item();
     $Product = new Product();
     $Article = new Article();
     $this->getView()->set(array('Articles' => $Article->findShortList(array('Type = ' . Article::ARTICLE), 'PostedAt desc', 0, 5), 'News' => $Article->findShortList(array('Type = ' . Article::NEWS), 'PostedAt desc', 0, 5), 'Gallery' => $Item->findList(array(), 'PostedAt desc, Id desc', 0, 10), 'Products' => $Product->findShortList(array(), 'Id desc', 0, 10), 'Updated' => $Product->findShortList(array(), 'UpdatedAt desc', 0, 10)));
     return $this->getView()->render();
 }
Example #2
0
 public function index($year = null)
 {
     $Article = new Article();
     $offset = $limit = null;
     $params = array();
     $params[] = 'Type = ' . $this->getArticleType();
     if ($year && is_numeric($year)) {
         $params[] = $Article->getParam('year', $year);
     } else {
         $offset = 0;
         $limit = 10;
     }
     $Tag = null;
     if (Request::get('tag')) {
         $Tag = new Tag();
         $Tag = $Tag->findItem(array('Name = ' . Request::get('tag')));
         $params[] = $Article->getParam('tag', Request::get('tag'));
     }
     $Paginator = new Paginator($Article->findSize($params), $this->getLimit(), $this->getPage());
     $this->getView()->set('Articles', $Article->findShortList($params, 'PostedAt desc, Id desc', $this->getOffset(), $this->getLimit()));
     $this->getView()->set('Paginator', $Paginator);
     $this->getView()->set('Current', $year);
     $this->getView()->set('Tag', $Tag);
     return $this->getView()->render();
 }
Example #3
0
 /**
  * The function returns short overview for current controller.
  * 
  * @access public
  * @param object $Page The Content Page.
  * @return string The HTML code.
  */
 public function htmlShort(Content_Page $Page)
 {
     if (get_class($this) == get_class()) {
         return null;
     }
     $Article = new Article();
     $params = array();
     $params[] = 'Type = ' . Article::ARTICLE;
     $params[] = 'PostedAt < ' . time();
     $params[] = $Article->getParam('reference', $Page);
     $Articles = $Article->findShortList($params, 'PostedAt desc, Id desc');
     return $this->getView()->htmlShort($Page, $Articles, $this->getImages());
 }
Example #4
0
 /**
  * The index handler.
  * 
  * @access public
  * @return string The HTML code.
  */
 public function index()
 {
     $Article = new Article();
     $Client = new Client();
     $Button = new Button();
     $Proud = new Proud();
     $Banner = new Banner();
     $a = array();
     $a[] = 'PostedAt < ' . time();
     $a[] = 'Type = ' . Article::ARTICLE;
     $b = array();
     $b[] = 'PostedAt < ' . time();
     $b[] = 'Type = ' . Article::NEWS;
     foreach ($Banner->findList(array(), 'rand()', 0, 1) as $Banner) {
     }
     $this->getView()->set(array('Articles' => $Article->findShortList($a, 'PostedAt desc', 0, 4), 'News' => $Article->findShortList($b, 'PostedAt desc', 0, 2), 'Clients' => $Client->findList(array(), 'Position asc', 0, 8), 'Buttons' => $Button->findList(array(), 'Position asc', 0, 3), 'Prouds' => $Proud->getLastProuds(), 'Banner' => $Banner));
     return $this->getView()->render();
 }
Example #5
0
 /**
  * The cache function for articles.
  * 
  * @access public
  * @return array The Articles.
  */
 public function getArticles()
 {
     if ($this->Id) {
         if ($this->Articles) {
             $Article = new Article();
             $params = array();
             $params[] = '* Id in (' . $this->Articles . ')';
             $this->articles = $Article->findShortList($params, 'PostedAt desc');
         } else {
             $this->articles = array();
         }
     }
     if ($this->articles === null) {
         $Article = new Article();
         $this->articles = $Article->findShortList(array('InSubscription = 1'), 'PostedAt desc');
     }
     return $this->articles;
 }
Example #6
0
 /**
  * The index handler.
  * 
  * @access public
  * @return string The HTML code.
  */
 public function index()
 {
     $Article = new Article();
     $this->getView()->set('Articles', $Article->findShortList(array('Type = ' . $this->getArticleType()), 'PostedAt desc, Id desc'));
     return $this->getView()->render();
 }