Ejemplo n.º 1
0
 /**
  * Reload this Topic 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 Topic object.');
     }
     // Reload the Object
     $objReloaded = Topic::Load($this->intId);
     // Update $this's local variables to match
     $this->TopicLinkId = $objReloaded->TopicLinkId;
     $this->strName = $objReloaded->strName;
     $this->PersonId = $objReloaded->PersonId;
     $this->dttLastPostDate = $objReloaded->dttLastPostDate;
     $this->intMessageCount = $objReloaded->intMessageCount;
     $this->intViewCount = $objReloaded->intViewCount;
 }
 protected function lstTopicsAsRead_Update()
 {
     if ($this->lstTopicsAsRead) {
         $this->objPerson->UnassociateAllTopicsAsRead();
         $objSelectedListItems = $this->lstTopicsAsRead->SelectedItems;
         if ($objSelectedListItems) {
             foreach ($objSelectedListItems as $objListItem) {
                 $this->objPerson->AssociateTopicAsRead(Topic::Load($objListItem->Value));
             }
         }
     }
 }
Ejemplo n.º 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 'TopicId':
             /**
              * Gets the value for intTopicId (Not Null)
              * @return integer
              */
             return $this->intTopicId;
         case 'TopicLinkId':
             /**
              * Gets the value for intTopicLinkId (Not Null)
              * @return integer
              */
             return $this->intTopicLinkId;
         case 'PersonId':
             /**
              * Gets the value for intPersonId 
              * @return integer
              */
             return $this->intPersonId;
         case 'Message':
             /**
              * Gets the value for strMessage 
              * @return string
              */
             return $this->strMessage;
         case 'CompiledHtml':
             /**
              * Gets the value for strCompiledHtml 
              * @return string
              */
             return $this->strCompiledHtml;
         case 'ReplyNumber':
             /**
              * Gets the value for intReplyNumber (Not Null)
              * @return integer
              */
             return $this->intReplyNumber;
         case 'PostDate':
             /**
              * Gets the value for dttPostDate (Not Null)
              * @return QDateTime
              */
             return $this->dttPostDate;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Topic':
             /**
              * Gets the value for the Topic object referenced by intTopicId (Not Null)
              * @return Topic
              */
             try {
                 if (!$this->objTopic && !is_null($this->intTopicId)) {
                     $this->objTopic = Topic::Load($this->intTopicId);
                 }
                 return $this->objTopic;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'TopicLink':
             /**
              * Gets the value for the TopicLink object referenced by intTopicLinkId (Not Null)
              * @return TopicLink
              */
             try {
                 if (!$this->objTopicLink && !is_null($this->intTopicLinkId)) {
                     $this->objTopicLink = TopicLink::Load($this->intTopicLinkId);
                 }
                 return $this->objTopicLink;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Person':
             /**
              * Gets the value for the Person object referenced by intPersonId 
              * @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;
             }
     }
 }
Ejemplo n.º 4
0
 /**
  * Logs in a Person/User
  * @param Person $objPerson
  * @return void
  */
 public static function LoginPerson(Person $objPerson)
 {
     $_SESSION['intPersonId'] = $objPerson->Id;
     QApplication::$Person = $objPerson;
     // Mark any topics as viewed if applicable
     if (array_key_exists('intViewedTopicArray', $_SESSION)) {
         foreach ($_SESSION['intViewedTopicArray'] as $intTopicId => $blnValue) {
             if ($blnValue) {
                 $objTopic = Topic::Load($intTopicId);
                 if ($objTopic && !$objTopic->IsPersonAsReadAssociated($objPerson)) {
                     $objTopic->AssociatePersonAsRead($objPerson);
                 }
             }
         }
     }
     QApplication::ClearViewedTopicArray();
 }
Ejemplo n.º 5
0
<?php

require '../../includes/prepend.inc.php';
$objTopic = Topic::Load(QApplication::PathInfo(0));
if (!$objTopic || $objTopic->TopicLink->TopicLinkTypeId != TopicLinkType::Forum) {
    QApplication::Redirect('/');
} else {
    QApplication::Redirect('/forums/forum.php/' . $objTopic->TopicLink->ForumId . '/' . $objTopic->Id);
}
Ejemplo n.º 6
0
 /**
  * Action to Select a Topic to view
  * @param integer $intTopicId the topic ID that we are now viewing
  * @return void
  */
 public function SelectTopic($intTopicId)
 {
     $this->objTopic = Topic::Load(QApplication::PathInfo(1));
     // Validate the Topic, Itself
     if (!$this->objTopic) {
         return;
     }
     // For Search Queries: needs to be in the QueryHitArray
     if (is_array($this->objQueryHitArray)) {
         $blnFound = false;
         foreach ($this->objQueryHitArray as $objHit) {
             if ($objHit->db_id == $this->objTopic->Id) {
                 $blnFound = true;
             }
         }
         if (!$blnFound) {
             $this->objTopic = null;
         }
         // For Forum View: Topic must be part of the Forum
     } else {
         if ($this->objTopic->TopicLink->ForumId != $this->objForum->Id) {
             $this->objTopic = null;
         }
     }
     // Go ahead and set up other stuff if the Topic is set
     if ($this->objTopic) {
         $this->objTopic->MarkAsViewed();
         $this->pnlMessages->SelectTopic($this->objTopic);
     }
 }
 /**
  * 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 TopicMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing Topic object creation - defaults to CreateOrEdit
  * @return TopicMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objTopic = Topic::Load($intId);
         // Topic was found -- return it!
         if ($objTopic) {
             return new TopicMetaControl($objParentObject, $objTopic);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a Topic 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 TopicMetaControl($objParentObject, new Topic());
 }