/**
  * Get the action links for this page.
  *
  * @param null
  *
  * @return  array   array of action links that we need to display for the browse screen
  * @access public
  */
 function &actionLinks()
 {
     // check if variable _actionsLinks is populated
     if (!isset(self::$_actionLinks)) {
         self::$_actionLinks = array(CRM_Core_Action::BROWSE => array('name' => ts('View and Edit Custom Fields'), 'url' => 'civicrm/admin/custom/group/field', 'qs' => 'reset=1&action=browse&gid=%%id%%', 'title' => ts('View and Edit Custom Fields')), CRM_Core_Action::PREVIEW => array('name' => ts('Preview'), 'url' => 'civicrm/admin/custom/group', 'qs' => 'action=preview&reset=1&id=%%id%%', 'title' => ts('Preview Custom Data Set')), CRM_Core_Action::UPDATE => array('name' => ts('Settings'), 'url' => 'civicrm/admin/custom/group', 'qs' => 'action=update&reset=1&id=%%id%%', 'title' => ts('Edit Custom Set')), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_CustomGroup' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable Custom Set')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_CustomGroup' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable Custom Set')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/custom/group', 'qs' => 'action=delete&reset=1&id=%%id%%', 'title' => ts('Delete Custom Set')));
     }
     return self::$_actionLinks;
 }
Example #2
0
 /**
  * Browse all custom data groups.
  * 
  * @param string $action   the action to be invoked
  * 
  * @return void
  * @access public
  */
 function browse($action = null)
 {
     // get all custom groups sorted by weight
     $customGroup = array();
     $dao =& new CRM_Core_DAO_CustomGroup();
     // set the domain_id parameter
     $config =& CRM_Core_Config::singleton();
     $dao->domain_id = $config->domainID();
     $dao->orderBy('weight, title');
     $dao->find();
     while ($dao->fetch()) {
         $customGroup[$dao->id] = array();
         CRM_Core_DAO::storeValues($dao, $customGroup[$dao->id]);
         // form all action links
         $action = array_sum(array_keys($this->actionLinks()));
         // update enable/disable links depending on custom_group properties.
         if ($dao->is_active) {
             $action -= CRM_CORE_ACTION_ENABLE;
         } else {
             $action -= CRM_CORE_ACTION_DISABLE;
         }
         $customGroup[$dao->id]['action'] = CRM_Core_Action::formLink(CRM_Custom_Page_Group::actionLinks(), $action, array('id' => $dao->id));
     }
     $customGroupExtends = CRM_Core_SelectValues::customGroupExtends();
     foreach ($customGroup as $key => $array) {
         CRM_Core_DAO_CustomGroup::addDisplayEnums($customGroup[$key]);
         $customGroup[$key]['extends_display'] = $customGroupExtends[$customGroup[$key]['extends']];
     }
     $this->assign('rows', $customGroup);
 }