示例#1
0
 /**
  * Determines task being called and attempts to execute it
  *
  * @return	void
  */
 public function execute()
 {
     $this->model = Archive::getInstance();
     $this->registerTask('comment', 'post');
     parent::execute();
 }
示例#2
0
 /**
  * Get a count for the specified key
  *
  * @param   string   $what  Key name [following, followers, collectios, posts]
  * @return  integer
  */
 public function count($what = 'following')
 {
     $what = strtolower(trim($what));
     $value = $this->get($what);
     switch ($what) {
         case 'following':
             if ($value === null) {
                 $value = $this->_tbl->count(array('follower_type' => $this->get('following_type'), 'follower_id' => $this->get('following_id')));
                 $this->set($what, $value);
             }
             break;
         case 'followers':
             if ($value === null) {
                 $value = $this->_tbl->count(array('following_type' => $this->get('following_type'), 'following_id' => $this->get('following_id')));
                 $this->set($what, $value);
             }
             break;
         case 'collections':
             if ($value === null && $this->get('following_type') != 'collection') {
                 $model = Collections::getInstance($this->get('following_type'), $this->get('following_id'));
                 $value = $model->collections(array('count'));
                 $this->set($what, $value);
             }
             break;
         case 'posts':
             if ($value === null) {
                 if ($this->get('following_type') != 'collection') {
                     $model = Archive::getInstance($this->get('following_type'), $this->get('following_id'));
                     $value = $model->posts(array('count'));
                     $this->set($what, $value);
                 } else {
                     $model = Collection::getInstance($this->get('following_id'));
                     $value = $model->posts(array('count'));
                     $this->set($what, $value);
                 }
             }
             break;
     }
     if ($value === null) {
         $value = 0;
     }
     return $value;
 }
示例#3
0
 /**
  * Display information about collections
  *
  * @return  void
  */
 public function aboutTask()
 {
     // Filters for returning results
     $this->view->filters = array('id' => Request::getInt('id', 0), 'search' => Request::getVar('search', ''), 'sort' => 'p.created', 'state' => 1, 'access' => !User::isGuest() ? array(0, 1) : 0);
     if ($this->view->filters['id']) {
         $this->view->filters['object_type'] = 'site';
     }
     $this->view->collection = new Collection();
     $this->view->filters['count'] = true;
     $this->view->total = $this->view->collection->posts($this->view->filters);
     $model = Archive::getInstance();
     $this->view->collections = $model->collections(array('count' => true, 'state' => 1, 'access' => !User::isGuest() ? array(0, 1) : 0));
     $this->_buildTitle();
     $this->_buildPathway();
     $this->view->setLayout('about')->display();
 }