示例#1
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objSignupEntry) {
         $objObject->objSignupEntry = SignupEntry::GetSoapObjectFromObject($objObject->objSignupEntry, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intSignupEntryId = null;
         }
     }
     if ($objObject->objClassMeeting) {
         $objObject->objClassMeeting = ClassMeeting::GetSoapObjectFromObject($objObject->objClassMeeting, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intClassMeetingId = null;
         }
     }
     if ($objObject->objPerson) {
         $objObject->objPerson = Person::GetSoapObjectFromObject($objObject->objPerson, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intPersonId = null;
         }
     }
     if ($objObject->objClassGrade) {
         $objObject->objClassGrade = ClassGrade::GetSoapObjectFromObject($objObject->objClassGrade, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intClassGradeId = null;
         }
     }
     return $objObject;
 }
示例#2
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, ClassGrade::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
示例#3
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 = ClassGrade::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 ClassGrade, given the clauses above
     $this->DataSource = ClassGrade::QueryArray($objCondition, $objClauses);
 }
 /**
  * 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 ClassGradeMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing ClassGrade object creation - defaults to CreateOrEdit
  * @return ClassGradeMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objClassGrade = ClassGrade::Load($intId);
         // ClassGrade was found -- return it!
         if ($objClassGrade) {
             return new ClassGradeMetaControl($objParentObject, $objClassGrade);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a ClassGrade 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 ClassGradeMetaControl($objParentObject, new ClassGrade());
 }
 /**
  * Refresh this MetaControl with Data from the local ClassRegistration object.
  * @param boolean $blnReload reload ClassRegistration from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objClassRegistration->Reload();
     }
     if ($this->lstSignupEntry) {
         $this->lstSignupEntry->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstSignupEntry->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objSignupEntryArray = SignupEntry::LoadAll();
         if ($objSignupEntryArray) {
             foreach ($objSignupEntryArray as $objSignupEntry) {
                 $objListItem = new QListItem($objSignupEntry->__toString(), $objSignupEntry->Id);
                 if ($this->objClassRegistration->SignupEntry && $this->objClassRegistration->SignupEntry->Id == $objSignupEntry->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSignupEntry->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSignupEntryId) {
         $this->lblSignupEntryId->Text = $this->objClassRegistration->SignupEntry ? $this->objClassRegistration->SignupEntry->__toString() : null;
     }
     if ($this->lstClassMeeting) {
         $this->lstClassMeeting->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstClassMeeting->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objClassMeetingArray = ClassMeeting::LoadAll();
         if ($objClassMeetingArray) {
             foreach ($objClassMeetingArray as $objClassMeeting) {
                 $objListItem = new QListItem($objClassMeeting->__toString(), $objClassMeeting->SignupFormId);
                 if ($this->objClassRegistration->ClassMeeting && $this->objClassRegistration->ClassMeeting->SignupFormId == $objClassMeeting->SignupFormId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstClassMeeting->AddItem($objListItem);
             }
         }
     }
     if ($this->lblClassMeetingId) {
         $this->lblClassMeetingId->Text = $this->objClassRegistration->ClassMeeting ? $this->objClassRegistration->ClassMeeting->__toString() : null;
     }
     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->objClassRegistration->Person && $this->objClassRegistration->Person->Id == $objPerson->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPerson->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPersonId) {
         $this->lblPersonId->Text = $this->objClassRegistration->Person ? $this->objClassRegistration->Person->__toString() : null;
     }
     if ($this->lstClassGrade) {
         $this->lstClassGrade->RemoveAllItems();
         $this->lstClassGrade->AddItem(QApplication::Translate('- Select One -'), null);
         $objClassGradeArray = ClassGrade::LoadAll();
         if ($objClassGradeArray) {
             foreach ($objClassGradeArray as $objClassGrade) {
                 $objListItem = new QListItem($objClassGrade->__toString(), $objClassGrade->Id);
                 if ($this->objClassRegistration->ClassGrade && $this->objClassRegistration->ClassGrade->Id == $objClassGrade->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstClassGrade->AddItem($objListItem);
             }
         }
     }
     if ($this->lblClassGradeId) {
         $this->lblClassGradeId->Text = $this->objClassRegistration->ClassGrade ? $this->objClassRegistration->ClassGrade->__toString() : null;
     }
     if ($this->txtChildcareNotes) {
         $this->txtChildcareNotes->Text = $this->objClassRegistration->ChildcareNotes;
     }
     if ($this->lblChildcareNotes) {
         $this->lblChildcareNotes->Text = $this->objClassRegistration->ChildcareNotes;
     }
 }