/**
  * Load an array of PackageCategory objects,
  * by ParentPackageCategoryId Index(es)
  * @param integer $intParentPackageCategoryId
  * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  * @return PackageCategory[]
  */
 public static function LoadArrayByParentPackageCategoryId($intParentPackageCategoryId, $objOptionalClauses = null)
 {
     // Call PackageCategory::QueryArray to perform the LoadArrayByParentPackageCategoryId query
     try {
         return PackageCategory::QueryArray(QQ::Equal(QQN::PackageCategory()->ParentPackageCategoryId, $intParentPackageCategoryId), $objOptionalClauses);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * 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).
  *
  * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
  * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query		 
  * @return void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = PackageCategory::QueryCount($objCondition, $objClauses);
     }
     // 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::QueryArray($objCondition, $objClauses);
 }
Esempio n. 3
0
//////////////////////
$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)) {
    $objPackage = new Package();
    $objPackage->PackageCategory = QDataGen::GenerateFromArray($objPackageCategories);
    $objPackage->Name = QDataGen::GenerateTitle(1, 3);
    $objPackage->Token = Package::SanitizeForToken($objPackage->Name);
    while (Package::LoadByToken($objPackage->Token)) {
        $objPackage->Name = QDataGen::GenerateTitle(1, 3);
        $objPackage->Token = Package::SanitizeForToken($objPackage->Name);
    }
    $objPackage->Description = QDataGen::GenerateContent(rand(1, 3), 20, 80);
    $objPackage->Save();
    $objPackage->CreateTopicAndTopicLink(Person::Load(rand(1, $intMaxPersonId)));
    $intContributionCount = rand(1, 10);
    for ($intContribution = 0; $intContribution < $intContributionCount; $intContribution++) {
        while (PackageContribution::LoadByPackageIdPersonId($objPackage->Id, $objPerson->Id)) {