Ejemplo n.º 1
0
 /**
  * Wrapper for contact relationship selector.
  *
  * @param array $params
  *   Associated array for params record id.
  *
  * @return array
  *   associated array of contact relationships
  */
 public static function getContactRelationshipSelector(&$params)
 {
     // format the params
     $params['offset'] = ($params['page'] - 1) * $params['rp'];
     $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
     if ($params['context'] == 'past') {
         $relationshipStatus = CRM_Contact_BAO_Relationship::INACTIVE;
     } elseif ($params['context'] == 'all') {
         $relationshipStatus = CRM_Contact_BAO_Relationship::ALL;
     } else {
         $relationshipStatus = CRM_Contact_BAO_Relationship::CURRENT;
     }
     // 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 ($page->_permission == CRM_Core_Permission::EDIT) {
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     $mask = CRM_Core_Action::mask($permissions);
     $permissionedContacts = TRUE;
     if ($params['context'] != 'user') {
         $links = CRM_Contact_Page_View_Relationship::links();
     } else {
         $links = CRM_Contact_Page_View_UserDashBoard::links();
         $mask = NULL;
     }
     // get contact relationships
     $relationships = CRM_Contact_BAO_Relationship::getRelationship($params['contact_id'], $relationshipStatus, $params['rp'], 0, 0, $links, $mask, $permissionedContacts, $params);
     $contactRelationships = array();
     $params['total'] = 0;
     if (!empty($relationships)) {
         // FIXME: we cannot directly determine total permissioned relationship, hence re-fire query
         $permissionedRelationships = CRM_Contact_BAO_Relationship::getRelationship($params['contact_id'], $relationshipStatus, 0, 0, 0, NULL, NULL, $permissionedContacts);
         $params['total'] = count($permissionedRelationships);
         // format params
         foreach ($relationships as $relationshipId => $values) {
             $relationship = array();
             $relationship['DT_RowId'] = $values['id'];
             $relationship['DT_RowClass'] = 'crm-entity';
             if ($values['is_active'] == 0) {
                 $relationship['DT_RowClass'] .= ' disabled';
             }
             $relationship['DT_RowAttr'] = array();
             $relationship['DT_RowAttr']['data-entity'] = 'relationship';
             $relationship['DT_RowAttr']['data-id'] = $values['id'];
             //Add image icon for related contacts: CRM-14919
             $icon = CRM_Contact_BAO_Contact_Utils::getImage($values['contact_type'], FALSE, $values['cid']);
             $relationship['sort_name'] = $icon . ' ' . CRM_Utils_System::href($values['name'], 'civicrm/contact/view', "reset=1&cid={$values['cid']}");
             $relationship['relation'] = CRM_Utils_System::href($values['relation'], 'civicrm/contact/view/rel', "action=view&reset=1&cid={$values['cid']}&id={$values['id']}&rtype={$values['rtype']}");
             if ($params['context'] == 'current') {
                 if ($params['contact_id'] == $values['contact_id_a'] and $values['is_permission_a_b'] == 1 or $params['contact_id'] == $values['contact_id_b'] and $values['is_permission_b_a'] == 1) {
                     $relationship['sort_name'] .= '<span id="permission-a-b" class="crm-marker permission-relationship"> *</span>';
                 }
                 if ($values['cid'] == $values['contact_id_a'] and $values['is_permission_a_b'] == 1 or $values['cid'] == $values['contact_id_b'] and $values['is_permission_b_a'] == 1) {
                     $relationship['relation'] .= '<span id="permission-b-a" class="crm-marker permission-relationship"> *</span>';
                 }
             }
             if (!empty($values['description'])) {
                 $relationship['relation'] .= "<p class='description'>{$values['description']}</p>";
             }
             $relationship['start_date'] = CRM_Utils_Date::customFormat($values['start_date']);
             $relationship['end_date'] = CRM_Utils_Date::customFormat($values['end_date']);
             $relationship['city'] = $values['city'];
             $relationship['state'] = $values['state'];
             $relationship['email'] = $values['email'];
             $relationship['phone'] = $values['phone'];
             $relationship['links'] = $values['action'];
             array_push($contactRelationships, $relationship);
         }
     }
     $relationshipsDT = array();
     $relationshipsDT['data'] = $contactRelationships;
     $relationshipsDT['recordsTotal'] = $params['total'];
     $relationshipsDT['recordsFiltered'] = $params['total'];
     return $relationshipsDT;
 }
Ejemplo n.º 2
0
 /**
  * This function is the main function that is called when the page
  * loads, it decides the which action has to be taken for the page.
  *
  * return null
  * @access public
  */
 function run()
 {
     parent::preProcess();
     $this->listActivities();
 }
Ejemplo n.º 3
0
 /**
  * This function is the main function that is called when the page
  * loads, it decides the which action has to be taken for the page.
  * 
  * return null
  * @access public
  */
 function run()
 {
     parent::preProcess();
     $this->listPledges();
 }
Ejemplo n.º 4
0
 /**
  * Get action links
  *
  * @return array (reference) of action links
  * @static
  */
 static function &links()
 {
     if (!self::$_links) {
         $deleteExtra = ts('Are you sure you want to delete this relationship?');
         $disableExtra = ts('Are you sure you want to disable this relationship?');
         $enableExtra = ts('Are you sure you want to re-enable this relationship?');
         self::$_links = array(CRM_Core_Action::UPDATE => array('name' => ts('Edit Contact Information'), 'url' => 'civicrm/contact/relatedcontact', 'qs' => 'action=update&reset=1&cid=%%cbid%%&rcid=%%cid%%', 'title' => ts('Edit Relationship')), CRM_Core_Action::VIEW => array('name' => ts('Dashboard'), 'url' => 'civicrm/user', 'qs' => 'reset=1&id=%%cbid%%', 'title' => ts('View Relationship')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'url' => 'civicrm/contact/view/rel', 'qs' => 'action=disable&reset=1&cid=%%cid%%&id=%%id%%&rtype=%%rtype%%&selectedChild=rel%%&context=dashboard', 'extra' => 'onclick = "return confirm(\'' . $disableExtra . '\');"', 'title' => ts('Disable Relationship')));
     }
     return self::$_links;
 }
 /**
  * This function is the main function that is called when the page
  * loads, it decides the which action has to be taken for the page.
  *
  * return null
  * @access public
  */
 function run()
 {
     parent::preProcess();
     $this->listParticipations();
 }
Ejemplo n.º 6
0
 /**
  * Get action links
  *
  * @return array (reference) of action links
  * @static
  */
 static function &links()
 {
     if (!self::$_links) {
         $disableExtra = ts('Are you sure you want to disable this relationship?');
         self::$_links = array(CRM_Core_Action::UPDATE => array('name' => ts('Edit Contact Information'), 'url' => 'civicrm/contact/relatedcontact', 'qs' => 'action=update&reset=1&cid=%%cbid%%&rcid=%%cid%%', 'title' => ts('Edit Relationship')), CRM_Core_Action::VIEW => array('name' => ts('Dashboard'), 'url' => 'civicrm/user', 'qs' => 'reset=1&id=%%cbid%%', 'title' => ts('View Relationship')));
         if (CRM_Core_Permission::check('access CiviCRM')) {
             self::$_links = array_merge(self::$_links, array(CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'url' => 'civicrm/contact/view/rel', 'qs' => 'action=disable&reset=1&cid=%%cid%%&id=%%id%%&rtype=%%rtype%%&selectedChild=rel&context=dashboard', 'extra' => 'onclick = "return confirm(\'' . $disableExtra . '\');"', 'title' => ts('Disable Relationship'))));
         }
     }
     // call the hook so we can modify it
     CRM_Utils_Hook::links('view.contact.userDashBoard', 'Contact', CRM_Core_DAO::$_nullObject, self::$_links, CRM_Core_DAO::$_nullObject, CRM_Core_DAO::$_nullObject);
     return self::$_links;
 }
Ejemplo n.º 7
0
 /**
  * the main function that is called when the page
  * loads, it decides the which action has to be taken for the page.
  */
 public function run()
 {
     $invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
     $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
     $defaultInvoicePage = CRM_Utils_Array::value('default_invoice_page', $invoiceSettings);
     $this->assign('invoicing', $invoicing);
     $this->assign('defaultInvoicePage', $defaultInvoicePage);
     parent::preProcess();
     $this->listContribution();
 }
 /**
  * the main function that is called when the page
  * loads, it decides the which action has to be taken for the page.
  *
  */
 public function run()
 {
     parent::preProcess();
     $this->listMemberships();
 }
Ejemplo n.º 9
0
 /**
  * the main function that is called when the page
  * loads, it decides the which action has to be taken for the page.
  */
 public function run()
 {
     $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
     $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
     $this->assign('invoicing', $invoicing);
     parent::preProcess();
     $this->listContribution();
 }
 /**
  * This function is the main function that is called when the page
  * loads, it decides the which action has to be taken for the page.
  *
  * return null
  * @access public
  */
 function run()
 {
     parent::preProcess();
     $this->listContribution();
 }