public function getUserStarredArticles($user_id) { $crit = $this->getCriteria(); $crit->addWhere(self::UID, $user_id); $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID()); $crit->addJoin(tables\Articles::getTable(), Articles::ID, self::ARTICLE); $crit->addWhere(Articles::DELETED, 0); $res = $this->select($crit); return $res; }
public function do_execute() { $this->cliEcho("Extracting articles ... \n", 'white', 'bold'); $articles = tables\Articles::getTable()->getAllArticles(); $this->cliEcho("Articles found: "); $this->cliEcho(count($articles) . "\n", 'green', 'bold'); foreach ($articles as $article_id => $article) { $filename = THEBUGGENIE_MODULES_PATH . 'publish' . DS . 'fixtures' . DS . urlencode($article->getName()); if (!file_exists($filename) || $this->getProvidedArgument('overwrite', 'no') == 'yes') { $this->cliEcho("Saving "); file_put_contents($filename, $article->getContent()); } else { $this->cliEcho("Skipping "); } $this->cliEcho($article->getName() . "\n", 'white', 'bold'); } }
/** * Returns the object which the notification is for * * @return \thebuggenie\core\entities\common\IdentifiableScoped */ public function getTarget() { if ($this->_target === null) { if ($this->_module_name == 'core') { switch ($this->_notification_type) { case self::TYPE_ARTICLE_COMMENTED: case self::TYPE_ARTICLE_MENTIONED: case self::TYPE_ISSUE_COMMENTED: case self::TYPE_ISSUE_MENTIONED: case self::TYPE_COMMENT_MENTIONED: $this->_target = tables\Comments::getTable()->selectById((int) $this->_target_id); break; case self::TYPE_ISSUE_UPDATED: case self::TYPE_ISSUE_CREATED: $this->_target = \thebuggenie\core\entities\Issue::getB2DBTable()->selectById((int) $this->_target_id); break; case self::TYPE_ARTICLE_UPDATED: $this->_target = tables\Articles::getTable()->selectById((int) $this->_target_id); break; } } else { $event = new \thebuggenie\core\framework\Event('core', 'thebuggenie\\core\\entities\\Notification::getTarget', $this); $event->triggerUntilProcessed(); $this->_target = $event->getReturnValue(); } } return $this->_target; }
public function getTarget() { if ($this->_target === null) { switch ($this->getTargetType()) { case self::TYPE_ISSUE: $this->_target = \thebuggenie\core\entities\Issue::getB2DBTable()->selectById($this->_target_id); break; case self::TYPE_ARTICLE: $this->_target = tables\Articles::getTable()->selectById($this->_target_id); break; default: $event = \thebuggenie\core\framework\Event::createNew('core', 'Comment::getTarget', $this); $event->trigger(); $this->_target = $event->getReturnValue(); } } return $this->_target; }