本文整理汇总了PHP中thebuggenie\core\entities\Status::getB2DBTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Status::getB2DBTable方法的具体用法?PHP Status::getB2DBTable怎么用?PHP Status::getB2DBTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\entities\Status
的用法示例。
在下文中一共展示了Status::getB2DBTable方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: perform
public function perform(\thebuggenie\core\entities\Issue $issue, $request = null)
{
switch ($this->_action_type) {
case self::ACTION_ASSIGN_ISSUE_SELF:
$issue->setAssignee(framework\Context::getUser());
break;
case self::ACTION_SET_STATUS:
if ($this->getTargetValue()) {
$issue->setStatus(Status::getB2DBTable()->selectById((int) $this->getTargetValue()));
} else {
$issue->setStatus($request['status_id']);
}
break;
case self::ACTION_CLEAR_MILESTONE:
$issue->setMilestone(null);
break;
case self::ACTION_SET_MILESTONE:
if ($this->getTargetValue()) {
$issue->setMilestone(Milestone::getB2DBTable()->selectById((int) $this->getTargetValue()));
} else {
$issue->setMilestone($request['milestone_id']);
}
break;
case self::ACTION_CLEAR_PRIORITY:
$issue->setPriority(null);
break;
case self::ACTION_SET_PRIORITY:
if ($this->getTargetValue()) {
$issue->setPriority(Priority::getB2DBTable()->selectById((int) $this->getTargetValue()));
} else {
$issue->setPriority($request['priority_id']);
}
break;
case self::ACTION_CLEAR_PERCENT:
$issue->setPercentCompleted(0);
break;
case self::ACTION_SET_PERCENT:
if ($this->getTargetValue()) {
$issue->setPercentCompleted((int) $this->getTargetValue());
} else {
$issue->setPercentCompleted((int) $request['percent_complete_id']);
}
break;
case self::ACTION_CLEAR_DUPLICATE:
$issue->setDuplicateOf(null);
break;
case self::ACTION_SET_DUPLICATE:
$issue->setDuplicateOf($request['duplicate_issue_id']);
break;
case self::ACTION_CLEAR_RESOLUTION:
$issue->setResolution(null);
break;
case self::ACTION_SET_RESOLUTION:
if ($this->getTargetValue()) {
$issue->setResolution(Resolution::getB2DBTable()->selectById((int) $this->getTargetValue()));
} else {
$issue->setResolution($request['resolution_id']);
}
break;
case self::ACTION_CLEAR_REPRODUCABILITY:
$issue->setReproducability(null);
break;
case self::ACTION_SET_REPRODUCABILITY:
if ($this->getTargetValue()) {
$issue->setReproducability(Reproducability::getB2DBTable()->selectById((int) $this->getTargetValue()));
} else {
$issue->setReproducability($request['reproducability_id']);
}
break;
case self::ACTION_CLEAR_ASSIGNEE:
$issue->clearAssignee();
break;
case self::ACTION_ASSIGN_ISSUE:
if ($this->getTargetValue()) {
$target_details = explode('_', $this->_target_value);
if ($target_details[0] == 'user') {
$assignee = \thebuggenie\core\entities\User::getB2DBTable()->selectById((int) $target_details[1]);
} else {
$assignee = Team::getB2DBTable()->selectById((int) $target_details[1]);
}
$issue->setAssignee($assignee);
} else {
$assignee = null;
switch ($request['assignee_type']) {
case 'user':
$assignee = \thebuggenie\core\entities\User::getB2DBTable()->selectById((int) $request['assignee_id']);
break;
case 'team':
$assignee = Team::getB2DBTable()->selectById((int) $request['assignee_id']);
break;
}
if ((bool) $request->getParameter('assignee_teamup', false) && $assignee instanceof \thebuggenie\core\entities\User && $assignee->getID() != framework\Context::getUser()->getID()) {
$team = new \thebuggenie\core\entities\Team();
$team->setName($assignee->getBuddyname() . ' & ' . framework\Context::getUser()->getBuddyname());
$team->setOndemand(true);
$team->save();
$team->addMember($assignee);
$team->addMember(framework\Context::getUser());
$assignee = $team;
}
//.........这里部分代码省略.........
示例2: array
case \thebuggenie\core\entities\WorkflowTransitionAction::ACTION_ASSIGN_ISSUE:
case \thebuggenie\core\entities\WorkflowTransitionAction::CUSTOMFIELD_SET_PREFIX . $action->getCustomActionType():
?>
<td id="workflowtransitionaction_<?php
echo $action->getID();
?>
_description" style="padding: 2px;">
<?php
if ($action->hasValidTarget()) {
?>
<?php
if ($action->getActionType() == \thebuggenie\core\entities\WorkflowTransitionAction::ACTION_SET_STATUS) {
?>
<?php
$target = $action->getTargetValue() ? \thebuggenie\core\entities\Status::getB2DBTable()->selectById((int) $action->getTargetValue()) : '';
if ($target instanceof \thebuggenie\core\entities\Status) {
echo __('Set status to %status', array('%status' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;"><span class="status_badge" style="background-color: ' . $target->getColor() . '; color: ' . $target->getTextColor() . ';">' . $target->getName() . '</span></span>'));
} else {
echo __('Set status to %status', array('%status' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;">' . __('Status provided by user') . '</span>'));
}
?>
<?php
} elseif ($action->getActionType() == \thebuggenie\core\entities\WorkflowTransitionAction::ACTION_SET_PRIORITY) {
?>
<?php
echo __('Set priority to %priority', array('%priority' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;">' . ($action->getTargetValue() ? \thebuggenie\core\entities\Priority::getB2DBTable()->selectById((int) $action->getTargetValue())->getName() : __('Priority provided by user')) . '</span>'));
?>
<?php
} elseif ($action->getActionType() == \thebuggenie\core\entities\WorkflowTransitionAction::ACTION_SET_PERCENT) {
?>
示例3: catch
}
} catch (\Exception $e) {
}
try {
switch ($customdatatype->getType()) {
case \thebuggenie\core\entities\CustomDatatype::EDITIONS_CHOICE:
$new_object = \thebuggenie\core\entities\Edition::getB2DBTable()->selectById($new_value);
break;
case \thebuggenie\core\entities\CustomDatatype::COMPONENTS_CHOICE:
$new_object = \thebuggenie\core\entities\Component::getB2DBTable()->selectById($new_value);
break;
case \thebuggenie\core\entities\CustomDatatype::RELEASES_CHOICE:
$new_object = \thebuggenie\core\entities\Build::getB2DBTable()->selectById($new_value);
break;
case \thebuggenie\core\entities\CustomDatatype::STATUS_CHOICE:
$new_object = \thebuggenie\core\entities\Status::getB2DBTable()->selectById($new_value);
break;
}
} catch (\Exception $e) {
}
$old_value = is_object($old_object) ? $old_object->getName() : \thebuggenie\core\framework\Context::getI18n()->__('Unknown');
$new_value = is_object($new_object) ? $new_object->getName() : \thebuggenie\core\framework\Context::getI18n()->__('Unknown');
break;
default:
$old_item = null;
$new_item = null;
try {
$old_item = $old_value ? new \thebuggenie\core\entities\CustomDatatypeOption($old_value) : null;
} catch (\Exception $e) {
}
try {
示例4: _processChanges
protected function _processChanges()
{
$related_issues_to_save = array();
$changed_properties = $this->_getChangedProperties();
if (count($changed_properties)) {
$is_saved_estimated = false;
$is_saved_spent = false;
$is_saved_assignee = false;
$is_saved_owner = false;
foreach ($changed_properties as $property => $value) {
$compare_value = is_object($this->{$property}) ? $this->{$property}->getID() : $this->{$property};
$original_value = $value['original_value'];
if ($original_value != $compare_value) {
switch ($property) {
case '_title':
$this->addLogEntry(tables\Log::LOG_ISSUE_UPDATE_TITLE, framework\Context::getI18n()->__("Title updated"), $original_value, $compare_value);
break;
case '_shortname':
$this->addLogEntry(tables\Log::LOG_ISSUE_UPDATE_SHORTNAME, framework\Context::getI18n()->__("Issue label updated"), $original_value, $compare_value);
break;
case '_description':
$this->addLogEntry(tables\Log::LOG_ISSUE_UPDATE_DESCRIPTION, framework\Context::getI18n()->__("Description updated"), $original_value, $compare_value);
break;
case '_reproduction_steps':
$this->addLogEntry(tables\Log::LOG_ISSUE_UPDATE_REPRODUCTIONSTEPS, framework\Context::getI18n()->__("Reproduction steps updated"), $original_value, $compare_value);
break;
case '_category':
if ($original_value != 0) {
$old_name = ($old_item = \thebuggenie\core\entities\Category::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Not determined');
} else {
$old_name = framework\Context::getI18n()->__('Not determined');
}
$new_name = $this->getCategory() instanceof Datatype ? $this->getCategory()->getName() : framework\Context::getI18n()->__('Not determined');
$this->addLogEntry(tables\Log::LOG_ISSUE_CATEGORY, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value);
break;
case '_pain_bug_type':
if ($original_value != 0) {
$old_name = ($old_item = self::getPainTypesOrLabel('pain_bug_type', $original_value)) ? $old_item : framework\Context::getI18n()->__('Not determined');
} else {
$old_name = framework\Context::getI18n()->__('Not determined');
}
$new_name = ($new_item = self::getPainTypesOrLabel('pain_bug_type', $value['current_value'])) ? $new_item : framework\Context::getI18n()->__('Not determined');
$this->addLogEntry(tables\Log::LOG_ISSUE_PAIN_BUG_TYPE, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value);
break;
case '_pain_effect':
if ($original_value != 0) {
$old_name = ($old_item = self::getPainTypesOrLabel('pain_effect', $original_value)) ? $old_item : framework\Context::getI18n()->__('Not determined');
} else {
$old_name = framework\Context::getI18n()->__('Not determined');
}
$new_name = ($new_item = self::getPainTypesOrLabel('pain_effect', $value['current_value'])) ? $new_item : framework\Context::getI18n()->__('Not determined');
$this->addLogEntry(tables\Log::LOG_ISSUE_PAIN_EFFECT, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value);
break;
case '_pain_likelihood':
if ($original_value != 0) {
$old_name = ($old_item = self::getPainTypesOrLabel('pain_likelihood', $original_value)) ? $old_item : framework\Context::getI18n()->__('Not determined');
} else {
$old_name = framework\Context::getI18n()->__('Not determined');
}
$new_name = ($new_item = self::getPainTypesOrLabel('pain_likelihood', $value['current_value'])) ? $new_item : framework\Context::getI18n()->__('Not determined');
$this->addLogEntry(tables\Log::LOG_ISSUE_PAIN_LIKELIHOOD, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value);
break;
case '_user_pain':
$this->addLogEntry(tables\Log::LOG_ISSUE_PAIN_CALCULATED, $original_value . ' ⇒ ' . $value['current_value']);
break;
case '_status':
if ($original_value != 0) {
$old_name = ($old_item = \thebuggenie\core\entities\Status::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Unknown');
} else {
$old_name = framework\Context::getI18n()->__('Not determined');
}
$new_name = $this->getStatus() instanceof Datatype ? $this->getStatus()->getName() : framework\Context::getI18n()->__('Not determined');
$this->addLogEntry(tables\Log::LOG_ISSUE_STATUS, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value);
break;
case '_reproducability':
if ($original_value != 0) {
$old_name = ($old_item = \thebuggenie\core\entities\Reproducability::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Unknown');
} else {
$old_name = framework\Context::getI18n()->__('Not determined');
}
$new_name = $this->getReproducability() instanceof Datatype ? $this->getReproducability()->getName() : framework\Context::getI18n()->__('Not determined');
$this->addLogEntry(tables\Log::LOG_ISSUE_REPRODUCABILITY, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value);
break;
case '_priority':
if ($original_value != 0) {
$old_name = ($old_item = \thebuggenie\core\entities\Priority::getB2DBTable()->selectById($original_value)) ? $old_item->getName() : framework\Context::getI18n()->__('Unknown');
} else {
$old_name = framework\Context::getI18n()->__('Not determined');
}
$new_name = $this->getPriority() instanceof Datatype ? $this->getPriority()->getName() : framework\Context::getI18n()->__('Not determined');
$this->addLogEntry(tables\Log::LOG_ISSUE_PRIORITY, $old_name . ' ⇒ ' . $new_name, $original_value, $compare_value);
break;
case '_assignee_team':
case '_assignee_user':
if (!$is_saved_assignee) {
$new_name = $this->getAssignee() instanceof \thebuggenie\core\entities\common\Identifiable ? $this->getAssignee()->getName() : framework\Context::getI18n()->__('Not assigned');
if ($this->getAssignee() instanceof \thebuggenie\core\entities\User) {
$this->startWorkingOnIssue($this->getAssignee());
}
$this->addLogEntry(tables\Log::LOG_ISSUE_ASSIGNED, $new_name);
//.........这里部分代码省略.........
示例5: _calculateImageDetails
protected function _calculateImageDetails($counts)
{
$i18n = framework\Context::getI18n();
$labels = array();
$values = array();
$colors = array();
foreach ($counts as $item_id => $details) {
if ($this->image_number == 1) {
$value = $details['open'] + $details['closed'];
}
if ($this->image_number == 2) {
$value = $details['open'];
}
if ($this->image_number == 3) {
$value = $details['closed'];
}
if (isset($value) && $value > 0) {
if ($item_id != 0 || $this->key == 'issues_per_state') {
switch ($this->key) {
case 'issues_per_status':
$item = entities\Status::getB2DBTable()->selectById($item_id);
break;
case 'issues_per_priority':
$item = entities\Priority::getB2DBTable()->selectById($item_id);
break;
case 'issues_per_category':
$item = entities\Category::getB2DBTable()->selectById($item_id);
break;
case 'issues_per_resolution':
$item = entities\Resolution::getB2DBTable()->selectById($item_id);
break;
case 'issues_per_reproducability':
$item = entities\Reproducability::getB2DBTable()->selectById($item_id);
break;
case 'issues_per_state':
$item = $item_id == entities\Issue::STATE_OPEN ? $i18n->__('Open', array(), true) : $i18n->__('Closed', array(), true);
break;
default:
$item = null;
}
if ($this->key != 'issues_per_state') {
$labels[] = $item instanceof entities\Datatype ? html_entity_decode($item->getName()) : $i18n->__('Unknown', array(), true);
framework\Context::loadLibrary('common');
if ($item instanceof entities\common\Colorizable) {
$colors[] = tbg_hex_to_rgb($item->getColor());
}
} else {
$labels[] = $item;
}
} else {
$labels[] = $i18n->__('Not determined', array(), true);
}
$values[] = $value;
}
}
return array($values, $labels, $colors);
}
示例6: runStatusAffected
public function runStatusAffected(framework\Request $request)
{
framework\Context::loadLibrary('ui');
try {
$issue = entities\Issue::getB2DBTable()->selectById($request['issue_id']);
$status = entities\Status::getB2DBTable()->selectById($request['status_id']);
if (!$issue->canEditIssue()) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('You are not allowed to do this')));
}
switch ($request['affected_type']) {
case 'edition':
if (!$issue->getProject()->isEditionsEnabled()) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('Editions are disabled')));
}
$editions = $issue->getEditions();
$edition = $editions[$request['affected_id']];
$issue->setAffectedEditionStatus($edition['edition'], $status);
break;
case 'component':
if (!$issue->getProject()->isComponentsEnabled()) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('Components are disabled')));
}
$components = $issue->getComponents();
$component = $components[$request['affected_id']];
$issue->setAffectedcomponentStatus($component['component'], $status);
break;
case 'build':
if (!$issue->getProject()->isBuildsEnabled()) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('Releases are disabled')));
}
$builds = $issue->getBuilds();
$build = $builds[$request['affected_id']];
$issue->setAffectedbuildStatus($build['build'], $status);
break;
default:
throw new \Exception('Internal error');
}
return $this->renderJSON(array('colour' => $status->getColor(), 'name' => $status->getName()));
} catch (\Exception $e) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => framework\Context::getI18n()->__('An internal error has occured')));
}
}
示例7: __
case \thebuggenie\core\entities\WorkflowTransitionAction::ACTION_ASSIGN_ISSUE:
case \thebuggenie\core\entities\WorkflowTransitionAction::CUSTOMFIELD_SET_PREFIX . $action->getCustomActionType():
?>
<td id="workflowtransitionaction_<?php
echo $action->getID();
?>
_description" style="padding: 2px;">
<?php
if ($action->hasValidTarget()) {
?>
<?php
if ($action->getActionType() == \thebuggenie\core\entities\WorkflowTransitionAction::ACTION_SET_STATUS) {
?>
<?php
echo __('Set status to %status', array('%status' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;">' . ($action->getTargetValue() ? \thebuggenie\core\entities\Status::getB2DBTable()->selectById((int) $action->getTargetValue())->getName() : __('Status provided by user')) . '</span>'));
?>
<?php
} elseif ($action->getActionType() == \thebuggenie\core\entities\WorkflowTransitionAction::ACTION_SET_PRIORITY) {
?>
<?php
echo __('Set priority to %priority', array('%priority' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;">' . ($action->getTargetValue() ? \thebuggenie\core\entities\Priority::getB2DBTable()->selectById((int) $action->getTargetValue())->getName() : __('Priority provided by user')) . '</span>'));
?>
<?php
} elseif ($action->getActionType() == \thebuggenie\core\entities\WorkflowTransitionAction::ACTION_SET_PERCENT) {
?>
<?php
echo __('Set percent completed to %percentcompleted', array('%percentcompleted' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;">' . ($action->getTargetValue() ? (int) $action->getTargetValue() : __('Percentage provided by user')) . '</span>'));
?>
<?php
} elseif ($action->getActionType() == \thebuggenie\core\entities\WorkflowTransitionAction::ACTION_SET_RESOLUTION) {
示例8: getLinkedStatus
/**
* Return this steps linked status if any
*
* @return \thebuggenie\core\entities\Status
*/
public function getLinkedStatus()
{
if (is_numeric($this->_status_id)) {
try {
$this->_status_id = \thebuggenie\core\entities\Status::getB2DBTable()->selectById($this->_status_id);
} catch (\Exception $e) {
$this->_status_id = null;
}
}
return $this->_status_id;
}
示例9: runDoImportCSV
public function runDoImportCSV(framework\Request $request)
{
try {
if ($request['csv_data'] == '') {
throw new \Exception($this->getI18n()->__('No data supplied to import'));
}
$csv = str_replace("\r\n", "\n", $request['csv_data']);
$csv = html_entity_decode($csv);
$headerrow = null;
$data = array();
$errors = array();
// Parse CSV
$handle = fopen("php://memory", 'r+');
fputs($handle, $csv);
rewind($handle);
$i = 0;
while (($row = fgetcsv($handle, 1000)) !== false) {
if (!$headerrow) {
$headerrow = $row;
} else {
if (count($headerrow) == count($row)) {
$data[] = array_combine($headerrow, $row);
} else {
$errors[] = $this->getI18n()->__('Row %row does not have the same number of elements as the header row', array('%row' => $i));
}
}
$i++;
}
fclose($handle);
if (empty($data)) {
throw new \Exception($this->getI18n()->__('Insufficient data to import'));
}
// Verify required columns are present based on type
$requiredcols = array(self::CSV_TYPE_CLIENTS => array(self::CSV_CLIENT_NAME), self::CSV_TYPE_PROJECTS => array(self::CSV_PROJECT_NAME), self::CSV_TYPE_ISSUES => array(self::CSV_ISSUE_TITLE, self::CSV_ISSUE_PROJECT, self::CSV_ISSUE_ISSUE_TYPE));
if (!isset($requiredcols[$request['type']])) {
throw new \Exception('Sorry, this type is unimplemented');
}
foreach ($requiredcols[$request['type']] as $col) {
if (!in_array($col, $headerrow)) {
$errors[] = $this->getI18n()->__('Required column \'%col\' not found in header row', array('%col' => $col));
}
}
// Check if rows are long enough and fields are not empty
for ($i = 0; $i != count($data); $i++) {
$activerow = $data[$i];
// Check if fields are empty
foreach ($activerow as $col => $val) {
if (strlen($val) == 0) {
$errors[] = $this->getI18n()->__('Row %row column %col has no value', array('%col' => $col, '%row' => $i + 1));
}
}
}
if (count($errors) == 0) {
// Check if fields are valid
switch ($request['type']) {
case self::CSV_TYPE_PROJECTS:
for ($i = 0; $i != count($data); $i++) {
$activerow = $data[$i];
// Check if project exists
$key = str_replace(' ', '', $activerow[self::CSV_PROJECT_NAME]);
$key = mb_strtolower($key);
$tmp = entities\Project::getByKey($key);
if ($tmp !== null) {
$errors[] = $this->getI18n()->__('Row %row: A project with this name already exists', array('%row' => $i + 1));
}
// First off are booleans
$boolitems = array(self::CSV_PROJECT_SCRUM, self::CSV_PROJECT_ALLOW_REPORTING, self::CSV_PROJECT_AUTOASSIGN, self::CSV_PROJECT_FREELANCE, self::CSV_PROJECT_EN_BUILDS, self::CSV_PROJECT_EN_COMPS, self::CSV_PROJECT_EN_EDITIONS, self::CSV_PROJECT_SHOW_SUMMARY);
foreach ($boolitems as $boolitem) {
if (array_key_exists($boolitem, $activerow) && isset($activerow[$boolitem]) && $activerow[$boolitem] != 1 && $activerow[$boolitem] != 0) {
$errors[] = $this->getI18n()->__('Row %row column %col: invalid value (must be 1/0)', array('%col' => $boolitem, '%row' => $i + 1));
}
}
// Now identifiables
$identifiableitems = array(array(self::CSV_PROJECT_QA, self::CSV_PROJECT_QA_TYPE), array(self::CSV_PROJECT_LEAD, self::CSV_PROJECT_LEAD_TYPE), array(self::CSV_PROJECT_OWNER, self::CSV_PROJECT_OWNER_TYPE));
foreach ($identifiableitems as $identifiableitem) {
if (!array_key_exists($identifiableitem[1], $activerow) && array_key_exists($identifiableitem[0], $activerow) || array_key_exists($identifiableitem[1], $activerow) && !array_key_exists($identifiableitem[0], $activerow)) {
$errors[] = $this->getI18n()->__('Row %row: Both the type and item ID must be supplied for owner/lead/qa fields', array('%row' => $i + 1));
continue;
}
if (array_key_exists($identifiableitem[1], $activerow) && isset($activerow[$identifiableitem[1]]) !== null && $activerow[$identifiableitem[1]] != self::CSV_IDENTIFIER_TYPE_USER && $activerow[$identifiableitem[1]] != self::CSV_IDENTIFIER_TYPE_TEAM) {
$errors[] = $this->getI18n()->__('Row %row column %col: invalid value (must be 1 for a user or 2 for a team)', array('%col' => $identifiableitem[1], '%row' => $i + 1));
}
if (array_key_exists($identifiableitem[0], $activerow) && isset($activerow[$identifiableitem[0]]) && !is_numeric($activerow[$identifiableitem[0]])) {
$errors[] = $this->getI18n()->__('Row %row column %col: invalid value (must be a number)', array('%col' => $identifiableitem[0], '%row' => $i + 1));
} elseif (array_key_exists($identifiableitem[0], $activerow) && isset($activerow[$identifiableitem[0]]) && is_numeric($activerow[$identifiableitem[0]])) {
// check if they exist
switch ($activerow[$identifiableitem[1]]) {
case self::CSV_IDENTIFIER_TYPE_USER:
try {
entities\User::getB2DBTable()->selectByID($activerow[$identifiableitem[0]]);
} catch (\Exception $e) {
$errors[] = $this->getI18n()->__('Row %row column %col: user does not exist', array('%col' => $identifiableitem[0], '%row' => $i + 1));
}
break;
case self::CSV_IDENTIFIER_TYPE_TEAM:
try {
entities\Team::getB2DBTable()->selectById($activerow[$identifiableitem[0]]);
} catch (\Exception $e) {
$errors[] = $this->getI18n()->__('Row %row column %col: team does not exist', array('%col' => $identifiableitem[0], '%row' => $i + 1));
}
//.........这里部分代码省略.........
示例10: isValid
public function isValid(\thebuggenie\core\framework\Request $request)
{
if ($this->_target_value) {
return true;
}
switch ($this->_action_type) {
case self::ACTION_ASSIGN_ISSUE:
return (bool) $request['assignee_type'] && $request['assignee_id'];
break;
case self::ACTION_SET_MILESTONE:
return (bool) $request->hasParameter('milestone_id');
break;
case self::ACTION_SET_PRIORITY:
return (bool) $request->hasParameter('priority_id');
break;
case self::ACTION_SET_STATUS:
return (bool) $request->hasParameter('status_id') && ($status = Status::getB2DBTable()->selectById((int) $request->getParameter('status_id'))) instanceof Status && $status->canUserSet(framework\Context::getUser());
break;
case self::ACTION_SET_REPRODUCABILITY:
return (bool) $request->hasParameter('reproducability_id');
break;
case self::ACTION_SET_RESOLUTION:
return (bool) $request->hasParameter('resolution_id');
break;
default:
return true;
}
}