public function deleteProcessedMessages($ids)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::ID, (array) $ids, B2DBCriteria::DB_IN);
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     $res = $this->doDelete($crit);
 }
 public function do_execute()
 {
     $this->cliEcho("Importing articles ... \n", 'white', 'bold');
     TBGEvent::listen('publish', 'fixture_article_loaded', array($this, 'listenPublishFixtureArticleCreated'));
     $overwrite = (bool) ($this->getProvidedArgument('overwrite', 'no') == 'yes');
     TBGPublish::getModule()->loadFixturesArticles(TBGContext::getScope()->getID(), $overwrite);
 }
 public function deleteBySearchID($saved_search_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     $crit->addWhere(self::SEARCH_ID, $saved_search_id);
     $this->doDelete($crit);
 }
 public function getAll()
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     $crit->addOrderBy(self::ID, Criteria::SORT_ASC);
     return $this->select($crit);
 }
 public function getByID($id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     $row = $this->doSelectById($id, $crit, false);
     return $row;
 }
Esempio n. 6
0
 public function countTeams()
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     $crit->addWhere(self::ONDEMAND, false);
     return $this->doCount($crit);
 }
 public function quickfind($client_name)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::NAME, "%{$client_name}%", Criteria::DB_LIKE);
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     return $this->select($crit);
 }
 public function doesGroupNameExist($group_name)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::NAME, $group_name);
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     return (bool) $this->doCount($crit);
 }
 protected function _uninstall()
 {
     if (TBGContext::getScope()->getID() == 1) {
         TBGVCSIntegrationTable::getTable()->drop();
     }
     parent::_uninstall();
 }
 public function getByTransitionID($transition_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     $crit->addWhere(self::TRANSITION_ID, $transition_id);
     return $this->doSelect($crit);
 }
 public function countWorkflows($scope = null)
 {
     $scope = $scope === null ? TBGContext::getScope()->getID() : $scope;
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, $scope);
     return $this->doCount($crit);
 }
 public function addStarredArticle($user_id, $article_id)
 {
     $crit = $this->getCriteria();
     $crit->addInsert(self::ARTICLE, $article_id);
     $crit->addInsert(self::UID, $user_id);
     $crit->addInsert(self::SCOPE, TBGContext::getScope()->getID());
     $this->doInsert($crit);
 }
 public function getAll($scope = null)
 {
     $scope = $scope === null ? TBGContext::getScope()->getID() : $scope;
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, $scope);
     $res = $this->doSelect($crit);
     return $res;
 }
Esempio n. 14
0
 public function removeFriendByUserID($user_id, $friend_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::UID, $user_id);
     $crit->addWhere(self::BID, $friend_id);
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     $this->doDelete($crit);
 }
 public function clearDefaultsByEditionID($edition_id)
 {
     $crit = $this->getCriteria();
     $crit->addUpdate(self::IS_DEFAULT, false);
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     $crit->addWhere(self::EDITION, $edition_id);
     $res = $this->doUpdate($crit);
 }
 public function addStarredIssue($user_id, $issue_id)
 {
     $crit = $this->getCriteria();
     $crit->addInsert(self::ISSUE, $issue_id);
     $crit->addInsert(self::UID, $user_id);
     $crit->addInsert(self::SCOPE, TBGContext::getScope()->getID());
     $this->doInsert($crit);
 }
 public function removeEditionComponent($edition_id, $component_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::EDITION, $edition_id);
     $crit->addWhere(self::COMPONENT, $component_id);
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     $res = $this->doDelete($crit);
 }
 public function getLinkingArticles($linked_article_name)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::LINK_ARTICLE_NAME, $linked_article_name);
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     $res = $this->doSelect($crit);
     return $res;
 }
 public function deleteByIssuetypeID($issuetype_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::ISSUETYPE_ID, $issuetype_id);
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     $this->doDelete($crit);
     return true;
 }
 public function disableModuleByName($module_name)
 {
     $crit = $this->getCriteria();
     $crit->addUpdate(self::ENABLED, 0);
     $crit->addWhere(self::MODULE_NAME, $module_name);
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     return $this->doUpdate($crit);
 }
 public function addChildIssue($issue_id, $child_id)
 {
     $crit = $this->getCriteria();
     $crit->addInsert(self::PARENT_ID, $issue_id);
     $crit->addInsert(self::CHILD_ID, $child_id);
     $crit->addInsert(self::SCOPE, TBGContext::getScope()->getID());
     $res = $this->doInsert($crit);
     return $res;
 }
 public function addByProjectIDAndMilestoneID($project_id, $milestone_id)
 {
     $crit = $this->getCriteria();
     $crit->addInsert(self::PROJECT_ID, $project_id);
     $crit->addInsert(self::MILESTONE_ID, $milestone_id);
     $crit->addInsert(self::SCOPE, TBGContext::getScope()->getID());
     $res = $this->doInsert($crit);
     return true;
 }
 public function getSubCategories($category_name)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::CATEGORY_NAME, $category_name);
     $crit->addWhere(self::ARTICLE_IS_CATEGORY, true);
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     $crit->addOrderBy(self::CATEGORY_NAME, B2DBCriteria::SORT_ASC);
     $res = $this->doSelect($crit);
     return $res;
 }
 public function removeByArticleIDandFileID($article_id, $file_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::ARTICLE_ID, $article_id);
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     if ($res = $this->doSelectById($file_id, $crit)) {
         $this->doDelete($crit);
     }
     return $res;
 }
 public function saveOptionOrder($options, $type)
 {
     foreach ($options as $key => $option_id) {
         $crit = $this->getCriteria();
         $crit->addUpdate(self::ORDER, $key + 1);
         $crit->addWhere(self::ITEMTYPE, $type);
         $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
         $this->doUpdateById($crit, $option_id);
     }
 }
 public function createNew($name, $type, $project_id)
 {
     $crit = $this->getCriteria();
     $crit->addInsert(self::NAME, $name);
     $crit->addInsert(self::MILESTONE_TYPE, $type);
     $crit->addInsert(self::PROJECT, $project_id);
     $crit->addInsert(self::SCOPE, TBGContext::getScope()->getID());
     $res = $this->doInsert($crit);
     return $res->getInsertID();
 }
 public function getViews($target_id, $target_type)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::TID, $target_id);
     $crit->addWhere(self::TARGET_TYPE, $target_type);
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     $crit->addOrderBy(self::ID);
     $res = $this->doSelect($crit);
     return $res;
 }
 public function getByIDs($ids)
 {
     if (empty($ids)) {
         return array();
     }
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     $crit->addWhere(self::ID, $ids, Criteria::DB_IN);
     return $this->select($crit);
 }
 public function saveOptionOrder($options, $customfield_id)
 {
     foreach ($options as $key => $option_id) {
         $crit = $this->getCriteria();
         $crit->addUpdate(self::SORT_ORDER, $key + 1);
         $crit->addWhere(self::CUSTOMFIELD_ID, $customfield_id);
         $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
         $this->doUpdateById($crit, $option_id);
     }
 }
Esempio n. 30
0
 /**
  * Return a row for the specified id in the current scope, if defined
  * 
  * @param integer $id
  * 
  * @return \b2db\Row
  */
 public function getByID($id)
 {
     if (defined('static::SCOPE')) {
         $crit = $this->getCriteria();
         $crit->addWhere(static::SCOPE, TBGContext::getScope()->getID());
         $row = $this->doSelectById($id, $crit);
     } else {
         $row = $this->doSelectById($id);
     }
     return $row;
 }