/**
     * Deletes all associated Topics
     * @return void
     */
    public function DeleteAllTopics()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateTopic on this unsaved TopicLink.');
        }
        // Get the Database Object for this Class
        $objDatabase = TopicLink::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (Topic::LoadArrayByTopicLinkId($this->intId) as $objTopic) {
                $objTopic->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`topic`
				WHERE
					`topic_link_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }
Beispiel #2
0
 public function dtrTopics_Bind()
 {
     $intTopicLinkId = null;
     switch ($this->intViewState) {
         case 5:
         case 6:
             $intTopicLinkId = $this->objForum->TopicLink->Id;
         case 3:
         case 4:
             if (!$this->objQueryHitArray) {
                 $this->objQueryHitArray = Topic::GetQueryHitArrayForSearch($this->strSearchTerm, $intTopicLinkId);
             }
             $this->dtrTopics->TotalItemCount = count($this->objQueryHitArray);
             // If First Time (on FormCreate), pre-set the Page Number
             if ($this->strCallType == QCallType::None && $this->objTopic) {
                 $this->dtrTopics->PageNumber = $this->GetPageNumber($this->objTopic, $this->dtrTopics->ItemsPerPage, $this->objQueryHitArray);
             }
             $this->dtrTopics->DataSource = Topic::LoadArrayBySearchResultArray($this->objQueryHitArray, $this->dtrTopics->LimitInfo);
             $this->objQueryHitArray = null;
             break;
         default:
             $this->dtrTopics->TotalItemCount = $this->objForum->TopicLink->TopicCount;
             // If First Time (on FormCreate), pre-set the Page Number
             if ($this->strCallType == QCallType::None && $this->objTopic) {
                 $this->dtrTopics->PageNumber = $this->GetPageNumber($this->objTopic, $this->dtrTopics->ItemsPerPage);
             }
             $this->dtrTopics->DataSource = Topic::LoadArrayByTopicLinkId($this->objForum->TopicLink->Id, QQ::Clause(QQ::OrderBy(QQN::Topic()->LastPostDate, false), $this->dtrTopics->LimitClause));
             break;
     }
 }
 /**
  * Gets all associated Topics as an array of Topic objects
  * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  * @return Topic[]
  */
 public function GetTopicArray($objOptionalClauses = null)
 {
     if (is_null($this->intId)) {
         return array();
     }
     try {
         return Topic::LoadArrayByTopicLinkId($this->intId, $objOptionalClauses);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }