/** * Refresh this MetaControl with Data from the local Package object. * @param boolean $blnReload reload Package from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objPackage->Reload(); } if ($this->lblId) { if ($this->blnEditMode) { $this->lblId->Text = $this->objPackage->Id; } } if ($this->lstPackageCategory) { $this->lstPackageCategory->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstPackageCategory->AddItem(QApplication::Translate('- Select One -'), null); } $objPackageCategoryArray = PackageCategory::LoadAll(); if ($objPackageCategoryArray) { foreach ($objPackageCategoryArray as $objPackageCategory) { $objListItem = new QListItem($objPackageCategory->__toString(), $objPackageCategory->Id); if ($this->objPackage->PackageCategory && $this->objPackage->PackageCategory->Id == $objPackageCategory->Id) { $objListItem->Selected = true; } $this->lstPackageCategory->AddItem($objListItem); } } } if ($this->lblPackageCategoryId) { $this->lblPackageCategoryId->Text = $this->objPackage->PackageCategory ? $this->objPackage->PackageCategory->__toString() : null; } if ($this->txtToken) { $this->txtToken->Text = $this->objPackage->Token; } if ($this->lblToken) { $this->lblToken->Text = $this->objPackage->Token; } if ($this->txtName) { $this->txtName->Text = $this->objPackage->Name; } if ($this->lblName) { $this->lblName->Text = $this->objPackage->Name; } if ($this->txtDescription) { $this->txtDescription->Text = $this->objPackage->Description; } if ($this->lblDescription) { $this->lblDescription->Text = $this->objPackage->Description; } if ($this->calLastPostDate) { $this->calLastPostDate->DateTime = $this->objPackage->LastPostDate; } if ($this->lblLastPostDate) { $this->lblLastPostDate->Text = sprintf($this->objPackage->LastPostDate) ? $this->objPackage->__toString($this->strLastPostDateDateTimeFormat) : null; } if ($this->lstLastPostedByPerson) { $this->lstLastPostedByPerson->RemoveAllItems(); $this->lstLastPostedByPerson->AddItem(QApplication::Translate('- Select One -'), null); $objLastPostedByPersonArray = Person::LoadAll(); if ($objLastPostedByPersonArray) { foreach ($objLastPostedByPersonArray as $objLastPostedByPerson) { $objListItem = new QListItem($objLastPostedByPerson->__toString(), $objLastPostedByPerson->Id); if ($this->objPackage->LastPostedByPerson && $this->objPackage->LastPostedByPerson->Id == $objLastPostedByPerson->Id) { $objListItem->Selected = true; } $this->lstLastPostedByPerson->AddItem($objListItem); } } } if ($this->lblLastPostedByPersonId) { $this->lblLastPostedByPersonId->Text = $this->objPackage->LastPostedByPerson ? $this->objPackage->LastPostedByPerson->__toString() : null; } if ($this->lstTopicLink) { $this->lstTopicLink->RemoveAllItems(); $this->lstTopicLink->AddItem(QApplication::Translate('- Select One -'), null); $objTopicLinkArray = TopicLink::LoadAll(); if ($objTopicLinkArray) { foreach ($objTopicLinkArray as $objTopicLink) { $objListItem = new QListItem($objTopicLink->__toString(), $objTopicLink->Id); if ($objTopicLink->PackageId == $this->objPackage->Id) { $objListItem->Selected = true; } $this->lstTopicLink->AddItem($objListItem); } } } if ($this->lblTopicLink) { $this->lblTopicLink->Text = $this->objPackage->TopicLink ? $this->objPackage->TopicLink->__toString() : null; } }
/** * 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 = PackageCategory::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 PackageCategory, given the clauses above $this->DataSource = PackageCategory::LoadAll($objClauses); }
protected function dtrPackageCategories_Bind() { $this->dtrPackageCategories->DataSource = PackageCategory::LoadAll(QQ::OrderBy(QQN::PackageCategory()->OrderNumber)); }
$strQpmXml .= '<changedFiles>'; for ($intFileCount = 0; $intFileCount < $intChangedFileCount; $intFileCount++) { $strContent = QDataGen::GenerateContent(rand(1, 3), 20, 80); $strQpmXml .= sprintf('<file directoryToken="__FOOBAR__" path="some/random/path.txt" md5="%s">%s</file>', md5($strContent), base64_encode($strContent)); } $strQpmXml .= '</changedFiles>'; $strQpmXml .= '</package></qpm>'; $objPackage->PostContributionVersion($objPerson, $strQpmXml, $dttPostDate); $dttEndRange = QDataGen::GenerateDateTime($dttPostDate, QDateTime::Now()); $dttEndRange = QDataGen::GenerateDateTime($dttPostDate, $dttEndRange); $dttEndRange = QDataGen::GenerateDateTime($dttPostDate, $dttEndRange); $dttPostDate = QDataGen::GenerateDateTime($dttPostDate, $dttEndRange); } } } foreach (PackageCategory::LoadAll() as $objCategory) { $objCategory->RefreshStats(); } // Generate Messages for Packages QDataGen::DisplayForEachTaskStart($strTitle = 'Generating Messages for QPM Packages', Package::CountAll()); foreach (Package::LoadAll() as $objPackage) { QDataGen::DisplayForEachTaskNext($strTitle); $intCount = rand(1, GENERATE_MESSAGES_PER_PACKAGE_UBOUND); if (rand(0, 1)) { $intCount = round($intCount / 2); } if (rand(0, 1)) { $intCount = round($intCount / 2); } if (rand(0, 1)) { $intCount = round($intCount / 2);