本文整理汇总了PHP中thebuggenie\core\entities\Project::getIncludingAllSubprojectsAsArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::getIncludingAllSubprojectsAsArray方法的具体用法?PHP Project::getIncludingAllSubprojectsAsArray怎么用?PHP Project::getIncludingAllSubprojectsAsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\entities\Project
的用法示例。
在下文中一共展示了Project::getIncludingAllSubprojectsAsArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addToCriteria
/**
*
* @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;
//.........这里部分代码省略.........
示例2: componentFilter
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;
}