/** * 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 = WikiItem::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 WikiItem, given the clauses above $this->DataSource = WikiItem::LoadAll($objClauses); }
$objWikiObject = new WikiFile(); $objWikiObject->Description = QDataGen::GenerateContent(rand(1, 3), 10, 50); $strPath = QDataGen::GenerateFromArray($strRandomFilePathArray); $strArray = pathinfo($strPath); $strFileName = str_replace(' ', '', $strName) . '.' . $strArray['extension']; $strMethodName = 'SaveFile'; $arrMethodParameters = array($strPath, $strFileName); break; default: throw new Exception('Unknown handler for WikiItemTypeId: ' . $objWikiItem->WikiItemTypeId); } $objWikiItem->CreateNewVersion($strName, $objWikiObject, $strMethodName, $arrMethodParameters, $objPerson, $dttPostDate); } } // Generate Messages for Wiki QDataGen::DisplayForEachTaskStart($strTitle = 'Generating Messages for Wiki', WikiItem::CountAll()); foreach (WikiItem::LoadAll() as $objWikiItem) { QDataGen::DisplayForEachTaskNext($strTitle); $intCount = rand(1, GENERATE_MESSAGES_PER_WIKI_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); } if (rand(0, 1)) { $intCount = round($intCount / 2); }