Ejemplo n.º 1
0
 public function getByID($id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $row = $this->doSelectById($id, $crit, false);
     return $row;
 }
Ejemplo n.º 2
0
 public function quickfind($client_name)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::NAME, "%{$client_name}%", Criteria::DB_LIKE);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     return $this->select($crit);
 }
Ejemplo n.º 3
0
 public function do_execute()
 {
     $this->cliEcho("Importing articles ... \n", 'white', 'bold');
     \thebuggenie\core\framework\Event::listen('publish', 'fixture_article_loaded', array($this, 'listenPublishFixtureArticleCreated'));
     $overwrite = (bool) ($this->getProvidedArgument('overwrite', 'no') == 'yes');
     \thebuggenie\core\framework\Context::getModule('publish')->loadFixturesArticles(\thebuggenie\core\framework\Context::getScope()->getID(), $overwrite);
 }
Ejemplo n.º 4
0
 public function markUserNotificationsReadByTypesAndId($types, $id, $user_id)
 {
     if (!is_array($types)) {
         $types = array($types);
     }
     $crit = $this->getCriteria();
     $crit->addWhere(self::USER_ID, $user_id);
     if (count($types)) {
         if (is_array($id)) {
             $crit->addWhere(self::TARGET_ID, $id, Criteria::DB_IN);
         } else {
             $crit->addWhere(self::TARGET_ID, $id);
         }
         $crit->addWhere(self::NOTIFICATION_TYPE, $types, Criteria::DB_IN);
     }
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addUpdate(self::IS_READ, true);
     $this->doUpdate($crit);
     $crit = $this->getCriteria();
     $crit->addWhere(self::USER_ID, $user_id);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::IS_READ, true);
     $crit->addWhere('notifications.created_at', NOW - 86400 * 30, Criteria::DB_LESS_THAN_EQUAL);
     $this->doDelete($crit);
 }
Ejemplo n.º 5
0
 public function deleteProcessedMessages($ids)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::ID, (array) $ids, Criteria::DB_IN);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $res = $this->doDelete($crit);
 }
Ejemplo n.º 6
0
 public function countTeams()
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::ONDEMAND, false);
     return $this->doCount($crit);
 }
Ejemplo n.º 7
0
 public function countWorkflows($scope = null)
 {
     $scope = $scope === null ? framework\Context::getScope()->getID() : $scope;
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, $scope);
     return $this->doCount($crit);
 }
Ejemplo n.º 8
0
 public function deleteBySearchID($saved_search_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::SEARCH_ID, $saved_search_id);
     $this->doDelete($crit);
 }
Ejemplo n.º 9
0
 public function doesGroupNameExist($group_name)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::NAME, $group_name);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     return (bool) $this->doCount($crit);
 }
Ejemplo n.º 10
0
 public function getAll()
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addOrderBy(self::ID, Criteria::SORT_ASC);
     return $this->select($crit);
 }
 public function getByTransitionID($transition_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::TRANSITION_ID, $transition_id);
     return $this->select($crit);
 }
Ejemplo n.º 12
0
 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, framework\Context::getScope()->getID());
     $this->doInsert($crit);
 }
Ejemplo n.º 13
0
 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, framework\Context::getScope()->getID());
     $this->doInsert($crit);
 }
Ejemplo n.º 14
0
 public function deleteByIssuetypeID($issuetype_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::ISSUETYPE_ID, $issuetype_id);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $this->doDelete($crit);
     return true;
 }
Ejemplo n.º 15
0
 /**
  * Get all rows by issue ID
  * @param integer $id
  * @return \b2db\Row
  */
 public function getByIssueID($id, $scope = null)
 {
     $scope = $scope === null ? \thebuggenie\core\framework\Context::getScope()->getID() : $scope;
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, $scope);
     $crit->addWhere(self::ISSUE_NO, $id);
     return $this->select($crit);
 }
Ejemplo n.º 16
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, framework\Context::getScope()->getID());
     $this->doDelete($crit);
 }
Ejemplo n.º 17
0
 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, framework\Context::getScope()->getID());
     $res = $this->doDelete($crit);
 }
Ejemplo n.º 18
0
 protected function _uninstall()
 {
     if (framework\Context::getScope()->isDefault()) {
         $filename = THEBUGGENIE_PATH . THEBUGGENIE_PUBLIC_FOLDER_NAME . DS . 'css' . DS . 'mobile.css';
         if (file_exists($filename)) {
             unlink($filename);
         }
     }
 }
Ejemplo n.º 19
0
 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, framework\Context::getScope()->getID());
     $res = $this->doInsert($crit);
     return true;
 }
Ejemplo n.º 20
0
 public function selectAll()
 {
     $crit = $this->getCriteria();
     $crit->addJoin(Projects::getTable(), Projects::ID, self::PROJECT);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addOrderBy(Projects::NAME, Criteria::SORT_ASC);
     $crit->addOrderBy(self::NAME, Criteria::SORT_ASC);
     return $this->select($crit);
 }
Ejemplo n.º 21
0
 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, framework\Context::getScope()->getID());
     $crit->addOrderBy(self::CATEGORY_NAME, Criteria::SORT_ASC);
     $res = $this->doSelect($crit);
     return $res;
 }
Ejemplo n.º 22
0
 public function getByIDs($ids)
 {
     if (empty($ids)) {
         return array();
     }
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::ID, $ids, Criteria::DB_IN);
     return $this->select($crit);
 }
Ejemplo n.º 23
0
 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, framework\Context::getScope()->getID());
         $this->doUpdateById($crit, $option_id);
     }
 }
Ejemplo n.º 24
0
 public function getKeyFromID($id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::ID, $id);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $row = $this->doSelectOne($crit);
     if ($row instanceof \b2db\Row) {
         return $row->get(self::FIELD_KEY);
     }
     return null;
 }
 public function getByTransitionID($transition_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::TRANSITION_ID, $transition_id);
     $actions = array('pre' => array(), 'post' => array());
     if ($res = $this->select($crit, false)) {
         foreach ($res as $rule) {
             $actions[$rule->isPreOrPost()][$rule->getRule()] = $rule;
         }
     }
     return $actions;
 }
Ejemplo n.º 26
0
 protected function _getByTypeID($type, $id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere($type == 'step' ? self::OUTGOING_STEP_ID : self::WORKFLOW_ID, $id);
     $return_array = array();
     if ($res = $this->doSelect($crit)) {
         while ($row = $res->getNextRow()) {
             $return_array[$row->get(self::ID)] = new \thebuggenie\core\entities\WorkflowTransition($row->get(self::ID), $row);
         }
     }
     return $return_array;
 }
Ejemplo n.º 27
0
 public function saveEstimate($issue_id, $months, $weeks, $days, $hours, $points)
 {
     $crit = $this->getCriteria();
     $crit->addInsert(self::ESTIMATED_MONTHS, $months);
     $crit->addInsert(self::ESTIMATED_WEEKS, $weeks);
     $crit->addInsert(self::ESTIMATED_DAYS, $days);
     $crit->addInsert(self::ESTIMATED_HOURS, $hours);
     $crit->addInsert(self::ESTIMATED_POINTS, $points);
     $crit->addInsert(self::ISSUE_ID, $issue_id);
     $crit->addInsert(self::EDITED_AT, NOW);
     $crit->addInsert(self::EDITED_BY, framework\Context::getUser()->getID());
     $crit->addInsert(self::SCOPE, framework\Context::getScope()->getID());
     $this->doInsert($crit);
 }
Ejemplo n.º 28
0
 public function getBugReportTypeIDs()
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::ICON, 'bug_report');
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $res = $this->doSelect($crit);
     $retarr = array();
     if ($res) {
         while ($row = $res->getNextRow()) {
             $retarr[] = $row->get(self::ID);
         }
     }
     return $retarr;
 }
Ejemplo n.º 29
0
 public function addByUserIdAndIssueId($user_id, $issue_id, $up = true)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::TARGET, $issue_id);
     $crit->addWhere(self::UID, $user_id);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $res = $this->doDelete($crit);
     $crit = $this->getCriteria();
     $crit->addInsert(self::TARGET, $issue_id);
     $crit->addInsert(self::UID, $user_id);
     $crit->addInsert(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addInsert(self::VOTE, $up ? 1 : -1);
     $res = $this->doInsert($crit);
     return $res->getInsertID();
 }
Ejemplo n.º 30
0
 public function getUniqueLinkedArticleNames()
 {
     $crit = $this->getCriteria();
     $crit->addSelectionColumn(self::LINK_ARTICLE_NAME);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->setDistinct();
     $names = array();
     if ($res = $this->doSelect($crit)) {
         while ($row = $res->getNextRow()) {
             $article_name = $row->get(self::LINK_ARTICLE_NAME);
             $names[$article_name] = $article_name;
         }
     }
     return $names;
 }