public function __construct()
 {
     parent::__construct(self::B2DBNAME, self::ID);
     parent::_addForeignKeyColumn(self::ISSUE, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
     parent::_addForeignKeyColumn(self::UID, TBGUsersTable::getTable(), TBGUsersTable::ID);
     parent::_addForeignKeyColumn(self::SCOPE, TBGScopesTable::getTable(), TBGScopesTable::ID);
 }
 public function __construct()
 {
     parent::__construct(self::B2DBNAME, self::ID);
     parent::_addForeignKeyColumn(self::ISSUE_ID, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
     parent::_addForeignKeyColumn(self::CUSTOMFIELDS_ID, B2DB::getTable('TBGCustomFieldsTable'), TBGCustomFieldsTable::ID);
     parent::_addText(self::OPTION_VALUE, false);
     parent::_addForeignKeyColumn(self::SCOPE, TBGScopesTable::getTable(), TBGScopesTable::ID);
 }
 protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addForeignKeyColumn(self::ISSUE_ID, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
     parent::_addVarchar(self::TAG_NAME, 50);
     parent::_addInteger(self::ADDED, 10);
     parent::_addForeignKeyColumn(self::SCOPE, TBGScopesTable::getTable(), TBGScopesTable::ID);
 }
 public function __construct()
 {
     parent::__construct(self::B2DBNAME, self::ID);
     parent::_addForeignKeyColumn(self::ISSUE_ID, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
     parent::_addVarchar(self::TAG_NAME, 50);
     parent::_addInteger(self::ADDED, 10);
     parent::_addForeignKeyColumn(self::SCOPE, TBGScopesTable::getTable(), TBGScopesTable::ID);
 }
 protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addBoolean(self::MUSTFIX);
     parent::_addForeignKeyColumn(self::SCOPE, TBGScopesTable::getTable(), TBGScopesTable::ID);
     parent::_addForeignKeyColumn(self::PARENT_ID, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
     parent::_addForeignKeyColumn(self::CHILD_ID, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
 }
 public function __construct()
 {
     parent::__construct(self::B2DBNAME, self::ID);
     parent::_addBoolean(self::MUSTFIX);
     parent::_addForeignKeyColumn(self::SCOPE, TBGScopesTable::getTable(), TBGScopesTable::ID);
     parent::_addForeignKeyColumn(self::PARENT_ID, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
     parent::_addForeignKeyColumn(self::CHILD_ID, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
 }
 protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addForeignKeyColumn(self::ISSUE_ID, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
     parent::_addForeignKeyColumn(self::CUSTOMFIELDS_ID, Core::getTable('TBGCustomFieldsTable'), TBGCustomFieldsTable::ID);
     parent::_addText(self::OPTION_VALUE, false);
     parent::_addForeignKeyColumn(self::SCOPE, TBGScopesTable::getTable(), TBGScopesTable::ID);
 }
 public function __construct()
 {
     parent::__construct(self::B2DBNAME, self::ID);
     parent::_addForeignKeyColumn(self::UID, TBGUsersTable::getTable(), TBGUsersTable::ID);
     parent::_addForeignKeyColumn(self::SCOPE, TBGScopesTable::getTable(), TBGScopesTable::ID);
     parent::_addForeignKeyColumn(self::ISSUE_ID, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
     parent::_addForeignKeyColumn(self::FILE_ID, TBGFilesTable::getTable(), TBGFilesTable::ID);
     parent::_addInteger(self::ATTACHED_AT, 10);
 }
 protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addBoolean(self::CONFIRMED);
     parent::_addForeignKeyColumn(self::BUILD, Core::getTable('TBGBuildsTable'), TBGBuildsTable::ID);
     parent::_addForeignKeyColumn(self::ISSUE, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
     parent::_addForeignKeyColumn(self::SCOPE, TBGScopesTable::getTable(), TBGScopesTable::ID);
     parent::_addForeignKeyColumn(self::STATUS, TBGListTypesTable::getTable(), TBGListTypesTable::ID);
 }
 public function __construct()
 {
     parent::__construct(self::B2DBNAME, self::ID);
     parent::_addBoolean(self::CONFIRMED);
     parent::_addForeignKeyColumn(self::COMPONENT, B2DB::getTable('TBGComponentsTable'), TBGComponentsTable::ID);
     parent::_addForeignKeyColumn(self::ISSUE, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
     parent::_addForeignKeyColumn(self::SCOPE, TBGScopesTable::getTable(), TBGScopesTable::ID);
     parent::_addForeignKeyColumn(self::STATUS, TBGListTypesTable::getTable(), TBGListTypesTable::ID);
 }
 protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addForeignKeyColumn(self::UID, TBGUsersTable::getTable(), TBGUsersTable::ID);
     parent::_addForeignKeyColumn(self::SCOPE, TBGScopesTable::getTable(), TBGScopesTable::ID);
     parent::_addForeignKeyColumn(self::ISSUE_ID, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
     parent::_addForeignKeyColumn(self::FILE_ID, TBGFilesTable::getTable(), TBGFilesTable::ID);
     parent::_addInteger(self::ATTACHED_AT, 10);
 }
 public function getUserStarredIssues($user_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::UID, $user_id);
     $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
     $crit->addJoin(TBGIssuesTable::getTable(), TBGIssuesTable::ID, self::ISSUE);
     $crit->addWhere(TBGIssuesTable::DELETED, 0);
     $res = $this->doSelect($crit);
     return $res;
 }
 protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addText(self::FILE_NAME, false);
     parent::_addText(self::LOG, false);
     parent::_addVarchar(self::OLD_REV, 40);
     parent::_addVarchar(self::NEW_REV, 40);
     parent::_addVarchar(self::AUTHOR, 100);
     parent::_addVarchar(self::ACTION, 1);
     parent::_addInteger(self::DATE, 10);
     parent::_addForeignKeyColumn(self::SCOPE, TBGScopesTable::getTable(), TBGScopesTable::ID);
     parent::_addForeignKeyColumn(self::ISSUE_NO, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
 }
 public function __construct()
 {
     parent::__construct(self::B2DBNAME, self::ID);
     parent::_addForeignKeyColumn(self::ISSUE_ID, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
     parent::_addForeignKeyColumn(self::EDITED_BY, TBGUsersTable::getTable(), TBGUsersTable::ID);
     parent::_addInteger(self::EDITED_AT, 10);
     parent::_addInteger(self::ESTIMATED_MONTHS, 10);
     parent::_addInteger(self::ESTIMATED_WEEKS, 10);
     parent::_addInteger(self::ESTIMATED_DAYS, 10);
     parent::_addInteger(self::ESTIMATED_HOURS, 10);
     parent::_addFloat(self::ESTIMATED_POINTS);
     parent::_addForeignKeyColumn(self::SCOPE, TBGScopesTable::getTable(), TBGScopesTable::ID);
 }
 protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addForeignKeyColumn(self::ISSUE_ID, TBGIssuesTable::getTable(), TBGIssuesTable::ID);
     parent::_addForeignKeyColumn(self::EDITED_BY, TBGUsersTable::getTable(), TBGUsersTable::ID);
     parent::_addInteger(self::EDITED_AT, 10);
     parent::_addInteger(self::SPENT_MONTHS, 10);
     parent::_addInteger(self::SPENT_WEEKS, 10);
     parent::_addInteger(self::SPENT_DAYS, 10);
     parent::_addInteger(self::SPENT_HOURS, 10);
     parent::_addFloat(self::SPENT_POINTS);
     parent::_addForeignKeyColumn(self::SCOPE, TBGScopesTable::getTable(), TBGScopesTable::ID);
 }
 public function do_execute()
 {
     if (TBGContext::isInstallmode()) {
         $this->cliEcho("The Bug Genie is not installed\n", 'red');
     } else {
         $this->cliEcho("Finding times to fix\n", 'white', 'bold');
         $issuetimes = TBGIssueSpentTimesTable::getTable()->getAllSpentTimesForFixing();
         $error_issues = array();
         foreach ($issuetimes as $issue_id => $times) {
             if (count($times) > 1) {
                 $this->cliEcho("Fixing times spent for issue ID {$issue_id}, " . count($times) . " entries\n");
                 $prev_times = array('hours' => 0, 'days' => 0, 'weeks' => 0, 'months' => 0, 'points' => 0);
                 foreach ($times as $k => $row) {
                     if ($row[TBGIssueSpentTimesTable::SPENT_DAYS] < $prev_times['days'] || $row[TBGIssueSpentTimesTable::SPENT_HOURS] < $prev_times['hours'] || $row[TBGIssueSpentTimesTable::SPENT_WEEKS] < $prev_times['weeks'] || $row[TBGIssueSpentTimesTable::SPENT_MONTHS] < $prev_times['months'] || $row[TBGIssueSpentTimesTable::SPENT_POINTS] < $prev_times['points']) {
                         $error_issues[] = $issue_id;
                     } else {
                         TBGIssueSpentTimesTable::getTable()->fixRow($row, $prev_times);
                         $prev_times['points'] += $row[TBGIssueSpentTimesTable::SPENT_POINTS];
                         $prev_times['hours'] += $row[TBGIssueSpentTimesTable::SPENT_HOURS];
                         $prev_times['days'] += $row[TBGIssueSpentTimesTable::SPENT_DAYS];
                         $prev_times['weeks'] += $row[TBGIssueSpentTimesTable::SPENT_WEEKS];
                         $prev_times['months'] += $row[TBGIssueSpentTimesTable::SPENT_MONTHS];
                     }
                 }
             }
         }
         foreach (TBGIssueSpentTimesTable::getTable()->getAllSpentTimesForFixing() as $issue_id => $times) {
             foreach ($times as $row) {
                 TBGIssueSpentTimesTable::getTable()->fixHours($row);
             }
             TBGIssuesTable::getTable()->fixHours($issue_id);
         }
         if (count($error_issues) > 0) {
             $this->cliEcho("\n");
             $this->cliEcho("All spent times have been attempted fixed, but there were some issues that could not be fixed automatically!\n");
             $this->cliEcho("This happens if there has been adjustments in time spent, lowering the value for spent points, hours, days, weeks or months.\n\n");
             $this->cliEcho("You should fix the issues manually (issue ids corresponding to issue_ids in the timesspent table): ");
             $this->cliEcho(join(', ', $error_issues) . "\n\n");
             $this->cliEcho("Spent times fixed!\n\n", 'green');
         } else {
             $this->cliEcho("All spent times fixed successfully!\n\n", 'green');
         }
         $this->cliEcho("IMPORTANT: Don't run this task again!\n", 'white', 'bold');
     }
 }
예제 #17
0
 /**
  * Adds this build to all open issues in this edition or project
  * Returns true if any issues were updated, false if not
  * 
  * @param integer $limit_status Limit to only a specific status type
  * @param integer $limit_category Limit to only a specific category
  * @param integer $limit_issuetype Limit to only a specific issue type
  * 
  * @return boolean
  */
 public function addToOpenParentIssues($limit_status = null, $limit_category = null, $limit_issuetype = null)
 {
     if ($this->isEditionBuild()) {
         $res = B2DB::getTable('TBGIssueAffectsEditionTable')->getOpenAffectedIssuesByEditionID($this->getParent()->getID(), $limit_status, $limit_category, $limit_issuetype);
     } else {
         $res = TBGIssuesTable::getTable()->getOpenAffectedIssuesByProjectID($this->getParent()->getID(), $limit_status, $limit_category, $limit_issuetype);
     }
     $retval = false;
     if ($res) {
         while ($row = $res->getNextRow()) {
             $issue_id = $row->get(TBGIssuesTable::ID);
             if (B2DB::getTable('TBGIssueAffectsBuildTable')->setIssueAffected($issue_id, $this->getID())) {
                 $retval = true;
             }
         }
     }
     return $retval;
 }
예제 #18
0
 protected function _populateRecentIdeas()
 {
     if ($this->_recentideas === null) {
         $this->_recentideas = array();
         if ($res = TBGIssuesTable::getTable()->getRecentByProjectIDandIssueType($this->getID(), array('idea'))) {
             while ($row = $res->getNextRow()) {
                 $recentissue = TBGContext::factory()->TBGIssue($row->get(TBGIssuesTable::ID), $row);
                 if ($recentissue->hasAccess()) {
                     $this->_recentideas[$recentissue->getID()] = $recentissue;
                 }
             }
         }
     }
 }
예제 #19
0
 /**
  *
  * @param \b2db\Criteria $crit
  * @param array|TBGSearchFilter $filters
  * @param \b2db\Criterion $ctn
  * @return null
  */
 public function addToCriteria($crit, $filters, $ctn = null)
 {
     $filter_key = $this->getFilterKey();
     if (in_array($this['operator'], array('=', '!=', '<=', '>=', '<', '>'))) {
         if ($filter_key == 'text') {
             if ($this['value'] != '') {
                 $searchterm = mb_strpos($this['value'], '%') !== false ? $this['value'] : "%{$this['value']}%";
                 if ($this['operator'] == '=') {
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion(TBGIssuesTable::TITLE, $searchterm, Criteria::DB_LIKE);
                     }
                     $ctn->addOr(TBGIssuesTable::DESCRIPTION, $searchterm, Criteria::DB_LIKE);
                     $ctn->addOr(TBGIssuesTable::REPRODUCTION_STEPS, $searchterm, Criteria::DB_LIKE);
                     $ctn->addOr(TBGIssueCustomFieldsTable::OPTION_VALUE, $searchterm, Criteria::DB_LIKE);
                 } else {
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion(TBGIssuesTable::TITLE, $searchterm, Criteria::DB_NOT_LIKE);
                     }
                     $ctn->addWhere(TBGIssuesTable::DESCRIPTION, $searchterm, Criteria::DB_NOT_LIKE);
                     $ctn->addWhere(TBGIssuesTable::REPRODUCTION_STEPS, $searchterm, Criteria::DB_NOT_LIKE);
                     $ctn->addOr(TBGIssueCustomFieldsTable::OPTION_VALUE, $searchterm, Criteria::DB_NOT_LIKE);
                 }
                 return $ctn;
             }
         } elseif (in_array($filter_key, self::getValidSearchFilters())) {
             if ($filter_key == 'subprojects') {
                 if (TBGContext::isProjectContext()) {
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion(TBGIssuesTable::PROJECT_ID, TBGContext::getCurrentProject()->getID());
                     }
                     if ($this->hasValue()) {
                         foreach ($this->getValues() as $value) {
                             switch ($value) {
                                 case 'all':
                                     $subprojects = TBGProject::getIncludingAllSubprojectsAsArray(TBGContext::getCurrentProject());
                                     foreach ($subprojects as $subproject) {
                                         if ($subproject->getID() == TBGContext::getCurrentProject()->getID()) {
                                             continue;
                                         }
                                         $ctn->addOr(TBGIssuesTable::PROJECT_ID, $subproject->getID());
                                     }
                                     break;
                                 case 'none':
                                 case '':
                                     break;
                                 default:
                                     $ctn->addOr(TBGIssuesTable::PROJECT_ID, (int) $value);
                                     break;
                             }
                         }
                     }
                     return $ctn;
                 }
             } elseif (in_array($filter_key, array('build', 'edition', 'component'))) {
                 switch ($filter_key) {
                     case 'component':
                         $tbl = TBGIssueAffectsComponentTable::getTable();
                         $fk = TBGIssueAffectsComponentTable::ISSUE;
                         break;
                     case 'edition':
                         $tbl = TBGIssueAffectsEditionTable::getTable();
                         $fk = TBGIssueAffectsEditionTable::ISSUE;
                         break;
                     case 'build':
                         $tbl = TBGIssueAffectsBuildTable::getTable();
                         $fk = TBGIssueAffectsBuildTable::ISSUE;
                         break;
                 }
                 $crit->addJoin($tbl, $fk, TBGIssuesTable::ID, array(array($tbl->getB2DBAlias() . '.' . $filter_key, $this->getValues())), \b2db\Criteria::DB_INNER_JOIN);
                 return null;
             } else {
                 if ($filter_key == 'project_id' && in_array('subprojects', $filters)) {
                     return null;
                 }
                 $values = $this->getValues();
                 $num_values = 0;
                 if ($filter_key == 'status') {
                     if ($this->hasValue('open')) {
                         $c = $crit->returnCriterion(TBGIssuesTable::STATE, TBGIssue::STATE_OPEN);
                         $num_values++;
                     }
                     if ($this->hasValue('closed')) {
                         $num_values++;
                         if (isset($c)) {
                             $c->addWhere(TBGIssuesTable::STATE, TBGIssue::STATE_CLOSED);
                         } else {
                             $c = $crit->returnCriterion(TBGIssuesTable::STATE, TBGIssue::STATE_CLOSED);
                         }
                     }
                     if (isset($c)) {
                         if (count($values) == $num_values) {
                             return $c;
                         } else {
                             $crit->addWhere($c);
                         }
                     }
                 }
                 $dbname = TBGIssuesTable::getTable()->getB2DBName();
                 foreach ($values as $value) {
                     $operator = $this['operator'];
                     $or = true;
                     if ($filter_key == 'status' && in_array($value, array('open', 'closed'))) {
                         continue;
                     } else {
                         $field = $dbname . '.' . $filter_key;
                         if ($operator == '!=' || in_array($filter_key, array('posted', 'last_updated'))) {
                             $or = false;
                         }
                     }
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion($field, $value, urldecode($operator));
                     } elseif ($or) {
                         $ctn->addOr($field, $value, urldecode($operator));
                     } else {
                         $ctn->addWhere($field, $value, urldecode($operator));
                     }
                 }
                 return $ctn;
             }
         } elseif (TBGCustomDatatype::doesKeyExist($filter_key)) {
             $customdatatype = TBGCustomDatatype::getByKey($filter_key);
             if (in_array($this->getFilterType(), TBGCustomDatatype::getInternalChoiceFieldsAsArray())) {
                 $tbl = clone TBGIssueCustomFieldsTable::getTable();
                 $crit->addJoin($tbl, TBGIssueCustomFieldsTable::ISSUE_ID, TBGIssuesTable::ID, array(array($tbl->getB2DBAlias() . '.customfields_id', $customdatatype->getID()), array($tbl->getB2DBAlias() . '.customfieldoption_id', $this->getValues())), \b2db\Criteria::DB_INNER_JOIN);
                 return null;
             } else {
                 foreach ($this->getValues() as $value) {
                     if ($customdatatype->hasCustomOptions()) {
                         if ($ctn === null) {
                             $ctn = $crit->returnCriterion(TBGIssueCustomFieldsTable::CUSTOMFIELDS_ID, $customdatatype->getID());
                             $ctn->addWhere(TBGIssueCustomFieldsTable::CUSTOMFIELDOPTION_ID, $value, $this['operator']);
                         } else {
                             $ctn->addOr(TBGIssueCustomFieldsTable::CUSTOMFIELDOPTION_ID, $value, $this['operator']);
                         }
                     } else {
                         if ($ctn === null) {
                             $ctn = $crit->returnCriterion(TBGIssueCustomFieldsTable::CUSTOMFIELDS_ID, $customdatatype->getID());
                             $ctn->addWhere(TBGIssueCustomFieldsTable::OPTION_VALUE, $value, $this['operator']);
                         } else {
                             $ctn->addOr(TBGIssueCustomFieldsTable::OPTION_VALUE, $value, $this['operator']);
                         }
                     }
                 }
                 return $ctn;
             }
         }
     }
 }
예제 #20
0
					<?php 
    echo link_tag(make_url('project_last_issues', array('project_key' => TBGContext::getCurrentProject()->getKey(), 'units' => 30, 'time_unit' => 'days')), image_tag('icon_savedsearch.png') . __('Issues reported last 30 days'));
    ?>
					<div class="header"><?php 
    echo __('Recently watched issues');
    ?>
</div>
					<?php 
    if (array_key_exists('viewissue_list', $_SESSION) && is_array($_SESSION['viewissue_list'])) {
        ?>
						<?php 
        foreach ($_SESSION['viewissue_list'] as $k => $i_id) {
            ?>
						<?php 
            try {
                $an_issue = TBGIssuesTable::getTable()->getIssueById($i_id);
                if (!$an_issue instanceof TBGIssue) {
                    unset($_SESSION['viewissue_list'][$k]);
                    continue;
                }
            } catch (Exception $e) {
                unset($_SESSION['viewissue_list'][$k]);
            }
            echo link_tag(make_url('viewissue', array('project_key' => $an_issue->getProject()->getKey(), 'issue_no' => $an_issue->getFormattedIssueNo())), $an_issue->getFormattedTitle(true, false), array('title' => $an_issue->getFormattedTitle(true, true)));
            ?>
						<?php 
        }
        ?>
					<?php 
    }
    ?>
예제 #21
0
 /**
  * Delete this milestone
  */
 protected function _preDelete()
 {
     TBGIssuesTable::getTable()->clearMilestone($this->getID());
 }
예제 #22
0
 public function runSortMilestoneIssues(TBGRequest $request)
 {
     $issue_table = TBGIssuesTable::getTable();
     $milestone_id = $request['milestone_id'];
     $orders = array_keys($request["milestone_{$milestone_id}_list"]);
     foreach ($request["milestone_{$milestone_id}_list"] as $issue_id) {
         $issue_table->setOrderByMilestoneIdAndIssueId(array_pop($orders), $milestone_id, $issue_id);
     }
     return $this->renderJSON('sorted ok');
 }
예제 #23
0
 /**
  * Returns the object which the notification is for
  *
  * @return TBGIdentifiableScopedClass
  */
 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 = TBGCommentsTable::getTable()->selectById((int) $this->_target_id);
                     break;
                 case self::TYPE_ISSUE_UPDATED:
                 case self::TYPE_ISSUE_CREATED:
                     $this->_target = TBGIssuesTable::getTable()->selectById((int) $this->_target_id);
                     break;
                 case self::TYPE_ARTICLE_UPDATED:
                     $this->_target = TBGArticlesTable::getTable()->selectById((int) $this->_target_id);
                     break;
             }
         } else {
             $event = new TBGEvent('core', 'TBGNotification::getTarget', $this);
             $event->triggerUntilProcessed();
             $this->_target = $event->getReturnValue();
         }
     }
     return $this->_target;
 }
예제 #24
0
 protected function _generateImageDetailsFromKey($mode = null)
 {
     $this->graphmode = null;
     $i18n = TBGContext::getI18n();
     if ($mode == 'main') {
         $this->width = 695;
         $this->height = 310;
     } else {
         $this->width = 230;
         $this->height = 150;
     }
     switch ($this->key) {
         case 'issues_per_status':
             $this->graphmode = 'piechart';
             $counts = TBGIssuesTable::getTable()->getStatusCountByProjectID($this->selected_project->getID());
             if ($this->image_number == 1) {
                 $this->title = $i18n->__('Total number of issues per status type');
             } elseif ($this->image_number == 2) {
                 $this->title = $i18n->__('Open issues per status type');
             } elseif ($this->image_number == 3) {
                 $this->title = $i18n->__('Closed issues per status type');
             }
             break;
         case 'issues_per_priority':
             $this->graphmode = 'piechart';
             $counts = TBGIssuesTable::getTable()->getPriorityCountByProjectID($this->selected_project->getID());
             if ($this->image_number == 1) {
                 $this->title = $i18n->__('Total number of issues per priority level');
             } elseif ($this->image_number == 2) {
                 $this->title = $i18n->__('Open issues per priority level');
             } elseif ($this->image_number == 3) {
                 $this->title = $i18n->__('Closed issues per priority level');
             }
             break;
         case 'issues_per_category':
             $this->graphmode = 'piechart';
             $counts = TBGIssuesTable::getTable()->getCategoryCountByProjectID($this->selected_project->getID());
             if ($this->image_number == 1) {
                 $this->title = $i18n->__('Total number of issues per category');
             } elseif ($this->image_number == 2) {
                 $this->title = $i18n->__('Open issues per category');
             } elseif ($this->image_number == 3) {
                 $this->title = $i18n->__('Closed issues per category');
             }
             break;
         case 'issues_per_resolution':
             $this->graphmode = 'piechart';
             $counts = TBGIssuesTable::getTable()->getResolutionCountByProjectID($this->selected_project->getID());
             if ($this->image_number == 1) {
                 $this->title = $i18n->__('Total number of issues per resolution');
             } elseif ($this->image_number == 2) {
                 $this->title = $i18n->__('Open issues per resolution');
             } elseif ($this->image_number == 3) {
                 $this->title = $i18n->__('Closed issues per resolution');
             }
             break;
         case 'issues_per_reproducability':
             $this->graphmode = 'piechart';
             $counts = TBGIssuesTable::getTable()->getReproducabilityCountByProjectID($this->selected_project->getID());
             if ($this->image_number == 1) {
                 $this->title = $i18n->__('Total number of issues per reproducability level');
             } elseif ($this->image_number == 2) {
                 $this->title = $i18n->__('Open issues per reproducability level');
             } elseif ($this->image_number == 3) {
                 $this->title = $i18n->__('Closed issues per reproducability level');
             }
             break;
         case 'issues_per_state':
             $this->graphmode = 'piechart';
             $counts = TBGIssuesTable::getTable()->getStateCountByProjectID($this->selected_project->getID());
             if ($this->image_number == 1) {
                 $this->title = $i18n->__('Total number of issues (open / closed)');
             }
             break;
         default:
             throw new Exception(__("unknown key '%key%'", array('%key%' => $this->key)));
     }
     $this->title = html_entity_decode($this->title);
     list($values, $labels) = $this->_calculateImageDetails($counts);
     $this->values = $values;
     $this->labels = $labels;
 }
예제 #25
0
 public function getLast15IssueCountsByProjectID($project_id)
 {
     $retarr = array();
     for ($cc = 15; $cc >= 0; $cc--) {
         $crit = $this->getCriteria();
         $joinedtable = $crit->addJoin(TBGIssuesTable::getTable(), TBGIssuesTable::ID, self::TARGET);
         $crit->addWhere(self::TARGET_TYPE, self::TYPE_ISSUE);
         $crit->addWhere(self::CHANGE_TYPE, array(self::LOG_ISSUE_CREATED, self::LOG_ISSUE_CLOSE), Criteria::DB_IN);
         $crit->addWhere(TBGIssuesTable::PROJECT_ID, $project_id);
         $crit->addWhere(TBGIssuesTable::DELETED, false);
         $crit->addJoin(TBGIssueTypesTable::getTable(), TBGIssueTypesTable::ID, TBGIssuesTable::ISSUE_TYPE, array(), Criteria::DB_LEFT_JOIN, $joinedtable);
         $crit->addWhere(TBGIssueTypesTable::ICON, 'bug_report');
         $crit->addWhere(self::SCOPE, TBGContext::getScope()->getID());
         $ctn = $crit->returnCriterion(self::TIME, NOW - 86400 * ($cc + 1), Criteria::DB_GREATER_THAN_EQUAL);
         $ctn->addWhere(self::TIME, NOW - 86400 * $cc, Criteria::DB_LESS_THAN_EQUAL);
         $crit->addWhere($ctn);
         $crit2 = clone $crit;
         $crit->addWhere(self::CHANGE_TYPE, self::LOG_ISSUE_CLOSE);
         $crit2->addWhere(self::CHANGE_TYPE, self::LOG_ISSUE_CREATED);
         $retarr[0][$cc] = $this->doCount($crit);
         $retarr[1][$cc] = $this->doCount($crit2);
     }
     return $retarr;
 }
예제 #26
0
 public function getTarget()
 {
     if ($this->_target === null) {
         switch ($this->getTargetType()) {
             case self::TYPE_ISSUE:
                 $this->_target = TBGIssuesTable::getTable()->selectById($this->_target_id);
                 break;
             case self::TYPE_ARTICLE:
                 $this->_target = TBGArticlesTable::getTable()->selectById($this->_target_id);
                 break;
             default:
                 $event = TBGEvent::createNew('core', 'TBGComment::getTarget', $this);
                 $event->trigger();
                 $this->_target = $event->getReturnValue();
         }
     }
     return $this->_target;
 }
예제 #27
0
 public function runAddFilter(TBGRequest $request)
 {
     if ($request->getParameter('filter_name') == 'project_id' && count(TBGProject::getAll()) == 0) {
         return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('No projects exist so this filter can not be added')));
     } elseif (in_array($request->getParameter('filter_name'), TBGIssuesTable::getValidSearchFilters()) || TBGCustomDatatype::doesKeyExist($request->getParameter('filter_name'))) {
         return $this->renderJSON(array('failed' => false, 'content' => $this->getComponentHTML('search/filter', array('filter' => $request->getParameter('filter_name'), 'key' => $request->getParameter('key', 0)))));
     } else {
         return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('This is not a valid search field')));
     }
 }
예제 #28
0
 public function componentUploader()
 {
     switch ($this->mode) {
         case 'issue':
             $this->issue = TBGIssuesTable::getTable()->selectById($this->issue_id);
             break;
         case 'article':
             $this->article = TBGWikiArticle::getByName($this->article_name);
             break;
         default:
             // @todo: dispatch a TBGEvent that allows us to retrieve the
             // necessary variables from anyone catching it
             break;
     }
 }
예제 #29
0
 /**
  * Adds an issue to the list of issues "starred" by this user 
  *
  * @param integer $issue_id ID of issue to add
  * @return boolean
  */
 public function addStarredIssue($issue_id)
 {
     $this->_populateStarredIssues();
     if ($this->isLoggedIn() && !$this->isGuest()) {
         if (array_key_exists($issue_id, $this->_starredissues)) {
             return true;
         }
         TBGUserIssuesTable::getTable()->addStarredIssue($this->getID(), $issue_id);
         $issue = TBGIssuesTable::getTable()->selectById($issue_id);
         $this->_starredissues[$issue->getID()] = $issue;
         ksort($this->_starredissues);
         return true;
     }
     return false;
 }
예제 #30
0
 public function runIssueLog(TBGRequest $request)
 {
     try {
         $this->issue = TBGIssuesTable::getTable()->getIssueById((int) $request['issue_id']);
         $this->log_items = $this->issue->getLogEntries();
         if ($this->issue->isDeleted() || !$this->issue->hasAccess()) {
             $this->issue = null;
         }
     } catch (Exception $e) {
         throw $e;
     }
 }