当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_Action::mask方法代码示例

本文整理汇总了PHP中CRM_Core_Action::mask方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Action::mask方法的具体用法?PHP CRM_Core_Action::mask怎么用?PHP CRM_Core_Action::mask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_Action的用法示例。


在下文中一共展示了CRM_Core_Action::mask方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: browse

 /**
  * This function is called when action is browse
  *
  * return null
  * @access public
  */
 function browse()
 {
     $note =& new CRM_Core_DAO_Note();
     $note->entity_table = 'civicrm_contact';
     $note->entity_id = $this->_contactId;
     $note->orderBy('modified_date desc');
     //CRM-4418, handling edit and delete separately.
     $permissions = array($this->_permission);
     if ($this->_permission == CRM_Core_Permission::EDIT) {
         //previously delete was subset of edit
         //so for consistency lets grant delete also.
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     $mask = CRM_Core_Action::mask($permissions);
     $values = array();
     $links =& self::links();
     $action = array_sum(array_keys($links)) & $mask;
     $note->find();
     while ($note->fetch()) {
         $values[$note->id] = array();
         CRM_Core_DAO::storeValues($note, $values[$note->id]);
         $values[$note->id]['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $note->id, 'cid' => $this->_contactId));
         $contact = new CRM_Contact_DAO_Contact();
         $contact->id = $note->contact_id;
         $contact->find();
         $contact->fetch();
         $values[$note->id]['createdBy'] = $contact->display_name;
     }
     $this->assign('notes', $values);
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:36,代码来源:Note.php

示例2: browse

 /**
  * This function is called when action is browse
  * 
  * return null
  * @access public
  */
 function browse()
 {
     $links =& self::links('all', $this->_isPaymentProcessor, $this->_accessContribution);
     $idList = array('membership_type' => 'MembershipType', 'status' => 'MembershipStatus');
     $membership = array();
     require_once 'CRM/Member/DAO/Membership.php';
     $dao =& new CRM_Member_DAO_Membership();
     $dao->contact_id = $this->_contactId;
     $dao->is_test = 0;
     //$dao->orderBy('name');
     $dao->find();
     //CRM--4418, check for view, edit, delete
     $permissions = array(CRM_Core_Permission::VIEW);
     if (CRM_Core_Permission::check('edit memberships')) {
         $permissions[] = CRM_Core_Permission::EDIT;
     }
     if (CRM_Core_Permission::check('delete in CiviMember')) {
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     $mask = CRM_Core_Action::mask($permissions);
     //checks membership of contact itself
     while ($dao->fetch()) {
         $membership[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $membership[$dao->id]);
         foreach ($idList as $name => $file) {
             if ($membership[$dao->id][$name . '_id']) {
                 $membership[$dao->id][$name] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_' . $file, $membership[$dao->id][$name . '_id']);
             }
         }
         if ($dao->status_id) {
             $active = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $dao->status_id, 'is_current_member');
             if ($active) {
                 $membership[$dao->id]['active'] = $active;
             }
         }
         if (!$dao->owner_membership_id) {
             $membership[$dao->id]['action'] = CRM_Core_Action::formLink(self::links('all'), $mask, array('id' => $dao->id, 'cid' => $this->_contactId));
         } else {
             $membership[$dao->id]['action'] = CRM_Core_Action::formLink(self::links('view'), $mask, array('id' => $dao->id, 'cid' => $this->_contactId));
         }
     }
     //Below code gives list of all Membership Types associated
     //with an Organization(CRM-2016)
     include_once 'CRM/Member/BAO/MembershipType.php';
     $membershipTypes = CRM_Member_BAO_MembershipType::getMembershipTypesByOrg($this->_contactId);
     foreach ($membershipTypes as $key => $value) {
         $membershipTypes[$key]['action'] = CRM_Core_Action::formLink(self::membershipTypeslinks(), $mask, array('id' => $value['id'], 'cid' => $this->_contactId));
     }
     $activeMembers = CRM_Member_BAO_Membership::activeMembers($membership);
     $inActiveMembers = CRM_Member_BAO_Membership::activeMembers($membership, 'inactive');
     $this->assign('activeMembers', $activeMembers);
     $this->assign('inActiveMembers', $inActiveMembers);
     $this->assign('membershipTypes', $membershipTypes);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:60,代码来源:Tab.php

示例3: browse

 /**
  * This function is called when action is browse
  * 
  * return null
  * @access public
  */
 function browse()
 {
     $links =& CRM_Contact_Page_View_Relationship::links();
     $mask = CRM_Core_Action::mask($this->_permission);
     $currentRelationships = CRM_Contact_BAO_Relationship::getRelationship($this->_contactId, CRM_CONTACT_BAO_RELATIONSHIP_CURRENT, 0, 0, 0, $links, $mask);
     $pastRelationships = CRM_Contact_BAO_Relationship::getRelationship($this->_contactId, CRM_CONTACT_BAO_RELATIONSHIP_PAST, 0, 0, 0, $links, $mask);
     $disableRelationships = CRM_Contact_BAO_Relationship::getRelationship($this->_contactId, CRM_CONTACT_BAO_RELATIONSHIP_DISABLED, 0, 0, 0, $links, $mask);
     $this->assign('currentRelationships', $currentRelationships);
     $this->assign('pastRelationships', $pastRelationships);
     $this->assign('disableRelationships', $disableRelationships);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:17,代码来源:Relationship.php

示例4: browse

 /**
  * This function is called when action is browse
  *
  * return null
  * @access public
  */
 function browse()
 {
     $note =& new CRM_Core_DAO_Note();
     $note->entity_table = 'civicrm_contact';
     $note->entity_id = $this->_contactId;
     $note->orderBy('modified_date desc');
     $values = array();
     $links =& CRM_Contact_Page_View_Note::links();
     $action = array_sum(array_keys($links)) & CRM_Core_Action::mask($this->_permission);
     $note->find();
     while ($note->fetch()) {
         $values[$note->id] = array();
         CRM_Core_DAO::storeValues($note, $values[$note->id]);
         $values[$note->id]['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $note->id, 'cid' => $this->_contactId));
         $contact = new CRM_Contact_DAO_Contact();
         $contact->id = $note->contact_id;
         $contact->find();
         $contact->fetch();
         $values[$note->id]['createdBy'] = $contact->display_name;
     }
     $this->assign('notes', $values);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:28,代码来源:Note.php

示例5: getCases

 /**
  * Retrieve cases related to particular contact or whole contact
  * used in Dashboad and Tab
  *
  * @param boolean $allCases
  *
  * @param int $userID
  *
  * @param String $type /upcoming,recent,all/
  *
  * @param string $context
  *
  * @return array     Array of Cases
  *
  * @access public
  */
 static function getCases($allCases = TRUE, $userID = NULL, $type = 'upcoming', $context = 'dashboard')
 {
     $condition = NULL;
     $casesList = array();
     //validate access for own cases.
     if (!self::accessCiviCase()) {
         return $casesList;
     }
     if (!$userID) {
         $session = CRM_Core_Session::singleton();
         $userID = $session->get('userID');
     }
     //validate access for all cases.
     if ($allCases && !CRM_Core_Permission::check('access all cases and activities')) {
         $allCases = FALSE;
     }
     $condition = " AND civicrm_case.is_deleted = 0 ";
     if (!$allCases) {
         $condition .= " AND case_relationship.contact_id_b = {$userID} ";
     }
     if ($type == 'upcoming' || $type == 'any') {
         $closedId = CRM_Core_OptionGroup::getValue('case_status', 'Closed', 'name');
         $condition .= "\nAND civicrm_case.status_id != {$closedId}";
     }
     $query = self::getCaseActivityQuery($type, $userID, $condition);
     $queryParams = array();
     $result = CRM_Core_DAO::executeQuery($query, $queryParams);
     $caseStatus = CRM_Core_OptionGroup::values('case_status', FALSE, FALSE, FALSE, " AND v.name = 'Urgent' ");
     $resultFields = array('contact_id', 'contact_type', 'sort_name', 'phone', 'case_id', 'case_subject', 'case_type', 'case_type_id', 'status_id', 'case_status', 'case_status_name', 'activity_type_id', 'case_start_date', 'case_role');
     if ($type == 'upcoming') {
         $resultFields[] = 'case_scheduled_activity_date';
         $resultFields[] = 'case_scheduled_activity_type_name';
         $resultFields[] = 'case_scheduled_activity_type';
         $resultFields[] = 'case_scheduled_activity_id';
     } elseif ($type == 'recent') {
         $resultFields[] = 'case_recent_activity_date';
         $resultFields[] = 'case_recent_activity_type_name';
         $resultFields[] = 'case_recent_activity_type';
         $resultFields[] = 'case_recent_activity_id';
     } elseif ($type == 'any') {
         $resultFields[] = 'case_activity_date';
         $resultFields[] = 'case_activity_type_name';
         $resultFields[] = 'case_activity_type';
         $resultFields[] = 'case_activity_id';
     }
     // we're going to use the usual actions, so doesn't make sense to duplicate definitions
     $actions = CRM_Case_Selector_Search::links();
     // check is the user has view/edit signer permission
     $permissions = array(CRM_Core_Permission::VIEW);
     if (CRM_Core_Permission::check('access all cases and activities') || !$allCases && CRM_Core_Permission::check('access my cases and activities')) {
         $permissions[] = CRM_Core_Permission::EDIT;
     }
     if (CRM_Core_Permission::check('delete in CiviCase')) {
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     $mask = CRM_Core_Action::mask($permissions);
     while ($result->fetch()) {
         foreach ($resultFields as $donCare => $field) {
             $casesList[$result->case_id][$field] = $result->{$field};
             if ($field == 'contact_type') {
                 $casesList[$result->case_id]['contact_type_icon'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type);
                 $casesList[$result->case_id]['action'] = CRM_Core_Action::formLink($actions['primaryActions'], $mask, array('id' => $result->case_id, 'cid' => $result->contact_id, 'cxt' => $context), ts('more'), FALSE, 'case.actions.primary', 'Case', $result->case_id);
                 $casesList[$result->case_id]['moreActions'] = CRM_Core_Action::formLink($actions['moreActions'], $mask, array('id' => $result->case_id, 'cid' => $result->contact_id, 'cxt' => $context), ts('more'), TRUE, 'case.actions.more', 'Case', $result->case_id);
             } elseif ($field == 'case_status') {
                 if (in_array($result->{$field}, $caseStatus)) {
                     $casesList[$result->case_id]['class'] = "status-urgent";
                 } else {
                     $casesList[$result->case_id]['class'] = "status-normal";
                 }
             }
         }
         //CRM-4510.
         $caseTypes = CRM_Case_PseudoConstant::caseType('name');
         $caseManagerContact = self::getCaseManagerContact($caseTypes[$result->case_type_id], $result->case_id);
         if (!empty($caseManagerContact)) {
             $casesList[$result->case_id]['casemanager_id'] = CRM_Utils_Array::value('casemanager_id', $caseManagerContact);
             $casesList[$result->case_id]['casemanager'] = CRM_Utils_Array::value('casemanager', $caseManagerContact);
         }
         //do check user permissions for edit/view activity.
         if (($actId = CRM_Utils_Array::value('case_scheduled_activity_id', $casesList[$result->case_id])) || ($actId = CRM_Utils_Array::value('case_recent_activity_id', $casesList[$result->case_id]))) {
             $casesList[$result->case_id]["case_{$type}_activity_editable"] = self::checkPermission($actId, 'edit', $casesList[$result->case_id]['activity_type_id'], $userID);
             $casesList[$result->case_id]["case_{$type}_activity_viewable"] = self::checkPermission($actId, 'view', $casesList[$result->case_id]['activity_type_id'], $userID);
         }
     }
//.........这里部分代码省略.........
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:101,代码来源:Case.php

示例6: array

 /**
  * Returns all the rows in the given offset and rowCount.
  *
  * @param string $action
  *   The action being performed.
  * @param int $offset
  *   The row number to start from.
  * @param int $rowCount
  *   The number of rows to return.
  * @param string $sort
  *   The sql string that describes the sort order.
  * @param string $output
  *   What should the result set include (web/email/csv).
  *
  * @return array
  *   rows in the given offset and rowCount
  */
 public function &getRows($action, $offset, $rowCount, $sort, $output = NULL)
 {
     $result = $this->_query->searchQuery($offset, $rowCount, $sort, FALSE, FALSE, FALSE, FALSE, FALSE, $this->_eventClause);
     // process the result of the query
     $rows = array();
     //lets handle view, edit and delete separately. CRM-4418
     $permissions = array(CRM_Core_Permission::VIEW);
     if (CRM_Core_Permission::check('edit event participants')) {
         $permissions[] = CRM_Core_Permission::EDIT;
     }
     if (CRM_Core_Permission::check('delete in CiviEvent')) {
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     $mask = CRM_Core_Action::mask($permissions);
     $statusTypes = CRM_Event_PseudoConstant::participantStatus();
     $statusClasses = CRM_Event_PseudoConstant::participantStatusClass();
     $participantRoles = CRM_Event_PseudoConstant::participantRole();
     $sep = CRM_Core_DAO::VALUE_SEPARATOR;
     //get all campaigns.
     $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
     while ($result->fetch()) {
         $row = array();
         // the columns we are interested in
         foreach (self::$_properties as $property) {
             if (isset($result->{$property})) {
                 $row[$property] = $result->{$property};
             }
         }
         //carry campaign on selectors.
         $row['campaign'] = CRM_Utils_Array::value($result->participant_campaign_id, $allCampaigns);
         $row['campaign_id'] = $result->participant_campaign_id;
         // gross hack to show extra information for pending status
         $statusClass = NULL;
         if (isset($row['participant_status_id']) && ($statusId = array_search($row['participant_status_id'], $statusTypes))) {
             $statusClass = $statusClasses[$statusId];
         }
         $row['showConfirmUrl'] = $statusClass == 'Pending' ? TRUE : FALSE;
         if (!empty($row['participant_is_test'])) {
             $row['participant_status'] .= ' (' . ts('test') . ')';
         }
         $row['checkbox'] = CRM_Core_Form::CB_PREFIX . $result->participant_id;
         $links = self::links($this->_key, $this->_context, $this->_compContext);
         if ($statusTypes[$row['participant_status_id']] == 'Partially paid') {
             $links[CRM_Core_Action::ADD] = array('name' => ts('Record Payment'), 'url' => 'civicrm/payment', 'qs' => 'reset=1&id=%%id%%&cid=%%cid%%&action=add&component=event', 'title' => ts('Record Payment'));
         }
         if ($statusTypes[$row['participant_status_id']] == 'Pending refund') {
             $links[CRM_Core_Action::ADD] = array('name' => ts('Record Refund'), 'url' => 'civicrm/payment', 'qs' => 'reset=1&id=%%id%%&cid=%%cid%%&action=add&component=event', 'title' => ts('Record Refund'));
         }
         $row['action'] = CRM_Core_Action::formLink($links, $mask, array('id' => $result->participant_id, 'cid' => $result->contact_id, 'cxt' => $this->_context), ts('more'), FALSE, 'participant.selector.row', 'Participant', $result->participant_id);
         $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id);
         $row['paid'] = CRM_Event_BAO_Event::isMonetary($row['event_id']);
         if (!empty($row['participant_fee_level'])) {
             CRM_Event_BAO_Participant::fixEventLevel($row['participant_fee_level']);
         }
         if (CRM_Event_BAO_Event::usesPriceSet($row['event_id'])) {
             // add line item details if applicable
             $lineItems[$row['participant_id']] = CRM_Price_BAO_LineItem::getLineItems($row['participant_id']);
         }
         if (!empty($row['participant_role_id'])) {
             $viewRoles = array();
             foreach (explode($sep, $row['participant_role_id']) as $k => $v) {
                 $viewRoles[] = $participantRoles[$v];
             }
             $row['participant_role_id'] = implode(', ', $viewRoles);
         }
         $rows[] = $row;
     }
     CRM_Core_Selector_Controller::$_template->assign_by_ref('lineItems', $lineItems);
     return $rows;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:87,代码来源:Search.php

示例7: action

 /**
  * Given an object, get the actions that can be associated with this
  * object. Check the is_active and is_required flags to display valid
  * actions
  *
  * @param CRM_Core_DAO $object
  *   The object being considered.
  * @param int $action
  *   The base set of actions.
  * @param array $values
  *   The array of values that we send to the template.
  * @param array $links
  *   The array of links.
  * @param string $permission
  *   The permission assigned to this object.
  *
  * @param bool $forceAction
  */
 public function action(&$object, $action, &$values, &$links, $permission, $forceAction = FALSE)
 {
     $values['class'] = '';
     $newAction = $action;
     $hasDelete = $hasDisable = TRUE;
     if (!empty($values['name']) && in_array($values['name'], array('encounter_medium', 'case_type', 'case_status'))) {
         static $caseCount = NULL;
         if (!isset($caseCount)) {
             $caseCount = CRM_Case_BAO_Case::caseCount(NULL, FALSE);
         }
         if ($caseCount > 0) {
             $hasDelete = $hasDisable = FALSE;
         }
     }
     if (!$forceAction) {
         if (array_key_exists('is_reserved', $object) && $object->is_reserved) {
             $values['class'] = 'reserved';
             // check if object is relationship type
             $object_type = get_class($object);
             $exceptions = array('CRM_Contact_BAO_RelationshipType', 'CRM_Core_BAO_LocationType', 'CRM_Badge_BAO_Layout');
             if (in_array($object_type, $exceptions)) {
                 $newAction = CRM_Core_Action::VIEW + CRM_Core_Action::UPDATE;
             } else {
                 $newAction = 0;
                 $values['action'] = '';
                 return;
             }
         } else {
             if (array_key_exists('is_active', $object)) {
                 if ($object->is_active) {
                     if ($hasDisable) {
                         $newAction += CRM_Core_Action::DISABLE;
                     }
                 } else {
                     $newAction += CRM_Core_Action::ENABLE;
                 }
             }
         }
     }
     //CRM-4418, handling edit and delete separately.
     $permissions = array($permission);
     if ($hasDelete && $permission == CRM_Core_Permission::EDIT) {
         //previously delete was subset of edit
         //so for consistency lets grant delete also.
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     // make sure we only allow those actions that the user is permissioned for
     $newAction = $newAction & CRM_Core_Action::mask($permissions);
     $values['action'] = CRM_Core_Action::formLink($links, $newAction, array('id' => $object->id));
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:68,代码来源:Basic.php

示例8: getContactActivitySelector

 /**
  * This function is a wrapper for ajax activity selector
  *
  * @param  array   $params associated array for params record id.
  *
  * @return array   $contactActivities associated array of contact activities
  * @access public
  */
 public static function getContactActivitySelector(&$params)
 {
     // format the params
     $params['offset'] = ($params['page'] - 1) * $params['rp'];
     $params['rowCount'] = $params['rp'];
     $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
     $params['caseId'] = NULL;
     $context = CRM_Utils_Array::value('context', $params);
     // get contact activities
     $activities = CRM_Activity_BAO_Activity::getActivities($params);
     // add total
     $params['total'] = CRM_Activity_BAO_Activity::getActivitiesCount($params);
     // format params and add links
     $contactActivities = array();
     if (!empty($activities)) {
         $activityStatus = CRM_Core_PseudoConstant::activityStatus();
         // check logged in user for permission
         $page = new CRM_Core_Page();
         CRM_Contact_Page_View::checkUserPermission($page, $params['contact_id']);
         $permissions = array($page->_permission);
         if (CRM_Core_Permission::check('delete activities')) {
             $permissions[] = CRM_Core_Permission::DELETE;
         }
         $mask = CRM_Core_Action::mask($permissions);
         foreach ($activities as $activityId => $values) {
             $contactActivities[$activityId]['activity_type'] = $values['activity_type'];
             $contactActivities[$activityId]['subject'] = $values['subject'];
             if ($params['contact_id'] == $values['source_contact_id']) {
                 $contactActivities[$activityId]['source_contact'] = $values['source_contact_name'];
             } elseif ($values['source_contact_id']) {
                 $contactActivities[$activityId]['source_contact'] = CRM_Utils_System::href($values['source_contact_name'], 'civicrm/contact/view', "reset=1&cid={$values['source_contact_id']}");
             } else {
                 $contactActivities[$activityId]['source_contact'] = '<em>n/a</em>';
             }
             if (isset($values['mailingId']) && !empty($values['mailingId'])) {
                 $contactActivities[$activityId]['target_contact'] = CRM_Utils_System::href($values['recipients'], 'civicrm/mailing/report/event', "mid={$values['source_record_id']}&reset=1&event=queue&cid={$params['contact_id']}&context=activitySelector");
             } elseif (CRM_Utils_Array::value('recipients', $values)) {
                 $contactActivities[$activityId]['target_contact'] = $values['recipients'];
             } elseif (!$values['target_contact_name']) {
                 $contactActivities[$activityId]['target_contact'] = '<em>n/a</em>';
             } elseif (!empty($values['target_contact_name'])) {
                 $count = 0;
                 $contactActivities[$activityId]['target_contact'] = '';
                 foreach ($values['target_contact_name'] as $tcID => $tcName) {
                     if ($tcID && $count < 5) {
                         $contactActivities[$activityId]['target_contact'] .= CRM_Utils_System::href($tcName, 'civicrm/contact/view', "reset=1&cid={$tcID}");
                         $count++;
                         if ($count) {
                             $contactActivities[$activityId]['target_contact'] .= ";&nbsp;";
                         }
                         if ($count == 4) {
                             $contactActivities[$activityId]['target_contact'] .= "(" . ts('more') . ")";
                             break;
                         }
                     }
                 }
             }
             if (empty($values['assignee_contact_name'])) {
                 $contactActivities[$activityId]['assignee_contact'] = '<em>n/a</em>';
             } elseif (!empty($values['assignee_contact_name'])) {
                 $count = 0;
                 $contactActivities[$activityId]['assignee_contact'] = '';
                 foreach ($values['assignee_contact_name'] as $acID => $acName) {
                     if ($acID && $count < 5) {
                         $contactActivities[$activityId]['assignee_contact'] .= CRM_Utils_System::href($acName, 'civicrm/contact/view', "reset=1&cid={$acID}");
                         $count++;
                         if ($count) {
                             $contactActivities[$activityId]['assignee_contact'] .= ";&nbsp;";
                         }
                         if ($count == 4) {
                             $contactActivities[$activityId]['assignee_contact'] .= "(" . ts('more') . ")";
                             break;
                         }
                     }
                 }
             }
             $contactActivities[$activityId]['activity_date'] = CRM_Utils_Date::customFormat($values['activity_date_time']);
             $contactActivities[$activityId]['status'] = $activityStatus[$values['status_id']];
             // add class to this row if overdue
             $contactActivities[$activityId]['class'] = '';
             if (CRM_Utils_Date::overdue(CRM_Utils_Array::value('activity_date_time', $values)) && CRM_Utils_Array::value('status_id', $values) == 1) {
                 $contactActivities[$activityId]['class'] = 'status-overdue';
             } else {
                 $contactActivities[$activityId]['class'] = 'status-ontime';
             }
             // build links
             $contactActivities[$activityId]['links'] = '';
             $accessMailingReport = FALSE;
             if (CRM_Utils_Array::value('mailingId', $values)) {
                 $accessMailingReport = TRUE;
             }
             $actionLinks = CRM_Activity_Selector_Activity::actionLinks(CRM_Utils_Array::value('activity_type_id', $values), CRM_Utils_Array::value('source_record_id', $values), $accessMailingReport, CRM_Utils_Array::value('activity_id', $values));
//.........这里部分代码省略.........
开发者ID:hguru,项目名称:224Civi,代码行数:101,代码来源:Activity.php

示例9: array_values

 /**
  * returns all the rows in the given offset and rowCount
  *
  * @param enum   $action   the action being performed
  * @param int    $offset   the row number to start from
  * @param int    $rowCount the number of rows to return
  * @param string $sort     the sql string that describes the sort order
  * @param enum   $output   what should the result set include (web/email/csv)
  *
  * @return int   the total number of rows for this action
  */
 function &getRows($action, $offset, $rowCount, $sort, $output = null)
 {
     $includeContactIDs = false;
     if (($output == CRM_Core_Selector_Controller::EXPORT || $output == CRM_Core_Selector_Controller::SCREEN) && $this->_formValues['radio_ts'] == 'ts_sel') {
         $includeContactIDs = true;
     }
     $sql = $this->_search->all($offset, $rowCount, $sort, $includeContactIDs);
     $dao = CRM_Core_DAO::executeQuery($sql, CRM_Core_DAO::$_nullArray);
     $columns = $this->_search->columns();
     $columnNames = array_values($columns);
     $links = self::links();
     $permissions = array(CRM_Core_Permission::getPermission());
     if (CRM_Core_Permission::check('delete contacts')) {
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     $mask = CRM_Core_Action::mask($permissions);
     $alterRow = false;
     if (method_exists($this->_customSearchClass, 'alterRow')) {
         $alterRow = true;
     }
     $image = false;
     if (is_a($this->_search, 'CRM_Contact_Form_Search_Custom_Basic')) {
         $image = true;
     }
     // process the result of the query
     $rows = array();
     while ($dao->fetch()) {
         $row = array();
         $empty = true;
         // the columns we are interested in
         foreach ($columnNames as $property) {
             $row[$property] = $dao->{$property};
             if (!empty($dao->{$property})) {
                 $empty = false;
             }
         }
         if (!$empty) {
             $contactID = isset($dao->contact_id) ? $dao->contact_id : NULL;
             $row['checkbox'] = CRM_Core_Form::CB_PREFIX . $contactID;
             $row['action'] = CRM_Core_Action::formLink($links, $mask, array('id' => $contactID));
             $row['contact_id'] = $contactID;
             if ($alterRow) {
                 $this->_search->alterRow($row);
             }
             if ($image) {
                 require_once 'CRM/Contact/BAO/Contact/Utils.php';
                 $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($dao->contact_sub_type ? $dao->contact_sub_type : $dao->contact_type, false, $contactID);
             }
             $rows[] = $row;
         }
     }
     return $rows;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:64,代码来源:Custom.php

示例10: addActions

 /**
  * Add actions.
  *
  * @param array $rows
  */
 public function addActions(&$rows)
 {
     $links = self::links($this->_key);
     $permissions = array(CRM_Core_Permission::getPermission());
     if (CRM_Core_Permission::check('delete contacts')) {
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     $mask = CRM_Core_Action::mask($permissions);
     foreach ($rows as $id => &$row) {
         $row['action'] = CRM_Core_Action::formLink($links, $mask, array('id' => $row['contact_id']), ts('more'), FALSE, 'contact.custom.actions', 'Contact', $row['contact_id']);
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:17,代码来源:Custom.php

示例11: getCases

 /**
  * Retrieve cases related to particular contact or whole contact
  * used in Dashboad and Tab
  *
  * @param boolean    $allCases  
  * 
  * @param int        $userID 
  *
  * @param String     $type /upcoming,recent,all/ 
  *
  * @return array     Array of Cases
  * 
  * @access public
  * 
  */
 function getCases($allCases = true, $userID = null, $type = 'upcoming')
 {
     $condition = null;
     if (!$allCases) {
         $condition = " AND case_relationship.contact_id_b = {$userID}";
     }
     $condition .= " \nAND civicrm_activity.is_deleted = 0\nAND civicrm_case.is_deleted     = 0";
     if ($type == 'upcoming') {
         $closedId = CRM_Core_OptionGroup::getValue('case_status', 'Closed', 'name');
         $condition .= "\nAND civicrm_case.status_id != {$closedId}";
     }
     $query = self::getCaseActivityQuery($type, $userID, $condition);
     $queryParams = array();
     $result = CRM_Core_DAO::executeQuery($query, $queryParams);
     require_once 'CRM/Core/OptionGroup.php';
     $caseStatus = CRM_Core_OptionGroup::values('case_status', false, false, false, " AND v.name = 'Urgent' ");
     $resultFields = array('contact_id', 'contact_type', 'sort_name', 'phone', 'case_id', 'case_type', 'case_type_name', 'status_id', 'case_status', 'case_status_name', 'activity_type_id', 'case_role');
     if ($type == 'upcoming') {
         $resultFields[] = 'case_scheduled_activity_date';
         $resultFields[] = 'case_scheduled_activity_type_name';
         $resultFields[] = 'case_scheduled_activity_type';
         $resultFields[] = 'case_scheduled_activity_id';
     } else {
         if ($type == 'recent') {
             $resultFields[] = 'case_recent_activity_date';
             $resultFields[] = 'case_recent_activity_type_name';
             $resultFields[] = 'case_recent_activity_type';
             $resultFields[] = 'case_recent_activity_id';
         }
     }
     // we're going to use the usual actions, so doesn't make sense to duplicate definitions
     require_once 'CRM/Case/Selector/Search.php';
     $actions = CRM_Case_Selector_Search::links();
     require_once "CRM/Contact/BAO/Contact/Utils.php";
     $casesList = array();
     // check is the user has view/edit signer permission
     $permissions = array(CRM_Core_Permission::VIEW);
     if (CRM_Core_Permission::check('edit cases')) {
         $permissions[] = CRM_Core_Permission::EDIT;
     }
     if (CRM_Core_Permission::check('delete in CiviCase')) {
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     $mask = CRM_Core_Action::mask($permissions);
     while ($result->fetch()) {
         foreach ($resultFields as $donCare => $field) {
             $casesList[$result->case_id][$field] = $result->{$field};
             if ($field == 'contact_type') {
                 $casesList[$result->case_id]['contact_type_icon'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type);
                 $casesList[$result->case_id]['action'] = CRM_Core_Action::formLink($actions, $mask, array('id' => $result->case_id, 'cid' => $result->contact_id, 'cxt' => 'dashboard'));
             } elseif ($field == 'case_status') {
                 if (in_array($result->{$field}, $caseStatus)) {
                     $casesList[$result->case_id]['class'] = "status-urgent";
                 } else {
                     $casesList[$result->case_id]['class'] = "status-normal";
                 }
             }
         }
         //CRM-4510.
         $caseManagerContact = self::getCaseManagerContact($result->case_type_name, $result->case_id);
         if (!empty($caseManagerContact)) {
             $casesList[$result->case_id]['casemanager_id'] = CRM_Utils_Array::value('casemanager_id', $caseManagerContact);
             $casesList[$result->case_id]['casemanager'] = CRM_Utils_Array::value('casemanager', $caseManagerContact);
         }
     }
     return $casesList;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:82,代码来源:Case.php

示例12: array

 /**
  * returns all the rows in the given offset and rowCount
  *
  * @param enum   $action   the action being performed
  * @param int    $offset   the row number to start from
  * @param int    $rowCount the number of rows to return
  * @param string $sort     the sql string that describes the sort order
  * @param enum   $output   what should the result set include (web/email/csv)
  *
  * @return int   the total number of rows for this action
  */
 function &getRows($action, $offset, $rowCount, $sort, $output = NULL)
 {
     $result = $this->_query->searchQuery($offset, $rowCount, $sort, FALSE, FALSE, FALSE, FALSE, FALSE, $this->_bookingClause);
     //lets handle view, edit and delete separately.
     $permissions = array(CRM_Core_Permission::VIEW, CRM_Core_Permission::EDIT, CRM_Core_Permission::DELETE);
     /*if (CRM_Core_Permission::check('edit event Booking')) {
         $permissions[] = CRM_Core_Permission::EDIT;
       }
       if (CRM_Core_Permission::check('delete in Booking')) {
         $permissions[] = CRM_Core_Permission::DELETE;
       }*/
     $mask = CRM_Core_Action::mask($permissions);
     // process the result of the query
     $rows = array();
     $params = array('option_group_name' => CRM_Booking_Utils_Constants::OPTION_BOOKING_STATUS, 'name' => CRM_Booking_Utils_Constants::OPTION_VALUE_CANCELLED);
     $ov = civicrm_api3('OptionValue', 'get', $params);
     $cancelStatusId = CRM_Utils_Array::value('value', CRM_Utils_Array::value($ov['id'], $ov['values']));
     while ($result->fetch()) {
         $row = array();
         //Fixed - CVB-84
         //Make sure we don't return contact that doesn't have booking
         if (!$result->booking_id) {
             continue;
         }
         // the columns we are interested in
         foreach (self::$_properties as $property) {
             if (property_exists($result, $property)) {
                 $row[$property] = $result->{$property};
             }
             $row['checkbox'] = CRM_Core_Form::CB_PREFIX . $result->contact_id;
             $isCancelled = FALSE;
             if ($result->booking_status_id == $cancelStatusId) {
                 $isCancelled = TRUE;
             }
             $links = self::links($this->_key, $this->_context);
             if ($isCancelled) {
                 unset($links[CRM_Core_Action::UPDATE]);
                 unset($links[CRM_Core_Action::BASIC]);
                 unset($links[CRM_Core_Action::CLOSE]);
             }
             //Fixed CVB-144
             if ($result->booking_payment_status_id) {
                 unset($links[CRM_Core_Action::ADVANCED]);
             }
             $row['action'] = CRM_Core_Action::formLink($links, $mask, array('id' => $result->booking_id, 'cid' => $result->contact_id, 'cxt' => $this->_context));
         }
         $rows[] = $row;
     }
     return $rows;
 }
开发者ID:sushantpaste,项目名称:civibooking,代码行数:61,代码来源:Search.php

示例13: array

 /**
  * returns all the rows in the given offset and rowCount
  *
  * @param enum   $action   the action being performed
  * @param int    $offset   the row number to start from
  * @param int    $rowCount the number of rows to return
  * @param string $sort     the sql string that describes the sort order
  * @param enum   $output   what should the result set include (web/email/csv)
  *
  * @return int   the total number of rows for this action
  */
 function &getRows($action, $offset, $rowCount, $sort, $output = NULL)
 {
     $result = $this->_query->searchQuery($offset, $rowCount, $sort, FALSE, FALSE, FALSE, FALSE, FALSE, $this->_additionalClause);
     // process the result of the query
     $rows = array();
     // get all pledge status
     $pledgeStatuses = CRM_Core_OptionGroup::values('contribution_status', FALSE, FALSE, FALSE, NULL, 'name', FALSE);
     //get all campaigns.
     $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
     //4418 check for view, edit and delete
     $permissions = array(CRM_Core_Permission::VIEW);
     if (CRM_Core_Permission::check('edit pledges')) {
         $permissions[] = CRM_Core_Permission::EDIT;
     }
     if (CRM_Core_Permission::check('delete in CiviPledge')) {
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     $mask = CRM_Core_Action::mask($permissions);
     while ($result->fetch()) {
         $row = array();
         // the columns we are interested in
         foreach (self::$_properties as $property) {
             if (isset($result->{$property})) {
                 $row[$property] = $result->{$property};
             }
         }
         //carry campaign on selectors.
         $row['campaign'] = CRM_Utils_Array::value($result->pledge_campaign_id, $allCampaigns);
         $row['campaign_id'] = $result->pledge_campaign_id;
         // add pledge status name
         $row['pledge_status_name'] = CRM_Utils_Array::value($row['pledge_status_id'], $pledgeStatuses);
         // append (test) to status label
         if (!empty($row['pledge_is_test'])) {
             $row['pledge_status'] .= ' (test)';
         }
         $hideOption = array();
         if (CRM_Utils_Array::key('Cancelled', $row) || CRM_Utils_Array::key('Completed', $row)) {
             $hideOption[] = 'Cancel';
         }
         $row['checkbox'] = CRM_Core_Form::CB_PREFIX . $result->pledge_id;
         $row['action'] = CRM_Core_Action::formLink(self::links($hideOption, $this->_key), $mask, array('id' => $result->pledge_id, 'cid' => $result->contact_id, 'cxt' => $this->_context), ts('more'), FALSE, 'pledge.selector.row', 'Pledge', $result->pledge_id);
         $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id);
         $rows[] = $row;
     }
     return $rows;
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:57,代码来源:Search.php

示例14: browse

 /**
  * We need to do slightly different things for groups vs saved search groups, hence we
  * reimplement browse from Page_Basic
  * @param int $action
  *
  * @return void
  * @access public
  */
 function browse($action = null)
 {
     require_once 'CRM/Contact/BAO/GroupNesting.php';
     $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter', 'String', $this);
     if ($this->_sortByCharacter == 1 || !empty($_POST)) {
         $this->_sortByCharacter = '';
         $this->set('sortByCharacter', '');
     }
     $query = " SELECT COUNT(*) FROM civicrm_group";
     $groupExists = CRM_Core_DAO::singleValueQuery($query);
     $this->assign('groupExists', $groupExists);
     $this->search();
     $config =& CRM_Core_Config::singleton();
     $params = array();
     $whereClause = $this->whereClause($params, false);
     $this->pagerAToZ($whereClause, $params);
     $params = array();
     $whereClause = $this->whereClause($params, true);
     $this->pager($whereClause, $params);
     list($offset, $rowCount) = $this->_pager->getOffsetAndRowCount();
     $select = $from = $where = "";
     if (defined('CIVICRM_MULTISITE') && CIVICRM_MULTISITE && CRM_Core_Permission::check('administer Multiple Organizations')) {
         $select = ", contact.display_name as orgName, contact.id as orgID";
         $from = " LEFT JOIN civicrm_group_organization gOrg\n                               ON gOrg.group_id = groups.id \n                        LEFT JOIN civicrm_contact contact\n                               ON contact.id = gOrg.organization_id ";
         //get the Organization ID
         $orgID = CRM_Utils_Request::retrieve('oid', 'Positive', CRM_Core_DAO::$_nullObject);
         if ($orgID) {
             $where = " AND gOrg.organization_id = {$orgID}";
         }
         $this->assign('groupOrg', true);
     }
     $query = "\n        SELECT groups.* {$select}\n        FROM  civicrm_group groups \n              {$from}\n        WHERE {$whereClause} {$where}\n        ORDER BY groups.title asc\n        LIMIT {$offset}, {$rowCount}";
     $object = CRM_Core_DAO::executeQuery($query, $params, true, 'CRM_Contact_DAO_Group');
     $groupPermission = CRM_Core_Permission::check('edit groups') ? CRM_Core_Permission::EDIT : CRM_Core_Permission::VIEW;
     $this->assign('groupPermission', $groupPermission);
     //FIXME CRM-4418, now we are handling delete separately
     //if we introduce 'delete for group' make sure to handle here.
     $groupPermissions = array(CRM_Core_Permission::VIEW);
     if (CRM_Core_Permission::check('edit groups')) {
         $groupPermissions[] = CRM_Core_Permission::EDIT;
         $groupPermissions[] = CRM_Core_Permission::DELETE;
     }
     require_once 'CRM/Core/OptionGroup.php';
     $links =& $this->links();
     $allTypes = CRM_Core_OptionGroup::values('group_type');
     $values = array();
     while ($object->fetch()) {
         $permission = $this->checkPermission($object->id, $object->title);
         if ($permission) {
             $newLinks = $links;
             $values[$object->id] = array();
             CRM_Core_DAO::storeValues($object, $values[$object->id]);
             if ($object->saved_search_id) {
                 $values[$object->id]['title'] .= ' (' . ts('Smart Group') . ')';
                 // check if custom search, if so fix view link
                 $customSearchID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $object->saved_search_id, 'search_custom_id');
                 if ($customSearchID) {
                     $newLinks[CRM_Core_Action::VIEW]['url'] = 'civicrm/contact/search/custom';
                     $newLinks[CRM_Core_Action::VIEW]['qs'] = "reset=1&force=1&ssID={$object->saved_search_id}";
                 }
             }
             $action = array_sum(array_keys($newLinks));
             if (array_key_exists('is_active', $object)) {
                 if ($object->is_active) {
                     $action -= CRM_Core_Action::ENABLE;
                 } else {
                     $action -= CRM_Core_Action::VIEW;
                     $action -= CRM_Core_Action::DISABLE;
                 }
             }
             $action = $action & CRM_Core_Action::mask($groupPermissions);
             $values[$object->id]['visibility'] = CRM_Contact_DAO_Group::tsEnum('visibility', $values[$object->id]['visibility']);
             if (isset($values[$object->id]['group_type'])) {
                 $groupTypes = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($values[$object->id]['group_type'], 1, -1));
                 $types = array();
                 foreach ($groupTypes as $type) {
                     $types[] = $allTypes[$type];
                 }
                 $values[$object->id]['group_type'] = implode(', ', $types);
             }
             $values[$object->id]['action'] = CRM_Core_Action::formLink($newLinks, $action, array('id' => $object->id, 'ssid' => $object->saved_search_id));
             if (array_key_exists('orgName', $object)) {
                 if ($object->orgName) {
                     $values[$object->id]['org_name'] = $object->orgName;
                     $values[$object->id]['org_id'] = $object->orgID;
                 }
             }
         }
     }
     if (isset($values)) {
         $this->assign('rows', $values);
     }
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdev,代码行数:101,代码来源:Group.php

示例15: browse

 /**
  * This function is called when action is browse
  * 
  * return null
  * @access public
  */
 function browse()
 {
     $links =& self::links();
     //CRM-4418, handling edit and delete separately.
     $permissions = array($this->_permission);
     if ($this->_permission == CRM_Core_Permission::EDIT) {
         //previously delete was subset of edit
         //so for consistency lets grant delete also.
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     $mask = CRM_Core_Action::mask($permissions);
     $currentRelationships = CRM_Contact_BAO_Relationship::getRelationship($this->_contactId, CRM_Contact_BAO_Relationship::CURRENT, 0, 0, 0, $links, $mask);
     $inactiveRelationships = CRM_Contact_BAO_Relationship::getRelationship($this->_contactId, CRM_Contact_BAO_Relationship::INACTIVE, 0, 0, 0, $links, $mask);
     $this->assign('currentRelationships', $currentRelationships);
     // to show the 'Current Relationships' title and links only when viewed
     // from relationship tab, not from dashboard
     $this->assign('relationshipTabContext', true);
     $this->assign('inactiveRelationships', $inactiveRelationships);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:25,代码来源:Relationship.php


注:本文中的CRM_Core_Action::mask方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。