예제 #1
0
파일: item.php 프로젝트: ming-hai/XoopsCore
 /**
  * @param bool $force
  *
  * @return bool
  */
 public function store($force = true)
 {
     $xoops = Xoops::getInstance();
     $isNew = $this->isNew();
     if (!$this->publisher->getItemHandler()->insert($this, $force)) {
         return false;
     }
     if ($isNew && $this->getVar('status') == _PUBLISHER_STATUS_PUBLISHED) {
         // Increment user posts
         $user_handler = $xoops->getHandlerUser();
         $member_handler = $xoops->getHandlerMember();
         $poster = $user_handler->get($this->getVar('uid'));
         if (is_object($poster) && !$poster->isNew()) {
             $poster->setVar('posts', $poster->getVar('posts') + 1);
             if (!$member_handler->insertUser($poster, true)) {
                 $this->setErrors('Article created but could not increment user posts.');
                 return false;
             }
         }
     }
     return true;
 }
예제 #2
0
 /**
  * @param int    $cat_id
  * @param string $status
  *
  * @return mixed
  */
 public function itemsCount($cat_id = 0, $status = '')
 {
     return $this->publisher->getItemHandler()->getCountsByCat($cat_id, $status);
 }