protected function btnOkay_Click() { $this->mctIssue->Issue->DueDate = $this->txtDueDate->DateTime; if (!$this->blnEditMode) { $this->mctIssue->Issue->PostDate = QDateTime::Now(); $this->mctIssue->SaveIssue(); $this->mctIssue->Issue->CreateTopicAndTopicLink(); $this->mctIssue->Issue->CreatePackage(); $this->mctIssue->Issue->PostMessage(trim($this->txtLongDescription->Text), QApplication::$Person, $this->mctIssue->Issue->PostDate); } else { $objOldVersionOfIssue = Issue::Load($this->mctIssue->Issue->Id); $this->mctIssue->SaveIssue(); $strTextArray = $this->mctIssue->Issue->GetDifferenceArray($objOldVersionOfIssue); if (count($strTextArray)) { $strMessage = sprintf("%s made edits to the issue, including:\r\n\r\n* %s", QApplication::$Person->DisplayName, implode("\r\n* ", $strTextArray)); } else { $strMessage = sprintf("%s made content edits to the issue", QApplication::$Person->DisplayName); } $this->mctIssue->Issue->PostMessage($strMessage, null); } // Save Other Fields (both required and optional) // First Erase them All to "start over" $this->mctIssue->Issue->DeleteAllIssueFieldValues(); // Now assign the Required ones foreach ($this->lstRequiredFields as $lstField) { $this->lstField_Save($lstField); } // Finally assign the Optional ones foreach ($this->lstOptionalFields as $lstField) { $this->lstField_Save($lstField); } QApplication::Redirect('/issues/view.php/' . $this->mctIssue->Issue->Id . '/lastpage'); }
protected function btnSubmitFixOkay_Click() { // Get Old Version of the issue (before any changes are made) $objOldVersionOfIssue = Issue::Load($this->objIssue->Id); // Render out the SubmitFix Message that we will post $strMessage = sprintf('A fix to this issue was posted by *%s* at *%s*', QApplication::$Person->DisplayName, trim($this->txtSubmitFixLink->Text)); if ($strNotes = trim($this->txtSubmitFixNotes->Text)) { $strMessage .= sprintf(":\r\n\r\n%s", $strNotes); } // Update the status to fixed $this->objIssue->IssueStatusTypeId = IssueStatusType::Fixed; // Change the assignment (if applicable) if ($this->objIssue->AssignedToPersonId != QApplication::$Person->Id) { $this->objIssue->AssignedToPerson = null; $this->objIssue->DueDate = null; } else { $this->pnlNotice->Visible = false; } // Save It! $this->objIssue->Save(); // Lookup Differences between thew new and the old and add it to the SubmitFix Message $strTextArray = $this->objIssue->GetDifferenceArray($objOldVersionOfIssue); if (count($strTextArray)) { $strMessage .= sprintf("\r\n\r\nThe following changes were made to this issue:\r\n\r\n* %s", implode("\r\n* ", $strTextArray)); } // Post the SubmitFix Message $this->objIssue->PostMessage($strMessage, null); // Refresh the Screen $this->pnlDetails->Refresh(); $this->pnlMessages->dtrMessages->PageNumber = QPaginatedControl::LastPage; $this->dlgSubmitFix->HideDialogBox(); }
/** * Static Helper Method to Create using PK arguments * You must pass in the PK arguments on an object to load, or leave it blank to create a new one. * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo * static helper methods. Finally, specify a CreateType to define whether or not we are only allowed to * edit, or if we are also allowed to create a new one, etc. * * @param mixed $objParentObject QForm or QPanel which will be using this IssueMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing Issue object creation - defaults to CreateOrEdit * @return IssueMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objIssue = Issue::Load($intId); // Issue was found -- return it! if ($objIssue) { return new IssueMetaControl($objParentObject, $objIssue); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a Issue object with PK arguments: ' . $intId); } } // If EditOnly is specified, throw an exception } else { if ($intCreateType == QMetaControlCreateType::EditOnly) { throw new QCallerException('No PK arguments specified'); } } // If we are here, then we need to create a new record return new IssueMetaControl($objParentObject, new Issue()); }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'Id': /** * Gets the value for intId (Read-Only PK) * @return integer */ return $this->intId; case 'IssueId': /** * Gets the value for intIssueId (Not Null) * @return integer */ return $this->intIssueId; case 'PersonId': /** * Gets the value for intPersonId (Not Null) * @return integer */ return $this->intPersonId; case 'VoteDate': /** * Gets the value for dttVoteDate (Not Null) * @return QDateTime */ return $this->dttVoteDate; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Issue': /** * Gets the value for the Issue object referenced by intIssueId (Not Null) * @return Issue */ try { if (!$this->objIssue && !is_null($this->intIssueId)) { $this->objIssue = Issue::Load($this->intIssueId); } return $this->objIssue; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Person': /** * Gets the value for the Person object referenced by intPersonId (Not Null) * @return Person */ try { if (!$this->objPerson && !is_null($this->intPersonId)) { $this->objPerson = Person::Load($this->intPersonId); } return $this->objPerson; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'Id': // Gets the value for intId (Read-Only PK) // @return integer return $this->intId; case 'TopicLinkTypeId': // Gets the value for intTopicLinkTypeId (Not Null) // @return integer return $this->intTopicLinkTypeId; case 'TopicCount': // Gets the value for intTopicCount // @return integer return $this->intTopicCount; case 'MessageCount': // Gets the value for intMessageCount // @return integer return $this->intMessageCount; case 'LastPostDate': // Gets the value for dttLastPostDate // @return QDateTime return $this->dttLastPostDate; case 'ForumId': // Gets the value for intForumId (Unique) // @return integer return $this->intForumId; case 'IssueId': // Gets the value for intIssueId (Unique) // @return integer return $this->intIssueId; case 'WikiItemId': // Gets the value for intWikiItemId (Unique) // @return integer return $this->intWikiItemId; case 'PackageId': // Gets the value for intPackageId (Unique) // @return integer return $this->intPackageId; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Forum': // Gets the value for the Forum object referenced by intForumId (Unique) // @return Forum try { if (!$this->objForum && !is_null($this->intForumId)) { $this->objForum = Forum::Load($this->intForumId); } return $this->objForum; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Issue': // Gets the value for the Issue object referenced by intIssueId (Unique) // @return Issue try { if (!$this->objIssue && !is_null($this->intIssueId)) { $this->objIssue = Issue::Load($this->intIssueId); } return $this->objIssue; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'WikiItem': // Gets the value for the WikiItem object referenced by intWikiItemId (Unique) // @return WikiItem try { if (!$this->objWikiItem && !is_null($this->intWikiItemId)) { $this->objWikiItem = WikiItem::Load($this->intWikiItemId); } return $this->objWikiItem; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Package': // Gets the value for the Package object referenced by intPackageId (Unique) // @return Package try { if (!$this->objPackage && !is_null($this->intPackageId)) { $this->objPackage = Package::Load($this->intPackageId); } return $this->objPackage; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '_Message': // Gets the value for the private _objMessage (Read-Only) // if set due to an expansion on the message.topic_link_id reverse relationship // @return Message return $this->_objMessage; case '_MessageArray': // Gets the value for the private _objMessageArray (Read-Only) // if set due to an ExpandAsArray on the message.topic_link_id reverse relationship // @return Message[] return (array) $this->_objMessageArray; case '_Topic': // Gets the value for the private _objTopic (Read-Only) // if set due to an expansion on the topic.topic_link_id reverse relationship // @return Topic return $this->_objTopic; case '_TopicArray': // Gets the value for the private _objTopicArray (Read-Only) // if set due to an ExpandAsArray on the topic.topic_link_id reverse relationship // @return Topic[] return (array) $this->_objTopicArray; case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'Id': // Gets the value for intId (Read-Only PK) // @return integer return $this->intId; case 'IssueId': // Gets the value for intIssueId (Not Null) // @return integer return $this->intIssueId; case 'IssueFieldId': // Gets the value for intIssueFieldId (Not Null) // @return integer return $this->intIssueFieldId; case 'IssueFieldOptionId': // Gets the value for intIssueFieldOptionId (Not Null) // @return integer return $this->intIssueFieldOptionId; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Issue': // Gets the value for the Issue object referenced by intIssueId (Not Null) // @return Issue try { if (!$this->objIssue && !is_null($this->intIssueId)) { $this->objIssue = Issue::Load($this->intIssueId); } return $this->objIssue; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'IssueField': // Gets the value for the IssueField object referenced by intIssueFieldId (Not Null) // @return IssueField try { if (!$this->objIssueField && !is_null($this->intIssueFieldId)) { $this->objIssueField = IssueField::Load($this->intIssueFieldId); } return $this->objIssueField; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'IssueFieldOption': // Gets the value for the IssueFieldOption object referenced by intIssueFieldOptionId (Not Null) // @return IssueFieldOption try { if (!$this->objIssueFieldOption && !is_null($this->intIssueFieldOptionId)) { $this->objIssueFieldOption = IssueFieldOption::Load($this->intIssueFieldOptionId); } return $this->objIssueFieldOption; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * Reload this Issue from the database. * @return void */ public function Reload() { // Make sure we are actually Restored from the database if (!$this->__blnRestored) { throw new QCallerException('Cannot call Reload() on a new, unsaved Issue object.'); } // Reload the Object $objReloaded = Issue::Load($this->intId); // Update $this's local variables to match $this->IssuePriorityTypeId = $objReloaded->IssuePriorityTypeId; $this->IssueStatusTypeId = $objReloaded->IssueStatusTypeId; $this->IssueResolutionTypeId = $objReloaded->IssueResolutionTypeId; $this->strTitle = $objReloaded->strTitle; $this->strExampleCode = $objReloaded->strExampleCode; $this->strExampleTemplate = $objReloaded->strExampleTemplate; $this->strExampleData = $objReloaded->strExampleData; $this->strExpectedOutput = $objReloaded->strExpectedOutput; $this->strActualOutput = $objReloaded->strActualOutput; $this->PostedByPersonId = $objReloaded->PostedByPersonId; $this->AssignedToPersonId = $objReloaded->AssignedToPersonId; $this->dttPostDate = $objReloaded->dttPostDate; $this->dttAssignedDate = $objReloaded->dttAssignedDate; $this->dttDueDate = $objReloaded->dttDueDate; $this->intVoteCount = $objReloaded->intVoteCount; }