/**
  * Refresh this MetaControl with Data from the local TopicLink object.
  * @param boolean $blnReload reload TopicLink from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objTopicLink->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objTopicLink->Id;
         }
     }
     if ($this->lstTopicLinkType) {
         $this->lstTopicLinkType->SelectedValue = $this->objTopicLink->TopicLinkTypeId;
     }
     if ($this->lblTopicLinkTypeId) {
         $this->lblTopicLinkTypeId->Text = $this->objTopicLink->TopicLinkTypeId ? TopicLinkType::$NameArray[$this->objTopicLink->TopicLinkTypeId] : null;
     }
     if ($this->txtTopicCount) {
         $this->txtTopicCount->Text = $this->objTopicLink->TopicCount;
     }
     if ($this->lblTopicCount) {
         $this->lblTopicCount->Text = $this->objTopicLink->TopicCount;
     }
     if ($this->txtMessageCount) {
         $this->txtMessageCount->Text = $this->objTopicLink->MessageCount;
     }
     if ($this->lblMessageCount) {
         $this->lblMessageCount->Text = $this->objTopicLink->MessageCount;
     }
     if ($this->calLastPostDate) {
         $this->calLastPostDate->DateTime = $this->objTopicLink->LastPostDate;
     }
     if ($this->lblLastPostDate) {
         $this->lblLastPostDate->Text = sprintf($this->objTopicLink->LastPostDate) ? $this->objTopicLink->__toString($this->strLastPostDateDateTimeFormat) : null;
     }
     if ($this->lstForum) {
         $this->lstForum->RemoveAllItems();
         $this->lstForum->AddItem(QApplication::Translate('- Select One -'), null);
         $objForumArray = Forum::LoadAll();
         if ($objForumArray) {
             foreach ($objForumArray as $objForum) {
                 $objListItem = new QListItem($objForum->__toString(), $objForum->Id);
                 if ($this->objTopicLink->Forum && $this->objTopicLink->Forum->Id == $objForum->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstForum->AddItem($objListItem);
             }
         }
     }
     if ($this->lblForumId) {
         $this->lblForumId->Text = $this->objTopicLink->Forum ? $this->objTopicLink->Forum->__toString() : null;
     }
     if ($this->lstIssue) {
         $this->lstIssue->RemoveAllItems();
         $this->lstIssue->AddItem(QApplication::Translate('- Select One -'), null);
         $objIssueArray = Issue::LoadAll();
         if ($objIssueArray) {
             foreach ($objIssueArray as $objIssue) {
                 $objListItem = new QListItem($objIssue->__toString(), $objIssue->Id);
                 if ($this->objTopicLink->Issue && $this->objTopicLink->Issue->Id == $objIssue->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstIssue->AddItem($objListItem);
             }
         }
     }
     if ($this->lblIssueId) {
         $this->lblIssueId->Text = $this->objTopicLink->Issue ? $this->objTopicLink->Issue->__toString() : null;
     }
     if ($this->lstWikiItem) {
         $this->lstWikiItem->RemoveAllItems();
         $this->lstWikiItem->AddItem(QApplication::Translate('- Select One -'), null);
         $objWikiItemArray = WikiItem::LoadAll();
         if ($objWikiItemArray) {
             foreach ($objWikiItemArray as $objWikiItem) {
                 $objListItem = new QListItem($objWikiItem->__toString(), $objWikiItem->Id);
                 if ($this->objTopicLink->WikiItem && $this->objTopicLink->WikiItem->Id == $objWikiItem->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstWikiItem->AddItem($objListItem);
             }
         }
     }
     if ($this->lblWikiItemId) {
         $this->lblWikiItemId->Text = $this->objTopicLink->WikiItem ? $this->objTopicLink->WikiItem->__toString() : null;
     }
     if ($this->lstPackage) {
         $this->lstPackage->RemoveAllItems();
         $this->lstPackage->AddItem(QApplication::Translate('- Select One -'), null);
         $objPackageArray = Package::LoadAll();
         if ($objPackageArray) {
             foreach ($objPackageArray as $objPackage) {
                 $objListItem = new QListItem($objPackage->__toString(), $objPackage->Id);
                 if ($this->objTopicLink->Package && $this->objTopicLink->Package->Id == $objPackage->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPackage->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPackageId) {
         $this->lblPackageId->Text = $this->objTopicLink->Package ? $this->objTopicLink->Package->__toString() : null;
     }
 }
示例#2
0
 protected function Form_PreRender()
 {
     $this->dtrForums->DataSource = Forum::LoadAll(QQ::OrderBy(QQN::Forum()->OrderNumber));
 }
示例#3
0
    for ($intIndex = 0; $intIndex < $intCount; $intIndex++) {
        // If first message, the person who posted is the one who posts the first message
        $objPerson = $intIndex == 0 ? $objIssue->PostedByPerson : Person::Load(rand(1, $intMaxPersonId));
        // Get a random Message PostDate relatively close to the current dttpostdate we're iterating through
        $dttEndRange = QDataGen::GenerateDateTime($dttPostDate, QDateTime::Now());
        $dttEndRange = QDataGen::GenerateDateTime($dttPostDate, $dttEndRange);
        $dttEndRange = QDataGen::GenerateDateTime($dttPostDate, $dttEndRange);
        $dttPostDate = $intIndex == 0 ? new QDateTime($objIssue->PostDate) : QDataGen::GenerateDateTime($dttPostDate, $dttEndRange);
        $objIssue->PostMessage(QDataGen::GenerateContent(rand(1, 3), 10, 30), $objPerson, $dttPostDate);
    }
}
QDataGen::DisplayForEachTaskEnd($strTitle);
//////////////////////
// Forum Topics
//////////////////////
$objForumArray = Forum::LoadAll();
$objForumTopicArray = array();
while (QDataGen::DisplayWhileTask('Generating Forum Topics', GENERATE_FORUM_TOPICS)) {
    $objForum = QDataGen::GenerateFromArray($objForumArray);
    $strName = QDataGen::GenerateTitle(4, 12);
    $strFirstMessageText = QDataGen::GenerateContent(rand(1, 5));
    $objPerson = Person::Load(rand(1, $intMaxPersonId));
    $dttDateTime = QDataGen::GenerateDateTime($dttStartDate, QDateTime::Now());
    $objTopic = $objForum->PostTopic($strName, $strFirstMessageText, $objPerson, $dttDateTime);
    $objForumTopicArray[] = $objTopic;
}
//////////////////////
// Qcodo Package Manager
//////////////////////
$objPackageCategories = PackageCategory::QueryArray(QQ::NotEqual(QQN::PackageCategory()->Token, 'issues'));
while (QDataGen::DisplayWhileTask('Generating QPM Packages...', GENERATE_QPM)) {
 public function EditMessage(Message $objMessage)
 {
     $this->mctMessage->ReplaceObject($objMessage);
     $this->ShowDialogBox();
     // Does the Topic for this Message Already Exist?
     if ($objMessage->TopicId) {
         $this->txtTopicName->Text = $objMessage->Topic->Name;
         $this->txtTopicName->Enabled = false;
         // If so, we need to call a helper method for the TopicLinkType for this Topic
         switch ($objMessage->TopicLink->TopicLinkTypeId) {
             case TopicLinkType::Forum:
                 $this->EditMessageHelper_Forum($objMessage);
                 break;
             case TopicLinkType::Issue:
                 $this->EditMessageHelper_Issue($objMessage);
                 break;
             case TopicLinkType::WikiItem:
                 $this->EditMessageHelper_WikiItem($objMessage);
                 break;
             case TopicLinkType::Package:
                 $this->EditMessageHelper_Package($objMessage);
                 break;
             default:
                 throw new Exception('Unsupported TopicLinkTypeId: ' . $objMessage->TopicLink->TopicLinkTypeId);
         }
         $this->txtMessage->Focus();
         // Otherwise, we are looking at a NEW Topic -- this ONLY HAPPENS with Forum
     } else {
         $this->lblHeading->Text = 'Post a New Topic';
         $this->lstForum->RemoveAllItems();
         foreach (Forum::LoadAll(QQ::OrderBy(QQN::Forum()->OrderNumber)) as $objForum) {
             if ($objForum->CanUserPost(QApplication::$Person)) {
                 $this->lstForum->AddItem($objForum->Name, $objForum->Id, $objForum->Id == $objMessage->TopicLink->ForumId);
             }
         }
         $this->lstForum->Enabled = true;
         $this->txtTopicName->Text = null;
         $this->txtTopicName->Enabled = true;
         $this->blnEditMode = false;
         $this->btnOkay->Text = 'Post New Topic and Message';
         $this->txtTopicName->Focus();
     }
 }
 /**
  * Default / simple DataBinder for this Meta DataGrid.  This can easily be overridden
  * by calling SetDataBinder() on this DataGrid with another DataBinder of your choice.
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  */
 public function MetaDataBinder()
 {
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = Forum::CountAll();
     }
     // Setup the $objClauses Array
     $objClauses = array();
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from Forum, given the clauses above
     $this->DataSource = Forum::LoadAll($objClauses);
 }