예제 #1
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 = ClassTerm::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 ClassTerm, given the clauses above
     $this->DataSource = ClassTerm::QueryArray($objCondition, $objClauses);
 }
예제 #2
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 ClassTermMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing ClassTerm object creation - defaults to CreateOrEdit
  * @return ClassTermMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objClassTerm = ClassTerm::Load($intId);
         // ClassTerm was found -- return it!
         if ($objClassTerm) {
             return new ClassTermMetaControl($objParentObject, $objClassTerm);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a ClassTerm 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 ClassTermMetaControl($objParentObject, new ClassTerm());
 }
예제 #3
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, ClassTerm::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
 /**
  * Refresh this MetaControl with Data from the local ClassMeeting object.
  * @param boolean $blnReload reload ClassMeeting from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objClassMeeting->Reload();
     }
     if ($this->lstSignupForm) {
         $this->lstSignupForm->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstSignupForm->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objSignupFormArray = SignupForm::LoadAll();
         if ($objSignupFormArray) {
             foreach ($objSignupFormArray as $objSignupForm) {
                 $objListItem = new QListItem($objSignupForm->__toString(), $objSignupForm->Id);
                 if ($this->objClassMeeting->SignupForm && $this->objClassMeeting->SignupForm->Id == $objSignupForm->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSignupForm->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSignupFormId) {
         $this->lblSignupFormId->Text = $this->objClassMeeting->SignupForm ? $this->objClassMeeting->SignupForm->__toString() : null;
     }
     if ($this->lstClassTerm) {
         $this->lstClassTerm->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstClassTerm->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objClassTermArray = ClassTerm::LoadAll();
         if ($objClassTermArray) {
             foreach ($objClassTermArray as $objClassTerm) {
                 $objListItem = new QListItem($objClassTerm->__toString(), $objClassTerm->Id);
                 if ($this->objClassMeeting->ClassTerm && $this->objClassMeeting->ClassTerm->Id == $objClassTerm->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstClassTerm->AddItem($objListItem);
             }
         }
     }
     if ($this->lblClassTermId) {
         $this->lblClassTermId->Text = $this->objClassMeeting->ClassTerm ? $this->objClassMeeting->ClassTerm->__toString() : null;
     }
     if ($this->lstClassCourse) {
         $this->lstClassCourse->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstClassCourse->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objClassCourseArray = ClassCourse::LoadAll();
         if ($objClassCourseArray) {
             foreach ($objClassCourseArray as $objClassCourse) {
                 $objListItem = new QListItem($objClassCourse->__toString(), $objClassCourse->Id);
                 if ($this->objClassMeeting->ClassCourse && $this->objClassMeeting->ClassCourse->Id == $objClassCourse->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstClassCourse->AddItem($objListItem);
             }
         }
     }
     if ($this->lblClassCourseId) {
         $this->lblClassCourseId->Text = $this->objClassMeeting->ClassCourse ? $this->objClassMeeting->ClassCourse->__toString() : null;
     }
     if ($this->lstClassInstructor) {
         $this->lstClassInstructor->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstClassInstructor->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objClassInstructorArray = ClassInstructor::LoadAll();
         if ($objClassInstructorArray) {
             foreach ($objClassInstructorArray as $objClassInstructor) {
                 $objListItem = new QListItem($objClassInstructor->__toString(), $objClassInstructor->Id);
                 if ($this->objClassMeeting->ClassInstructor && $this->objClassMeeting->ClassInstructor->Id == $objClassInstructor->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstClassInstructor->AddItem($objListItem);
             }
         }
     }
     if ($this->lblClassInstructorId) {
         $this->lblClassInstructorId->Text = $this->objClassMeeting->ClassInstructor ? $this->objClassMeeting->ClassInstructor->__toString() : null;
     }
     if ($this->calDateStart) {
         $this->calDateStart->DateTime = $this->objClassMeeting->DateStart;
     }
     if ($this->lblDateStart) {
         $this->lblDateStart->Text = sprintf($this->objClassMeeting->DateStart) ? $this->objClassMeeting->__toString($this->strDateStartDateTimeFormat) : null;
     }
     if ($this->calDateEnd) {
         $this->calDateEnd->DateTime = $this->objClassMeeting->DateEnd;
     }
     if ($this->lblDateEnd) {
         $this->lblDateEnd->Text = sprintf($this->objClassMeeting->DateEnd) ? $this->objClassMeeting->__toString($this->strDateEndDateTimeFormat) : null;
     }
     if ($this->txtLocation) {
         $this->txtLocation->Text = $this->objClassMeeting->Location;
     }
     if ($this->lblLocation) {
         $this->lblLocation->Text = $this->objClassMeeting->Location;
     }
     if ($this->txtMeetingDay) {
         $this->txtMeetingDay->Text = $this->objClassMeeting->MeetingDay;
     }
     if ($this->lblMeetingDay) {
         $this->lblMeetingDay->Text = $this->objClassMeeting->MeetingDay;
     }
     if ($this->txtMeetingStartTime) {
         $this->txtMeetingStartTime->Text = $this->objClassMeeting->MeetingStartTime;
     }
     if ($this->lblMeetingStartTime) {
         $this->lblMeetingStartTime->Text = $this->objClassMeeting->MeetingStartTime;
     }
     if ($this->txtMeetingEndTime) {
         $this->txtMeetingEndTime->Text = $this->objClassMeeting->MeetingEndTime;
     }
     if ($this->lblMeetingEndTime) {
         $this->lblMeetingEndTime->Text = $this->objClassMeeting->MeetingEndTime;
     }
 }
예제 #5
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objSignupForm) {
         $objObject->objSignupForm = SignupForm::GetSoapObjectFromObject($objObject->objSignupForm, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intSignupFormId = null;
         }
     }
     if ($objObject->objClassTerm) {
         $objObject->objClassTerm = ClassTerm::GetSoapObjectFromObject($objObject->objClassTerm, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intClassTermId = null;
         }
     }
     if ($objObject->objClassCourse) {
         $objObject->objClassCourse = ClassCourse::GetSoapObjectFromObject($objObject->objClassCourse, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intClassCourseId = null;
         }
     }
     if ($objObject->objClassInstructor) {
         $objObject->objClassInstructor = ClassInstructor::GetSoapObjectFromObject($objObject->objClassInstructor, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intClassInstructorId = null;
         }
     }
     if ($objObject->dttDateStart) {
         $objObject->dttDateStart = $objObject->dttDateStart->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->dttDateEnd) {
         $objObject->dttDateEnd = $objObject->dttDateEnd->__toString(QDateTime::FormatSoap);
     }
     return $objObject;
 }