本文整理汇总了PHP中thebuggenie\core\entities\Issue::setPostedBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Issue::setPostedBy方法的具体用法?PHP Issue::setPostedBy怎么用?PHP Issue::setPostedBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\entities\Issue
的用法示例。
在下文中一共展示了Issue::setPostedBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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()));
}
}
示例2: 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) {
//.........这里部分代码省略.........
示例3: runDoImportCSV
//.........这里部分代码省略.........
$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])) {
$issue->setPostedBy(entities\User::getB2DBTable()->selectByID($activerow[self::CSV_ISSUE_POSTED_BY]));
}
if (isset($activerow[self::CSV_ISSUE_OWNER]) && isset($activerow[self::CSV_ISSUE_OWNER_TYPE])) {
switch ($activerow[self::CSV_ISSUE_OWNER_TYPE]) {
case self::CSV_IDENTIFIER_TYPE_USER:
$user = new entities\User($activerow[self::CSV_ISSUE_OWNER]);
$issue->setOwner($user);
break;
case self::CSV_IDENTIFIER_TYPE_TEAM:
$team = new entities\Team($activerow[self::CSV_ISSUE_OWNER]);
$issue->setOwner($team);
break;
}
}
if (isset($activerow[self::CSV_ISSUE_ASSIGNED]) && isset($activerow[self::CSV_ISSUE_ASSIGNED_TYPE])) {
switch ($activerow[self::CSV_ISSUE_ASSIGNED_TYPE]) {
case self::CSV_IDENTIFIER_TYPE_USER:
$user = new entities\User($activerow[self::CSV_ISSUE_ASSIGNED]);
$issue->setAssignee($user);
break;
case self::CSV_IDENTIFIER_TYPE_TEAM:
$team = new entities\Team($activerow[self::CSV_ISSUE_ASSIGNED]);
$issue->setAssignee($team);
break;
}
}
if (isset($activerow[self::CSV_ISSUE_RESOLUTION])) {
$issue->setResolution($activerow[self::CSV_ISSUE_RESOLUTION]);
}
if (isset($activerow[self::CSV_ISSUE_PRIORITY])) {
$issue->setPriority($activerow[self::CSV_ISSUE_PRIORITY]);
}
if (isset($activerow[self::CSV_ISSUE_CATEGORY])) {