public function pxyEmailMessage_Click($strFormId, $strControlId, $strParameter) { $objEmailMessageRoute = EmailMessageRoute::Load($strParameter); if ($objEmailMessageRoute && $objEmailMessageRoute->CommunicationListId == $this->objList->Id) { $this->objSelectedEmailMessageRoute = $objEmailMessageRoute; $this->dlgEmailMessage->ShowDialogBox(); } }
/** * This will create a New EmailMessageRoute object for a given EmailMessage. * You must specify the Source object (which is either a Login, CommListEntry or Person) and * the Destination object (which is either a Group or CommList). * * This will throw a QCallerException if the route is invalid. * * @param EmailMessage $objEmailMessage * @param object $objSource must be a Login, CommunicationListEntry or Person object (can be null for public lists) * @param object $objDestination must be a Group or CommunicationList object * @return EmailMessageRoute */ public static function CreateNewRoute(EmailMessage $objEmailMessage, $objSource = null, $objDestination = null) { $objRoute = new EmailMessageRoute(); $objRoute->EmailMessage = $objEmailMessage; if ($objSource instanceof Login) { $objRoute->Login = $objSource; } else { if ($objSource instanceof CommunicationListEntry) { $objRoute->CommunicationListEntry = $objSource; } else { if ($objSource instanceof Person) { $objRoute->Person = $objSource; } else { if (!is_null($objSource)) { throw new QCallerException('Invalid Source for EmailMessageRoute'); } } } } if ($objDestination instanceof Group) { $objRoute->Group = $objDestination; } else { if ($objDestination instanceof CommunicationList) { $objRoute->CommunicationList = $objDestination; } else { throw new QCallerException('Invalid Destination for EmailMessageRoute'); } } if (is_null($objSource) && $objDestination->EmailBroadcastTypeId != EmailBroadcastType::PublicList) { throw new QCallerException('Invalid External Source for EmailMessageRoute to a non PublicList Destination'); } if ($objRoute->CommunicationListEntry && !$objRoute->CommunicationList) { throw new QCallerException('Invalid CommunicationListEntry Source for EmailMessageRoute to a non CommunicationList Destination'); } $objRoute->Save(); return $objRoute; }
/** * Deletes all associated EmailMessageRoutes * @return void */ public function DeleteAllEmailMessageRoutes() { if (is_null($this->intId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateEmailMessageRoute on this unsaved CommunicationList.'); } // Get the Database Object for this Class $objDatabase = CommunicationList::GetDatabase(); // Journaling if ($objDatabase->JournalingDatabase) { foreach (EmailMessageRoute::LoadArrayByCommunicationListId($this->intId) as $objEmailMessageRoute) { $objEmailMessageRoute->Journal('DELETE'); } } // Perform the SQL Query $objDatabase->NonQuery(' DELETE FROM `email_message_route` WHERE `communication_list_id` = ' . $objDatabase->SqlVariable($this->intId) . ' '); }
public static function GetSoapArrayFromArray($objArray) { if (!$objArray) { return null; } $objArrayToReturn = array(); foreach ($objArray as $objObject) { array_push($objArrayToReturn, EmailMessageRoute::GetSoapObjectFromObject($objObject, true)); } return unserialize(serialize($objArrayToReturn)); }
/** * 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 = EmailMessageRoute::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 EmailMessageRoute, given the clauses above $this->DataSource = EmailMessageRoute::QueryArray($objCondition, $objClauses); }
/** * 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 EmailMessageRouteMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing EmailMessageRoute object creation - defaults to CreateOrEdit * @return EmailMessageRouteMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objEmailMessageRoute = EmailMessageRoute::Load($intId); // EmailMessageRoute was found -- return it! if ($objEmailMessageRoute) { return new EmailMessageRouteMetaControl($objParentObject, $objEmailMessageRoute); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a EmailMessageRoute 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 EmailMessageRouteMetaControl($objParentObject, new EmailMessageRoute()); }
/** * Given the locally set Login and CommListEntry link, and given an array of Person[] objects all which * represent the FromEmailAddress, iterate through the array of CommunicationList objects to see which ones * the sender can send to. Associate any valid ones to this object as a new EmailMessageRoute. * Return any invalid (e.g. unauthorized) ones as an array. * @param CommunicationList[] $objCommunicationListArray * @param mixed[] $objSenderArray * @return CommunicationList[] returns any unauthorized CommLists that the sender is not allowed to send to */ protected function SetupCommunicationListRoutes($objCommunicationListArray, $objSenderArray) { // Pull out the components of the $objSenderArray $objLogin = $objSenderArray[0]; $objCommunicationListEntry = $objSenderArray[1]; $objPersonArray = $objSenderArray[2]; $objUnauthorizedArray = array(); // Do the calculation for Each CommList being attempted to emailed to foreach ($objCommunicationListArray as $objCommunicationList) { $objSource = null; // Figure out if there is a valid "Source" of this email that is authorized // to send to $objCommunicaitonList if ($objLogin && $objCommunicationList->IsLoginCanSendEmail($objLogin)) { $objSource = $objLogin; } else { if ($objCommunicationListEntry && $objCommunicationList->IsCommunicationListEntryCanSendEmail($objCommunicationListEntry)) { $objSource = $objCommunicationListEntry; } else { foreach ($objPersonArray as $objPerson) { if ($objCommunicationList->IsPersonCanSendEmail($objPerson)) { $objSource = $objPerson; break; } } } } // If a Valid Source, or if a PublicList, create the EmailRoute for the CommList, // otherwise, add the CommList to the list of Unauthorized if ($objSource || $objCommunicationList->IsAnyoneCanSendEmail()) { EmailMessageRoute::CreateNewRoute($this, $objSource, $objCommunicationList); } else { $objUnauthorizedArray[] = $objCommunicationList; } } return $objUnauthorizedArray; }