Esempio n. 1
0
 /**
  * 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 ParentPagerStation
  */
 public static function CreateOrUpdateForMsSqlRow($objRow)
 {
     $intServerIdentifier = $objRow['lngStationID'];
     $strName = trim($objRow['strStation']);
     $objParentPagerStation = ParentPagerStation::LoadByServerIdentifier($intServerIdentifier);
     if (!$objParentPagerStation) {
         $objParentPagerStation = new ParentPagerStation();
         $objParentPagerStation->ServerIdentifier = $intServerIdentifier;
     }
     $objParentPagerStation->Name = $strName;
     $objParentPagerStation->Save();
     return $objParentPagerStation;
 }
 /**
  * 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 ParentPagerChildHistory
  */
 public static function CreateOrUpdateForMsSqlRow($objRow)
 {
     $intServerIdentifier = $objRow['lngChildHistoryID'];
     $intIndividualIdentifier = $objRow['lngIndividualID'];
     $intStationIdentifier = $objRow['lngStationID'];
     $intPeriodIdentifier = $objRow['lngPeriodID'];
     $intDropoffIndividualIdentifier = $objRow['lngDropOffByID'];
     $intPickupIndividualIdentifier = $objRow['lngPickupByID'];
     $dttDateIn = new QDateTime($objRow['dtmCheckInDateTime']);
     $dttDateOut = new QDateTime($objRow['dtmCheckOutDateTime']);
     $objParentPagerChildHistory = ParentPagerChildHistory::LoadByServerIdentifier($intServerIdentifier);
     if (!$objParentPagerChildHistory) {
         $objParentPagerChildHistory = new ParentPagerChildHistory();
         $objParentPagerChildHistory->ServerIdentifier = $intServerIdentifier;
     }
     $objParentPagerChildHistory->ParentPagerIndividual = ParentPagerIndividual::LoadByServerIdentifier($intIndividualIdentifier);
     $objParentPagerChildHistory->ParentPagerStation = ParentPagerStation::LoadByServerIdentifier($intStationIdentifier);
     $objParentPagerChildHistory->ParentPagerPeriod = ParentPagerPeriod::LoadByServerIdentifier($intPeriodIdentifier);
     $objParentPagerChildHistory->DropoffByParentPagerIndividual = ParentPagerIndividual::LoadByServerIdentifier($intDropoffIndividualIdentifier);
     $objParentPagerChildHistory->PickupByParentPagerIndividual = ParentPagerIndividual::LoadByServerIdentifier($intPickupIndividualIdentifier);
     $objParentPagerChildHistory->DateIn = $dttDateIn;
     $objParentPagerChildHistory->DateOut = $dttDateOut;
     $objParentPagerChildHistory->Save();
     return $objParentPagerChildHistory;
 }
 /**
  * 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;
 }
 /**
  * Refresh this MetaControl with Data from the local ParentPagerChildHistory object.
  * @param boolean $blnReload reload ParentPagerChildHistory from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objParentPagerChildHistory->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objParentPagerChildHistory->Id;
         }
     }
     if ($this->txtServerIdentifier) {
         $this->txtServerIdentifier->Text = $this->objParentPagerChildHistory->ServerIdentifier;
     }
     if ($this->lblServerIdentifier) {
         $this->lblServerIdentifier->Text = $this->objParentPagerChildHistory->ServerIdentifier;
     }
     if ($this->lstParentPagerIndividual) {
         $this->lstParentPagerIndividual->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstParentPagerIndividual->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objParentPagerIndividualArray = ParentPagerIndividual::LoadAll();
         if ($objParentPagerIndividualArray) {
             foreach ($objParentPagerIndividualArray as $objParentPagerIndividual) {
                 $objListItem = new QListItem($objParentPagerIndividual->__toString(), $objParentPagerIndividual->Id);
                 if ($this->objParentPagerChildHistory->ParentPagerIndividual && $this->objParentPagerChildHistory->ParentPagerIndividual->Id == $objParentPagerIndividual->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstParentPagerIndividual->AddItem($objListItem);
             }
         }
     }
     if ($this->lblParentPagerIndividualId) {
         $this->lblParentPagerIndividualId->Text = $this->objParentPagerChildHistory->ParentPagerIndividual ? $this->objParentPagerChildHistory->ParentPagerIndividual->__toString() : null;
     }
     if ($this->lstParentPagerStation) {
         $this->lstParentPagerStation->RemoveAllItems();
         $this->lstParentPagerStation->AddItem(QApplication::Translate('- Select One -'), null);
         $objParentPagerStationArray = ParentPagerStation::LoadAll();
         if ($objParentPagerStationArray) {
             foreach ($objParentPagerStationArray as $objParentPagerStation) {
                 $objListItem = new QListItem($objParentPagerStation->__toString(), $objParentPagerStation->Id);
                 if ($this->objParentPagerChildHistory->ParentPagerStation && $this->objParentPagerChildHistory->ParentPagerStation->Id == $objParentPagerStation->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstParentPagerStation->AddItem($objListItem);
             }
         }
     }
     if ($this->lblParentPagerStationId) {
         $this->lblParentPagerStationId->Text = $this->objParentPagerChildHistory->ParentPagerStation ? $this->objParentPagerChildHistory->ParentPagerStation->__toString() : null;
     }
     if ($this->lstParentPagerPeriod) {
         $this->lstParentPagerPeriod->RemoveAllItems();
         $this->lstParentPagerPeriod->AddItem(QApplication::Translate('- Select One -'), null);
         $objParentPagerPeriodArray = ParentPagerPeriod::LoadAll();
         if ($objParentPagerPeriodArray) {
             foreach ($objParentPagerPeriodArray as $objParentPagerPeriod) {
                 $objListItem = new QListItem($objParentPagerPeriod->__toString(), $objParentPagerPeriod->Id);
                 if ($this->objParentPagerChildHistory->ParentPagerPeriod && $this->objParentPagerChildHistory->ParentPagerPeriod->Id == $objParentPagerPeriod->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstParentPagerPeriod->AddItem($objListItem);
             }
         }
     }
     if ($this->lblParentPagerPeriodId) {
         $this->lblParentPagerPeriodId->Text = $this->objParentPagerChildHistory->ParentPagerPeriod ? $this->objParentPagerChildHistory->ParentPagerPeriod->__toString() : null;
     }
     if ($this->lstDropoffByParentPagerIndividual) {
         $this->lstDropoffByParentPagerIndividual->RemoveAllItems();
         $this->lstDropoffByParentPagerIndividual->AddItem(QApplication::Translate('- Select One -'), null);
         $objDropoffByParentPagerIndividualArray = ParentPagerIndividual::LoadAll();
         if ($objDropoffByParentPagerIndividualArray) {
             foreach ($objDropoffByParentPagerIndividualArray as $objDropoffByParentPagerIndividual) {
                 $objListItem = new QListItem($objDropoffByParentPagerIndividual->__toString(), $objDropoffByParentPagerIndividual->Id);
                 if ($this->objParentPagerChildHistory->DropoffByParentPagerIndividual && $this->objParentPagerChildHistory->DropoffByParentPagerIndividual->Id == $objDropoffByParentPagerIndividual->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstDropoffByParentPagerIndividual->AddItem($objListItem);
             }
         }
     }
     if ($this->lblDropoffByParentPagerIndividualId) {
         $this->lblDropoffByParentPagerIndividualId->Text = $this->objParentPagerChildHistory->DropoffByParentPagerIndividual ? $this->objParentPagerChildHistory->DropoffByParentPagerIndividual->__toString() : null;
     }
     if ($this->lstPickupByParentPagerIndividual) {
         $this->lstPickupByParentPagerIndividual->RemoveAllItems();
         $this->lstPickupByParentPagerIndividual->AddItem(QApplication::Translate('- Select One -'), null);
         $objPickupByParentPagerIndividualArray = ParentPagerIndividual::LoadAll();
         if ($objPickupByParentPagerIndividualArray) {
             foreach ($objPickupByParentPagerIndividualArray as $objPickupByParentPagerIndividual) {
                 $objListItem = new QListItem($objPickupByParentPagerIndividual->__toString(), $objPickupByParentPagerIndividual->Id);
                 if ($this->objParentPagerChildHistory->PickupByParentPagerIndividual && $this->objParentPagerChildHistory->PickupByParentPagerIndividual->Id == $objPickupByParentPagerIndividual->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPickupByParentPagerIndividual->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPickupByParentPagerIndividualId) {
         $this->lblPickupByParentPagerIndividualId->Text = $this->objParentPagerChildHistory->PickupByParentPagerIndividual ? $this->objParentPagerChildHistory->PickupByParentPagerIndividual->__toString() : null;
     }
     if ($this->calDateIn) {
         $this->calDateIn->DateTime = $this->objParentPagerChildHistory->DateIn;
     }
     if ($this->lblDateIn) {
         $this->lblDateIn->Text = sprintf($this->objParentPagerChildHistory->DateIn) ? $this->objParentPagerChildHistory->__toString($this->strDateInDateTimeFormat) : null;
     }
     if ($this->calDateOut) {
         $this->calDateOut->DateTime = $this->objParentPagerChildHistory->DateOut;
     }
     if ($this->lblDateOut) {
         $this->lblDateOut->Text = sprintf($this->objParentPagerChildHistory->DateOut) ? $this->objParentPagerChildHistory->__toString($this->strDateOutDateTimeFormat) : null;
     }
 }
Esempio n. 5
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, ParentPagerStation::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
Esempio n. 6
0
// Uses FREETDS.conf to specify connection settings to ppager!!!
// Oh and ensure the connection in FREETDS sets text size to a large enough value (e.g. text size = 4194304)
$objMsSql = mssql_connect($strConnectionName, $strUsername, $strPassword);
mssql_select_db($strDbName, $objMsSql);
// One Table at a Time...
////////////////////////////
// ParentPager Station, Period and Program
////////////////////////////
$strTableName = 'tblStation';
$strPkColumnName = 'lngStationID';
$intRowCount = GetRowCount($strTableName);
$intCurrentRow = 0;
$objResult = GetPkResultForTableColumn($strTableName, $strPkColumnName);
while ($objRow = mssql_fetch_assoc($objResult)) {
    $objRow = GetRowForTableColumnRow($strTableName, $strPkColumnName, $objRow);
    ParentPagerStation::CreateOrUpdateForMsSqlRow($objRow);
}
$strTableName = 'tblPeriod';
$strPkColumnName = 'lngPeriodID';
$intRowCount = GetRowCount($strTableName);
$intCurrentRow = 0;
$objResult = GetPkResultForTableColumn($strTableName, $strPkColumnName);
while ($objRow = mssql_fetch_assoc($objResult)) {
    $objRow = GetRowForTableColumnRow($strTableName, $strPkColumnName, $objRow);
    ParentPagerPeriod::CreateOrUpdateForMsSqlRow($objRow);
}
$strTableName = 'tblProgram';
$strPkColumnName = 'lngProgramID';
$intRowCount = GetRowCount($strTableName);
$intCurrentRow = 0;
$objResult = GetPkResultForTableColumn($strTableName, $strPkColumnName);
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objParentPagerIndividual) {
         $objObject->objParentPagerIndividual = ParentPagerIndividual::GetSoapObjectFromObject($objObject->objParentPagerIndividual, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intParentPagerIndividualId = null;
         }
     }
     if ($objObject->objParentPagerStation) {
         $objObject->objParentPagerStation = ParentPagerStation::GetSoapObjectFromObject($objObject->objParentPagerStation, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intParentPagerStationId = null;
         }
     }
     if ($objObject->objParentPagerPeriod) {
         $objObject->objParentPagerPeriod = ParentPagerPeriod::GetSoapObjectFromObject($objObject->objParentPagerPeriod, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intParentPagerPeriodId = null;
         }
     }
     if ($objObject->objDropoffByParentPagerIndividual) {
         $objObject->objDropoffByParentPagerIndividual = ParentPagerIndividual::GetSoapObjectFromObject($objObject->objDropoffByParentPagerIndividual, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intDropoffByParentPagerIndividualId = null;
         }
     }
     if ($objObject->objPickupByParentPagerIndividual) {
         $objObject->objPickupByParentPagerIndividual = ParentPagerIndividual::GetSoapObjectFromObject($objObject->objPickupByParentPagerIndividual, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intPickupByParentPagerIndividualId = null;
         }
     }
     if ($objObject->dttDateIn) {
         $objObject->dttDateIn = $objObject->dttDateIn->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->dttDateOut) {
         $objObject->dttDateOut = $objObject->dttDateOut->__toString(QDateTime::FormatSoap);
     }
     return $objObject;
 }
 /**
  * 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 ParentPagerStationMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing ParentPagerStation object creation - defaults to CreateOrEdit
  * @return ParentPagerStationMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objParentPagerStation = ParentPagerStation::Load($intId);
         // ParentPagerStation was found -- return it!
         if ($objParentPagerStation) {
             return new ParentPagerStationMetaControl($objParentObject, $objParentPagerStation);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a ParentPagerStation 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 ParentPagerStationMetaControl($objParentObject, new ParentPagerStation());
 }
 /**
  * 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 = ParentPagerStation::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 ParentPagerStation, given the clauses above
     $this->DataSource = ParentPagerStation::QueryArray($objCondition, $objClauses);
 }