public function getNotificationByTypeAndDate($type, $date) { $noti = new Notification(); $noti->Load("date(time) = ? and type = ?", array($date, $type)); if (!empty($noti->id) && ($noti->type = $type)) { return $noti; } return null; }
protected function SetupNotification() { // Lookup Object PK information from Query String (if applicable) // Set mode to Edit or New depending on what's found $intNotificationId = QApplication::QueryString('intNotificationId'); if ($intNotificationId) { $this->objNotification = Notification::Load($intNotificationId); if (!$this->objNotification) { throw new Exception('Could not find a Notification object with PK arguments: ' . $intNotificationId); } $this->strTitleVerb = QApplication::Translate('Edit'); $this->blnEditMode = true; } else { $this->objNotification = new Notification(); $this->strTitleVerb = QApplication::Translate('Create'); $this->blnEditMode = false; } }
/** * Reload this Notification from the database. * @return void */ public function Reload() { // Make sure we are actually Restored from the database if (!$this->__blnRestored) { throw new QCallerException('Cannot call Reload() on a new, unsaved Notification object.'); } // Reload the Object $objReloaded = Notification::Load($this->intNotificationId); // Update $this's local variables to match $this->strShortDescription = $objReloaded->strShortDescription; $this->strLongDescription = $objReloaded->strLongDescription; $this->strCriteria = $objReloaded->strCriteria; $this->strFrequency = $objReloaded->strFrequency; $this->blnEnabledFlag = $objReloaded->blnEnabledFlag; $this->CreatedBy = $objReloaded->CreatedBy; $this->dttCreationDate = $objReloaded->dttCreationDate; $this->ModifiedBy = $objReloaded->ModifiedBy; $this->strModifiedDate = $objReloaded->strModifiedDate; }
public function btnEdit_Click($strFormId, $strControlId, $strParameter) { $strParameterArray = explode(',', $strParameter); $objNotification = Notification::Load($strParameterArray[0]); $objEditPanel = new NotificationEditPanel($this, $this->strCloseEditPanelMethod, $objNotification); $strMethodName = $this->strSetEditPanelMethod; $this->objForm->{$strMethodName}($objEditPanel); }
/** * 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 NotificationMetaControl * @param integer $intNotificationId primary key value * @param QMetaControlCreateType $intCreateType rules governing Notification object creation - defaults to CreateOrEdit * @return NotificationMetaControl */ public static function Create($objParentObject, $intNotificationId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intNotificationId)) { $objNotification = Notification::Load($intNotificationId); // Notification was found -- return it! if ($objNotification) { return new NotificationMetaControl($objParentObject, $objNotification); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a Notification object with PK arguments: ' . $intNotificationId); } } // 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 NotificationMetaControl($objParentObject, new Notification()); }
/** * 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 'NotificationUserAccountId': /** * Gets the value for intNotificationUserAccountId (Read-Only PK) * @return integer */ return $this->intNotificationUserAccountId; case 'UserAccountId': /** * Gets the value for intUserAccountId (Not Null) * @return integer */ return $this->intUserAccountId; case 'NotificationId': /** * Gets the value for intNotificationId (Not Null) * @return integer */ return $this->intNotificationId; case 'Level': /** * Gets the value for strLevel * @return string */ return $this->strLevel; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'UserAccount': /** * Gets the value for the UserAccount object referenced by intUserAccountId (Not Null) * @return UserAccount */ try { if (!$this->objUserAccount && !is_null($this->intUserAccountId)) { $this->objUserAccount = UserAccount::Load($this->intUserAccountId); } return $this->objUserAccount; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Notification': /** * Gets the value for the Notification object referenced by intNotificationId (Not Null) * @return Notification */ try { if (!$this->objNotification && !is_null($this->intNotificationId)) { $this->objNotification = Notification::Load($this->intNotificationId); } return $this->objNotification; } 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) //////////////////////////// default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }