示例#1
0
 public function RenderGroupRoles(Group $objGroup)
 {
     $this->objParticipationArray = GroupParticipation::LoadArrayByPersonIdGroupId($this->objPerson->Id, $objGroup->Id, QQ::OrderBy(QQN::GroupParticipation()->GroupRole->Name, QQN::GroupParticipation()->DateStart));
     $strCurrentRole = null;
     $strArray = array();
     foreach ($this->objParticipationArray as $objParticipation) {
         if ($strCurrentRole != $objParticipation->GroupRole->Name) {
             $strCurrentRole = $objParticipation->GroupRole->Name;
             $strArray[] = QApplication::HtmlEntities($strCurrentRole);
         } else {
             $strArray[] = ' ';
         }
     }
     return implode('<br/>', $strArray);
 }
示例#2
0
 public function RenderCurrentRoles(Person $objPerson)
 {
     $objParticipations = GroupParticipation::LoadArrayByPersonIdGroupId($objPerson->Id, $this->objGroup->Id, array(QQ::OrderBy(QQN::GroupParticipation()->GroupRole->Name), QQ::Expand(QQN::GroupParticipation()->GroupRole->Name)));
     $strArray = array();
     foreach ($objParticipations as $objParticipation) {
         if (!$objParticipation->DateEnd) {
             $strArray[] = $objParticipation->GroupRole->Name;
         }
     }
     if (count($strArray)) {
         return implode(' and ', $strArray);
     } else {
         return '<span style="font-size: 10px; color: #999;">No current roles</span>';
     }
 }
示例#3
0
文件: Group.class.php 项目: alcf/chms
 /**
  * Calculates whether or not a given Person object is allowed to send emails
  * to this Group email list.  Return true if the Person can.  Returns false
  * if the Person is not allowed to OR if there is no Email List for this Group.
  * @param Person $objPerson
  * @return boolean
  */
 public function IsPersonCanSendEmail(Person $objPerson)
 {
     switch ($this->intEmailBroadcastTypeId) {
         case EmailBroadcastType::PublicList:
             return true;
         case EmailBroadcastType::PrivateList:
             foreach (GroupParticipation::LoadArrayByPersonIdGroupId($objPerson->Id, $this->intId) as $objParticipation) {
                 if (!$objParticipation->DateEnd || $objParticipation->DateEnd->IsLaterThan(QDateTime::Now())) {
                     return true;
                 }
             }
             return false;
         case EmailBroadcastType::AnnouncementOnly:
             $objLogin = Login::LoadByEmail($objPerson->PrimaryEmail->Address);
             if ($objLogin) {
                 if ($objLogin->IsMinistryAssociated($this->Ministry)) {
                     return true;
                 } else {
                     return false;
                 }
             }
             return false;
         default:
             return false;
     }
 }
 public function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     $objArrayToDelete = array();
     foreach (GroupParticipation::LoadArrayByPersonIdGroupId($this->pnlContent->objPerson->Id, $this->pnlContent->objGroup->Id) as $objParticipation) {
         $objArrayToDelete[$objParticipation->Id] = $objParticipation;
     }
     // Save all the participation records
     foreach ($this->objParticipationArray as $objParticipation) {
         $objParticipation->Save();
         if (array_key_exists($objParticipation->Id, $objArrayToDelete)) {
             unset($objArrayToDelete[$objParticipation->Id]);
         }
     }
     // Delete any that are supposed to be deleted
     foreach ($objArrayToDelete as $objParticipation) {
         $objParticipation->Delete();
     }
     // Update groupAuthorizedSender table
     if ($this->chkIsAuthorizedSender->Checked && !GroupAuthorizedSender::LoadByGroupIdPersonId($this->pnlContent->objGroup->Id, $this->pnlContent->objPerson->Id)) {
         $objGroupAuthorizedSender = new GroupAuthorizedSender();
         $objGroupAuthorizedSender->GroupId = $this->pnlContent->objGroup->Id;
         $objGroupAuthorizedSender->PersonId = $this->pnlContent->objPerson->Id;
         $objGroupAuthorizedSender->Save();
     } else {
         if (!$this->chkIsAuthorizedSender->Checked) {
             $objGroupAuthorizedSender = GroupAuthorizedSender::LoadByGroupIdPersonId($this->pnlContent->objGroup->Id, $this->pnlContent->objPerson->Id);
             if ($objGroupAuthorizedSender) {
                 $objGroupAuthorizedSender->Delete();
             }
         }
     }
     $this->pnlContent->ReturnTo($this->strReturnUrl);
 }