/**
  * This will create a new record or update an existing record given the MS SQL Data Row
  * @param string[] $objRow the mssql_fetch_assoc row result from MS SQL Server
  * @return ParentPagerAttendantHistory
  */
 public static function CreateOrUpdateForMsSqlRow($objRow)
 {
     $intServerIdentifier = $objRow['lngAttendantHistoryID'];
     $intIndividualIdentifier = $objRow['lngIndividualID'];
     $intStationIdentifier = $objRow['lngStationID'];
     $intPeriodIdentifier = $objRow['lngPeriodID'];
     $intProgramIdentifier = $objRow['lngProgramID'];
     $dttDateIn = new QDateTime($objRow['dtmStartDateTime']);
     $dttDateOut = new QDateTime($objRow['dtmEndDateTime']);
     $objParentPagerAttendantHistory = ParentPagerAttendantHistory::LoadByServerIdentifier($intServerIdentifier);
     if (!$objParentPagerAttendantHistory) {
         $objParentPagerAttendantHistory = new ParentPagerAttendantHistory();
         $objParentPagerAttendantHistory->ServerIdentifier = $intServerIdentifier;
     }
     $objParentPagerAttendantHistory->ParentPagerIndividual = ParentPagerIndividual::LoadByServerIdentifier($intIndividualIdentifier);
     $objParentPagerAttendantHistory->ParentPagerStation = ParentPagerStation::LoadByServerIdentifier($intStationIdentifier);
     $objParentPagerAttendantHistory->ParentPagerPeriod = ParentPagerPeriod::LoadByServerIdentifier($intPeriodIdentifier);
     $objParentPagerAttendantHistory->ParentPagerProgram = ParentPagerProgram::LoadByServerIdentifier($intProgramIdentifier);
     $objParentPagerAttendantHistory->DateIn = $dttDateIn;
     $objParentPagerAttendantHistory->DateOut = $dttDateOut;
     $objParentPagerAttendantHistory->Save();
     return $objParentPagerAttendantHistory;
 }
Exemplo n.º 2
0
 protected function SetupPanel()
 {
     if ($this->objPerson->CountParentPagerIndividuals()) {
         if (ParentPagerAttendantHistory::QueryCount(QQ::Equal(QQN::ParentPagerAttendantHistory()->ParentPagerIndividual->PersonId, $this->objPerson->Id))) {
             $this->dtgAttendantHistory = new ParentPagerAttendantHistoryDataGrid($this);
             $this->dtgAttendantHistory->MetaAddColumn('DateIn', 'Width=125px', 'FontSize=10px');
             $this->dtgAttendantHistory->MetaAddColumn('DateOut', 'Width=125px', 'FontSize=10px');
             $this->dtgAttendantHistory->MetaAddColumn(QQN::ParentPagerAttendantHistory()->ParentPagerStation->Name, 'Name=Station', 'Width=160px');
             $this->dtgAttendantHistory->MetaAddColumn(QQN::ParentPagerAttendantHistory()->ParentPagerPeriod->Name, 'Name=Period', 'Width=150px');
             $this->dtgAttendantHistory->MetaAddColumn(QQN::ParentPagerAttendantHistory()->ParentPagerProgram->Name, 'Name=Program', 'Width=150px');
             $this->dtgAttendantHistory->SetDataBinder('dtgAttendantHistory_Bind', $this);
             $this->dtgAttendantHistory->Paginator = new QPaginator($this->dtgAttendantHistory);
             $this->dtgAttendantHistory->SortColumnIndex = 0;
             $this->dtgAttendantHistory->SortDirection = 1;
             $this->dtgAttendantHistory->FontSize = '11px';
         }
         if (QApplication::$Login->IsPermissionAllowed(PermissionType::ManageSafariKids) && (ParentPagerChildHistory::QueryCount(QQ::Equal(QQN::ParentPagerChildHistory()->ParentPagerIndividual->PersonId, $this->objPerson->Id)) || ParentPagerChildHistory::QueryCount(QQ::Equal(QQN::ParentPagerChildHistory()->PickupByParentPagerIndividual->PersonId, $this->objPerson->Id)) || ParentPagerChildHistory::QueryCount(QQ::Equal(QQN::ParentPagerChildHistory()->DropoffByParentPagerIndividual->PersonId, $this->objPerson->Id)))) {
             $this->dtgChildHistory = new ParentPagerChildHistoryDataGrid($this);
             $this->dtgChildHistory->MetaAddColumn('DateIn', 'Width=125px', 'FontSize=10px');
             $this->dtgChildHistory->MetaAddColumn('DateOut', 'Width=125px', 'FontSize=10px');
             $this->dtgChildHistory->MetaAddColumn(QQN::ParentPagerChildHistory()->ParentPagerIndividual->FirstName, 'Name=Child', 'Width=80px');
             $this->dtgChildHistory->MetaAddColumn(QQN::ParentPagerChildHistory()->PickupByParentPagerIndividual->FirstName, 'Name=Pick Up', 'Width=70px');
             $this->dtgChildHistory->MetaAddColumn(QQN::ParentPagerChildHistory()->DropoffByParentPagerIndividual->FirstName, 'Name=Drop Off', 'Width=70px');
             $this->dtgChildHistory->MetaAddColumn(QQN::ParentPagerChildHistory()->ParentPagerStation->Name, 'Name=Station', 'Width=150px');
             $this->dtgChildHistory->MetaAddColumn(QQN::ParentPagerChildHistory()->ParentPagerPeriod->Name, 'Name=Period', 'Width=70px');
             $this->dtgChildHistory->SetDataBinder('dtgChildHistory_Bind', $this);
             $this->dtgChildHistory->Paginator = new QPaginator($this->dtgChildHistory);
             $this->dtgChildHistory->SortColumnIndex = 0;
             $this->dtgChildHistory->SortDirection = 1;
             $this->dtgChildHistory->FontSize = '11px';
         }
         $this->dtgParentPagerIndividuals = new ParentPagerIndividualDataGrid($this);
         $this->dtgParentPagerIndividuals->MetaAddColumn('ServerIdentifier', 'Name=Parent Pager ID', 'Html=<?= $_CONTROL->ParentControl->RenderIdentifier($_ITEM); ?>', 'Width=120px', 'HtmlEntities=false');
         $this->dtgParentPagerIndividuals->MetaAddColumn('FirstName', 'Width=125px', 'FontSize=10px');
         $this->dtgParentPagerIndividuals->MetaAddColumn('MiddleName', 'Width=125px', 'FontSize=10px');
         $this->dtgParentPagerIndividuals->MetaAddColumn('LastName', 'Width=125px', 'FontSize=10px');
         $this->dtgParentPagerIndividuals->AddColumn(new QDataGridColumn('Address(es)', '<?= $_CONTROL->ParentControl->RenderAddresses($_ITEM); ?>', 'Width=200px', 'HtmlEntities=false'));
         $this->dtgParentPagerIndividuals->SetDataBinder('ParentPagerIndividuals_Bind', $this);
         $this->dtgParentPagerIndividuals->SortColumnIndex = 0;
         $this->dtgParentPagerIndividuals->FontSize = '11px';
     }
     $this->pxyUnassociate = new QControlProxy($this);
     $this->pxyUnassociate->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to UNASSOCIATE this ParentPagerIndividual record from this NOAH Person?'));
     $this->pxyUnassociate->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'pxyUnassociate_Click'));
     $this->pxyUnassociate->AddAction(new QClickEvent(), new QTerminateAction());
 }
 /**
  * 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 = ParentPagerAttendantHistory::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 ParentPagerAttendantHistory, given the clauses above
     $this->DataSource = ParentPagerAttendantHistory::QueryArray($objCondition, $objClauses);
 }
Exemplo n.º 4
0
    /**
     * Deletes all associated ParentPagerAttendantHistories
     * @return void
     */
    public function DeleteAllParentPagerAttendantHistories()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateParentPagerAttendantHistory on this unsaved ParentPagerIndividual.');
        }
        // Get the Database Object for this Class
        $objDatabase = ParentPagerIndividual::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (ParentPagerAttendantHistory::LoadArrayByParentPagerIndividualId($this->intId) as $objParentPagerAttendantHistory) {
                $objParentPagerAttendantHistory->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`parent_pager_attendant_history`
				WHERE
					`parent_pager_individual_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }
Exemplo n.º 5
0
    print '  -  ID #' . $objRow[$strPkColumnName] . '  -  ' . $objRow['strAddress1'] . ' ' . $objRow['strCity'] . "\r\n";
    ParentPagerAddress::CreateOrUpdateForMsSqlRow($objRow);
}
///////////////////////////
// ParentPager Child Records
////////////////////////////
$strTableName = 'tblChildInStationHistory';
$strPkColumnName = 'lngChildHistoryID';
$intRowCount = GetRowCount($strTableName);
$intCurrentRow = 0;
$objResult = GetPkResultForTableColumn($strTableName, $strPkColumnName);
while ($objRow = mssql_fetch_assoc($objResult)) {
    printf('[%6s/%6s]', $intCurrentRow++, $intRowCount);
    $objRow = GetRowForTableColumnRow($strTableName, $strPkColumnName, $objRow);
    print '  -  ID #' . $objRow[$strPkColumnName] . "\r\n";
    ParentPagerChildHistory::CreateOrUpdateForMsSqlRow($objRow);
}
///////////////////////////
// ParentPager Volunteer Records
////////////////////////////
$strTableName = 'tblAttendantInStationHistory';
$strPkColumnName = 'lngAttendantHistoryID';
$intRowCount = GetRowCount($strTableName);
$intCurrentRow = 0;
$objResult = GetPkResultForTableColumn($strTableName, $strPkColumnName);
while ($objRow = mssql_fetch_assoc($objResult)) {
    printf('[%6s/%6s]', $intCurrentRow++, $intRowCount);
    $objRow = GetRowForTableColumnRow($strTableName, $strPkColumnName, $objRow);
    print '  -  ID #' . $objRow[$strPkColumnName] . "\r\n";
    ParentPagerAttendantHistory::CreateOrUpdateForMsSqlRow($objRow);
}
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, ParentPagerAttendantHistory::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
 /**
  * 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 ParentPagerAttendantHistoryMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing ParentPagerAttendantHistory object creation - defaults to CreateOrEdit
  * @return ParentPagerAttendantHistoryMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objParentPagerAttendantHistory = ParentPagerAttendantHistory::Load($intId);
         // ParentPagerAttendantHistory was found -- return it!
         if ($objParentPagerAttendantHistory) {
             return new ParentPagerAttendantHistoryMetaControl($objParentObject, $objParentPagerAttendantHistory);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a ParentPagerAttendantHistory 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 ParentPagerAttendantHistoryMetaControl($objParentObject, new ParentPagerAttendantHistory());
 }