/** * This method returns the links that are given for each search row. * currently the links added for each row are * * - View * - Edit * * @return array * @access public * */ static function &links() { list($context, $contextMenu, $key) = func_get_args(); $extraParams = $key ? "&key={$key}" : NULL; $searchContext = $context ? "&context={$context}" : NULL; if (!self::$_links) { self::$_links = array(CRM_Core_Action::VIEW => array('name' => ts('View'), 'url' => 'civicrm/contact/view', 'class' => 'no-popup', 'qs' => "reset=1&cid=%%id%%{$searchContext}{$extraParams}", 'title' => ts('View Contact Details'), 'ref' => 'view-contact'), CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/contact/add', 'class' => 'no-popup', 'qs' => "reset=1&action=update&cid=%%id%%{$searchContext}{$extraParams}", 'title' => ts('Edit Contact Details'), 'ref' => 'edit-contact')); $config = CRM_Core_Config::singleton(); if ($config->mapAPIKey && $config->mapProvider) { self::$_links[CRM_Core_Action::MAP] = array('name' => ts('Map'), 'url' => 'civicrm/contact/map', 'qs' => "reset=1&cid=%%id%%{$searchContext}{$extraParams}", 'title' => ts('Map Contact')); } // Adding Context Menu Links in more action if ($contextMenu) { $counter = 7000; foreach ($contextMenu as $key => $value) { $contextVal = '&context=' . $value['key']; if ($value['key'] == 'delete') { $contextVal = $searchContext; } $url = "civicrm/contact/view/{$value['key']}"; $qs = "reset=1&action=add&cid=%%id%%{$contextVal}{$extraParams}"; if ($value['key'] == 'activity') { $qs = "action=browse&selectedChild=activity&reset=1&cid=%%id%%{$extraParams}"; } elseif ($value['key'] == 'email') { $url = "civicrm/contact/view/activity"; $qs = "atype=3&action=add&reset=1&cid=%%id%%{$extraParams}"; } self::$_links[$counter++] = array('name' => $value['title'], 'url' => $url, 'qs' => $qs, 'title' => $value['title'], 'ref' => $value['ref'], 'class' => CRM_Utils_Array::value('class', $value)); } } } return self::$_links; }
/** * This method returns the links that are given for each search row. * currently the links added for each row are * * - View * - Edit * * @return array * @access public * */ static function &links($searchType = null, $contextMenu = null) { if (!self::$_links) { self::$_links = array(CRM_Core_Action::VIEW => array('name' => ts('View'), 'url' => 'civicrm/contact/view', 'qs' => 'reset=1&cid=%%id%%', 'title' => ts('View Contact Details'), 'ref' => 'view-contact'), CRM_Core_Action::UPDATE => array('name' => ts('Edit'), 'url' => 'civicrm/contact/add', 'qs' => 'reset=1&action=update&cid=%%id%%', 'title' => ts('Edit Contact Details'), 'ref' => 'edit-contact')); $config = CRM_Core_Config::singleton(); if ($config->mapAPIKey && $config->mapProvider) { $mapSearch = null; if ($searchType) { $mapSearch = "&searchType={$searchType}"; } self::$_links[CRM_Core_Action::MAP] = array('name' => ts('Map'), 'url' => 'civicrm/contact/map', 'qs' => "reset=1&cid=%%id%%{$mapSearch}", 'title' => ts('Map Contact')); } // Adding Context Menu Links in more action if ($contextMenu) { $counter = 7000; foreach ($contextMenu as $key => $value) { $url = "civicrm/contact/view/{$key}"; $qs = "reset=1&action=add&cid=%%id%%&context={$key}"; if ($key == 'activity') { $qs = "action=browse&selectedChild=activity&reset=1&cid=%%id%%"; } else { if ($key == 'email') { $url = "civicrm/contact/view/activity"; $qs = "atype=3&action=add&reset=1&cid=%%id%%"; } } self::$_links[$counter++] = array('name' => $value['title'], 'url' => $url, 'qs' => $qs, 'title' => $value['title'], 'ref' => $value['ref']); } } } return self::$_links; }