php thebuggenie-core-entities-Project类(方法)实例源码

下面列出了php thebuggenie-core-entities-Project 类(方法)源码代码实例,从而了解它的用法。

作者:pkdevbox    项目:thebuggeni   
public function runListProjects(framework\Request $request)
 {
     $projects = entities\Project::getAll();
     $return_array = array();
     foreach ($projects as $project) {
         $return_array[$project->getKey()] = $project->getName();
     }
     $this->projects = $return_array;
 }

作者:nrense    项目:thebuggeni   
/**
  * Pre-execute function
  *
  * @param \thebuggenie\core\framework\Request $request
  */
 public function preExecute(framework\Request $request, $action)
 {
     $this->article = null;
     $this->article_name = $request->getRawParameter('article_name');
     $this->article_id = (int) $request['article_id'];
     $this->special = false;
     if (!is_null($this->article_name) && mb_strpos($this->article_name, ':') !== false) {
         $this->article_name = $this->_getArticleNameDetails($this->article_name);
     } else {
         try {
             if ($project_key = $request['project_key']) {
                 $this->selected_project = \thebuggenie\core\entities\Project::getByKey($project_key);
             } elseif ($project_id = (int) $request['project_id']) {
                 $this->selected_project = \thebuggenie\core\entities\tables\Projects::getTable()->selectById($project_id);
             }
         } catch (\Exception $e) {
         }
     }
     if (!$this->special) {
         if ($this->article_id) {
             $this->article = Articles::getTable()->selectById($this->article_id);
         } elseif ($this->article_name) {
             $this->article = Articles::getTable()->getArticleByName($this->article_name);
         }
         if (!$this->article instanceof Article) {
             $this->article = new Article();
             if ($this->article_name) {
                 $this->article->setName($this->article_name);
             } elseif ($request->hasParameter('parent_article_name')) {
                 $parent_article_name = $request->getRawParameter('parent_article_name');
                 $this->article->setParentArticle(Articles::getTable()->getArticleByName($parent_article_name));
                 $this->_getArticleNameDetails($parent_article_name);
                 if ($this->article->getParentArticle() instanceof Article) {
                     if ($this->article->getParentArticle()->getArticleType() == Article::TYPE_WIKI) {
                         $this->article->setName($this->article->getParentArticle()->getName() . ':');
                     }
                     $this->article->setArticleType($this->article->getParentArticle()->getArticleType());
                 }
             }
             $this->article->setContentSyntax($this->getUser()->getPreferredWikiSyntax(true));
         }
     }
     if ($this->selected_project instanceof \thebuggenie\core\entities\Project) {
         if (!$this->selected_project->hasAccess()) {
             $this->forward403();
         } else {
             framework\Context::setCurrentProject($this->selected_project);
         }
     }
 }

作者:founderi    项目:thebuggeni   
/**
  * Pre-execute function
  *
  * @param framework\Request $request
  * @param string $action
  */
 public function preExecute(framework\Request $request, $action)
 {
     try {
         if ($project_id = $request['project_id']) {
             $this->selected_project = entities\Project::getB2DBTable()->selectById($project_id);
         } elseif ($project_key = $request['project_key']) {
             $this->selected_project = entities\Project::getByKey($project_key);
         }
     } catch (\Exception $e) {
     }
     if (!$this->selected_project instanceof entities\Project) {
         return $this->return404(framework\Context::getI18n()->__('This project does not exist'));
     }
     framework\Context::setCurrentProject($this->selected_project);
     $this->project_key = $this->selected_project->getKey();
 }

作者:RTechSof    项目:thebuggeni   
public function componentArchivedProjects()
 {
     if (!isset($this->target)) {
         $this->projects = entities\Project::getAllRootProjects(true);
         $this->project_count = count($this->projects);
     } elseif ($this->target == 'team') {
         $this->team = entities\Team::getB2DBTable()->selectById($this->id);
         $projects = array();
         foreach (entities\Project::getAllByOwner($this->team) as $project) {
             $projects[$project->getID()] = $project;
         }
         foreach (entities\Project::getAllByLeader($this->team) as $project) {
             $projects[$project->getID()] = $project;
         }
         foreach (entities\Project::getAllByQaResponsible($this->team) as $project) {
             $projects[$project->getID()] = $project;
         }
         foreach ($this->team->getAssociatedProjects() as $project_id => $project) {
             $projects[$project_id] = $project;
         }
         $final_projects = array();
         foreach ($projects as $project) {
             if ($project->isArchived()) {
                 $final_projects[] = $project;
             }
         }
         $this->projects = $final_projects;
     } elseif ($this->target == 'client') {
         $this->client = entities\Client::getB2DBTable()->selectById($this->id);
         $projects = entities\Project::getAllByClientID($this->client->getID());
         $final_projects = array();
         foreach ($projects as $project) {
             if (!$project->isArchived()) {
                 $final_projects[] = $project;
             }
         }
         $this->projects = $final_projects;
     } elseif ($this->target == 'project') {
         $this->parent = entities\Project::getB2DBTable()->selectById($this->id);
         $this->projects = $this->parent->getChildren(true);
     }
     $this->project_count = count($this->projects);
 }

作者:founderi    项目:thebuggeni   
/**
  * Save incoming email account
  *
  * @Route(url="/mailing/:project_key/incoming_account/*", name="save_incoming_account")
  * @param \thebuggenie\core\framework\Request $request
  * @return type
  */
 public function runSaveIncomingAccount(framework\Request $request)
 {
     $project = null;
     if ($project_key = $request['project_key']) {
         try {
             $project = \thebuggenie\core\entities\Project::getByKey($project_key);
         } catch (\Exception $e) {
         }
     }
     if ($project instanceof \thebuggenie\core\entities\Project) {
         try {
             $account_id = $request['account_id'];
             $account = $account_id ? new \thebuggenie\modules\mailing\entities\IncomingEmailAccount($account_id) : new \thebuggenie\modules\mailing\entities\IncomingEmailAccount();
             $account->setIssuetype((int) $request['issuetype']);
             $account->setProject($project);
             $account->setPort((int) $request['port']);
             $account->setName($request['name']);
             $account->setFoldername($request['folder']);
             $account->setKeepEmails($request['keepemail']);
             $account->setServer($request['servername']);
             $account->setUsername($request['username']);
             $account->setPassword($request['password']);
             $account->setSSL((bool) $request['ssl']);
             $account->setIgnoreCertificateValidation((bool) $request['ignore_certificate_validation']);
             $account->setUsePlaintextAuthentication((bool) $request['plaintext_authentication']);
             $account->setServerType((int) $request['account_type']);
             $account->save();
             if (!$account_id) {
                 return $this->renderComponent('mailing/incomingemailaccount', array('project' => $project, 'account' => $account));
             } else {
                 return $this->renderJSON(array('name' => $account->getName()));
             }
         } catch (\Exception $e) {
             $this->getResponse()->setHttpStatus(400);
             return $this->renderJSON(array('error' => $this->getI18n()->__('This is not a valid mailing account')));
         }
     } else {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => $this->getI18n()->__('This is not a valid project')));
     }
 }

作者:thebuggeni    项目:module-ap   
/**
  * The currently selected project in actions where there is one
  *
  * @access protected
  * @property entities\Project $selected_project
  */
 public function preExecute(framework\Request $request, $action)
 {
     try {
         // Default to JSON if nothing is specified.
         $newFormat = $request->getParameter('format', 'json');
         $this->getResponse()->setTemplate(mb_strtolower($action) . '.' . $newFormat . '.php');
         $this->getResponse()->setupResponseContentType($newFormat);
         if ($project_key = $request['project_key']) {
             $this->selected_project = entities\Project::getByKey($project_key);
         } elseif ($project_id = (int) $request['project_id']) {
             $this->selected_project = entities\Project::getB2DBTable()->selectByID($project_id);
         }
         if ($this->selected_project instanceof entities\Project) {
             framework\Context::setCurrentProject($this->selected_project);
         }
         $this->render_detail = !isset($request['nodetail']);
     } catch (\Exception $e) {
         $this->getResponse()->setHttpStatus(500);
         return $this->renderJSON(array('error' => 'An exception occurred: ' . $e));
     }
 }

作者:JonathanR    项目:thebuggeni   
public static function populateBreadcrumbs()
 {
     $childbreadcrumbs = array();
     if (self::$_selected_project instanceof Project) {
         $t = self::$_selected_project;
         $hierarchy_breadcrumbs = array();
         $projects_processed = array();
         while ($t instanceof Project) {
             if (array_key_exists($t->getKey(), $projects_processed)) {
                 // We have a cyclic dependency! Oh no!
                 // If this happens, throw an exception
                 throw new \Exception(self::geti18n()->__('A loop has been found in the project heirarchy. Go to project configuration, and alter the subproject setting for this project so that this project is not a subproject of one which is a subproject of this one.'));
             }
             $projects_processed[$t->getKey()] = $t;
             $itemsubmenulinks = self::getResponse()->getPredefinedBreadcrumbLinks('project_summary', $t);
             if ($t->hasChildren()) {
                 $itemsubmenulinks[] = array('separator' => true);
                 foreach ($t->getChildren() as $child) {
                     if (!$child->hasAccess()) {
                         continue;
                     }
                     $itemsubmenulinks[] = array('url' => self::getRouting()->generate('project_dashboard', array('project_key' => $child->getKey())), 'title' => $child->getName());
                 }
             }
             $hierarchy_breadcrumbs[] = array($t, $itemsubmenulinks);
             if ($t->hasParent()) {
                 $parent = $t->getParent();
                 $t = $t->getParent();
             } else {
                 $t = null;
             }
         }
         if (self::$_selected_project->hasClient()) {
             self::setCurrentClient(self::$_selected_project->getClient());
         }
         if (mb_strtolower(Settings::getSiteHeaderName()) != mb_strtolower(self::$_selected_project->getName()) || self::isClientContext()) {
             self::getResponse()->addBreadcrumb(Settings::getSiteHeaderName(), self::getRouting()->generate('home'), self::getResponse()->getPredefinedBreadcrumbLinks('main_links', self::$_selected_project));
             if (self::isClientContext()) {
                 self::getResponse()->addBreadcrumb(self::getCurrentClient()->getName(), self::getRouting()->generate('client_dashboard', array('client_id' => self::getCurrentClient()->getID())), self::getResponse()->getPredefinedBreadcrumbLinks('client_list'));
             }
         }
         // Add root breadcrumb first, so reverse order
         $hierarchy_breadcrumbs = array_reverse($hierarchy_breadcrumbs);
         foreach ($hierarchy_breadcrumbs as $breadcrumb) {
             $class = null;
             if ($breadcrumb[0]->getKey() == self::getCurrentProject()->getKey()) {
                 $class = 'selected_project';
             }
             self::getResponse()->addBreadcrumb($breadcrumb[0]->getName(), self::getRouting()->generate('project_dashboard', array('project_key' => $breadcrumb[0]->getKey())), $breadcrumb[1], $class);
         }
     } else {
         self::getResponse()->addBreadcrumb(Settings::getSiteHeaderName(), self::getRouting()->generate('home'), self::getResponse()->getPredefinedBreadcrumbLinks('main_links'));
     }
 }

作者:founderi    项目:thebuggeni   
/**
  *
  * @param \b2db\Criteria $crit
  * @param array|\thebuggenie\core\entities\SearchFilter $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']}%";
                 $issue_no = Issue::extractIssueNoFromNumber($this['value']);
                 if ($this['operator'] == '=') {
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion(tables\Issues::TITLE, $searchterm, Criteria::DB_LIKE);
                     }
                     $ctn->addOr(tables\Issues::DESCRIPTION, $searchterm, Criteria::DB_LIKE);
                     $ctn->addOr(tables\Issues::REPRODUCTION_STEPS, $searchterm, Criteria::DB_LIKE);
                     $ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_LIKE);
                     if (is_numeric($issue_no)) {
                         $ctn->addOr(tables\Issues::ISSUE_NO, $issue_no, Criteria::DB_EQUALS);
                     }
                     $ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_LIKE);
                     if (is_numeric($issue_no)) {
                         $ctn->addOr(tables\Issues::ISSUE_NO, $issue_no, Criteria::DB_EQUALS);
                     }
                     // $ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_LIKE);
                 } else {
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion(tables\Issues::TITLE, $searchterm, Criteria::DB_NOT_LIKE);
                     }
                     $ctn->addWhere(tables\Issues::DESCRIPTION, $searchterm, Criteria::DB_NOT_LIKE);
                     $ctn->addWhere(tables\Issues::REPRODUCTION_STEPS, $searchterm, Criteria::DB_NOT_LIKE);
                     $ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_NOT_LIKE);
                     if (is_numeric($issue_no)) {
                         $ctn->addWhere(tables\Issues::ISSUE_NO, $issue_no, Criteria::DB_EQUALS);
                     }
                     $ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_NOT_LIKE);
                     if (is_numeric($issue_no)) {
                         $ctn->addWhere(tables\Issues::ISSUE_NO, $issue_no, Criteria::DB_EQUALS);
                     }
                     // $ctn->addOr(tables\IssueCustomFields::OPTION_VALUE, $searchterm, Criteria::DB_NOT_LIKE);
                 }
                 return $ctn;
             }
         } elseif (in_array($filter_key, self::getValidSearchFilters())) {
             if ($filter_key == 'subprojects') {
                 if (framework\Context::isProjectContext()) {
                     if ($ctn === null) {
                         $ctn = $crit->returnCriterion(tables\Issues::PROJECT_ID, framework\Context::getCurrentProject()->getID());
                     }
                     if ($this->hasValue()) {
                         foreach ($this->getValues() as $value) {
                             switch ($value) {
                                 case 'all':
                                     $subprojects = Project::getIncludingAllSubprojectsAsArray(framework\Context::getCurrentProject());
                                     foreach ($subprojects as $subproject) {
                                         if ($subproject->getID() == framework\Context::getCurrentProject()->getID()) {
                                             continue;
                                         }
                                         $ctn->addOr(tables\Issues::PROJECT_ID, $subproject->getID());
                                     }
                                     break;
                                 case 'none':
                                 case '':
                                     break;
                                 default:
                                     $ctn->addOr(tables\Issues::PROJECT_ID, (int) $value);
                                     break;
                             }
                         }
                     }
                     return $ctn;
                 }
             } elseif (in_array($filter_key, array('build', 'edition', 'component'))) {
                 switch ($filter_key) {
                     case 'component':
                         $tbl = tables\IssueAffectsComponent::getTable();
                         $fk = tables\IssueAffectsComponent::ISSUE;
                         break;
                     case 'edition':
                         $tbl = tables\IssueAffectsEdition::getTable();
                         $fk = tables\IssueAffectsEdition::ISSUE;
                         break;
                     case 'build':
                         $tbl = tables\IssueAffectsBuild::getTable();
                         $fk = tables\IssueAffectsBuild::ISSUE;
                         break;
                 }
                 $crit->addJoin($tbl, $fk, tables\Issues::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;
//.........这里部分代码省略.........

作者:rianori    项目:thebuggeni   
/**
  * Specify whether or not this item is locked / locked to category based on project new issues lock type
  *
  * @param Project $project
  */
 public function setLockedFromProject(Project $project)
 {
     switch ($project->getIssuesLockType()) {
         case Project::ISSUES_LOCK_TYPE_PUBLIC_CATEGORY:
             $this->setLocked(false);
             $this->setLockedCategory(true);
             break;
         case Project::ISSUES_LOCK_TYPE_PUBLIC:
             $this->setLocked(false);
             $this->setLockedCategory(false);
             break;
         case Project::ISSUES_LOCK_TYPE_RESTRICTED:
             $this->setLocked(true);
             $this->setLockedCategory(false);
             break;
     }
 }

作者:RTechSof    项目:thebuggeni   
">
                    <input type="search" name="articlename" placeholder="<?php 
    echo $quicksearch_title;
    ?>
">
                </form>
            </div>
            <?php 
    if (count(\thebuggenie\core\entities\Project::getAll()) > (int) \thebuggenie\core\framework\Context::isProjectContext()) {
        ?>
                <div class="header"><?php 
        echo __('Project wikis');
        ?>
</div>
                <?php 
        foreach (\thebuggenie\core\entities\Project::getAll() as $project) {
            ?>
                    <?php 
            if (!$project->hasAccess() || isset($project_url) && $project->getID() == \thebuggenie\core\framework\Context::getCurrentProject()->getID()) {
                continue;
            }
            ?>
                    <?php 
            if (!$project->hasWikiURL()) {
                ?>
                        <?php 
                echo link_tag(make_url('publish_article', array('article_name' => ucfirst($project->getKey()) . ':MainPage')), $project->getName());
                ?>
                    <?php 
            } else {
                ?>

作者:RTechSof    项目:thebuggeni   
public function getIncomingEmailAccountsForProject(Project $project)
 {
     return IncomingEmailAccount::getAllByProjectID($project->getID());
 }

作者:underblaz    项目:thebuggenie-4.1.   
/**
  * Return if the user can assign scrum user stories
  *
  * @param \thebuggenie\core\entities\Project $project
  *
  * @return boolean
  */
 public function canAssignScrumUserStories(\thebuggenie\core\entities\Project $project)
 {
     if ($project->isArchived()) {
         return false;
     }
     if ($this->canSaveConfiguration(framework\Settings::CONFIGURATION_SECTION_PROJECTS)) {
         return true;
     }
     if ($project->getOwner() instanceof User && $project->getOwner()->getID() == $this->getID()) {
         return true;
     }
     $retval = $this->hasPermission('canassignscrumuserstoriestosprints', $project->getID());
     $retval = $retval !== null ? $retval : $this->hasPermission('candoscrumplanning', $project->getID());
     $retval = $retval !== null ? $retval : $this->hasPermission('canassignscrumuserstoriestosprints', 0);
     $retval = $retval !== null ? $retval : $this->hasPermission('candoscrumplanning', 0);
     return (bool) ($retval !== null) ? $retval : false;
 }

作者:RTechSof    项目:thebuggeni   
public function hasProjectsAvailable()
 {
     return $this->getMaxProjects() ? Project::getProjectsCount() < $this->getMaxProjects() : true;
 }

作者:pkdevbox    项目:thebuggeni   
/**
  * Return the associated project if any
  * 
  * @return Project
  */
 public function getProject()
 {
     return $this->getItemdata() ? \thebuggenie\core\entities\Project::getB2DBTable()->selectById((int) $this->getItemdata()) : null;
 }

作者:nrense    项目:thebuggeni   
public function runDeleteClient(framework\Request $request)
 {
     try {
         try {
             $client = entities\Client::getB2DBTable()->selectById($request['client_id']);
         } catch (\Exception $e) {
         }
         if (!$client instanceof entities\Client) {
             throw new \Exception($this->getI18n()->__("You cannot delete this client"));
         }
         if (entities\Project::getAllByClientID($client->getID()) !== null) {
             foreach (entities\Project::getAllByClientID($client->getID()) as $project) {
                 $project->setClient(null);
                 $project->save();
             }
         }
         $client->delete();
         return $this->renderJSON(array('success' => true, 'message' => $this->getI18n()->__('The client was deleted')));
     } catch (\Exception $e) {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => $e->getMessage()));
     }
 }

作者:founderi    项目:thebuggeni   
public function componentFilter()
 {
     $pkey = framework\Context::isProjectContext() ? framework\Context::getCurrentProject()->getID() : null;
     $i18n = framework\Context::getI18n();
     $this->selected_operator = isset($this->selected_operator) ? $this->selected_operator : '=';
     $this->key = isset($this->key) ? $this->key : null;
     $this->filter = isset($this->filter) ? $this->filter : null;
     if (in_array($this->filter, array('posted', 'last_updated'))) {
         $this->selected_value = $this->selected_value ? $this->selected_value : NOW;
     } else {
         $this->selected_value = isset($this->selected_value) ? $this->selected_value : 0;
     }
     $this->filter_info = isset($this->filter_info) ? $this->filter_info : null;
     $filters = array();
     $filters['status'] = array('description' => $i18n->__('Status'), 'options' => entities\Status::getAll());
     $filters['category'] = array('description' => $i18n->__('Category'), 'options' => entities\Category::getAll());
     $filters['priority'] = array('description' => $i18n->__('Priority'), 'options' => entities\Priority::getAll());
     $filters['severity'] = array('description' => $i18n->__('Severity'), 'options' => entities\Severity::getAll());
     $filters['reproducability'] = array('description' => $i18n->__('Reproducability'), 'options' => entities\Reproducability::getAll());
     $filters['resolution'] = array('description' => $i18n->__('Resolution'), 'options' => entities\Resolution::getAll());
     $filters['issuetype'] = array('description' => $i18n->__('Issue type'), 'options' => entities\Issuetype::getAll());
     $filters['component'] = array('description' => $i18n->__('Component'), 'options' => array());
     $filters['build'] = array('description' => $i18n->__('Build'), 'options' => array());
     $filters['edition'] = array('description' => $i18n->__('Edition'), 'options' => array());
     $filters['milestone'] = array('description' => $i18n->__('Milestone'), 'options' => array());
     if (framework\Context::isProjectContext()) {
         $filters['subprojects'] = array('description' => $i18n->__('Include subproject(s)'), 'options' => array('all' => $this->getI18n()->__('All subprojects'), 'none' => $this->getI18n()->__("Don't include subprojects (default, unless specified otherwise)")));
         $projects = entities\Project::getIncludingAllSubprojectsAsArray(framework\Context::getCurrentProject());
         foreach ($projects as $project) {
             if ($project->getID() == framework\Context::getCurrentProject()->getID()) {
                 continue;
             }
             $filters['subprojects']['options'][$project->getID()] = "{$project->getName()} ({$project->getKey()})";
         }
     } else {
         $projects = array();
         foreach (entities\Project::getAllRootProjects() as $project) {
             entities\Project::getSubprojectsArray($project, $projects);
         }
     }
     if (count($projects) > 0) {
         foreach ($projects as $project) {
             foreach ($project->getComponents() as $component) {
                 $filters['component']['options'][] = $component;
             }
             foreach ($project->getBuilds() as $build) {
                 $filters['build']['options'][] = $build;
             }
             foreach ($project->getEditions() as $edition) {
                 $filters['edition']['options'][] = $edition;
             }
             foreach ($project->getMilestones() as $milestone) {
                 $filters['milestone']['options'][] = $milestone;
             }
         }
     }
     $filters['posted_by'] = array('description' => $i18n->__('Posted by'));
     $filters['assignee_user'] = array('description' => $i18n->__('Assigned to user'));
     $filters['assignee_team'] = array('description' => $i18n->__('Assigned to team'));
     $filters['owner_user'] = array('description' => $i18n->__('Owned by user'));
     $filters['owner_team'] = array('description' => $i18n->__('Owned by team'));
     $filters['posted'] = array('description' => $i18n->__('Date reported'));
     $filters['last_updated'] = array('description' => $i18n->__('Date last updated'));
     $this->filters = $filters;
 }

作者:pkdevbox    项目:thebuggeni   
public function componentProjectInfo()
 {
     $this->valid_subproject_targets = entities\Project::getValidSubprojects($this->project);
 }

作者:pkdevbox    项目:thebuggeni   
echo __('Yes, behave as tracker for a single project');
?>
</option>
                <option value=0<?php 
if (!\thebuggenie\core\framework\Settings::isSingleProjectTracker()) {
    ?>
 selected<?php 
}
?>
><?php 
echo __('No, use regular index page');
?>
</option>
            </select>
            <?php 
echo config_explanation(__('In single project tracker mode, The Bug Genie will display the homepage for the first project as the main page instead of the regular index page') . "<br>" . (count(\thebuggenie\core\entities\Project::getAll()) > 1 ? '<br><b class="more_than_one_project_warning">' . __('More than one project exists. When in "single project" mode, accessing other projects than the first will become harder.') . '</b>' : ''));
?>
        </td>
    </tr>
    <tr>
        <td><label for="showprojectsoverview"><?php 
echo __('Show project list on frontpage');
?>
</label></td>
        <td>
            <select name="<?php 
echo \thebuggenie\core\framework\Settings::SETTING_SHOW_PROJECTS_OVERVIEW;
?>
" id="showprojectsoverview" style="width: 300px;"<?php 
if ($access_level != \thebuggenie\core\framework\Settings::ACCESS_FULL) {
    ?>

作者:nrense    项目:thebuggeni   
/**
  * Partial backdrop loader
  *
  * @Route(name="get_partial_for_backdrop", url="/get/partials/:key/*")
  * @AnonymousRoute
  *
  * @param framework\Request $request
  *
  * @return bool
  */
 public function runGetBackdropPartial(framework\Request $request)
 {
     if (!$request->isAjaxCall()) {
         return $this->return404($this->getI18n()->__('You need to enable javascript for The Bug Genie to work properly'));
     }
     try {
         $template_name = null;
         if ($request->hasParameter('issue_id')) {
             $issue = entities\Issue::getB2DBTable()->selectById($request['issue_id']);
             $options = array('issue' => $issue);
         } else {
             $options = array();
         }
         switch ($request['key']) {
             case 'usercard':
                 $template_name = 'main/usercard';
                 if ($user_id = $request['user_id']) {
                     $user = entities\User::getB2DBTable()->selectById($user_id);
                     $options['user'] = $user;
                 }
                 break;
             case 'login':
                 $template_name = 'main/loginpopup';
                 $options = $request->getParameters();
                 $options['content'] = $this->getComponentHTML('login', array('section' => $request->getParameter('section', 'login')));
                 $options['mandatory'] = false;
                 break;
             case 'uploader':
                 $template_name = 'main/uploader';
                 $options = $request->getParameters();
                 $options['uploader'] = $request['uploader'] == 'dynamic' ? 'dynamic' : 'standard';
                 break;
             case 'attachlink':
                 $template_name = 'main/attachlink';
                 break;
             case 'openid':
                 $template_name = 'main/openid';
                 break;
             case 'notifications':
                 $template_name = 'main/notifications';
                 $options['first_notification_id'] = $request['first_notification_id'];
                 $options['last_notification_id'] = $request['last_notification_id'];
                 break;
             case 'workflow_transition':
                 $transition = entities\WorkflowTransition::getB2DBTable()->selectById($request['transition_id']);
                 $template_name = $transition->getTemplate();
                 $options['transition'] = $transition;
                 if ($request->hasParameter('issue_ids')) {
                     $options['issues'] = array();
                     foreach ($request['issue_ids'] as $issue_id) {
                         $options['issues'][$issue_id] = new entities\Issue($issue_id);
                     }
                 } else {
                     $options['issue'] = new entities\Issue($request['issue_id']);
                 }
                 $options['show'] = true;
                 $options['interactive'] = true;
                 $options['project'] = $this->selected_project;
                 break;
             case 'reportissue':
                 $this->_loadSelectedProjectAndIssueTypeFromRequestForReportIssueAction($request);
                 if ($this->selected_project instanceof entities\Project && !$this->selected_project->isLocked() && $this->getUser()->canReportIssues($this->selected_project)) {
                     $template_name = 'main/reportissuecontainer';
                     $options['selected_project'] = $this->selected_project;
                     $options['selected_issuetype'] = $this->selected_issuetype;
                     $options['locked_issuetype'] = $this->locked_issuetype;
                     $options['selected_milestone'] = $this->_getMilestoneFromRequest($request);
                     $options['parent_issue'] = $this->_getParentIssueFromRequest($request);
                     $options['board'] = $this->_getBoardFromRequest($request);
                     $options['selected_build'] = $this->_getBuildFromRequest($request);
                     $options['issuetypes'] = $this->issuetypes;
                     $options['errors'] = array();
                 } else {
                     throw new \Exception($this->getI18n()->__('You are not allowed to do this'));
                 }
                 break;
             case 'move_issue':
                 $template_name = 'main/moveissue';
                 $options['multi'] = (bool) $request->getParameter('multi', false);
                 break;
             case 'issue_permissions':
                 $template_name = 'main/issuepermissions';
                 break;
             case 'issue_subscribers':
                 $template_name = 'main/issuesubscribers';
                 break;
             case 'issue_spenttimes':
                 $template_name = 'main/issuespenttimes';
                 $options['initial_view'] = $request->getParameter('initial_view', 'list');
                 break;
//.........这里部分代码省略.........

作者:RTechSof    项目:thebuggeni   
/**
  * Move issues from one step to another for a given issue type and conversions
  * @param \thebuggenie\core\entities\Project $project
  * @param \thebuggenie\core\entities\Issuetype $type
  * @param array $conversions
  *
  * $conversions should be an array containing arrays:
  * array (
  *         array(oldstep, newstep)
  *         ...
  * )
  */
 public function convertIssueStepByIssuetype(\thebuggenie\core\entities\Project $project, \thebuggenie\core\entities\Issuetype $type, array $conversions)
 {
     foreach ($conversions as $conversion) {
         $crit = $this->getCriteria();
         $crit->addWhere(self::PROJECT_ID, $project->getID());
         $crit->addWhere(self::ISSUE_TYPE, $type->getID());
         $crit->addWhere(self::WORKFLOW_STEP_ID, $conversion[0]);
         $crit->addUpdate(self::WORKFLOW_STEP_ID, $conversion[1]);
         $this->doUpdate($crit);
     }
 }


问题


面经


文章

微信
公众号

扫码关注公众号