Beispiel #1
0
 protected function btnCheck_Click($strFormId, $strControlId, $strParameter)
 {
     $this->lblResult->Text = '';
     $objEmailArray = Email::LoadArrayByAddress($this->txtEmail->Text);
     if (count($objEmailArray) > 0) {
         $this->lblResult->Text .= "Found email objects<br><br>";
         $intPersonIdArray = array();
         foreach ($objEmailArray as $objEmail) {
             $objPerson = Person::LoadByPrimaryEmailId($objEmail->Id);
             if ($objPerson) {
                 $intPersonIdArray[] = $objPerson->Id;
             }
         }
         $this->lblResult->Text .= "<h3>GROUPS</h3>";
         $objGroupCursor = Group::QueryCursor(QQ::All());
         while ($objGroup = Group::InstantiateCursor($objGroupCursor)) {
             $objGroupParticipationArr = $objGroup->GetGroupParticipationArray();
             foreach ($objGroupParticipationArr as $objGroupParticipant) {
                 if (in_array($objGroupParticipant->PersonId, $intPersonIdArray)) {
                     $this->lblResult->Text .= sprintf("%s is in %s: %s<br>", $this->txtEmail->Text, $objGroup->Ministry->Name, $objGroup->Name);
                     break;
                 }
             }
         }
         $this->lblResult->Text .= "<br><h3>COMMUNICATION LISTS</h3>";
         $objCommuncationsCursor = CommunicationList::QueryCursor(QQ::All());
         while ($objCommunicationList = CommunicationList::InstantiateCursor($objCommuncationsCursor)) {
             $objCommListArray = $objCommunicationList->GetMemberAsArray();
             foreach ($objCommListArray as $objComListEntry) {
                 if ($objComListEntry[3] == $this->txtEmail->Text) {
                     $this->lblResult->Text .= sprintf("%s is in %s: %s<br>", $this->txtEmail->Text, $objCommunicationList->Ministry->Name, $objCommunicationList->Name);
                     break;
                 }
             }
         }
     } else {
         $this->lblResult->Text .= "No email object found<br>";
     }
 }
 /**
  * Create and setup QListBox lstCommunicationLists
  * @param string $strControlId optional ControlId to use
  * @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 QListBox
  */
 public function lstCommunicationLists_Create($strControlId = null, QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     $this->lstCommunicationLists = new QListBox($this->objParentObject, $strControlId);
     $this->lstCommunicationLists->Name = QApplication::Translate('Communication Lists');
     $this->lstCommunicationLists->SelectionMode = QSelectionMode::Multiple;
     // We need to know which items to "Pre-Select"
     $objAssociatedArray = $this->objCommunicationListEntry->GetCommunicationListArray();
     // Setup and perform the Query
     if (is_null($objCondition)) {
         $objCondition = QQ::All();
     }
     $objCommunicationListCursor = CommunicationList::QueryCursor($objCondition, $objOptionalClauses);
     // Iterate through the Cursor
     while ($objCommunicationList = CommunicationList::InstantiateCursor($objCommunicationListCursor)) {
         $objListItem = new QListItem($objCommunicationList->__toString(), $objCommunicationList->Id);
         foreach ($objAssociatedArray as $objAssociated) {
             if ($objAssociated->Id == $objCommunicationList->Id) {
                 $objListItem->Selected = true;
             }
         }
         $this->lstCommunicationLists->AddItem($objListItem);
     }
     // Return the QListControl
     return $this->lstCommunicationLists;
 }
    print "GROUPS\n";
    $objGroupCursor = Group::QueryCursor(QQ::All());
    QDataGen::DisplayForEachTaskStart('Checking for email in Group Lists', Group::CountAll());
    while ($objGroup = Group::InstantiateCursor($objGroupCursor)) {
        QDataGen::DisplayForEachTaskNext('Checking for email in Group Lists');
        $objGroupParticipationArr = $objGroup->GetGroupParticipationArray();
        foreach ($objGroupParticipationArr as $objGroupParticipant) {
            if (in_array($objGroupParticipant->PersonId, $intPersonIdArray)) {
                printf("\n%s is in %s: %s\n", $txtEmail, $objGroup->Ministry->Name, $objGroup->Name);
                break;
            }
        }
    }
    QDataGen::DisplayForEachTaskEnd('Checking for email in Group Lists');
    print "COMMUNICATION LISTS\n";
    $objCommuncationsCursor = CommunicationList::QueryCursor(QQ::All());
    QDataGen::DisplayForEachTaskStart('Checking for email in Communication Lists', CommunicationList::CountAll());
    while ($objCommunicationList = CommunicationList::InstantiateCursor($objCommuncationsCursor)) {
        QDataGen::DisplayForEachTaskNext('Checking for email in Communication Lists');
        $objCommListArray = $objCommunicationList->GetMemberAsArray();
        foreach ($objCommListArray as $objComListEntry) {
            if ($objComListEntry[3] == $txtEmail) {
                printf("\n%s is in %s: %s\n", $txtEmail, $objCommunicationList->Ministry->Name, $objCommunicationList->Name);
                break;
            }
        }
    }
    QDataGen::DisplayForEachTaskEnd('Checking for email in Communication Lists');
} else {
    print "No email object found\n";
}
 /**
  * Create and setup QListBox lstCommunicationList
  * @param string $strControlId optional ControlId to use
  * @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 QListBox
  */
 public function lstCommunicationList_Create($strControlId = null, QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     $this->lstCommunicationList = new QListBox($this->objParentObject, $strControlId);
     $this->lstCommunicationList->Name = QApplication::Translate('Communication List');
     $this->lstCommunicationList->AddItem(QApplication::Translate('- Select One -'), null);
     // Setup and perform the Query
     if (is_null($objCondition)) {
         $objCondition = QQ::All();
     }
     $objCommunicationListCursor = CommunicationList::QueryCursor($objCondition, $objOptionalClauses);
     // Iterate through the Cursor
     while ($objCommunicationList = CommunicationList::InstantiateCursor($objCommunicationListCursor)) {
         $objListItem = new QListItem($objCommunicationList->__toString(), $objCommunicationList->Id);
         if ($this->objEmailMessageRoute->CommunicationList && $this->objEmailMessageRoute->CommunicationList->Id == $objCommunicationList->Id) {
             $objListItem->Selected = true;
         }
         $this->lstCommunicationList->AddItem($objListItem);
     }
     // Return the QListBox
     return $this->lstCommunicationList;
 }