本文整理汇总了PHP中QQN::Message方法的典型用法代码示例。如果您正苦于以下问题:PHP QQN::Message方法的具体用法?PHP QQN::Message怎么用?PHP QQN::Message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQN
的用法示例。
在下文中一共展示了QQN::Message方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RefreshStats
/**
* This will refresh all the stats (last post date, message/topic counts) and save the record to the database
* @return void
*/
public function RefreshStats()
{
$objMessage = Message::QuerySingle(QQ::Equal(QQN::Message()->TopicLinkId, $this->intId), QQ::Clause(QQ::OrderBy(QQN::Message()->PostDate, false), QQ::LimitInfo(1)));
if ($objMessage) {
$this->dttLastPostDate = $objMessage->PostDate;
} else {
$this->dttLastPostDate = null;
}
$this->intMessageCount = Message::CountByTopicLinkId($this->intId);
$this->intTopicCount = Topic::CountByTopicLinkId($this->intId);
$this->Save();
}
示例2: CountByPersonId
/**
* Count Messages
* by PersonId Index(es)
* @param integer $intPersonId
* @return int
*/
public static function CountByPersonId($intPersonId)
{
// Call Message::QueryCount to perform the CountByPersonId query
return Message::QueryCount(QQ::Equal(QQN::Message()->PersonId, $intPersonId));
}
示例3: QRssFeed
<?php
require '../../includes/prepend.inc.php';
$objRss = new QRssFeed('Qcodo.com RSS Feed', 'http://www.qcodo.com/', 'The Qcodo Development Framework is an open-source PHP framework that focuses on freeing developers from unnecessary tedious, mundane coding. ' . 'This RSS feed reports on the most recent activity, posts and community contributions to the framework via the Qcodo.com website.');
$objRss->Image = new QRssImage('http://www.qcodo.com/images/qcodo_smaller.png');
$objRss->PubDate = new QDateTime(QDateTime::Now);
$objMessageArray = Message::QueryArray(QQ::Equal(QQN::Message()->Topic->TopicLink->TopicLinkTypeId, TopicLinkType::Forum), QQ::Clause(QQ::OrderBy(QQN::Message()->PostDate, false), QQ::LimitInfo(25)));
$objMessageArray = Message::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Message()->PostDate, false), QQ::LimitInfo(25)));
foreach ($objMessageArray as $objMessage) {
$objTopic = $objMessage->Topic;
$strTitle = ($objTopic->CountMessages() > 1 ? 'Re: ' : '') . $objTopic->Name;
$strLink = 'http://www.qcodo.com' . $objTopic->LinkLastPage;
$strDescription = $objMessage->CompiledHtml;
switch ($objTopic->TopicLink->TopicLinkTypeId) {
case TopicLinkType::Forum:
$strTitle = '[Forums] ' . $strTitle;
break;
case TopicLinkType::Issue:
$strTitle = '[Issue] ' . $strTitle;
break;
case TopicLinkType::Package:
$strTitle = '[QPM] ' . $strTitle;
break;
case TopicLinkType::WikiItem:
$strTitle = '[Wiki] ' . $strTitle;
break;
}
$objItem = new QRssItem($strTitle, $strLink, $strDescription);
$objItem->Author = $objMessage->Person ? $objMessage->Person->DisplayName : 'Qcodo System Message';
$objItem->Comments = $objItem->Link;
$objItem->PubDate = $objMessage->PostDate;
示例4: while
$objTopic->Name = $objRow['name'];
$objTopic->PersonId = $objRow['person_id'];
$objTopic->Save();
if ($objTopic->Id != $objRow['id']) {
Topic::GetDatabase()->NonQuery('UPDATE topic SET id=' . $objRow['id'] . ' WHERE id=' . $objTopic->Id);
Topic::GetDatabase()->NonQuery('ALTER TABLE topic AUTO_INCREMENT=' . ($objTopic->Id + 1));
}
}
$objResult = $objDb->query('SELECT * FROM message ORDER BY id');
while (QDataGen::DisplayWhileTask('Migrating Messages', $objResult->num_rows)) {
$objRow = $objResult->fetch_array();
$objMessage = new Message();
$objMessage->TopicLinkId = $objRow['forum_id'] - 1;
$objMessage->TopicId = $objRow['topic_id'];
$objMessage->PersonId = $objRow['person_id'];
$objMessage->ReplyNumber = Message::QueryCount(QQ::Equal(QQN::Message()->TopicId, $objRow['topic_id'])) + 1;
$objMessage->PostDate = new QDateTime($objRow['post_date']);
$strContent = $objRow['message'];
$strContent = str_replace("\r\n", "\n", $strContent);
$strContent = str_replace("\n", "\r\n", $strContent);
$strContent = str_replace('<b>', '*', $strContent);
$strContent = str_replace('</b>', '*', $strContent);
$strContent = str_replace('<i>', '+', $strContent);
$strContent = str_replace('</i>', '+', $strContent);
$strContent = str_replace('<u>', '_', $strContent);
$strContent = str_replace('</u>', '_', $strContent);
while (strpos($strContent, "\r\n<code>") !== false) {
$strContent = str_replace("\r\n<code>", '<code>', $strContent);
}
while (strpos($strContent, "<code>\r\n") !== false) {
$strContent = str_replace("<code>\r\n", '<code>', $strContent);
示例5: SelectTopic
public function SelectTopic(Topic $objTopic)
{
$this->objTopic = $objTopic;
if ($this->objTopic) {
// View Buttons
$this->btnRespond1->Visible = true;
$this->btnRespond2->Visible = true;
$this->btnMarkAsViewed1->Visible = true;
$this->btnMarkAsViewed2->Visible = true;
$this->btnNotify1->Visible = true;
$this->btnNotify2->Visible = true;
$objFirstMessage = Message::QuerySingle(QQ::Equal(QQN::Message()->TopicId, $this->objTopic->Id), QQ::OrderBy(QQN::Message()->Id));
if ($objFirstMessage) {
$dttLocalize = QApplication::LocalizeDateTime($objFirstMessage->PostDate);
$this->strPostStartedLinkText = strtolower($dttLocalize->__toString('DDDD, MMMM D, YYYY, h:mm z ')) . strtolower(QApplication::DisplayTimezoneLink($dttLocalize, false));
} else {
$this->strPostStartedLinkText = 'none';
}
$this->UpdateNotifyButtons();
$this->UpdateMarkAsViewedButtons();
} else {
// Hide Buttons
$this->btnRespond1->Visible = false;
$this->btnRespond2->Visible = false;
$this->btnMarkAsViewed1->Visible = false;
$this->btnMarkAsViewed2->Visible = false;
$this->btnNotify1->Visible = false;
$this->btnNotify2->Visible = false;
}
}
示例6: RefreshSearchIndex
/**
* This will refresh the search index for this topic (for all message content under this topic)
* @param Zend_Search_Lucene $objIndex should be null if we are updating just one -- but for bulk index updates, you can pass in an already loaded index file
* @return void
*/
public function RefreshSearchIndex($objIndex = null)
{
// Currently only implemented for Forum-based topic/message searches
if ($this->TopicLink->TopicLinkTypeId != TopicLinkType::Forum) {
return;
}
if (!$objIndex) {
$objIndex = new Zend_Search_Lucene(__SEARCH_INDEXES__ . '/topics');
$blnIndexProvided = false;
} else {
$blnIndexProvided = true;
}
// Retrievew the Index Documents (if applicable) to delete them from the index
$objSearchTerm = new Zend_Search_Lucene_Index_Term($this->Id, 'db_id');
foreach ($objIndex->termDocs($objSearchTerm) as $intDocId) {
$objIndex->delete($intDocId);
}
// Create the Message Contents for this Topic
$strContents = null;
foreach ($this->GetMessageArray(QQ::OrderBy(QQN::Message()->ReplyNumber)) as $objMessage) {
$strMessage = strip_tags(trim($objMessage->CompiledHtml));
$strMessage = html_entity_decode($strMessage, ENT_QUOTES, 'UTF-8');
$strContents .= $strMessage . "\r\n\r\n";
}
// Create the Document
$objDocument = new Zend_Search_Lucene_Document();
$objDocument->addField(Zend_Search_Lucene_Field::Keyword('db_id', $this->Id));
$objDocument->addField(Zend_Search_Lucene_Field::UnIndexed('topic_link_id', $this->TopicLinkId));
$objDocument->addField(Zend_Search_Lucene_Field::UnIndexed('topic_link_type_id', $this->TopicLink->TopicLinkTypeId));
$objDocument->addField(Zend_Search_Lucene_Field::UnIndexed('message_count', $this->MessageCount));
$objDocument->addField(Zend_Search_Lucene_Field::UnIndexed('last_post_date', $this->LastPostDate->Timestamp));
$objDocument->addField(Zend_Search_Lucene_Field::Text('title', $this->Name));
$objDocument->addField(Zend_Search_Lucene_Field::UnStored('contents', trim($strContents)));
// Add Document to Index
$objIndex->addDocument($objDocument);
// Only call commit on the index if it was provided for us
if (!$blnIndexProvided) {
$objIndex->commit();
}
}
示例7: ResolveContentItem
/**
* Used internally by the Meta-based Add Column tools.
*
* Given a QQNode or a Text String, this will return a Message-based QQNode.
* It will also verify that it is a proper Message-based QQNode, and will throw an exception otherwise.
*
* @param mixed $mixContent
* @return QQNode
*/
protected function ResolveContentItem($mixContent)
{
if ($mixContent instanceof QQNode) {
if (!$mixContent->_ParentNode) {
throw new QCallerException('Content QQNode cannot be a Top Level Node');
}
if ($mixContent->_RootTableName == 'message') {
if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) {
throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
}
$objCurrentNode = $mixContent;
while ($objCurrentNode = $objCurrentNode->_ParentNode) {
if (!$objCurrentNode instanceof QQNode) {
throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
}
if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) {
throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
}
}
return $mixContent;
} else {
throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "message".');
}
} else {
if (is_string($mixContent)) {
switch ($mixContent) {
case 'Id':
return QQN::Message()->Id;
case 'TopicId':
return QQN::Message()->TopicId;
case 'Topic':
return QQN::Message()->Topic;
case 'TopicLinkId':
return QQN::Message()->TopicLinkId;
case 'TopicLink':
return QQN::Message()->TopicLink;
case 'PersonId':
return QQN::Message()->PersonId;
case 'Person':
return QQN::Message()->Person;
case 'Message':
return QQN::Message()->Message;
case 'CompiledHtml':
return QQN::Message()->CompiledHtml;
case 'ReplyNumber':
return QQN::Message()->ReplyNumber;
case 'PostDate':
return QQN::Message()->PostDate;
default:
throw new QCallerException('Simple Property not found in MessageDataGrid content: ' . $mixContent);
}
} else {
if ($mixContent instanceof QQAssociationNode) {
throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
} else {
throw new QCallerException('Invalid Content type');
}
}
}
}
示例8: QRssFeed
<?php
require '../../includes/prepend.inc.php';
$objRss = new QRssFeed('Qcodo.com Forums RSS Feed', 'http://www.qcodo.com/forums/', 'The Qcodo forums attempts to provide a community to post, discuss, ask, and converse about the current state of the framework, as well as provide an opportunity for members to discuss the future direction of Qcodo.');
$objRss->Image = new QRssImage('http://www.qcodo.com/images/qcodo_smaller.png');
$objRss->PubDate = new QDateTime(QDateTime::Now);
$objMessageArray = Message::QueryArray(QQ::Equal(QQN::Message()->Topic->TopicLink->TopicLinkTypeId, TopicLinkType::Forum), QQ::Clause(QQ::OrderBy(QQN::Message()->PostDate, false), QQ::LimitInfo(25)));
foreach ($objMessageArray as $objMessage) {
$objTopic = $objMessage->Topic;
$strTitle = ($objTopic->CountMessages() > 1 ? 'Re: ' : '') . $objTopic->Name;
$strLink = 'http://www.qcodo.com/forums/forum.php/' . $objTopic->TopicLink->ForumId . '/' . $objTopic->Id . '/lastpage';
$strDescription = $objMessage->CompiledHtml;
$objItem = new QRssItem($strTitle, $strLink, $strDescription);
$objItem->Author = $objMessage->Person->DisplayName;
$objItem->Comments = $objItem->Link;
$objItem->PubDate = $objMessage->PostDate;
$objItem->Guid = $objItem->Link;
$objItem->GuidPermaLink = true;
$objItem->AddCategory(new QRssCategory($objTopic->TopicLink->Forum->Name));
$objRss->AddItem($objItem);
}
$objRss->Run();