/**
  * This will save this object's WikiVersion instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveWikiVersion()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->lstWikiItem) {
             $this->objWikiVersion->WikiItemId = $this->lstWikiItem->SelectedValue;
         }
         if ($this->txtVersionNumber) {
             $this->objWikiVersion->VersionNumber = $this->txtVersionNumber->Text;
         }
         if ($this->txtName) {
             $this->objWikiVersion->Name = $this->txtName->Text;
         }
         if ($this->lstPostedByPerson) {
             $this->objWikiVersion->PostedByPersonId = $this->lstPostedByPerson->SelectedValue;
         }
         if ($this->calPostDate) {
             $this->objWikiVersion->PostDate = $this->calPostDate->DateTime;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstWikiFile) {
             $this->objWikiVersion->WikiFile = WikiFile::Load($this->lstWikiFile->SelectedValue);
         }
         if ($this->lstWikiImage) {
             $this->objWikiVersion->WikiImage = WikiImage::Load($this->lstWikiImage->SelectedValue);
         }
         if ($this->lstWikiItemAsCurrent) {
             $this->objWikiVersion->WikiItemAsCurrent = WikiItem::Load($this->lstWikiItemAsCurrent->SelectedValue);
         }
         if ($this->lstWikiPage) {
             $this->objWikiVersion->WikiPage = WikiPage::Load($this->lstWikiPage->SelectedValue);
         }
         // Save the WikiVersion object
         $this->objWikiVersion->Save();
         // Finally, update any ManyToManyReferences (if any)
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
예제 #2
0
 /**
  * Reload this WikiItem 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 WikiItem object.');
     }
     // Reload the Object
     $objReloaded = WikiItem::Load($this->intId);
     // Update $this's local variables to match
     $this->strPath = $objReloaded->strPath;
     $this->WikiItemTypeId = $objReloaded->WikiItemTypeId;
     $this->EditorMinimumPersonTypeId = $objReloaded->EditorMinimumPersonTypeId;
     $this->intOverrideNavbarIndex = $objReloaded->intOverrideNavbarIndex;
     $this->intOverrideSubnavIndex = $objReloaded->intOverrideSubnavIndex;
     $this->CurrentWikiVersionId = $objReloaded->CurrentWikiVersionId;
     $this->strCurrentName = $objReloaded->strCurrentName;
     $this->CurrentPostedByPersonId = $objReloaded->CurrentPostedByPersonId;
     $this->dttCurrentPostDate = $objReloaded->dttCurrentPostDate;
 }
예제 #3
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 '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;
             }
     }
 }
예제 #4
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 'WikiItemId':
             // Gets the value for intWikiItemId (Not Null)
             // @return integer
             return $this->intWikiItemId;
         case 'VersionNumber':
             // Gets the value for intVersionNumber (Not Null)
             // @return integer
             return $this->intVersionNumber;
         case 'Name':
             // Gets the value for strName
             // @return string
             return $this->strName;
         case 'PostedByPersonId':
             // Gets the value for intPostedByPersonId (Not Null)
             // @return integer
             return $this->intPostedByPersonId;
         case 'PostDate':
             // Gets the value for dttPostDate (Not Null)
             // @return QDateTime
             return $this->dttPostDate;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'WikiItem':
             // Gets the value for the WikiItem object referenced by intWikiItemId (Not Null)
             // @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 '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 'WikiFile':
             // Gets the value for the WikiFile object that uniquely references this WikiVersion
             // by objWikiFile (Unique)
             // @return WikiFile
             try {
                 if ($this->objWikiFile === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objWikiFile) {
                     $this->objWikiFile = WikiFile::LoadByWikiVersionId($this->intId);
                 }
                 return $this->objWikiFile;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'WikiImage':
             // Gets the value for the WikiImage object that uniquely references this WikiVersion
             // by objWikiImage (Unique)
             // @return WikiImage
             try {
                 if ($this->objWikiImage === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objWikiImage) {
                     $this->objWikiImage = WikiImage::LoadByWikiVersionId($this->intId);
                 }
                 return $this->objWikiImage;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'WikiItemAsCurrent':
             // Gets the value for the WikiItem object that uniquely references this WikiVersion
             // by objWikiItemAsCurrent (Unique)
             // @return WikiItem
             try {
                 if ($this->objWikiItemAsCurrent === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objWikiItemAsCurrent) {
                     $this->objWikiItemAsCurrent = WikiItem::LoadByCurrentWikiVersionId($this->intId);
                 }
                 return $this->objWikiItemAsCurrent;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'WikiPage':
             // Gets the value for the WikiPage object that uniquely references this WikiVersion
             // by objWikiPage (Unique)
             // @return WikiPage
             try {
                 if ($this->objWikiPage === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objWikiPage) {
                     $this->objWikiPage = WikiPage::LoadByWikiVersionId($this->intId);
                 }
                 return $this->objWikiPage;
             } 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;
             }
     }
 }
 /**
  * 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 WikiItemMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing WikiItem object creation - defaults to CreateOrEdit
  * @return WikiItemMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objWikiItem = WikiItem::Load($intId);
         // WikiItem was found -- return it!
         if ($objWikiItem) {
             return new WikiItemMetaControl($objParentObject, $objWikiItem);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a WikiItem 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 WikiItemMetaControl($objParentObject, new WikiItem());
 }