本文整理汇总了PHP中Forum::Load方法的典型用法代码示例。如果您正苦于以下问题:PHP Forum::Load方法的具体用法?PHP Forum::Load怎么用?PHP Forum::Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forum
的用法示例。
在下文中一共展示了Forum::Load方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: btnOkay_Click
public function btnOkay_Click($strFormId, $strControlId, $strParameter)
{
$this->btnOkay->Enabled = true;
$blnNewTopic = false;
// Setup stuff if it's a NEW message being posted (either a NEW response or a NEW topic)
if (!$this->blnEditMode) {
// For NEW TOPIC in this Forum
if (!$this->mctMessage->Message->Topic) {
$objForum = Forum::Load($this->lstForum->SelectedValue);
$objNewTopic = $objForum->PostTopic(trim($this->txtTopicName->Text), trim($this->txtMessage->Text), QApplication::$Person);
QApplication::Redirect(sprintf('/forums/forum.php/%s/%s/', $objForum->Id, $objNewTopic->Id));
// Otherwise, it's a new POST in this TOPIC
} else {
$this->mctMessage->Message->PostDate = QDateTime::Now();
}
// Set the Reply Number for this New Message
$this->mctMessage->Message->ReplyNumber = $this->mctMessage->Message->Topic->GetNextReplyNumber();
}
// Save Everything Else
$this->mctMessage->SaveMessage();
$this->mctMessage->Message->RefreshCompiledHtml();
$this->mctMessage->SaveMessage();
// Refresh Stats and Stuff
$this->mctMessage->Message->Topic->RefreshStats();
$this->mctMessage->Message->Topic->RefreshSearchIndex();
$this->mctMessage->Message->TopicLink->RefreshStats();
// Send Alerts and Reset Read Flag on any NEW post
if (!$this->blnEditMode) {
$this->mctMessage->Message->SendAlerts();
$this->mctMessage->Message->Topic->UnassociateAllPeopleAsRead();
//Mark as read for poster
$this->mctMessage->Message->Topic->AssociatePersonAsRead(QApplication::$Person);
}
$this->ParentControl->CloseMessageDialog(true, !$this->blnEditMode);
}
示例2: Create
/**
* 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 ForumMetaControl
* @param integer $intId primary key value
* @param QMetaControlCreateType $intCreateType rules governing Forum object creation - defaults to CreateOrEdit
* @return ForumMetaControl
*/
public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
{
// Attempt to Load from PK Arguments
if (strlen($intId)) {
$objForum = Forum::Load($intId);
// Forum was found -- return it!
if ($objForum) {
return new ForumMetaControl($objParentObject, $objForum);
} else {
if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
throw new QCallerException('Could not find a Forum 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 ForumMetaControl($objParentObject, new Forum());
}
示例3: Form_Create
protected function Form_Create()
{
parent::Form_Create();
// Uses the MessagesPanel control for most of the DisplayMessages functionality
$this->pnlMessages = new MessagesPanel($this);
// Figure out the Forum, ViewState and Topic we are viewing
$this->objForum = Forum::Load(QApplication::PathInfo(0));
$this->CalculateViewState($strHeaderSmall, $strHeaderLarge);
// Update the MessagePanel Header template based on the View State
switch ($this->intViewState) {
case 4:
$this->pnlMessages->lblTopicInfo_SetTemplate(__INCLUDES__ . '/messages/lblTopicInfoWithForumName.tpl.php');
break;
case 1:
case 3:
case 5:
// No Topic is Selected -- therefore, no template
break;
default:
$this->pnlMessages->lblTopicInfo_SetTemplate(__INCLUDES__ . '/messages/lblTopicInfo.tpl.php');
break;
}
// Setup Controls
$this->lblHeader = new QLabel($this);
$this->lblHeader->HtmlEntities = false;
$this->lblHeader->Text = sprintf('<span style="font-weight: normal; font-size: 12px;">%s: </span> %s', $strHeaderSmall, $strHeaderLarge);
$this->lblDescription_Setup();
$this->btnPost_Setup();
$this->txtSearch = new SearchTextBox($this, 'txtSearch');
$this->txtSearch->Text = QApplication::QueryString('search');
$this->txtSearch->AddAction(new QChangeEvent(), new QAjaxAction('ExecuteSearch'));
$this->txtSearch->AddAction(new QEnterKeyEvent(), new QAjaxAction('ExecuteSearch'));
$this->txtSearch->AddAction(new QEnterKeyEvent(), new QTerminateAction());
$this->txtSearch->ActionParameter = $this->intViewState == 5 || $this->intViewState == 6;
$this->dtrTopics = new QDataRepeater($this, 'dtrTopics');
$this->dtrTopics->Template = 'dtrTopics.tpl.php';
$this->dtrTopics->SetDataBinder('dtrTopics_Bind');
$this->dtrTopics->Paginator = new ForumTopicsPaginator($this);
$this->dtrTopics->ItemsPerPage = 20;
$this->dtrTopics->UseAjax = true;
$this->pnlMessages->AddControlToRefreshOnUpdate($this->dtrTopics);
$this->pnlMessages->SetCallbackOnNewPost($this, 'dtrTopics_Reset');
if (QApplication::PathInfo(2) == 'lastpage') {
$this->pnlMessages->SetPageNumber(QPaginatedControl::LastPage);
}
// Search Stuff
$this->btnSearchAll = new RoundedLinkButton($this);
$this->btnSearchAll->Text = 'All Forums';
$this->btnSearchAll->CssClass = 'searchOption';
$this->btnSearchAll->ToolTip = 'Search all forums';
$this->btnSearchThis = new RoundedLinkButton($this);
$this->btnSearchThis->CssClass = 'searchOption';
if ($this->objForum) {
$this->btnSearchThis->Text = '"' . $this->objForum->Name . '"';
$this->btnSearchThis->ToolTip = 'Search within ' . $this->btnSearchThis->Text . ' forum';
} else {
if ($this->objTopic) {
if ($this->objTopic->TopicLink->Forum) {
$this->btnSearchThis->Text = '"' . $this->objTopic->TopicLink->Forum->Name . '"';
$this->btnSearchThis->ToolTip = 'Search within ' . $this->btnSearchThis->Text . ' forum';
} else {
$this->btnSearchThis->Text = '"Issues"';
$this->btnSearchThis->ToolTip = 'Search within ' . $this->btnSearchThis->Text . ' forum';
}
} else {
$this->btnSearchThis->Visible = false;
}
}
if (strlen(trim(QApplication::QueryString('search')))) {
if ($this->objForum && $this->objForum->Id == QApplication::PathInfo(0)) {
$this->btnSearchThis->AddCssClass('searchOptionActive');
} else {
$this->btnSearchAll->AddCssClass('searchOptionActive');
}
} else {
$this->btnSearchAll->Display = false;
$this->btnSearchThis->Display = false;
}
$this->btnSearchThis->AddAction(new QClickEvent(), new QAjaxAction('ExecuteSearch'));
$this->btnSearchThis->AddAction(new QClickEvent(), new QTerminateAction());
$this->btnSearchThis->ActionParameter = true;
$this->btnSearchAll->AddAction(new QClickEvent(), new QAjaxAction('ExecuteSearch'));
$this->btnSearchAll->AddAction(new QClickEvent(), new QTerminateAction());
$this->btnSearchAll->ActionParameter = false;
// Last Minute Cleanup
switch ($this->intViewState) {
case 3:
case 4:
$this->txtSearch->ActionParameter = false;
break;
default:
$this->txtSearch->ActionParameter = true;
break;
}
}
示例4: __get
/**
* 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) {
//.........这里部分代码省略.........
示例5: Reload
/**
* Reload this Forum 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 Forum object.');
}
// Reload the Object
$objReloaded = Forum::Load($this->intId);
// Update $this's local variables to match
$this->intOrderNumber = $objReloaded->intOrderNumber;
$this->strName = $objReloaded->strName;
$this->blnAnnounceOnlyFlag = $objReloaded->blnAnnounceOnlyFlag;
$this->strDescription = $objReloaded->strDescription;
}