本文整理汇总了PHP中thebuggenie\core\entities\Issue::setIssuetype方法的典型用法代码示例。如果您正苦于以下问题:PHP Issue::setIssuetype方法的具体用法?PHP Issue::setIssuetype怎么用?PHP Issue::setIssuetype使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\entities\Issue
的用法示例。
在下文中一共展示了Issue::setIssuetype方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processIncomingEmailAccount
public function processIncomingEmailAccount(IncomingEmailAccount $account)
{
$count = 0;
if ($emails = $account->getUnprocessedEmails()) {
try {
$current_user = framework\Context::getUser();
foreach ($emails as $email) {
$user = $this->getOrCreateUserFromEmailString($email->from);
if ($user instanceof User) {
if (framework\Context::getUser()->getID() != $user->getID()) {
framework\Context::switchUserContext($user);
}
$message = $account->getMessage($email);
$data = $message->getBodyPlain() ? $message->getBodyPlain() : strip_tags($message->getBodyHTML());
if ($data) {
if (mb_detect_encoding($data, 'UTF-8', true) === false) {
$data = utf8_encode($data);
}
$new_data = '';
foreach (explode("\n", $data) as $line) {
$line = trim($line);
if ($line) {
$line = preg_replace('/^(_{2,}|-{2,})$/', "<hr>", $line);
$new_data .= $line . "\n";
} else {
$new_data .= "\n";
}
}
$data = nl2br($new_data, false);
}
// Parse the subject, and obtain the issues.
$parsed_commit = Issue::getIssuesFromTextByRegex(mb_decode_mimeheader($email->subject));
$issues = $parsed_commit["issues"];
// If any issues were found, add new comment to each issue.
if ($issues) {
foreach ($issues as $issue) {
$text = preg_replace('#(^\\w.+:\\n)?(^>.*(\\n|$))+#mi', "", $data);
$text = trim($text);
if (!$this->processIncomingEmailCommand($text, $issue) && $user->canPostComments()) {
$comment = new Comment();
$comment->setContent($text);
$comment->setPostedBy($user);
$comment->setTargetID($issue->getID());
$comment->setTargetType(Comment::TYPE_ISSUE);
$comment->save();
}
}
} else {
if ($user->canReportIssues($account->getProject())) {
$issue = new Issue();
$issue->setProject($account->getProject());
$issue->setTitle(mb_decode_mimeheader($email->subject));
$issue->setDescription($data);
$issue->setPostedBy($user);
$issue->setIssuetype($account->getIssuetype());
$issue->save();
// Append the new issue to the list of affected issues. This
// is necessary in order to process the attachments properly.
$issues[] = $issue;
}
}
// If there was at least a single affected issue, and mail
// contains attachments, add those attachments to related issues.
if ($issues && $message->hasAttachments()) {
foreach ($message->getAttachments() as $attachment_no => $attachment) {
echo 'saving attachment ' . $attachment_no;
$name = $attachment['filename'];
$new_filename = framework\Context::getUser()->getID() . '_' . NOW . '_' . basename($name);
if (framework\Settings::getUploadStorage() == 'files') {
$files_dir = framework\Settings::getUploadsLocalpath();
$filename = $files_dir . $new_filename;
} else {
$filename = $name;
}
Logging::log('Creating issue attachment ' . $filename . ' from attachment ' . $attachment_no);
echo 'Creating issue attachment ' . $filename . ' from attachment ' . $attachment_no;
$content_type = $attachment['type'] . '/' . $attachment['subtype'];
$file = new File();
$file->setRealFilename($new_filename);
$file->setOriginalFilename(basename($name));
$file->setContentType($content_type);
$file->setDescription($name);
$file->setUploadedBy(framework\Context::getUser());
if (framework\Settings::getUploadStorage() == 'database') {
$file->setContent($attachment['data']);
} else {
Logging::log('Saving file ' . $new_filename . ' with content from attachment ' . $attachment_no);
file_put_contents($new_filename, $attachment['data']);
}
$file->save();
// Attach file to each related issue.
foreach ($issues as $issue) {
$issue->attachFile($file);
}
}
}
$count++;
}
}
} catch (\Exception $e) {
//.........这里部分代码省略.........
示例2: runAddEpic
/**
* Adds an epic
*
* @Route(url="/boards/:board_id/addepic")
*
* @param framework\Request $request
*/
public function runAddEpic(framework\Request $request)
{
$this->forward403unless($this->_checkProjectPageAccess('project_planning'));
$board = entities\tables\AgileBoards::getTable()->selectById($request['board_id']);
try {
$title = trim($request['title']);
$shortname = trim($request['shortname']);
if (!$title) {
throw new \Exception($this->getI18n()->__('You have to provide a title'));
}
if (!$shortname) {
throw new \Exception($this->getI18n()->__('You have to provide a label'));
}
$issue = new \thebuggenie\core\entities\Issue();
$issue->setTitle($title);
$issue->setShortname($shortname);
$issue->setIssuetype($board->getEpicIssuetypeID());
$issue->setProject($board->getProject());
$issue->setPostedBy($this->getUser());
$issue->save();
return $this->renderJSON(array('issue_details' => $issue->toJSON()));
} catch (\Exception $e) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => $e->getMessage()));
}
}
示例3: _postIssue
protected function _postIssue()
{
$fields_array = $this->selected_project->getReportableFieldsArray($this->issuetype_id);
$issue = new entities\Issue();
$issue->setTitle($this->title);
$issue->setIssuetype($this->issuetype_id);
$issue->setProject($this->selected_project);
if (isset($fields_array['shortname'])) {
$issue->setShortname($this->selected_shortname);
}
if (isset($fields_array['description'])) {
$issue->setDescription($this->selected_description);
$issue->setDescriptionSyntax($this->selected_description_syntax);
}
if (isset($fields_array['reproduction_steps'])) {
$issue->setReproductionSteps($this->selected_reproduction_steps);
$issue->setReproductionStepsSyntax($this->selected_reproduction_steps_syntax);
}
if (isset($fields_array['category']) && $this->selected_category instanceof entities\Datatype) {
$issue->setCategory($this->selected_category->getID());
}
if (isset($fields_array['status']) && $this->selected_status instanceof entities\Datatype) {
$issue->setStatus($this->selected_status->getID());
}
if (isset($fields_array['reproducability']) && $this->selected_reproducability instanceof entities\Datatype) {
$issue->setReproducability($this->selected_reproducability->getID());
}
if (isset($fields_array['resolution']) && $this->selected_resolution instanceof entities\Datatype) {
$issue->setResolution($this->selected_resolution->getID());
}
if (isset($fields_array['severity']) && $this->selected_severity instanceof entities\Datatype) {
$issue->setSeverity($this->selected_severity->getID());
}
if (isset($fields_array['priority']) && $this->selected_priority instanceof entities\Datatype) {
$issue->setPriority($this->selected_priority->getID());
}
if (isset($fields_array['estimated_time'])) {
$issue->setEstimatedTime($this->selected_estimated_time);
}
if (isset($fields_array['spent_time'])) {
$issue->setSpentTime($this->selected_spent_time);
}
if (isset($fields_array['milestone']) || isset($this->selected_milestone)) {
$issue->setMilestone($this->selected_milestone);
}
if (isset($fields_array['percent_complete'])) {
$issue->setPercentCompleted($this->selected_percent_complete);
}
if (isset($fields_array['pain_bug_type'])) {
$issue->setPainBugType($this->selected_pain_bug_type);
}
if (isset($fields_array['pain_likelihood'])) {
$issue->setPainLikelihood($this->selected_pain_likelihood);
}
if (isset($fields_array['pain_effect'])) {
$issue->setPainEffect($this->selected_pain_effect);
}
foreach (entities\CustomDatatype::getAll() as $customdatatype) {
if (!isset($fields_array[$customdatatype->getKey()])) {
continue;
}
if ($customdatatype->hasCustomOptions()) {
if (isset($fields_array[$customdatatype->getKey()]) && $this->selected_customdatatype[$customdatatype->getKey()] instanceof entities\CustomDatatypeOption) {
$selected_option = $this->selected_customdatatype[$customdatatype->getKey()];
$issue->setCustomField($customdatatype->getKey(), $selected_option->getID());
}
} else {
$issue->setCustomField($customdatatype->getKey(), $this->selected_customdatatype[$customdatatype->getKey()]);
}
}
// FIXME: If we set the issue assignee during report issue, this needs to be set INSTEAD of this
if ($this->selected_project->canAutoassign()) {
if (isset($fields_array['component']) && $this->selected_component instanceof entities\Component && $this->selected_component->hasLeader()) {
$issue->setAssignee($this->selected_component->getLeader());
} elseif (isset($fields_array['edition']) && $this->selected_edition instanceof entities\Edition && $this->selected_edition->hasLeader()) {
$issue->setAssignee($this->selected_edition->getLeader());
} elseif ($this->selected_project->hasLeader()) {
$issue->setAssignee($this->selected_project->getLeader());
}
}
$issue->save();
if (isset($this->parent_issue)) {
$issue->addParentIssue($this->parent_issue);
}
if (isset($fields_array['edition']) && $this->selected_edition instanceof entities\Edition) {
$issue->addAffectedEdition($this->selected_edition);
}
if (isset($fields_array['build']) && $this->selected_build instanceof entities\Build) {
$issue->addAffectedBuild($this->selected_build);
}
if (isset($fields_array['component']) && $this->selected_component instanceof entities\Component) {
$issue->addAffectedComponent($this->selected_component);
}
return $issue;
}
示例4: _postIssue
protected function _postIssue(framework\Request $request)
{
$fields_array = $this->selected_project->getReportableFieldsArray($this->issuetype_id);
$issue = new entities\Issue();
$issue->setTitle($this->title);
$issue->setIssuetype($this->issuetype_id);
$issue->setProject($this->selected_project);
if (isset($fields_array['shortname'])) {
$issue->setShortname($this->selected_shortname);
}
if (isset($fields_array['description'])) {
$issue->setDescription($this->selected_description);
$issue->setDescriptionSyntax($this->selected_description_syntax);
}
if (isset($fields_array['reproduction_steps'])) {
$issue->setReproductionSteps($this->selected_reproduction_steps);
$issue->setReproductionStepsSyntax($this->selected_reproduction_steps_syntax);
}
if (isset($fields_array['category']) && $this->selected_category instanceof entities\Datatype) {
$issue->setCategory($this->selected_category->getID());
}
if (isset($fields_array['status']) && $this->selected_status instanceof entities\Datatype) {
$issue->setStatus($this->selected_status->getID());
}
if (isset($fields_array['reproducability']) && $this->selected_reproducability instanceof entities\Datatype) {
$issue->setReproducability($this->selected_reproducability->getID());
}
if (isset($fields_array['resolution']) && $this->selected_resolution instanceof entities\Datatype) {
$issue->setResolution($this->selected_resolution->getID());
}
if (isset($fields_array['severity']) && $this->selected_severity instanceof entities\Datatype) {
$issue->setSeverity($this->selected_severity->getID());
}
if (isset($fields_array['priority']) && $this->selected_priority instanceof entities\Datatype) {
$issue->setPriority($this->selected_priority->getID());
}
if (isset($fields_array['estimated_time'])) {
$issue->setEstimatedTime($this->selected_estimated_time);
}
if (isset($fields_array['spent_time'])) {
$issue->setSpentTime($this->selected_spent_time);
}
if (isset($fields_array['milestone']) || isset($this->selected_milestone)) {
$issue->setMilestone($this->selected_milestone);
}
if (isset($fields_array['percent_complete'])) {
$issue->setPercentCompleted($this->selected_percent_complete);
}
if (isset($fields_array['pain_bug_type'])) {
$issue->setPainBugType($this->selected_pain_bug_type);
}
if (isset($fields_array['pain_likelihood'])) {
$issue->setPainLikelihood($this->selected_pain_likelihood);
}
if (isset($fields_array['pain_effect'])) {
$issue->setPainEffect($this->selected_pain_effect);
}
foreach (entities\CustomDatatype::getAll() as $customdatatype) {
if (!isset($fields_array[$customdatatype->getKey()])) {
continue;
}
if ($customdatatype->hasCustomOptions()) {
if (isset($fields_array[$customdatatype->getKey()]) && $this->selected_customdatatype[$customdatatype->getKey()] instanceof entities\CustomDatatypeOption) {
$selected_option = $this->selected_customdatatype[$customdatatype->getKey()];
$issue->setCustomField($customdatatype->getKey(), $selected_option->getID());
}
} else {
$issue->setCustomField($customdatatype->getKey(), $this->selected_customdatatype[$customdatatype->getKey()]);
}
}
// FIXME: If we set the issue assignee during report issue, this needs to be set INSTEAD of this
if ($this->selected_project->canAutoassign()) {
if (isset($fields_array['component']) && $this->selected_component instanceof entities\Component && $this->selected_component->hasLeader()) {
$issue->setAssignee($this->selected_component->getLeader());
} elseif (isset($fields_array['edition']) && $this->selected_edition instanceof entities\Edition && $this->selected_edition->hasLeader()) {
$issue->setAssignee($this->selected_edition->getLeader());
} elseif ($this->selected_project->hasLeader()) {
$issue->setAssignee($this->selected_project->getLeader());
}
}
if ($request->hasParameter('custom_issue_access') && $this->selected_project->permissionCheck('canlockandeditlockedissues')) {
switch ($request->getParameter('issue_access')) {
case 'public':
case 'public_category':
$issue->setLocked(false);
$issue->setLockedCategory($request->hasParameter('public_category'));
break;
case 'restricted':
$issue->setLocked();
break;
}
} else {
$issue->setLockedFromProject($this->selected_project);
}
framework\Event::listen('core', 'thebuggenie\\core\\entities\\Issue::createNew_pre_notifications', array($this, 'listen_issueCreate'));
$issue->save();
if (isset($this->parent_issue)) {
$issue->addParentIssue($this->parent_issue);
}
if (isset($fields_array['edition']) && $this->selected_edition instanceof entities\Edition) {
//.........这里部分代码省略.........
示例5: runDoImportCSV
//.........这里部分代码省略.........
if (isset($activerow[self::CSV_PROJECT_EN_BUILDS])) {
if ($activerow[self::CSV_PROJECT_EN_BUILDS] == '1') {
$project->setBuildsEnabled(true);
}
}
if (isset($activerow[self::CSV_PROJECT_EN_COMPS])) {
if ($activerow[self::CSV_PROJECT_EN_COMPS] == '1') {
$project->setComponentsEnabled(true);
}
}
if (isset($activerow[self::CSV_PROJECT_EN_EDITIONS])) {
if ($activerow[self::CSV_PROJECT_EN_EDITIONS] == '1') {
$project->setEditionsEnabled(true);
}
}
if (isset($activerow[self::CSV_PROJECT_CLIENT])) {
$project->setClient(entities\Client::getB2DBTable()->selectById($activerow[self::CSV_PROJECT_CLIENT]));
}
if (isset($activerow[self::CSV_PROJECT_SHOW_SUMMARY])) {
if ($activerow[self::CSV_PROJECT_SHOW_SUMMARY] == '1') {
$project->setFrontpageSummaryVisibility(true);
}
}
if (isset($activerow[self::CSV_PROJECT_SUMMARY_TYPE])) {
$project->setFrontpageSummaryType($activerow[self::CSV_PROJECT_SUMMARY_TYPE]);
}
if (isset($activerow[self::CSV_PROJECT_ALLOW_REPORTING])) {
$project->setLocked($activerow[self::CSV_PROJECT_ALLOW_REPORTING]);
}
if (isset($activerow[self::CSV_PROJECT_AUTOASSIGN])) {
$project->setAutoassign($activerow[self::CSV_PROJECT_AUTOASSIGN]);
}
if (isset($activerow[self::CSV_PROJECT_ISSUETYPE_SCHEME])) {
$project->setIssuetypeScheme(entities\IssuetypeScheme::getB2DBTable()->selectById($activerow[self::CSV_PROJECT_ISSUETYPE_SCHEME]));
}
if (isset($activerow[self::CSV_PROJECT_WORKFLOW_ID])) {
}
$project->setWorkflowScheme(entities\WorkflowScheme::getB2DBTable()->selectById($activerow[self::CSV_PROJECT_WORKFLOW_ID]));
$project->save();
} catch (\Exception $e) {
$errors[] = $this->getI18n()->__('Row %row failed: %err', array('%row' => $i + 1, '%err' => $e->getMessage()));
}
}
break;
case self::CSV_TYPE_ISSUES:
for ($i = 0; $i != count($data); $i++) {
try {
$activerow = $data[$i];
$issue = new entities\Issue();
$issue->setTitle($activerow[self::CSV_ISSUE_TITLE]);
$issue->setProject($activerow[self::CSV_ISSUE_PROJECT]);
$issue->setIssuetype($activerow[self::CSV_ISSUE_ISSUE_TYPE]);
$issue->save();
if (isset($activerow[self::CSV_ISSUE_DESCR])) {
$issue->setDescription($activerow[self::CSV_ISSUE_DESCR]);
}
if (isset($activerow[self::CSV_ISSUE_REPRO])) {
$issue->setReproductionSteps($activerow[self::CSV_ISSUE_REPRO]);
}
if (isset($activerow[self::CSV_ISSUE_STATE])) {
$issue->setState($activerow[self::CSV_ISSUE_STATE]);
}
if (isset($activerow[self::CSV_ISSUE_STATUS])) {
$issue->setStatus($activerow[self::CSV_ISSUE_STATUS]);
}
if (isset($activerow[self::CSV_ISSUE_POSTED_BY])) {