/** * 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 ClassInstructorMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing ClassInstructor object creation - defaults to CreateOrEdit * @return ClassInstructorMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objClassInstructor = ClassInstructor::Load($intId); // ClassInstructor was found -- return it! if ($objClassInstructor) { return new ClassInstructorMetaControl($objParentObject, $objClassInstructor); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a ClassInstructor 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 ClassInstructorMetaControl($objParentObject, new ClassInstructor()); }
/** * 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 = ClassInstructor::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 ClassInstructor, given the clauses above $this->DataSource = ClassInstructor::QueryArray($objCondition, $objClauses); }
public static function GetSoapArrayFromArray($objArray) { if (!$objArray) { return null; } $objArrayToReturn = array(); foreach ($objArray as $objObject) { array_push($objArrayToReturn, ClassInstructor::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; } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'Id': // Gets the value for intId (Read-Only PK) // @return integer return $this->intId; case 'RoleTypeId': // Gets the value for intRoleTypeId (Not Null) // @return integer return $this->intRoleTypeId; case 'PermissionBitmap': // Gets the value for intPermissionBitmap // @return integer return $this->intPermissionBitmap; case 'Username': // Gets the value for strUsername (Unique) // @return string return $this->strUsername; case 'PasswordCache': // Gets the value for strPasswordCache // @return string return $this->strPasswordCache; case 'PasswordLastSet': // Gets the value for strPasswordLastSet // @return string return $this->strPasswordLastSet; case 'DateLastLogin': // Gets the value for dttDateLastLogin // @return QDateTime return $this->dttDateLastLogin; case 'DomainActiveFlag': // Gets the value for blnDomainActiveFlag // @return boolean return $this->blnDomainActiveFlag; case 'LoginActiveFlag': // Gets the value for blnLoginActiveFlag // @return boolean return $this->blnLoginActiveFlag; case 'Email': // Gets the value for strEmail (Unique) // @return string return $this->strEmail; case 'FirstName': // Gets the value for strFirstName // @return string return $this->strFirstName; case 'MiddleInitial': // Gets the value for strMiddleInitial // @return string return $this->strMiddleInitial; case 'LastName': // Gets the value for strLastName // @return string return $this->strLastName; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'ClassInstructor': // Gets the value for the ClassInstructor object that uniquely references this Login // by objClassInstructor (Unique) // @return ClassInstructor try { if ($this->objClassInstructor === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objClassInstructor) { $this->objClassInstructor = ClassInstructor::LoadByLoginId($this->intId); } return $this->objClassInstructor; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '_Ministry': // Gets the value for the private _objMinistry (Read-Only) // if set due to an expansion on the ministry_login_assn association table // @return Ministry return $this->_objMinistry; case '_MinistryArray': // Gets the value for the private _objMinistryArray (Read-Only) // if set due to an ExpandAsArray on the ministry_login_assn association table // @return Ministry[] return (array) $this->_objMinistryArray; case '_CommentAsPostedBy': // Gets the value for the private _objCommentAsPostedBy (Read-Only) // if set due to an expansion on the comment.posted_by_login_id reverse relationship // @return Comment return $this->_objCommentAsPostedBy; case '_CommentAsPostedByArray': // Gets the value for the private _objCommentAsPostedByArray (Read-Only) // if set due to an ExpandAsArray on the comment.posted_by_login_id reverse relationship // @return Comment[] return (array) $this->_objCommentAsPostedByArray; case '_EmailMessageRoute': // Gets the value for the private _objEmailMessageRoute (Read-Only) // if set due to an expansion on the email_message_route.login_id reverse relationship // @return EmailMessageRoute return $this->_objEmailMessageRoute; case '_EmailMessageRouteArray': // Gets the value for the private _objEmailMessageRouteArray (Read-Only) // if set due to an ExpandAsArray on the email_message_route.login_id reverse relationship // @return EmailMessageRoute[] return (array) $this->_objEmailMessageRouteArray; case '_SmsMessage': // Gets the value for the private _objSmsMessage (Read-Only) // if set due to an expansion on the sms_message.login_id reverse relationship // @return SmsMessage return $this->_objSmsMessage; case '_SmsMessageArray': // Gets the value for the private _objSmsMessageArray (Read-Only) // if set due to an ExpandAsArray on the sms_message.login_id reverse relationship // @return SmsMessage[] return (array) $this->_objSmsMessageArray; case '_StewardshipBatchAsCreatedBy': // Gets the value for the private _objStewardshipBatchAsCreatedBy (Read-Only) // if set due to an expansion on the stewardship_batch.created_by_login_id reverse relationship // @return StewardshipBatch return $this->_objStewardshipBatchAsCreatedBy; case '_StewardshipBatchAsCreatedByArray': // Gets the value for the private _objStewardshipBatchAsCreatedByArray (Read-Only) // if set due to an ExpandAsArray on the stewardship_batch.created_by_login_id reverse relationship // @return StewardshipBatch[] return (array) $this->_objStewardshipBatchAsCreatedByArray; case '_StewardshipContributionAsCreatedBy': // Gets the value for the private _objStewardshipContributionAsCreatedBy (Read-Only) // if set due to an expansion on the stewardship_contribution.created_by_login_id reverse relationship // @return StewardshipContribution return $this->_objStewardshipContributionAsCreatedBy; case '_StewardshipContributionAsCreatedByArray': // Gets the value for the private _objStewardshipContributionAsCreatedByArray (Read-Only) // if set due to an ExpandAsArray on the stewardship_contribution.created_by_login_id reverse relationship // @return StewardshipContribution[] return (array) $this->_objStewardshipContributionAsCreatedByArray; case '_StewardshipPostAsCreatedBy': // Gets the value for the private _objStewardshipPostAsCreatedBy (Read-Only) // if set due to an expansion on the stewardship_post.created_by_login_id reverse relationship // @return StewardshipPost return $this->_objStewardshipPostAsCreatedBy; case '_StewardshipPostAsCreatedByArray': // Gets the value for the private _objStewardshipPostAsCreatedByArray (Read-Only) // if set due to an ExpandAsArray on the stewardship_post.created_by_login_id reverse relationship // @return StewardshipPost[] return (array) $this->_objStewardshipPostAsCreatedByArray; case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * This will save this object's Login instance, * updating only the fields which have had a control created for it. */ public function SaveLogin() { try { // Update any fields for controls that have been created if ($this->lstRoleType) { $this->objLogin->RoleTypeId = $this->lstRoleType->SelectedValue; } if ($this->txtPermissionBitmap) { $this->objLogin->PermissionBitmap = $this->txtPermissionBitmap->Text; } if ($this->txtUsername) { $this->objLogin->Username = $this->txtUsername->Text; } if ($this->txtPasswordCache) { $this->objLogin->PasswordCache = $this->txtPasswordCache->Text; } if ($this->txtPasswordLastSet) { $this->objLogin->PasswordLastSet = $this->txtPasswordLastSet->Text; } if ($this->calDateLastLogin) { $this->objLogin->DateLastLogin = $this->calDateLastLogin->DateTime; } if ($this->chkDomainActiveFlag) { $this->objLogin->DomainActiveFlag = $this->chkDomainActiveFlag->Checked; } if ($this->chkLoginActiveFlag) { $this->objLogin->LoginActiveFlag = $this->chkLoginActiveFlag->Checked; } if ($this->txtEmail) { $this->objLogin->Email = $this->txtEmail->Text; } if ($this->txtFirstName) { $this->objLogin->FirstName = $this->txtFirstName->Text; } if ($this->txtMiddleInitial) { $this->objLogin->MiddleInitial = $this->txtMiddleInitial->Text; } if ($this->txtLastName) { $this->objLogin->LastName = $this->txtLastName->Text; } // Update any UniqueReverseReferences (if any) for controls that have been created for it if ($this->lstClassInstructor) { $this->objLogin->ClassInstructor = ClassInstructor::Load($this->lstClassInstructor->SelectedValue); } // Save the Login object $this->objLogin->Save(); // Finally, update any ManyToManyReferences (if any) $this->lstMinistries_Update(); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
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; }