public function __construct(QPanel $pnlContent, $strReturnUrl)
 {
     $this->pnlContent = $pnlContent;
     $this->pnlContent->Template = dirname(__FILE__) . '/EditGroupParticipationDelegate.tpl.php';
     // Throw Exception if Group Cannot have Explicitly Defined Participants
     if (!$this->pnlContent->objGroup->IsGroupCanHaveExplicitlyDefinedParticipants()) {
         throw new Exception('Group Cannot have Explicitly Defined Participants');
     }
     $this->strReturnUrl = $strReturnUrl;
     $this->objParticipationArray = GroupParticipation::LoadArrayByPersonIdGroupId($this->pnlContent->objPerson->Id, $this->pnlContent->objGroup->Id, QQ::OrderBy(QQN::GroupParticipation()->GroupRole->Name, QQN::GroupParticipation()->DateStart), QQ::Clause(QQ::Expand(QQN::GroupParticipation()->GroupRole)));
     $this->chkIsAuthorizedSender = new QCheckBox($this->pnlContent);
     $this->chkIsAuthorizedSender->Name = '  Is Authorized Sender';
     if (GroupAuthorizedSender::LoadByGroupIdPersonId($this->pnlContent->objGroup->Id, $this->pnlContent->objPerson->Id)) {
         $this->chkIsAuthorizedSender->Checked = true;
     } else {
         $this->chkIsAuthorizedSender->Checked = false;
     }
     $this->lblCurrentRoles = new QLabel($this->pnlContent);
     $this->lblCurrentRoles->Name = 'Current Roles';
     $this->lblCurrentRoles->HtmlEntities = false;
     $this->lblCurrentRoles_Refresh();
     $this->dtgParticipations = new QDataGrid($this->pnlContent);
     $this->dtgParticipations->AddColumn(new QDataGridColumn('Role', '<?= $_CONTROL->ParentControl->objDelegate->RenderRole($_ITEM); ?>', 'HtmlEntities=false', 'Width=100px'));
     $this->dtgParticipations->AddColumn(new QDataGridColumn('Participation Started', '<?= $_CONTROL->ParentControl->objDelegate->RenderDateStart($_ITEM); ?>', 'HtmlEntities=false', 'Width=150px'));
     $this->dtgParticipations->AddColumn(new QDataGridColumn('Participation Ended', '<?= $_CONTROL->ParentControl->objDelegate->RenderDateEnd($_ITEM); ?>', 'HtmlEntities=false', 'Width=150px'));
     $this->dtgParticipations->SetDataBinder('dtgParticipations_Bind', $this);
     $this->pxyEdit = new QControlProxy($this->pnlContent);
     $this->pxyEdit->AddAction(new QClickEvent(), new QAjaxControlAction($this->pnlContent, 'pxyEdit_Click'));
     $this->pxyEdit->AddAction(new QClickEvent(), new QTerminateAction());
     $this->dlgEdit_Setup();
 }
示例#2
0
 /**
  * Retrieves an array of array of dates (which can be used for IsValidDates for a given
  * Person, Group and GroupRole
  * 
  * @param integer $intPersonId
  * @param integer $intGroupId
  * @param integer $intGroupRoleId
  * @return QDateTime[][]
  */
 public static function GetParticipationDatesArrayForPersonIdGroupIdGroupRoleId($intPersonId, $intGroupId, $intGroupRoleId)
 {
     $objParticipationArray = GroupParticipation::QueryArray(QQ::AndCondition(QQ::Equal(QQN::GroupParticipation()->PersonId, $intPersonId), QQ::Equal(QQN::GroupParticipation()->GroupId, $intGroupId), QQ::Equal(QQN::GroupParticipation()->GroupRoleId, $intGroupRoleId)), QQ::OrderBy(QQN::GroupParticipation()->DateStart));
     $dttArrayToReturn = array();
     foreach ($objParticipationArray as $objParticipation) {
         $dttArrayToReturn[] = array($objParticipation->DateStart, $objParticipation->DateEnd);
     }
     return $dttArrayToReturn;
 }
示例#3
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[] = '&nbsp;';
         }
     }
     return implode('<br/>', $strArray);
 }
 /**
  * Used internally by the Meta-based Add Column tools.
  *
  * Given a QQNode or a Text String, this will return a GroupParticipation-based QQNode.
  * It will also verify that it is a proper GroupParticipation-based QQNode, and will throw an exception otherwise.
  *
  * @param mixed $mixContent
  * @return QQNode
  */
 protected function ResolveContentItem($mixContent)
 {
     if ($mixContent instanceof QQNode) {
         if (!$mixContent->_ParentNode) {
             throw new QCallerException('Content QQNode cannot be a Top Level Node');
         }
         if ($mixContent->_RootTableName == 'group_participation') {
             if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) {
                 throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
             }
             $objCurrentNode = $mixContent;
             while ($objCurrentNode = $objCurrentNode->_ParentNode) {
                 if (!$objCurrentNode instanceof QQNode) {
                     throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
                 }
                 if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) {
                     throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
                 }
             }
             return $mixContent;
         } else {
             throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "group_participation".');
         }
     } else {
         if (is_string($mixContent)) {
             switch ($mixContent) {
                 case 'Id':
                     return QQN::GroupParticipation()->Id;
                 case 'PersonId':
                     return QQN::GroupParticipation()->PersonId;
                 case 'Person':
                     return QQN::GroupParticipation()->Person;
                 case 'GroupId':
                     return QQN::GroupParticipation()->GroupId;
                 case 'Group':
                     return QQN::GroupParticipation()->Group;
                 case 'GroupRoleId':
                     return QQN::GroupParticipation()->GroupRoleId;
                 case 'GroupRole':
                     return QQN::GroupParticipation()->GroupRole;
                 case 'DateStart':
                     return QQN::GroupParticipation()->DateStart;
                 case 'DateEnd':
                     return QQN::GroupParticipation()->DateEnd;
                 case 'Status':
                     return QQN::GroupParticipation()->Status;
                 case 'DateFollowup':
                     return QQN::GroupParticipation()->DateFollowup;
                 default:
                     throw new QCallerException('Simple Property not found in GroupParticipationDataGrid content: ' . $mixContent);
             }
         } else {
             if ($mixContent instanceof QQAssociationNode) {
                 throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
             } else {
                 throw new QCallerException('Invalid Content type');
             }
         }
     }
 }
示例#5
0
文件: Group.class.php 项目: alcf/chms
 /**
  * Gets all associated ACTIVE GroupParticipations as an array of GroupParticipation objects
  * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  * @return GroupParticipation[]
  */
 public function GetActiveGroupParticipationArray($objOptionalClauses = null)
 {
     if (is_null($this->intId)) {
         return array();
     }
     try {
         return GroupParticipation::QueryArray(QQ::AndCondition(QQ::Equal(QQN::GroupParticipation()->GroupId, $this->intId), QQ::OrCondition(QQ::IsNull(QQN::GroupParticipation()->DateEnd), QQ::GreaterThan(QQN::GroupParticipation()->DateEnd, QDateTime::Now()))), $objOptionalClauses);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
示例#6
0
 public function RenderCurrentGroups(Person $objPerson)
 {
     $this->objParticipations = GroupParticipation::QueryArray(QQ::AndCondition(QQ::Equal(QQN::GroupParticipation()->PersonId, $objPerson->Id), QQ::IsNull(QQN::GroupParticipation()->DateEnd), QQ::In(QQN::GroupParticipation()->GroupId, $this->intGroupIdArray)), QQ::Clause(QQ::OrderBy(QQN::GroupParticipation()->Group->Name), QQ::Expand(QQN::GroupParticipation()->Group->Name)));
     $strArray = array();
     foreach ($this->objParticipations as $objParticipation) {
         $strArray[] = $objParticipation->Group->Name;
     }
     if (count($strArray)) {
         return implode(' and ', $strArray);
     } else {
         return '<span style="font-size: 10px; color: #999;">No current groups</span>';
     }
 }
示例#7
0
 /**
  * Count GroupParticipations
  * by DateFollowup Index(es)
  * @param QDateTime $dttDateFollowup
  * @return int
  */
 public static function CountByDateFollowup($dttDateFollowup, $objOptionalClauses = null)
 {
     // Call GroupParticipation::QueryCount to perform the CountByDateFollowup query
     return GroupParticipation::QueryCount(QQ::Equal(QQN::GroupParticipation()->DateFollowup, $dttDateFollowup), $objOptionalClauses);
 }