示例#1
0
文件: class.php 项目: alcf/chms
 protected function CreateChildObject()
 {
     $objClassRegistration = new ClassRegistration();
     $objClassRegistration->SignupEntry = $this->objSignupEntry;
     $objClassRegistration->ClassMeeting = $this->objClassMeeting;
     $objClassRegistration->Person = $this->objSignupEntry->Person;
     $objClassRegistration->Save();
 }
示例#2
0
 /**
  * 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 'SignupFormId':
             // Gets the value for intSignupFormId (Not Null)
             // @return integer
             return $this->intSignupFormId;
         case 'PersonId':
             // Gets the value for intPersonId
             // @return integer
             return $this->intPersonId;
         case 'SignupByPersonId':
             // Gets the value for intSignupByPersonId
             // @return integer
             return $this->intSignupByPersonId;
         case 'SignupEntryStatusTypeId':
             // Gets the value for intSignupEntryStatusTypeId (Not Null)
             // @return integer
             return $this->intSignupEntryStatusTypeId;
         case 'DateCreated':
             // Gets the value for dttDateCreated (Not Null)
             // @return QDateTime
             return $this->dttDateCreated;
         case 'DateSubmitted':
             // Gets the value for dttDateSubmitted
             // @return QDateTime
             return $this->dttDateSubmitted;
         case 'AmountTotal':
             // Gets the value for fltAmountTotal
             // @return double
             return $this->fltAmountTotal;
         case 'AmountPaid':
             // Gets the value for fltAmountPaid
             // @return double
             return $this->fltAmountPaid;
         case 'AmountBalance':
             // Gets the value for fltAmountBalance
             // @return double
             return $this->fltAmountBalance;
         case 'InternalNotes':
             // Gets the value for strInternalNotes
             // @return string
             return $this->strInternalNotes;
         case 'CommunicationsEntryId':
             // Gets the value for intCommunicationsEntryId
             // @return integer
             return $this->intCommunicationsEntryId;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'SignupForm':
             // Gets the value for the SignupForm object referenced by intSignupFormId (Not Null)
             // @return SignupForm
             try {
                 if (!$this->objSignupForm && !is_null($this->intSignupFormId)) {
                     $this->objSignupForm = SignupForm::Load($this->intSignupFormId);
                 }
                 return $this->objSignupForm;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Person':
             // Gets the value for the Person object referenced by intPersonId
             // @return Person
             try {
                 if (!$this->objPerson && !is_null($this->intPersonId)) {
                     $this->objPerson = Person::Load($this->intPersonId);
                 }
                 return $this->objPerson;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'SignupByPerson':
             // Gets the value for the Person object referenced by intSignupByPersonId
             // @return Person
             try {
                 if (!$this->objSignupByPerson && !is_null($this->intSignupByPersonId)) {
                     $this->objSignupByPerson = Person::Load($this->intSignupByPersonId);
                 }
                 return $this->objSignupByPerson;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CommunicationsEntry':
             // Gets the value for the CommunicationListEntry object referenced by intCommunicationsEntryId
             // @return CommunicationListEntry
             try {
                 if (!$this->objCommunicationsEntry && !is_null($this->intCommunicationsEntryId)) {
                     $this->objCommunicationsEntry = CommunicationListEntry::Load($this->intCommunicationsEntryId);
                 }
                 return $this->objCommunicationsEntry;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ClassRegistration':
             // Gets the value for the ClassRegistration object that uniquely references this SignupEntry
             // by objClassRegistration (Unique)
             // @return ClassRegistration
             try {
                 if ($this->objClassRegistration === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objClassRegistration) {
                     $this->objClassRegistration = ClassRegistration::LoadBySignupEntryId($this->intId);
                 }
                 return $this->objClassRegistration;
             } 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 '_FormAnswer':
             // Gets the value for the private _objFormAnswer (Read-Only)
             // if set due to an expansion on the form_answer.signup_entry_id reverse relationship
             // @return FormAnswer
             return $this->_objFormAnswer;
         case '_FormAnswerArray':
             // Gets the value for the private _objFormAnswerArray (Read-Only)
             // if set due to an ExpandAsArray on the form_answer.signup_entry_id reverse relationship
             // @return FormAnswer[]
             return (array) $this->_objFormAnswerArray;
         case '_SignupPayment':
             // Gets the value for the private _objSignupPayment (Read-Only)
             // if set due to an expansion on the signup_payment.signup_entry_id reverse relationship
             // @return SignupPayment
             return $this->_objSignupPayment;
         case '_SignupPaymentArray':
             // Gets the value for the private _objSignupPaymentArray (Read-Only)
             // if set due to an ExpandAsArray on the signup_payment.signup_entry_id reverse relationship
             // @return SignupPayment[]
             return (array) $this->_objSignupPaymentArray;
         case '_SignupProduct':
             // Gets the value for the private _objSignupProduct (Read-Only)
             // if set due to an expansion on the signup_product.signup_entry_id reverse relationship
             // @return SignupProduct
             return $this->_objSignupProduct;
         case '_SignupProductArray':
             // Gets the value for the private _objSignupProductArray (Read-Only)
             // if set due to an ExpandAsArray on the signup_product.signup_entry_id reverse relationship
             // @return SignupProduct[]
             return (array) $this->_objSignupProductArray;
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
示例#3
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, ClassRegistration::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
示例#4
0
    /**
     * Deletes all associated ClassRegistrations
     * @return void
     */
    public function DeleteAllClassRegistrations()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateClassRegistration on this unsaved ClassGrade.');
        }
        // Get the Database Object for this Class
        $objDatabase = ClassGrade::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (ClassRegistration::LoadArrayByClassGradeId($this->intId) as $objClassRegistration) {
                $objClassRegistration->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`class_registration`
				WHERE
					`class_grade_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }
示例#5
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objClassRegistration) {
         $objObject->objClassRegistration = ClassRegistration::GetSoapObjectFromObject($objObject->objClassRegistration, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intClassRegistrationId = null;
         }
     }
     return $objObject;
 }
 /**
  * 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 = ClassRegistration::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 ClassRegistration, given the clauses above
     $this->DataSource = ClassRegistration::QueryArray($objCondition, $objClauses);
 }
示例#7
0
文件: new_signup.php 项目: alcf/chms
 protected function CreateAndRedirect(Person $objPerson)
 {
     $objSignupEntry = new SignupEntry();
     $objSignupEntry->SignupForm = $this->objSignupForm;
     $objSignupEntry->Person = $objPerson;
     $objSignupEntry->SignupByPerson = $objPerson;
     $objSignupEntry->SignupEntryStatusTypeId = SignupEntryStatusType::Incomplete;
     $objSignupEntry->DateCreated = QDateTime::Now();
     $objSignupEntry->Save();
     if ($this->objSignupForm->SignupFormTypeId == SignupFormType::Course) {
         $objClassRegistration = new ClassRegistration();
         $objClassRegistration->SignupEntry = $objSignupEntry;
         $objClassRegistration->ClassMeeting = $this->objSignupForm->ClassMeeting;
         $objClassRegistration->Person = $objSignupEntry->Person;
         $objClassRegistration->Save();
     }
     QApplication::Redirect(sprintf('/events/result.php/%s/%s', $this->objSignupForm->Id, $objSignupEntry->Id));
 }
 /**
  * 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 ClassRegistrationMetaControl
  * @param integer $intSignupEntryId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing ClassRegistration object creation - defaults to CreateOrEdit
  * @return ClassRegistrationMetaControl
  */
 public static function Create($objParentObject, $intSignupEntryId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intSignupEntryId)) {
         $objClassRegistration = ClassRegistration::Load($intSignupEntryId);
         // ClassRegistration was found -- return it!
         if ($objClassRegistration) {
             return new ClassRegistrationMetaControl($objParentObject, $objClassRegistration);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a ClassRegistration object with PK arguments: ' . $intSignupEntryId);
             }
         }
         // 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 ClassRegistrationMetaControl($objParentObject, new ClassRegistration());
 }
 /**
  * This will save this object's SignupEntry instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveSignupEntry()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->lstSignupForm) {
             $this->objSignupEntry->SignupFormId = $this->lstSignupForm->SelectedValue;
         }
         if ($this->lstPerson) {
             $this->objSignupEntry->PersonId = $this->lstPerson->SelectedValue;
         }
         if ($this->lstSignupByPerson) {
             $this->objSignupEntry->SignupByPersonId = $this->lstSignupByPerson->SelectedValue;
         }
         if ($this->lstSignupEntryStatusType) {
             $this->objSignupEntry->SignupEntryStatusTypeId = $this->lstSignupEntryStatusType->SelectedValue;
         }
         if ($this->calDateCreated) {
             $this->objSignupEntry->DateCreated = $this->calDateCreated->DateTime;
         }
         if ($this->calDateSubmitted) {
             $this->objSignupEntry->DateSubmitted = $this->calDateSubmitted->DateTime;
         }
         if ($this->txtAmountTotal) {
             $this->objSignupEntry->AmountTotal = $this->txtAmountTotal->Text;
         }
         if ($this->txtAmountPaid) {
             $this->objSignupEntry->AmountPaid = $this->txtAmountPaid->Text;
         }
         if ($this->txtAmountBalance) {
             $this->objSignupEntry->AmountBalance = $this->txtAmountBalance->Text;
         }
         if ($this->txtInternalNotes) {
             $this->objSignupEntry->InternalNotes = $this->txtInternalNotes->Text;
         }
         if ($this->lstCommunicationsEntry) {
             $this->objSignupEntry->CommunicationsEntryId = $this->lstCommunicationsEntry->SelectedValue;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstClassRegistration) {
             $this->objSignupEntry->ClassRegistration = ClassRegistration::Load($this->lstClassRegistration->SelectedValue);
         }
         // Save the SignupEntry object
         $this->objSignupEntry->Save();
         // Finally, update any ManyToManyReferences (if any)
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
 /**
  * Refresh this MetaControl with Data from the local ClassAttendence object.
  * @param boolean $blnReload reload ClassAttendence from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objClassAttendence->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objClassAttendence->Id;
         }
     }
     if ($this->lstClassRegistration) {
         $this->lstClassRegistration->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstClassRegistration->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objClassRegistrationArray = ClassRegistration::LoadAll();
         if ($objClassRegistrationArray) {
             foreach ($objClassRegistrationArray as $objClassRegistration) {
                 $objListItem = new QListItem($objClassRegistration->__toString(), $objClassRegistration->SignupEntryId);
                 if ($this->objClassAttendence->ClassRegistration && $this->objClassAttendence->ClassRegistration->SignupEntryId == $objClassRegistration->SignupEntryId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstClassRegistration->AddItem($objListItem);
             }
         }
     }
     if ($this->lblClassRegistrationId) {
         $this->lblClassRegistrationId->Text = $this->objClassAttendence->ClassRegistration ? $this->objClassAttendence->ClassRegistration->__toString() : null;
     }
     if ($this->txtMeetingNumber) {
         $this->txtMeetingNumber->Text = $this->objClassAttendence->MeetingNumber;
     }
     if ($this->lblMeetingNumber) {
         $this->lblMeetingNumber->Text = $this->objClassAttendence->MeetingNumber;
     }
     if ($this->chkPresentFlag) {
         $this->chkPresentFlag->Checked = $this->objClassAttendence->PresentFlag;
     }
     if ($this->lblPresentFlag) {
         $this->lblPresentFlag->Text = $this->objClassAttendence->PresentFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
 }