/**
  * Refresh this MetaControl with Data from the local WikiVersion object.
  * @param boolean $blnReload reload WikiVersion from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objWikiVersion->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objWikiVersion->Id;
         }
     }
     if ($this->lstWikiItem) {
         $this->lstWikiItem->RemoveAllItems();
         if (!$this->blnEditMode) {
             $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->objWikiVersion->WikiItem && $this->objWikiVersion->WikiItem->Id == $objWikiItem->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstWikiItem->AddItem($objListItem);
             }
         }
     }
     if ($this->lblWikiItemId) {
         $this->lblWikiItemId->Text = $this->objWikiVersion->WikiItem ? $this->objWikiVersion->WikiItem->__toString() : null;
     }
     if ($this->txtVersionNumber) {
         $this->txtVersionNumber->Text = $this->objWikiVersion->VersionNumber;
     }
     if ($this->lblVersionNumber) {
         $this->lblVersionNumber->Text = $this->objWikiVersion->VersionNumber;
     }
     if ($this->txtName) {
         $this->txtName->Text = $this->objWikiVersion->Name;
     }
     if ($this->lblName) {
         $this->lblName->Text = $this->objWikiVersion->Name;
     }
     if ($this->lstPostedByPerson) {
         $this->lstPostedByPerson->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstPostedByPerson->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objPostedByPersonArray = Person::LoadAll();
         if ($objPostedByPersonArray) {
             foreach ($objPostedByPersonArray as $objPostedByPerson) {
                 $objListItem = new QListItem($objPostedByPerson->__toString(), $objPostedByPerson->Id);
                 if ($this->objWikiVersion->PostedByPerson && $this->objWikiVersion->PostedByPerson->Id == $objPostedByPerson->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPostedByPerson->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPostedByPersonId) {
         $this->lblPostedByPersonId->Text = $this->objWikiVersion->PostedByPerson ? $this->objWikiVersion->PostedByPerson->__toString() : null;
     }
     if ($this->calPostDate) {
         $this->calPostDate->DateTime = $this->objWikiVersion->PostDate;
     }
     if ($this->lblPostDate) {
         $this->lblPostDate->Text = sprintf($this->objWikiVersion->PostDate) ? $this->objWikiVersion->__toString($this->strPostDateDateTimeFormat) : null;
     }
     if ($this->lstWikiFile) {
         $this->lstWikiFile->RemoveAllItems();
         $this->lstWikiFile->AddItem(QApplication::Translate('- Select One -'), null);
         $objWikiFileArray = WikiFile::LoadAll();
         if ($objWikiFileArray) {
             foreach ($objWikiFileArray as $objWikiFile) {
                 $objListItem = new QListItem($objWikiFile->__toString(), $objWikiFile->WikiVersionId);
                 if ($objWikiFile->WikiVersionId == $this->objWikiVersion->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstWikiFile->AddItem($objListItem);
             }
         }
         // Because WikiFile's WikiFile is not null, if a value is already selected, it cannot be changed.
         if ($this->lstWikiFile->SelectedValue) {
             $this->lstWikiFile->Enabled = false;
         } else {
             $this->lstWikiFile->Enabled = true;
         }
     }
     if ($this->lblWikiFile) {
         $this->lblWikiFile->Text = $this->objWikiVersion->WikiFile ? $this->objWikiVersion->WikiFile->__toString() : null;
     }
     if ($this->lstWikiImage) {
         $this->lstWikiImage->RemoveAllItems();
         $this->lstWikiImage->AddItem(QApplication::Translate('- Select One -'), null);
         $objWikiImageArray = WikiImage::LoadAll();
         if ($objWikiImageArray) {
             foreach ($objWikiImageArray as $objWikiImage) {
                 $objListItem = new QListItem($objWikiImage->__toString(), $objWikiImage->WikiVersionId);
                 if ($objWikiImage->WikiVersionId == $this->objWikiVersion->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstWikiImage->AddItem($objListItem);
             }
         }
         // Because WikiImage's WikiImage is not null, if a value is already selected, it cannot be changed.
         if ($this->lstWikiImage->SelectedValue) {
             $this->lstWikiImage->Enabled = false;
         } else {
             $this->lstWikiImage->Enabled = true;
         }
     }
     if ($this->lblWikiImage) {
         $this->lblWikiImage->Text = $this->objWikiVersion->WikiImage ? $this->objWikiVersion->WikiImage->__toString() : null;
     }
     if ($this->lstWikiItemAsCurrent) {
         $this->lstWikiItemAsCurrent->RemoveAllItems();
         $this->lstWikiItemAsCurrent->AddItem(QApplication::Translate('- Select One -'), null);
         $objWikiItemArray = WikiItem::LoadAll();
         if ($objWikiItemArray) {
             foreach ($objWikiItemArray as $objWikiItem) {
                 $objListItem = new QListItem($objWikiItem->__toString(), $objWikiItem->Id);
                 if ($objWikiItem->CurrentWikiVersionId == $this->objWikiVersion->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstWikiItemAsCurrent->AddItem($objListItem);
             }
         }
     }
     if ($this->lblWikiItemAsCurrent) {
         $this->lblWikiItemAsCurrent->Text = $this->objWikiVersion->WikiItemAsCurrent ? $this->objWikiVersion->WikiItemAsCurrent->__toString() : null;
     }
     if ($this->lstWikiPage) {
         $this->lstWikiPage->RemoveAllItems();
         $this->lstWikiPage->AddItem(QApplication::Translate('- Select One -'), null);
         $objWikiPageArray = WikiPage::LoadAll();
         if ($objWikiPageArray) {
             foreach ($objWikiPageArray as $objWikiPage) {
                 $objListItem = new QListItem($objWikiPage->__toString(), $objWikiPage->WikiVersionId);
                 if ($objWikiPage->WikiVersionId == $this->objWikiVersion->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstWikiPage->AddItem($objListItem);
             }
         }
         // Because WikiPage's WikiPage is not null, if a value is already selected, it cannot be changed.
         if ($this->lstWikiPage->SelectedValue) {
             $this->lstWikiPage->Enabled = false;
         } else {
             $this->lstWikiPage->Enabled = true;
         }
     }
     if ($this->lblWikiPage) {
         $this->lblWikiPage->Text = $this->objWikiVersion->WikiPage ? $this->objWikiVersion->WikiPage->__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 = WikiFile::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 WikiFile, given the clauses above
     $this->DataSource = WikiFile::LoadAll($objClauses);
 }