當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Topic::GetDatabase方法代碼示例

本文整理匯總了PHP中Topic::GetDatabase方法的典型用法代碼示例。如果您正苦於以下問題:PHP Topic::GetDatabase方法的具體用法?PHP Topic::GetDatabase怎麽用?PHP Topic::GetDatabase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Topic的用法示例。


在下文中一共展示了Topic::GetDatabase方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: UnassociateAllPeopleAsRead

    /**
     * Unassociates all PeopleAsRead
     * @return void
     */
    public function UnassociateAllPeopleAsRead()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAllPersonAsReadArray on this unsaved Topic.');
        }
        // Get the Database Object for this Class
        $objDatabase = Topic::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`read_topic_person_assn`
				WHERE
					`topic_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }
開發者ID:klucznik,項目名稱:qcodo-website,代碼行數:19,代碼來源:TopicGen.class.php

示例2: GetPageNumber

 /**
  * Given a Topic and the number of items in a "page", this will
  * return the page number that the topic shows up in
  * when listing all topics for the Topic's forum, assuming
  * the list of topics is ordered by reverse last_post_date
  * @param Topic $objTopic the topic to search for
  * @param integer $intItemsPerPage
  * @param Zend_Search_Lucene_Search_QueryHit[] $objQueryHitArray a predefined set of topics to search through
  * @return unknown_type
  */
 public function GetPageNumber(Topic $objTopic, $intItemsPerPage, $objQueryHitArray = null)
 {
     if (is_null($objQueryHitArray)) {
         $objResult = Topic::GetDatabase()->Query('SELECT id FROM topic WHERE topic_link_id=' . $objTopic->TopicLinkId . ' ORDER BY last_post_date DESC');
         $intRecordNumber = 0;
         while ($objRow = $objResult->GetNextRow()) {
             $intRecordNumber++;
             if ($objRow->GetColumn('id') == $objTopic->Id) {
                 break;
             }
         }
     } else {
         $intRecordNumber = 0;
         foreach ($objQueryHitArray as $objHit) {
             $intRecordNumber++;
             if ($objHit->db_id == $objTopic->Id) {
                 break;
             }
         }
     }
     $intPageNumber = floor($intRecordNumber / $intItemsPerPage);
     if ($intRecordNumber % $intItemsPerPage) {
         $intPageNumber++;
     }
     return $intPageNumber;
 }
開發者ID:qcodo,項目名稱:qcodo-website,代碼行數:36,代碼來源:forum.php

示例3: LoadArrayBySearch

 /**
  * Searches using the search index for applicable topics, and returns topics as an array
  * Note that this will return ALL topics for the search.  No limit / pagination can be applied.
  * @param string $strSearchQuery
  * @return Topic[]
  */
 public static function LoadArrayBySearch($strSearchQuery)
 {
     // open the index
     $objIndex = new Zend_Search_Lucene(__SEARCH_INDEXES__ . '/topics');
     $intIdArray = array();
     $objHits = $objIndex->find($strSearchQuery);
     if (!count($objHits)) {
         return array();
     }
     foreach ($objHits as $objHit) {
         $intIdArray[] = $objHit->db_id;
         // note: do we want to do anything with $objHit->score (?)
     }
     $objResult = Topic::GetDatabase()->Query('SELECT * FROM topic WHERE id IN(' . implode(',', $intIdArray) . ');');
     while ($objRow = $objResult->GetNextRow()) {
         $objTopic = Topic::InstantiateDbRow($objRow);
         $objTopicArrayById[$objTopic->Id] = $objTopic;
     }
     $objTopicArray = array();
     foreach ($objHits as $objHit) {
         $objTopicArray[] = $objTopicArrayById[intval($objHit->db_id)];
     }
     return $objTopicArray;
 }
開發者ID:qcodo,項目名稱:qcodo-website,代碼行數:30,代碼來源:Topic.class.php

示例4: array

$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();
    try {
        Topic::GetDatabase()->NonQuery('INSERT INTO read_topic_person_assn(topic_id, person_id) VALUES (' . $objRow['topic_id'] . ',' . $objRow['person_id'] . ');');
    } catch (QMySqliDatabaseException $objExc) {
    }
}
開發者ID:qcodo,項目名稱:qcodo-website,代碼行數:31,代碼來源:migrator.cli.php

示例5: UnassociateAllPeopleAsRead

    /**
     * Unassociates all PeopleAsRead
     * @return void
     */
    public function UnassociateAllPeopleAsRead()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAllPersonAsReadArray on this unsaved Topic.');
        }
        // Get the Database Object for this Class
        $objDatabase = Topic::GetDatabase();
        // Journaling (if applicable)
        if ($objDatabase->JournalingDatabase) {
            $objResult = $objDatabase->Query('SELECT `person_id` AS associated_id FROM `read_topic_person_assn` WHERE `topic_id` = ' . $objDatabase->SqlVariable($this->intId));
            while ($objRow = $objResult->GetNextRow()) {
                $this->JournalPersonAsReadAssociation($objRow->GetColumn('associated_id'), 'DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`read_topic_person_assn`
				WHERE
					`topic_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }
開發者ID:qcodo,項目名稱:qcodo-website,代碼行數:26,代碼來源:TopicGen.class.php


注:本文中的Topic::GetDatabase方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。