public function testGetIssueId() { $testIssueId = 'T-2'; $xml = simplexml_load_file($this->filename); $issue = new Issue($xml); $this->assertEquals($testIssueId, $issue->getId()); }
public function store() { $validator = Validator::make(Input::all(), Issue::$rules, Issue::$messages); //if($validator->passes()){ $issue = new Issue(); $issue->summary = Input::get('summary'); $issue->detail = Input::get('detail'); $issue->budget = 0.0; $issue->currentState = "TO-DO"; $issue->points = Input::get('points'); $issue->labels = Input::get('labels'); $issue->iterationid = Input::get('iterationid'); $categoryId = Input::get('categoryid'); if ($categoryId == 0) { //crear categoria $category = new Category(); $category->name = Input::get('category_name'); $category->save(); $issue->categoryid = $category->id; } else { $issue->categoryid = $categoryId; } $issue->save(); return Redirect::to('/iterations/' . $issue->iterationid)->with('message', 'Historia creada con exito'); /*}else{ return Redirect::to('iterations/'. Input::get('iterationid')) ->with('error', 'Ocurrieron los siguientes errores') ->withErrors($validator) ->withInput(); }*/ }
function destroy() { # @issue_count = @category.issues.size # if @issue_count == 0 # # No issue assigned to this category # @category.destroy # redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'categories' # elsif params[:todo] # reassign_to = @project.issue_categories.find_by_id(params[:reassign_to_id]) if params[:todo] == 'reassign' # @category.destroy(reassign_to) # redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'categories' # end App::import('model', 'Issue'); $Issue = new Issue(); $issue_count = $Issue->find('count', aa('conditions', aa('category_id', $this->params['id']))); if ($issue_count == 0) { $this->IssueCategory->del($this->params['id']); $this->redirect(aa('controller', 'projects', 'action', 'settings', 'project_id', $this->_project['Project']['identifier'], '?', 'tab=categories')); } elseif ($this->data) { $reassgin_to = null; if ($this->data['IssueCategory']['todo'] == 'reassgin_to') { $reassgin_to = $this->data['IssueCategory']['reassign_to_id']; } $this->IssueCategory->del_with_reassgin($this->params['id'], $reassgin_to); $this->redirect(aa('controller', 'projects', 'action', 'settings', 'project_id', $this->_project['Project']['identifier'], '?', 'tab=categories')); } $issue_category_data = $this->IssueCategory->find('first', aa('conditions', aa('IssueCategory.id', $this->params['id']))); $this->set('issue_category_data', $issue_category_data); $this->set('issue_count', $issue_count); }
public function setIssueAndChanges(Issue $issue, array $old_values) { $this->Issue = $issue; $this->exists = $issue->exists(); $this->modified = $issue->getModified(); $this->old_values = $old_values; }
/** * Transforms an object (issue) to a string (number). * * @param Issue|null $issue * @return string */ public function transform($issue) { if (null === $issue) { return ""; } return $issue->getusername(); }
/** * Transforms an object (issue) to a string (number). * * @param Issue|null $issue * @return string */ public function transform($issue) { if (null === $issue) { return ''; } return $issue->getId(); }
public static function GetURI($p_publicationId, $p_languageId, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = null) { $translator = \Zend_Registry::get('container')->getService('translator'); $languageObj = new Language($p_languageId); if (!$languageObj->exists()) { return new PEAR_Error($translator->trans('Language does not exist.')); } $uri = '/' . $languageObj->getCode() . '/'; if (!is_null($p_issueNo) && is_null($p_articleNo)) { $issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo); if (!$issueObj->exists()) { return new PEAR_Error($translator->trans('Issue does not exist.')); } $uri .= $issueObj->getUrlName() . '/'; } if (!is_null($p_sectionNo) && is_null($p_articleNo)) { $sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo); if (!$sectionObj->exists()) { return new PEAR_Error($translator->trans('Section does not exist.')); } $uri .= $sectionObj->getUrlName() . '/'; } if (!is_null($p_articleNo)) { $articleObj = new Article($p_languageId, $p_articleNo); if (!$articleObj->exists()) { return new PEAR_Error($translator->trans('Article does not exist.')); } $issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber()); $sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId, $articleObj->getSectionNumber()); $uri .= $issueObj->getUrlName() . '/'; $uri .= $sectionObj->getUrlName() . '/'; $uri .= $articleObj->getUrlName() . '/'; } return $uri; }
/** * The setter of the field issue_id. * @param Issue $issue - the issue related to the reply */ public function setIssue(Issue $issue) { if ($issue == NULL) { throw new InvalidArgumentException('[Model\\IssueReply] Invalid Model\\Issue.'); } $this->issue_id = $issue->getIssueId(); }
/** * Transforms an object (issue) to a string (number). * * @param Issue|null $entity * @return string */ public function transform($entity) { if (null === $entity) { return ''; } return $entity->getId(); }
/** * @param Issue $issue * @param string $file * @param int $line * @param array $template_parameters */ public function __construct(Issue $issue, string $file, int $line, array $template_parameters) { $this->issue = $issue; $this->file = $file; $this->line = $line; $this->message = vsprintf($issue->getTemplate(), $template_parameters); }
/** * Transforms an object (roles) to a string (choice). * * @param Issue|null $roles * @return string */ public function transform($roles) { if (null === $roles) { return ""; } return $roles->getNumber(); }
public static function GetURI($p_publicationId, $p_languageId, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = null) { $languageObj = new Language($p_languageId); if (!$languageObj->exists()) { return new PEAR_Error(getGS('Language does not exist.')); } $uri = $GLOBALS['Campsite']['SUBDIR'] . '/' . $languageObj->getCode() . '/'; if (!is_null($p_issueNo) && is_null($p_articleNo)) { $issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo); if (!$issueObj->exists()) { return new PEAR_Error(getGS('Issue does not exist.')); } $uri .= $issueObj->getUrlName() . '/'; } if (!is_null($p_sectionNo) && is_null($p_articleNo)) { $sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo); if (!$sectionObj->exists()) { return new PEAR_Error(getGS('Section does not exist.')); } $uri .= $sectionObj->getUrlName() . '/'; } if (!is_null($p_articleNo)) { $articleObj = new Article($p_languageId, $p_articleNo); if (!$articleObj->exists()) { return new PEAR_Error(getGS('Article does not exist.')); } $issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber()); $sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId, $articleObj->getSectionNumber()); $uri .= $issueObj->getUrlName() . '/'; $uri .= $sectionObj->getUrlName() . '/'; $uri .= $articleObj->getUrlName() . '/'; } return $uri; }
/** * Transforms an object (model) to a string (id). * * @param Issue|null $model * @return string */ public function transform($model) { if (null === $model) { return ''; } return $model->getId(); }
protected function getTemplate() { if ($this->m_dbObject->getSectionTemplateId() > 0) { return new MetaTemplate($this->m_dbObject->getSectionTemplateId()); } $sectionIssue = new Issue($this->m_dbObject->getProperty('IdPublication'), $this->m_dbObject->getProperty('IdLanguage'), $this->m_dbObject->getProperty('NrIssue')); return new MetaTemplate($sectionIssue->getSectionTemplateId()); }
/** * Transforms an object (issue) to a string (number). * * @param Issue|null $issue * @return string */ public function transform($issue) { if (null === $issue) { return ''; } $this->id = $issue->getId(); return $issue->getFirstName() . " " . $issue->getSurname() . "(" . $issue->getAddress() . ")"; }
public function delete($issue_id) { $this->load->model('Issue'); $issue = new Issue(); $issue->load($issue_id); if (!$issue->issue_id) { show_404(); } $issue->delete(); $this->load->view('bootstrap/main', ['main' => 'magazines/magazine_deleted', 'issue_id' => $issue_id]); }
/** * @param Issue $issue * @param string $file * @param int $line * @param array $template_parameters */ public function __construct(Issue $issue, string $file, int $line, array $template_parameters) { $this->issue = $issue; $this->file = $file; $this->line = $line; $template = $issue->getTemplate(); if (Config::get()->markdown_issue_messages) { $template = preg_replace('/([^ ]*%s[^ ]*)/', '`\\1`', $template); } $this->message = vsprintf($template, $template_parameters); }
/** * @covers PubObjectCache */ public function testAddIssue() { $nullVar = null; $cache = new PubObjectCache(); $issue = new Issue(); $issue->setId('1'); self::assertFalse($cache->isCached('issues', $issue->getId())); $cache->add($issue, $nullVar); self::assertTrue($cache->isCached('issues', $issue->getId())); $retrievedIssue = $cache->get('issues', $issue->getId()); self::assertEquals($issue, $retrievedIssue); }
function scm_ping($module, $username, $scm_name, $issues, $commit_msg) { // module is per file (svn hook) if (is_array($module)) { $module = null; } // process checkins for each issue foreach ($issues as $issue_id) { // check early if issue exists to report proper message back // workflow needs to know project_id to find out which workflow class to use. $prj_id = Issue::getProjectID($issue_id); if (empty($prj_id)) { echo "issue #{$issue_id} not found\n"; continue; } $files = array(); $nfiles = count($_GET['files']); for ($y = 0; $y < $nfiles; $y++) { $file = array('file' => $_GET['files'][$y], 'old_version' => isset($_GET['old_versions'][$y]) ? $_GET['old_versions'][$y] : null, 'new_version' => isset($_GET['new_versions'][$y]) ? $_GET['new_versions'][$y] : null, 'module' => isset($module) ? $module : $_GET['module'][$y]); $files[] = $file; } $commit_time = Date_Helper::getCurrentDateGMT(); SCM::addCheckins($issue_id, $commit_time, $scm_name, $username, $commit_msg, $files); // print report to stdout of commits so hook could report status back to commiter $details = Issue::getDetails($issue_id); echo "#{$issue_id} - {$details['iss_summary']} ({$details['sta_title']})\n"; } }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $student = Student::find($id); if ($student == NULL) { throw new Exception('Invalid Student ID'); } $student->year = (int) substr($student->year, 2, 4); $student_category = StudentCategories::find($student->category); $student->category = $student_category->category; $student_branch = Branch::find($student->branch); $student->branch = $student_branch->branch; if ($student->rejected == 1) { unset($student->approved); unset($student->books_issued); $student->rejected = (bool) $student->rejected; return $student; } if ($student->approved == 0) { unset($student->rejected); unset($student->books_issued); $student->approved = (bool) $student->approved; return $student; } unset($student->rejected); unset($student->approved); $student_issued_books = Logs::select('book_issue_id', 'issued_at')->where('student_id', '=', $id)->orderBy('time_stamp', 'desc')->take($student->books_issued)->get(); foreach ($student_issued_books as $issued_book) { $issue = Issue::find($issued_book->book_issue_id); $book = Books::find($issue->book_id); $issued_book->name = $book->title; $issued_book->issued_at = date('d-M', $issued_book->issued_at); } $student->issued_books = $student_issued_books; return $student; }
/** * Creates an issue with title, summary, documentation and tags pulled from * the plugin definition. * * @param TargetInterface $target * The target module. * * @return IssueInterface */ protected function buildIssue(TargetInterface $target) { $issue = new Issue($target, $this->pluginDefinition['message'], $this->pluginDefinition['summary']); foreach ($this->pluginDefinition['documentation'] as $doc) { $issue->addDocumentation($doc['url'], $doc['title']); } foreach ($this->pluginDefinition['tags'] as $group => $tag) { $issue->setTag($group, $tag); } // If the plugin definition didn't supply an error_level tag, mark this // one as an error. if (empty($this->pluginDefinition['tags']['error_level'])) { $issue->setTag('error_level', 'error'); } return $issue; }
public function show($id) { try { $iteration = Iterations::findOrFail($id); $iterations = Iterations::where('projectid', '=', $iteration->projectid)->get(); $project = Project::findOrFail($iteration->projectid); $issues = Issue::where('iterationid', '=', $id)->get(); //$issues = $iteration->issues; $countIssues = sizeof($issues); $categories = Category::all(); $idCategory = 0; $totalPoints = $issues->sum('points'); $materiales = Material::all(); $personal = PersonalType::all(); $team = Teams::where('projectid', '=', $project->id)->get()->first(); $members = DB::table('memberof')->where('teamid', '=', $team->id)->get(); $hasmembers = sizeof($members) > 0 ? true : false; $users = array(); foreach ($members as $member) { $users[] = User::findOrFail($member->usersid); echo $hasmembers; } $this->layout->content = View::make('layouts.iterations.show')->with('iteration', $iteration)->with('iterations', $iterations)->with('issues', $issues)->with('categories', $categories)->with('idCategory', $idCategory)->with('countIssues', $countIssues)->with('totalPoints', $totalPoints)->with('project', $project)->with('materiales', $materiales)->with('personal', $personal)->with('hasmembers', $hasmembers)->with('members', $members)->with('users', $users)->with('message', ''); } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) { return Redirect::to('/projects/')->with('message', 'Error al crear la iteración'); } }
/** * Check if the given parameters match an existing issue. All parameters * should be for the issue you are adding/editing. If you are adding, * set $p_isExistingIssue to FALSE, and if you are editing, set it to TRUE. * * @param int $p_publicationId * @param int $p_issueNumber * @param int $p_languageId * @param string $p_urlName * @param boolean $p_isExistingIssue * Set this to true if the issue already exists. * @return string * Return empty string on success, error message on failure. */ function camp_is_issue_conflicting($p_publicationId, $p_issueNumber, $p_languageId, $p_urlName, $p_isExistingIssue) { global $ADMIN; // The tricky part - language ID and URL name must be unique. $conflictingIssues = Issue::GetIssues($p_publicationId, $p_languageId, null, $p_urlName, null, false, null, true); $conflictingIssue = array_pop($conflictingIssues); // Check if the issue conflicts with another issue. // If the issue exists, we have to make sure the conflicting issue is not // itself. $isSelf = ($p_isExistingIssue && is_object($conflictingIssue) && ($conflictingIssue->getIssueNumber() == $p_issueNumber)); if (is_object($conflictingIssue) && !$isSelf) { $conflictingIssueLink = "/$ADMIN/issues/edit.php?" ."Pub=$p_publicationId" ."&Issue=".$conflictingIssue->getIssueNumber() ."&Language=".$conflictingIssue->getLanguageId(); $errMsg = getGS('The language and URL name must be unique for each issue in this publication.')."<br>".getGS('The values you are trying to set conflict with issue "$1$2. $3 ($4)$5".', "<a href='$conflictingIssueLink'>", $conflictingIssue->getIssueNumber(), $conflictingIssue->getName(), $conflictingIssue->getLanguageName(), '</a>'); return $errMsg; } return ""; }
/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionView($id) { $step = $this->loadModel($id); $issue = null; if (isset($_GET['issueId'])) { if ($_GET['issueId'] != '') { $issue = Issue::model()->find('id=' . $_GET['issueId']); } if ($issue) { if ($issue->status == 0) { $this->layout = "//layouts/column1"; } } } if (isset($_POST['position'])) { $step->sortElement($_POST['position']); exit("ok"); } $comment = $this->createComment($step, $issue); $element = $this->createElement($step); $text = $this->createText($step); $subStepModel = $this->createSubStep($step); $file = $this->createFile($step); $link = $this->createLink($step); $this->render('view', array('model' => $step, 'comment' => $comment, 'element' => $element, 'file' => $file, 'link' => $link, 'text' => $text, 'subStepModel' => $subStepModel, 'issue' => $issue)); }
/** * Adds an email to the outgoing mail queue. * * @param string $recipient The recipient of this email * @param array $headers The list of headers that should be sent with this email * @param string $body The body of the message * @param integer $save_email_copy Whether to send a copy of this email to a configurable address or not (eventum_sent@) * @param integer $issue_id The ID of the issue. If false, email will not be associated with issue. * @param string $type The type of message this is. * @param integer $sender_usr_id The id of the user sending this email. * @param integer $type_id The ID of the event that triggered this notification (issue_id, sup_id, not_id, etc) * @return true, or a PEAR_Error object */ public static function add($recipient, $headers, $body, $save_email_copy = 0, $issue_id = false, $type = '', $sender_usr_id = false, $type_id = false) { Workflow::modifyMailQueue(Auth::getCurrentProject(false), $recipient, $headers, $body, $issue_id, $type, $sender_usr_id, $type_id); // avoid sending emails out to users with inactive status $recipient_email = Mail_Helper::getEmailAddress($recipient); $usr_id = User::getUserIDByEmail($recipient_email); if (!empty($usr_id)) { $user_status = User::getStatusByEmail($recipient_email); // if user is not set to an active status, then silently ignore if (!User::isActiveStatus($user_status) && !User::isPendingStatus($user_status)) { return false; } } $to_usr_id = User::getUserIDByEmail($recipient_email); $recipient = Mail_Helper::fixAddressQuoting($recipient); $reminder_addresses = Reminder::_getReminderAlertAddresses(); // add specialized headers if (!empty($issue_id) && (!empty($to_usr_id) && User::getRoleByUser($to_usr_id, Issue::getProjectID($issue_id)) != User::getRoleID('Customer')) || @in_array(Mail_Helper::getEmailAddress($recipient), $reminder_addresses)) { $headers += Mail_Helper::getSpecializedHeaders($issue_id, $type, $headers, $sender_usr_id); } // try to prevent triggering absence auto responders $headers['precedence'] = 'bulk'; // the 'classic' way, works with e.g. the unix 'vacation' tool $headers['Auto-submitted'] = 'auto-generated'; // the RFC 3834 way if (empty($issue_id)) { $issue_id = 'null'; } // if the Date: header is missing, add it. if (empty($headers['Date'])) { $headers['Date'] = Mime_Helper::encode(date('D, j M Y H:i:s O')); } if (!empty($headers['To'])) { $headers['To'] = Mail_Helper::fixAddressQuoting($headers['To']); } // encode headers and add special mime headers $headers = Mime_Helper::encodeHeaders($headers); $res = Mail_Helper::prepareHeaders($headers); if (Misc::isError($res)) { Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); return $res; } // convert array of headers into text headers list(, $text_headers) = $res; $params = array('maq_save_copy' => $save_email_copy, 'maq_queued_date' => Date_Helper::getCurrentDateGMT(), 'maq_sender_ip_address' => !empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '', 'maq_recipient' => $recipient, 'maq_headers' => $text_headers, 'maq_body' => $body, 'maq_iss_id' => $issue_id, 'maq_subject' => $headers['Subject'], 'maq_type' => $type); if ($sender_usr_id) { $params['maq_usr_id'] = $sender_usr_id; } if ($type_id) { $params['maq_type_id'] = $type_id; } $stmt = 'INSERT INTO {{%mail_queue}} SET ' . DB_Helper::buildSet($params); try { DB_Helper::getInstance()->query($stmt, $params); } catch (DbException $e) { return $res; } return true; }
function ajaxgetissueAction() { $this->_helper->layout->disableLayout(); $issue = $this->_request->getParam('issue'); if ($issue) { $issueModel = new Issue(); $uid = $this->_currentUser->id; $r = $issueModel->updateIssueParticipant($issue, $uid); if ($r) { $alertModel = new Alert(); $alertModel->createAlert($uid, $issue); echo "ok"; } else { echo "exceed"; } } }
/** * Index page for Magazine controller. */ public function index() { $this->load->database(); $this->load->model('Publication'); $this->Publication->publication_name = 'Sandy Shore'; $this->Publication->save(); echo '<tt><pre>' . var_export($this->Publication, TRUE) . '</pre></tt>'; $this->load->model('Issue'); $issue = new Issue(); $issue->publication_id = $this->Publication->publication_id; $issue->issue_number = 2; $issue->issue_date_publication = date('2013-02-01'); $issue->issue_cover = 'This is first issue'; $issue->save(); echo '<tt><pre>' . var_export($issue, TRUE) . '</pre></tt>'; $this->load->view('magazines'); }
public function loadIssue($id) { $model = Issue::model()->find("id = {$id}"); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function show($id) { $issue = Issue::find($id); $retrievals = Retrieval::where('issue_id', '=', $id)->get(); $handbooks = Handbook::where('project_id', '=', Auth::user()->curr_project_id)->where('generation_id', '=', $issue->generation_id)->get(); $menu = 'student'; return View::make('retrievals.show', compact('issue', 'retrievals', 'handbooks', 'menu')); }
/** * Posts the Issue * @param Issue $paramIssue Issue object * @return boolean indicating if issue was created succesfully */ public function postIssue($paramIssue) { $req = curl_init("https://code.google.com/feeds/issues/p/orongocms/issues/full"); curl_setopt($req, CURLOPT_POST, true); curl_setopt($req, CURLOPT_HEADER, true); //cURL, stop outputting the data! curl_setopt($req, CURLOPT_RETURNTRANSFER, true); //Ignore: SSL certificate problem, verify that the CA cert is OK. error curl_setopt($req, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($req, CURLOPT_SSL_VERIFYPEER, false); $headers = array("Content-Type: application/atom+xml", "Authorization: AuthSub token=\"" . $this->token . "\"", "Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2", "Connection: keep-alive"); curl_setopt($req, CURLOPT_HTTPHEADER, $headers); $xml = $paramIssue->toXML(); curl_setopt($req, CURLOPT_POSTFIELDS, $xml); curl_exec($req); $info = curl_getinfo($req); curl_close($req); if ($info["http_code"] == '201') { return true; } else { switch ($info["http_code"]) { case '400': throw new Exception("Invalid request URI or header, or unsupported nonstandard parameter.", 400); break; case '401': throw new Exception("Authorization required.", 401); break; case '403': throw new Exception("Unsupported standard parameter, or authentication or authorization failed.", 403); break; case '404': throw new Exception("Resource (such as a feed or entry) not found.", 404); break; case '409': throw new Exception("Specified version number doesn't match resource's latest version number.", 409); break; case '500': throw new Exception("Internal error. This is the default code that is used for all unrecognized server errors.", 500); break; default: throw new Exception($info["http_code"] . ": Don't know why this happened - please update the bug manually (including this error)", $info["http_code"]); break; } } }