コード例 #1
0
ファイル: datagen.cli.php プロジェクト: alcf/chms
 /**
  * Main DataGen Runner
  * @return void
  */
 public static function Run()
 {
     // Run "Fake Data" SQL Script
     $strFakeDataSql = file_get_contents(__DOCROOT__ . '/../database/fake_data.sql');
     foreach (explode("\n", $strFakeDataSql) as $strSql) {
         $strSql = trim($strSql);
         if (strlen($strSql) && substr($strSql, 0, 1) != '#') {
             Person::GetDatabase()->NonQuery($strSql);
         }
     }
     self::$SystemStartDate = new QDateTime('1990-01-01');
     self::$LifeStartDate = new QDateTime('1930-01-01');
     self::$OldestChildBirthDate = QDateTime::Now(false);
     self::$OldestChildBirthDate->Year -= 18;
     // Get Cached Data
     self::$CommentCategoryArray = CommentCategory::LoadAll();
     // Erase Directories
     exec('rm -r -f ' . __DOCROOT__ . '/../file_assets/head_shots');
     exec('rm -r -f ' . __DOCROOT__ . '/../file_assets/contribution_images');
     // Generate Stuff
     ChmsDataGen::GenerateMinistries();
     ChmsDataGen::GenerateUsers();
     ChmsDataGen::GenerateHouseholds();
     ChmsDataGen::GenerateStewardship();
     self::$MaxPersonId = Person::CountAll();
     ChmsDataGen::GenerateCommunicationLists();
     ChmsDataGen::GenerateGroups();
 }
コード例 #2
0
ファイル: edit.php プロジェクト: alcf/chms
 protected function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     $this->txtName->Text = trim($this->txtName->Text);
     $this->mctCommentCategory->SaveCommentCategory();
     CommentCategory::RefreshOrderNumber();
     $this->ReturnToList();
 }
コード例 #3
0
ファイル: CommentCategory.class.php プロジェクト: alcf/chms
 public function MoveDown()
 {
     $blnFound = false;
     foreach (CommentCategory::LoadAll(QQ::OrderBy(QQN::CommentCategory()->OrderNumber)) as $objObject) {
         if ($blnFound) {
             break;
         }
         if ($objObject->Id == $this->Id) {
             $blnFound = true;
         }
     }
     $this->OrderNumber++;
     $this->Save();
     if ($objObject) {
         $objObject->OrderNumber--;
         $objObject->Save();
     }
     self::RefreshOrderNumber();
 }
コード例 #4
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, CommentCategory::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
コード例 #5
0
ファイル: CommentGen.class.php プロジェクト: alcf/chms
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objPerson) {
         $objObject->objPerson = Person::GetSoapObjectFromObject($objObject->objPerson, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intPersonId = null;
         }
     }
     if ($objObject->objPostedByLogin) {
         $objObject->objPostedByLogin = Login::GetSoapObjectFromObject($objObject->objPostedByLogin, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intPostedByLoginId = null;
         }
     }
     if ($objObject->objCommentCategory) {
         $objObject->objCommentCategory = CommentCategory::GetSoapObjectFromObject($objObject->objCommentCategory, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intCommentCategoryId = null;
         }
     }
     if ($objObject->dttDatePosted) {
         $objObject->dttDatePosted = $objObject->dttDatePosted->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->dttDateAction) {
         $objObject->dttDateAction = $objObject->dttDateAction->__toString(QDateTime::FormatSoap);
     }
     return $objObject;
 }
コード例 #6
0
 /**
  * Refresh this MetaControl with Data from the local Comment object.
  * @param boolean $blnReload reload Comment from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objComment->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objComment->Id;
         }
     }
     if ($this->lstPerson) {
         $this->lstPerson->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstPerson->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objPersonArray = Person::LoadAll();
         if ($objPersonArray) {
             foreach ($objPersonArray as $objPerson) {
                 $objListItem = new QListItem($objPerson->__toString(), $objPerson->Id);
                 if ($this->objComment->Person && $this->objComment->Person->Id == $objPerson->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPerson->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPersonId) {
         $this->lblPersonId->Text = $this->objComment->Person ? $this->objComment->Person->__toString() : null;
     }
     if ($this->lstPostedByLogin) {
         $this->lstPostedByLogin->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstPostedByLogin->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objPostedByLoginArray = Login::LoadAll();
         if ($objPostedByLoginArray) {
             foreach ($objPostedByLoginArray as $objPostedByLogin) {
                 $objListItem = new QListItem($objPostedByLogin->__toString(), $objPostedByLogin->Id);
                 if ($this->objComment->PostedByLogin && $this->objComment->PostedByLogin->Id == $objPostedByLogin->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPostedByLogin->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPostedByLoginId) {
         $this->lblPostedByLoginId->Text = $this->objComment->PostedByLogin ? $this->objComment->PostedByLogin->__toString() : null;
     }
     if ($this->lstCommentPrivacyType) {
         $this->lstCommentPrivacyType->SelectedValue = $this->objComment->CommentPrivacyTypeId;
     }
     if ($this->lblCommentPrivacyTypeId) {
         $this->lblCommentPrivacyTypeId->Text = $this->objComment->CommentPrivacyTypeId ? CommentPrivacyType::$NameArray[$this->objComment->CommentPrivacyTypeId] : null;
     }
     if ($this->lstCommentCategory) {
         $this->lstCommentCategory->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstCommentCategory->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objCommentCategoryArray = CommentCategory::LoadAll();
         if ($objCommentCategoryArray) {
             foreach ($objCommentCategoryArray as $objCommentCategory) {
                 $objListItem = new QListItem($objCommentCategory->__toString(), $objCommentCategory->Id);
                 if ($this->objComment->CommentCategory && $this->objComment->CommentCategory->Id == $objCommentCategory->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCommentCategory->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCommentCategoryId) {
         $this->lblCommentCategoryId->Text = $this->objComment->CommentCategory ? $this->objComment->CommentCategory->__toString() : null;
     }
     if ($this->txtComment) {
         $this->txtComment->Text = $this->objComment->Comment;
     }
     if ($this->lblComment) {
         $this->lblComment->Text = $this->objComment->Comment;
     }
     if ($this->calDatePosted) {
         $this->calDatePosted->DateTime = $this->objComment->DatePosted;
     }
     if ($this->lblDatePosted) {
         $this->lblDatePosted->Text = sprintf($this->objComment->DatePosted) ? $this->objComment->__toString($this->strDatePostedDateTimeFormat) : null;
     }
     if ($this->calDateAction) {
         $this->calDateAction->DateTime = $this->objComment->DateAction;
     }
     if ($this->lblDateAction) {
         $this->lblDateAction->Text = sprintf($this->objComment->DateAction) ? $this->objComment->__toString($this->strDateActionDateTimeFormat) : null;
     }
 }
コード例 #7
0
 /**
  * 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 = CommentCategory::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 CommentCategory, given the clauses above
     $this->DataSource = CommentCategory::QueryArray($objCondition, $objClauses);
 }
コード例 #8
0
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this CommentCategoryMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing CommentCategory object creation - defaults to CreateOrEdit
  * @return CommentCategoryMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objCommentCategory = CommentCategory::Load($intId);
         // CommentCategory was found -- return it!
         if ($objCommentCategory) {
             return new CommentCategoryMetaControl($objParentObject, $objCommentCategory);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a CommentCategory object with PK arguments: ' . $intId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new CommentCategoryMetaControl($objParentObject, new CommentCategory());
 }
コード例 #9
0
ファイル: index.php プロジェクト: alcf/chms
 public function pxyMoveUp_Click($strFormId, $strControlId, $strParameter)
 {
     $objObject = CommentCategory::Load($strParameter);
     $objObject->MoveUp();
     $this->dtgCategories->Refresh();
 }