コード例 #1
0
 /**
  * Creates the Topic and TopicLink for this Package object.
  * @param Person $objPerson person who created this package who will be credited with creating the linked topic
  * @return Topic
  */
 public function CreateTopicAndTopicLink(Person $objPerson)
 {
     $objTopicLink = new TopicLink();
     $objTopicLink->TopicLinkTypeId = TopicLinkType::Package;
     $objTopicLink->Package = $this;
     $objTopicLink->Save();
     $objTopic = new Topic();
     $objTopic->TopicLink = $objTopicLink;
     $objTopic->Name = $this->strName;
     $objTopic->Person = $objPerson;
     $objTopic->Save();
     return $objTopic;
 }
コード例 #2
0
 /**
  * Default / simple DataBinder for this Meta DataGrid.  This can easily be overridden
  * by calling SetDataBinder() on this DataGrid with another DataBinder of your choice.
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  */
 public function MetaDataBinder()
 {
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = TopicLink::CountAll();
     }
     // Setup the $objClauses Array
     $objClauses = array();
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from TopicLink, given the clauses above
     $this->DataSource = TopicLink::LoadAll($objClauses);
 }
コード例 #3
0
ファイル: Issue.class.php プロジェクト: qcodo/qcodo-website
 /**
  * Creates the Topic and TopicLink for this Issue object.
  * @return Topic
  */
 public function CreateTopicAndTopicLink()
 {
     $objTopicLink = new TopicLink();
     $objTopicLink->TopicLinkTypeId = TopicLinkType::Issue;
     $objTopicLink->Issue = $this;
     $objTopicLink->Save();
     $objTopic = new Topic();
     $objTopic->TopicLink = $objTopicLink;
     $objTopic->Name = $this->strTitle;
     $objTopic->Person = $this->PostedByPerson;
     $objTopic->Save();
     return $objTopic;
 }
コード例 #4
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objTopicLink) {
         $objObject->objTopicLink = TopicLink::GetSoapObjectFromObject($objObject->objTopicLink, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intTopicLinkId = null;
         }
     }
     if ($objObject->objPerson) {
         $objObject->objPerson = Person::GetSoapObjectFromObject($objObject->objPerson, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intPersonId = null;
         }
     }
     if ($objObject->dttLastPostDate) {
         $objObject->dttLastPostDate = $objObject->dttLastPostDate->__toString(QDateTime::FormatSoap);
     }
     return $objObject;
 }
コード例 #5
0
 /**
  * This will save this object's Forum instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveForum()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->txtOrderNumber) {
             $this->objForum->OrderNumber = $this->txtOrderNumber->Text;
         }
         if ($this->txtName) {
             $this->objForum->Name = $this->txtName->Text;
         }
         if ($this->chkAnnounceOnlyFlag) {
             $this->objForum->AnnounceOnlyFlag = $this->chkAnnounceOnlyFlag->Checked;
         }
         if ($this->txtDescription) {
             $this->objForum->Description = $this->txtDescription->Text;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstTopicLink) {
             $this->objForum->TopicLink = TopicLink::Load($this->lstTopicLink->SelectedValue);
         }
         // Save the Forum object
         $this->objForum->Save();
         // Finally, update any ManyToManyReferences (if any)
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
コード例 #6
0
 /**
  * Creates the Topic and TopicLink for this Issue object.
  * @return Topic
  */
 protected function CreateTopicAndTopicLink()
 {
     $objTopicLink = new TopicLink();
     $objTopicLink->TopicLinkTypeId = TopicLinkType::WikiItem;
     $objTopicLink->WikiItem = $this;
     $objTopicLink->Save();
     $objTopic = new Topic();
     $objTopic->TopicLink = $objTopicLink;
     $objTopic->Name = $this->CurrentName;
     $objTopic->Person = $this->CurrentPostedByPerson;
     $objTopic->Save();
     return $objTopic;
 }
コード例 #7
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, TopicLink::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
コード例 #8
0
 /**
  * This will save this object's Package instance,
  * updating only the fields which have had a control created for it.
  */
 public function SavePackage()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->lstPackageCategory) {
             $this->objPackage->PackageCategoryId = $this->lstPackageCategory->SelectedValue;
         }
         if ($this->txtToken) {
             $this->objPackage->Token = $this->txtToken->Text;
         }
         if ($this->txtName) {
             $this->objPackage->Name = $this->txtName->Text;
         }
         if ($this->txtDescription) {
             $this->objPackage->Description = $this->txtDescription->Text;
         }
         if ($this->calLastPostDate) {
             $this->objPackage->LastPostDate = $this->calLastPostDate->DateTime;
         }
         if ($this->lstLastPostedByPerson) {
             $this->objPackage->LastPostedByPersonId = $this->lstLastPostedByPerson->SelectedValue;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstTopicLink) {
             $this->objPackage->TopicLink = TopicLink::Load($this->lstTopicLink->SelectedValue);
         }
         // Save the Package object
         $this->objPackage->Save();
         // Finally, update any ManyToManyReferences (if any)
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
コード例 #9
0
ファイル: migrator.cli.php プロジェクト: qcodo/qcodo-website
$strContent .= 'h2. "Other":wiki:/old_downloads/other';
$strContent .= "\r\n\r\n";
$strContent .= 'For other Community-Contributed classes, utilities, and code-snippets';
$objWikiPage = new WikiPage();
$objWikiPage->Content = trim($strContent);
$objWikiPage->CompileHtml();
$objWikiItem->CreateNewVersion('Downloads from Old Qcodo.com Website', $objWikiPage, 'Save', array(), Person::Load(1), null);
print "Done.\r\n";
QDataGen::DisplayForEachTaskStart($strTitle = 'Refreshing Topic Stats', Topic::CountAll());
foreach (Topic::LoadAll() as $objTopic) {
    QDataGen::DisplayForEachTaskNext($strTitle);
    $objTopic->RefreshStats();
}
QDataGen::DisplayForEachTaskEnd($strTitle);
QDataGen::DisplayForEachTaskStart($strTitle = 'Refreshing TopicLink Stats', TopicLink::CountAll());
foreach (TopicLink::LoadAll() as $objTopicLink) {
    QDataGen::DisplayForEachTaskNext($strTitle);
    $objTopicLink->RefreshStats();
}
QDataGen::DisplayForEachTaskEnd($strTitle);
$objResult = $objDb->query('SELECT * FROM email_topic_person_assn');
while (QDataGen::DisplayWhileTask('Migrating email_topic_person_assn', $objResult->num_rows)) {
    $objRow = $objResult->fetch_array();
    try {
        Topic::GetDatabase()->NonQuery('INSERT INTO email_topic_person_assn(topic_id, person_id) VALUES (' . $objRow['topic_id'] . ',' . $objRow['person_id'] . ');');
    } catch (QMySqliDatabaseException $objExc) {
    }
}
$objResult = $objDb->query('SELECT * FROM read_topic_person_assn');
while (QDataGen::DisplayWhileTask('Migrating read_topic_person_assn', $objResult->num_rows)) {
    $objRow = $objResult->fetch_array();
コード例 #10
0
 /**
  * Refresh this MetaControl with Data from the local Topic object.
  * @param boolean $blnReload reload Topic from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objTopic->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objTopic->Id;
         }
     }
     if ($this->lstTopicLink) {
         $this->lstTopicLink->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstTopicLink->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objTopicLinkArray = TopicLink::LoadAll();
         if ($objTopicLinkArray) {
             foreach ($objTopicLinkArray as $objTopicLink) {
                 $objListItem = new QListItem($objTopicLink->__toString(), $objTopicLink->Id);
                 if ($this->objTopic->TopicLink && $this->objTopic->TopicLink->Id == $objTopicLink->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstTopicLink->AddItem($objListItem);
             }
         }
     }
     if ($this->lblTopicLinkId) {
         $this->lblTopicLinkId->Text = $this->objTopic->TopicLink ? $this->objTopic->TopicLink->__toString() : null;
     }
     if ($this->txtName) {
         $this->txtName->Text = $this->objTopic->Name;
     }
     if ($this->lblName) {
         $this->lblName->Text = $this->objTopic->Name;
     }
     if ($this->lstPerson) {
         $this->lstPerson->RemoveAllItems();
         $this->lstPerson->AddItem(QApplication::Translate('- Select One -'), null);
         $objPersonArray = Person::LoadAll();
         if ($objPersonArray) {
             foreach ($objPersonArray as $objPerson) {
                 $objListItem = new QListItem($objPerson->__toString(), $objPerson->Id);
                 if ($this->objTopic->Person && $this->objTopic->Person->Id == $objPerson->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPerson->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPersonId) {
         $this->lblPersonId->Text = $this->objTopic->Person ? $this->objTopic->Person->__toString() : null;
     }
     if ($this->calLastPostDate) {
         $this->calLastPostDate->DateTime = $this->objTopic->LastPostDate;
     }
     if ($this->lblLastPostDate) {
         $this->lblLastPostDate->Text = sprintf($this->objTopic->LastPostDate) ? $this->objTopic->__toString($this->strLastPostDateDateTimeFormat) : null;
     }
     if ($this->txtMessageCount) {
         $this->txtMessageCount->Text = $this->objTopic->MessageCount;
     }
     if ($this->lblMessageCount) {
         $this->lblMessageCount->Text = $this->objTopic->MessageCount;
     }
     if ($this->txtViewCount) {
         $this->txtViewCount->Text = $this->objTopic->ViewCount;
     }
     if ($this->lblViewCount) {
         $this->lblViewCount->Text = $this->objTopic->ViewCount;
     }
     if ($this->lstPeopleAsEmail) {
         $this->lstPeopleAsEmail->RemoveAllItems();
         $objAssociatedArray = $this->objTopic->GetPersonAsEmailArray();
         $objPersonArray = Person::LoadAll();
         if ($objPersonArray) {
             foreach ($objPersonArray as $objPerson) {
                 $objListItem = new QListItem($objPerson->__toString(), $objPerson->Id);
                 foreach ($objAssociatedArray as $objAssociated) {
                     if ($objAssociated->Id == $objPerson->Id) {
                         $objListItem->Selected = true;
                     }
                 }
                 $this->lstPeopleAsEmail->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPeopleAsEmail) {
         $objAssociatedArray = $this->objTopic->GetPersonAsEmailArray();
         $strItems = array();
         foreach ($objAssociatedArray as $objAssociated) {
             $strItems[] = $objAssociated->__toString();
         }
         $this->lblPeopleAsEmail->Text = implode($strGlue, $strItems);
     }
     if ($this->lstPeopleAsReadOnce) {
         $this->lstPeopleAsReadOnce->RemoveAllItems();
         $objAssociatedArray = $this->objTopic->GetPersonAsReadOnceArray();
         $objPersonArray = Person::LoadAll();
         if ($objPersonArray) {
             foreach ($objPersonArray as $objPerson) {
                 $objListItem = new QListItem($objPerson->__toString(), $objPerson->Id);
                 foreach ($objAssociatedArray as $objAssociated) {
                     if ($objAssociated->Id == $objPerson->Id) {
                         $objListItem->Selected = true;
                     }
                 }
                 $this->lstPeopleAsReadOnce->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPeopleAsReadOnce) {
         $objAssociatedArray = $this->objTopic->GetPersonAsReadOnceArray();
         $strItems = array();
         foreach ($objAssociatedArray as $objAssociated) {
             $strItems[] = $objAssociated->__toString();
         }
         $this->lblPeopleAsReadOnce->Text = implode($strGlue, $strItems);
     }
     if ($this->lstPeopleAsRead) {
         $this->lstPeopleAsRead->RemoveAllItems();
         $objAssociatedArray = $this->objTopic->GetPersonAsReadArray();
         $objPersonArray = Person::LoadAll();
         if ($objPersonArray) {
             foreach ($objPersonArray as $objPerson) {
                 $objListItem = new QListItem($objPerson->__toString(), $objPerson->Id);
                 foreach ($objAssociatedArray as $objAssociated) {
                     if ($objAssociated->Id == $objPerson->Id) {
                         $objListItem->Selected = true;
                     }
                 }
                 $this->lstPeopleAsRead->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPeopleAsRead) {
         $objAssociatedArray = $this->objTopic->GetPersonAsReadArray();
         $strItems = array();
         foreach ($objAssociatedArray as $objAssociated) {
             $strItems[] = $objAssociated->__toString();
         }
         $this->lblPeopleAsRead->Text = implode($strGlue, $strItems);
     }
 }
コード例 #11
0
 /**
  * This will save this object's WikiItem instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveWikiItem()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->txtPath) {
             $this->objWikiItem->Path = $this->txtPath->Text;
         }
         if ($this->lstWikiItemType) {
             $this->objWikiItem->WikiItemTypeId = $this->lstWikiItemType->SelectedValue;
         }
         if ($this->lstEditorMinimumPersonType) {
             $this->objWikiItem->EditorMinimumPersonTypeId = $this->lstEditorMinimumPersonType->SelectedValue;
         }
         if ($this->txtOverrideNavbarIndex) {
             $this->objWikiItem->OverrideNavbarIndex = $this->txtOverrideNavbarIndex->Text;
         }
         if ($this->txtOverrideSubnavIndex) {
             $this->objWikiItem->OverrideSubnavIndex = $this->txtOverrideSubnavIndex->Text;
         }
         if ($this->lstCurrentWikiVersion) {
             $this->objWikiItem->CurrentWikiVersionId = $this->lstCurrentWikiVersion->SelectedValue;
         }
         if ($this->txtCurrentName) {
             $this->objWikiItem->CurrentName = $this->txtCurrentName->Text;
         }
         if ($this->lstCurrentPostedByPerson) {
             $this->objWikiItem->CurrentPostedByPersonId = $this->lstCurrentPostedByPerson->SelectedValue;
         }
         if ($this->calCurrentPostDate) {
             $this->objWikiItem->CurrentPostDate = $this->calCurrentPostDate->DateTime;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstTopicLink) {
             $this->objWikiItem->TopicLink = TopicLink::Load($this->lstTopicLink->SelectedValue);
         }
         // Save the WikiItem object
         $this->objWikiItem->Save();
         // Finally, update any ManyToManyReferences (if any)
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
コード例 #12
0
 /**
  * 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 'OrderNumber':
             // Gets the value for intOrderNumber
             // @return integer
             return $this->intOrderNumber;
         case 'Name':
             // Gets the value for strName (Not Null)
             // @return string
             return $this->strName;
         case 'AnnounceOnlyFlag':
             // Gets the value for blnAnnounceOnlyFlag
             // @return boolean
             return $this->blnAnnounceOnlyFlag;
         case 'Description':
             // Gets the value for strDescription
             // @return string
             return $this->strDescription;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'TopicLink':
             // Gets the value for the TopicLink object that uniquely references this Forum
             // by objTopicLink (Unique)
             // @return TopicLink
             try {
                 if ($this->objTopicLink === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objTopicLink) {
                     $this->objTopicLink = TopicLink::LoadByForumId($this->intId);
                 }
                 return $this->objTopicLink;
             } 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;
             }
     }
 }
コード例 #13
0
 /**
  * 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 'IssuePriorityTypeId':
             // Gets the value for intIssuePriorityTypeId (Not Null)
             // @return integer
             return $this->intIssuePriorityTypeId;
         case 'IssueStatusTypeId':
             // Gets the value for intIssueStatusTypeId (Not Null)
             // @return integer
             return $this->intIssueStatusTypeId;
         case 'IssueResolutionTypeId':
             // Gets the value for intIssueResolutionTypeId
             // @return integer
             return $this->intIssueResolutionTypeId;
         case 'Title':
             // Gets the value for strTitle
             // @return string
             return $this->strTitle;
         case 'ExampleCode':
             // Gets the value for strExampleCode
             // @return string
             return $this->strExampleCode;
         case 'ExampleTemplate':
             // Gets the value for strExampleTemplate
             // @return string
             return $this->strExampleTemplate;
         case 'ExampleData':
             // Gets the value for strExampleData
             // @return string
             return $this->strExampleData;
         case 'ExpectedOutput':
             // Gets the value for strExpectedOutput
             // @return string
             return $this->strExpectedOutput;
         case 'ActualOutput':
             // Gets the value for strActualOutput
             // @return string
             return $this->strActualOutput;
         case 'PostedByPersonId':
             // Gets the value for intPostedByPersonId (Not Null)
             // @return integer
             return $this->intPostedByPersonId;
         case 'AssignedToPersonId':
             // Gets the value for intAssignedToPersonId
             // @return integer
             return $this->intAssignedToPersonId;
         case 'PostDate':
             // Gets the value for dttPostDate (Not Null)
             // @return QDateTime
             return $this->dttPostDate;
         case 'AssignedDate':
             // Gets the value for dttAssignedDate
             // @return QDateTime
             return $this->dttAssignedDate;
         case 'DueDate':
             // Gets the value for dttDueDate
             // @return QDateTime
             return $this->dttDueDate;
         case 'VoteCount':
             // Gets the value for intVoteCount
             // @return integer
             return $this->intVoteCount;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'PostedByPerson':
             // Gets the value for the Person object referenced by intPostedByPersonId (Not Null)
             // @return Person
             try {
                 if (!$this->objPostedByPerson && !is_null($this->intPostedByPersonId)) {
                     $this->objPostedByPerson = Person::Load($this->intPostedByPersonId);
                 }
                 return $this->objPostedByPerson;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'AssignedToPerson':
             // Gets the value for the Person object referenced by intAssignedToPersonId
             // @return Person
             try {
                 if (!$this->objAssignedToPerson && !is_null($this->intAssignedToPersonId)) {
                     $this->objAssignedToPerson = Person::Load($this->intAssignedToPersonId);
                 }
                 return $this->objAssignedToPerson;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'TopicLink':
             // Gets the value for the TopicLink object that uniquely references this Issue
             // by objTopicLink (Unique)
             // @return TopicLink
             try {
                 if ($this->objTopicLink === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objTopicLink) {
                     $this->objTopicLink = TopicLink::LoadByIssueId($this->intId);
                 }
                 return $this->objTopicLink;
             } 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 '_IssueFieldValue':
             // Gets the value for the private _objIssueFieldValue (Read-Only)
             // if set due to an expansion on the issue_field_value.issue_id reverse relationship
             // @return IssueFieldValue
             return $this->_objIssueFieldValue;
         case '_IssueFieldValueArray':
             // Gets the value for the private _objIssueFieldValueArray (Read-Only)
             // if set due to an ExpandAsArray on the issue_field_value.issue_id reverse relationship
             // @return IssueFieldValue[]
             return (array) $this->_objIssueFieldValueArray;
         case '_IssueVote':
             // Gets the value for the private _objIssueVote (Read-Only)
             // if set due to an expansion on the issue_vote.issue_id reverse relationship
             // @return IssueVote
             return $this->_objIssueVote;
         case '_IssueVoteArray':
             // Gets the value for the private _objIssueVoteArray (Read-Only)
             // if set due to an ExpandAsArray on the issue_vote.issue_id reverse relationship
             // @return IssueVote[]
             return (array) $this->_objIssueVoteArray;
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
コード例 #14
0
 /**
  * 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 TopicLinkMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing TopicLink object creation - defaults to CreateOrEdit
  * @return TopicLinkMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objTopicLink = TopicLink::Load($intId);
         // TopicLink was found -- return it!
         if ($objTopicLink) {
             return new TopicLinkMetaControl($objParentObject, $objTopicLink);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a TopicLink 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 TopicLinkMetaControl($objParentObject, new TopicLink());
 }
コード例 #15
0
 /**
  * This will save this object's Issue instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveIssue()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->lstIssuePriorityType) {
             $this->objIssue->IssuePriorityTypeId = $this->lstIssuePriorityType->SelectedValue;
         }
         if ($this->lstIssueStatusType) {
             $this->objIssue->IssueStatusTypeId = $this->lstIssueStatusType->SelectedValue;
         }
         if ($this->lstIssueResolutionType) {
             $this->objIssue->IssueResolutionTypeId = $this->lstIssueResolutionType->SelectedValue;
         }
         if ($this->txtTitle) {
             $this->objIssue->Title = $this->txtTitle->Text;
         }
         if ($this->txtExampleCode) {
             $this->objIssue->ExampleCode = $this->txtExampleCode->Text;
         }
         if ($this->txtExampleTemplate) {
             $this->objIssue->ExampleTemplate = $this->txtExampleTemplate->Text;
         }
         if ($this->txtExampleData) {
             $this->objIssue->ExampleData = $this->txtExampleData->Text;
         }
         if ($this->txtExpectedOutput) {
             $this->objIssue->ExpectedOutput = $this->txtExpectedOutput->Text;
         }
         if ($this->txtActualOutput) {
             $this->objIssue->ActualOutput = $this->txtActualOutput->Text;
         }
         if ($this->lstPostedByPerson) {
             $this->objIssue->PostedByPersonId = $this->lstPostedByPerson->SelectedValue;
         }
         if ($this->lstAssignedToPerson) {
             $this->objIssue->AssignedToPersonId = $this->lstAssignedToPerson->SelectedValue;
         }
         if ($this->calPostDate) {
             $this->objIssue->PostDate = $this->calPostDate->DateTime;
         }
         if ($this->calAssignedDate) {
             $this->objIssue->AssignedDate = $this->calAssignedDate->DateTime;
         }
         if ($this->calDueDate) {
             $this->objIssue->DueDate = $this->calDueDate->DateTime;
         }
         if ($this->txtVoteCount) {
             $this->objIssue->VoteCount = $this->txtVoteCount->Text;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstTopicLink) {
             $this->objIssue->TopicLink = TopicLink::Load($this->lstTopicLink->SelectedValue);
         }
         // Save the Issue object
         $this->objIssue->Save();
         // Finally, update any ManyToManyReferences (if any)
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
コード例 #16
0
 /**
  * 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 'PackageCategoryId':
             // Gets the value for intPackageCategoryId (Not Null)
             // @return integer
             return $this->intPackageCategoryId;
         case 'Token':
             // Gets the value for strToken (Unique)
             // @return string
             return $this->strToken;
         case 'Name':
             // Gets the value for strName
             // @return string
             return $this->strName;
         case 'Description':
             // Gets the value for strDescription
             // @return string
             return $this->strDescription;
         case 'LastPostDate':
             // Gets the value for dttLastPostDate
             // @return QDateTime
             return $this->dttLastPostDate;
         case 'LastPostedByPersonId':
             // Gets the value for intLastPostedByPersonId
             // @return integer
             return $this->intLastPostedByPersonId;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'PackageCategory':
             // Gets the value for the PackageCategory object referenced by intPackageCategoryId (Not Null)
             // @return PackageCategory
             try {
                 if (!$this->objPackageCategory && !is_null($this->intPackageCategoryId)) {
                     $this->objPackageCategory = PackageCategory::Load($this->intPackageCategoryId);
                 }
                 return $this->objPackageCategory;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'LastPostedByPerson':
             // Gets the value for the Person object referenced by intLastPostedByPersonId
             // @return Person
             try {
                 if (!$this->objLastPostedByPerson && !is_null($this->intLastPostedByPersonId)) {
                     $this->objLastPostedByPerson = Person::Load($this->intLastPostedByPersonId);
                 }
                 return $this->objLastPostedByPerson;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'TopicLink':
             // Gets the value for the TopicLink object that uniquely references this Package
             // by objTopicLink (Unique)
             // @return TopicLink
             try {
                 if ($this->objTopicLink === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objTopicLink) {
                     $this->objTopicLink = TopicLink::LoadByPackageId($this->intId);
                 }
                 return $this->objTopicLink;
             } 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 '_PackageContribution':
             // Gets the value for the private _objPackageContribution (Read-Only)
             // if set due to an expansion on the package_contribution.package_id reverse relationship
             // @return PackageContribution
             return $this->_objPackageContribution;
         case '_PackageContributionArray':
             // Gets the value for the private _objPackageContributionArray (Read-Only)
             // if set due to an ExpandAsArray on the package_contribution.package_id reverse relationship
             // @return PackageContribution[]
             return (array) $this->_objPackageContributionArray;
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
コード例 #17
0
 /**
  * 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 'Path':
             // Gets the value for strPath (Not Null)
             // @return string
             return $this->strPath;
         case 'WikiItemTypeId':
             // Gets the value for intWikiItemTypeId (Not Null)
             // @return integer
             return $this->intWikiItemTypeId;
         case 'EditorMinimumPersonTypeId':
             // Gets the value for intEditorMinimumPersonTypeId (Not Null)
             // @return integer
             return $this->intEditorMinimumPersonTypeId;
         case 'OverrideNavbarIndex':
             // Gets the value for intOverrideNavbarIndex
             // @return integer
             return $this->intOverrideNavbarIndex;
         case 'OverrideSubnavIndex':
             // Gets the value for intOverrideSubnavIndex
             // @return integer
             return $this->intOverrideSubnavIndex;
         case 'CurrentWikiVersionId':
             // Gets the value for intCurrentWikiVersionId (Unique)
             // @return integer
             return $this->intCurrentWikiVersionId;
         case 'CurrentName':
             // Gets the value for strCurrentName
             // @return string
             return $this->strCurrentName;
         case 'CurrentPostedByPersonId':
             // Gets the value for intCurrentPostedByPersonId
             // @return integer
             return $this->intCurrentPostedByPersonId;
         case 'CurrentPostDate':
             // Gets the value for dttCurrentPostDate
             // @return QDateTime
             return $this->dttCurrentPostDate;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'CurrentWikiVersion':
             // Gets the value for the WikiVersion object referenced by intCurrentWikiVersionId (Unique)
             // @return WikiVersion
             try {
                 if (!$this->objCurrentWikiVersion && !is_null($this->intCurrentWikiVersionId)) {
                     $this->objCurrentWikiVersion = WikiVersion::Load($this->intCurrentWikiVersionId);
                 }
                 return $this->objCurrentWikiVersion;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CurrentPostedByPerson':
             // Gets the value for the Person object referenced by intCurrentPostedByPersonId
             // @return Person
             try {
                 if (!$this->objCurrentPostedByPerson && !is_null($this->intCurrentPostedByPersonId)) {
                     $this->objCurrentPostedByPerson = Person::Load($this->intCurrentPostedByPersonId);
                 }
                 return $this->objCurrentPostedByPerson;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'TopicLink':
             // Gets the value for the TopicLink object that uniquely references this WikiItem
             // by objTopicLink (Unique)
             // @return TopicLink
             try {
                 if ($this->objTopicLink === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objTopicLink) {
                     $this->objTopicLink = TopicLink::LoadByWikiItemId($this->intId);
                 }
                 return $this->objTopicLink;
             } 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 '_WikiVersion':
             // Gets the value for the private _objWikiVersion (Read-Only)
             // if set due to an expansion on the wiki_version.wiki_item_id reverse relationship
             // @return WikiVersion
             return $this->_objWikiVersion;
         case '_WikiVersionArray':
             // Gets the value for the private _objWikiVersionArray (Read-Only)
             // if set due to an ExpandAsArray on the wiki_version.wiki_item_id reverse relationship
             // @return WikiVersion[]
             return (array) $this->_objWikiVersionArray;
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
コード例 #18
0
 /**
  * Refresh this MetaControl with Data from the local Message object.
  * @param boolean $blnReload reload Message from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objMessage->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objMessage->Id;
         }
     }
     if ($this->lstTopic) {
         $this->lstTopic->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstTopic->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objTopicArray = Topic::LoadAll();
         if ($objTopicArray) {
             foreach ($objTopicArray as $objTopic) {
                 $objListItem = new QListItem($objTopic->__toString(), $objTopic->Id);
                 if ($this->objMessage->Topic && $this->objMessage->Topic->Id == $objTopic->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstTopic->AddItem($objListItem);
             }
         }
     }
     if ($this->lblTopicId) {
         $this->lblTopicId->Text = $this->objMessage->Topic ? $this->objMessage->Topic->__toString() : null;
     }
     if ($this->lstTopicLink) {
         $this->lstTopicLink->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstTopicLink->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objTopicLinkArray = TopicLink::LoadAll();
         if ($objTopicLinkArray) {
             foreach ($objTopicLinkArray as $objTopicLink) {
                 $objListItem = new QListItem($objTopicLink->__toString(), $objTopicLink->Id);
                 if ($this->objMessage->TopicLink && $this->objMessage->TopicLink->Id == $objTopicLink->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstTopicLink->AddItem($objListItem);
             }
         }
     }
     if ($this->lblTopicLinkId) {
         $this->lblTopicLinkId->Text = $this->objMessage->TopicLink ? $this->objMessage->TopicLink->__toString() : null;
     }
     if ($this->lstPerson) {
         $this->lstPerson->RemoveAllItems();
         $this->lstPerson->AddItem(QApplication::Translate('- Select One -'), null);
         $objPersonArray = Person::LoadAll();
         if ($objPersonArray) {
             foreach ($objPersonArray as $objPerson) {
                 $objListItem = new QListItem($objPerson->__toString(), $objPerson->Id);
                 if ($this->objMessage->Person && $this->objMessage->Person->Id == $objPerson->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPerson->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPersonId) {
         $this->lblPersonId->Text = $this->objMessage->Person ? $this->objMessage->Person->__toString() : null;
     }
     if ($this->txtMessage) {
         $this->txtMessage->Text = $this->objMessage->Message;
     }
     if ($this->lblMessage) {
         $this->lblMessage->Text = $this->objMessage->Message;
     }
     if ($this->txtCompiledHtml) {
         $this->txtCompiledHtml->Text = $this->objMessage->CompiledHtml;
     }
     if ($this->lblCompiledHtml) {
         $this->lblCompiledHtml->Text = $this->objMessage->CompiledHtml;
     }
     if ($this->txtReplyNumber) {
         $this->txtReplyNumber->Text = $this->objMessage->ReplyNumber;
     }
     if ($this->lblReplyNumber) {
         $this->lblReplyNumber->Text = $this->objMessage->ReplyNumber;
     }
     if ($this->calPostDate) {
         $this->calPostDate->DateTime = $this->objMessage->PostDate;
     }
     if ($this->lblPostDate) {
         $this->lblPostDate->Text = sprintf($this->objMessage->PostDate) ? $this->objMessage->__toString($this->strPostDateDateTimeFormat) : null;
     }
 }
コード例 #19
0
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  *
  * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
  * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query		 
  * @return void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = TopicLink::QueryCount($objCondition, $objClauses);
     }
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from TopicLink, given the clauses above
     $this->DataSource = TopicLink::QueryArray($objCondition, $objClauses);
 }