/** * Get the action links for this page. * * @param * * @return array $_actionLinks * */ function &actionLinks() { // check if variable _actionsLinks is populated if (!self::$_actionLinks) { // helper variable for nicer formatting $copyExtra = ts('Are you sure you want to make a copy of this Profile?'); self::$_actionLinks = array(CRM_Core_Action::BROWSE => array('name' => ts('Fields'), 'url' => 'civicrm/admin/uf/group/field', 'qs' => 'reset=1&action=browse&gid=%%id%%', 'title' => ts('View and Edit Fields')), CRM_Core_Action::UPDATE => array('name' => ts('Settings'), 'url' => 'civicrm/admin/uf/group/update', 'qs' => 'action=update&id=%%id%%&context=group', 'title' => ts('Edit CiviCRM Profile Group')), CRM_Core_Action::PREVIEW => array('name' => ts('Preview'), 'url' => 'civicrm/admin/uf/group', 'qs' => 'action=preview&id=%%id%%&field=0&context=group', 'title' => ts('Edit CiviCRM Profile Group')), CRM_Core_Action::ADD => array('name' => ts('Use Profile-Create Mode'), 'url' => 'civicrm/profile/create', 'qs' => 'gid=%%id%%&reset=1', 'title' => ts('Use Profile-Create Mode'), 'fe' => true), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_UFGroup' . '\',\'' . 'enable-disable\',0,\'UFGroup' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable CiviCRM Profile Group')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_UFGroup' . '\',\'' . 'disable-enable\',0,\'UFGroup' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable CiviCRM Profile Group')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/uf/group', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete CiviCRM Profile Group')), CRM_Core_Action::PROFILE => array('name' => ts('HTML Form Snippet'), 'url' => 'civicrm/admin/uf/group', 'qs' => 'action=profile&gid=%%id%%', 'title' => ts('HTML Form Snippet for this Profile')), CRM_Core_Action::COPY => array('name' => ts('Copy Profile'), 'url' => 'civicrm/admin/uf/group', 'qs' => 'action=copy&gid=%%id%%', 'title' => ts('Make a Copy of CiviCRM Profile Group'), 'extra' => 'onclick = "return confirm(\'' . $copyExtra . '\');"')); } return self::$_actionLinks; }
/** * Get the action links for this page. * * @param * * @return array */ public static function &actionLinks() { // check if variable _actionsLinks is populated if (!self::$_actionLinks) { // helper variable for nicer formatting $copyExtra = ts('Are you sure you want to make a copy of this Profile?'); self::$_actionLinks = array(CRM_Core_Action::BROWSE => array('name' => ts('Fields'), 'url' => 'civicrm/admin/uf/group/field', 'qs' => 'reset=1&action=browse&gid=%%id%%', 'title' => ts('View and Edit Fields')), CRM_Core_Action::UPDATE => array('name' => ts('Settings'), 'url' => 'civicrm/admin/uf/group/update', 'qs' => 'action=update&id=%%id%%&context=group', 'title' => ts('Edit CiviCRM Profile Group')), CRM_Core_Action::PREVIEW => array('name' => ts('Preview'), 'url' => 'civicrm/admin/uf/group', 'qs' => 'action=preview&id=%%id%%&field=0&context=group', 'title' => ts('Edit CiviCRM Profile Group')), CRM_Core_Action::ADD => array('name' => ts('Use - Create Mode'), 'url' => 'civicrm/profile/create', 'qs' => 'gid=%%id%%&reset=1', 'title' => ts('Use - Create Mode'), 'fe' => TRUE), CRM_Core_Action::ADVANCED => array('name' => ts('Use - Edit Mode'), 'url' => 'civicrm/profile/edit', 'qs' => 'gid=%%id%%&reset=1', 'title' => ts('Use - Edit Mode'), 'fe' => TRUE), CRM_Core_Action::BASIC => array('name' => ts('Use - Listings Mode'), 'url' => 'civicrm/profile', 'qs' => 'gid=%%id%%&reset=1', 'title' => ts('Use - Listings Mode'), 'fe' => TRUE), CRM_Core_Action::DISABLE => array('name' => ts('Disable'), 'ref' => 'crm-enable-disable', 'title' => ts('Disable CiviCRM Profile Group')), CRM_Core_Action::ENABLE => array('name' => ts('Enable'), 'ref' => 'crm-enable-disable', 'title' => ts('Enable CiviCRM Profile Group')), CRM_Core_Action::DELETE => array('name' => ts('Delete'), 'url' => 'civicrm/admin/uf/group', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete CiviCRM Profile Group')), CRM_Core_Action::COPY => array('name' => ts('Copy'), 'url' => 'civicrm/admin/uf/group', 'qs' => 'action=copy&gid=%%id%%', 'title' => ts('Make a Copy of CiviCRM Profile Group'), 'extra' => 'onclick = "return confirm(\'' . $copyExtra . '\');"')); $allowRemoteSubmit = Civi::settings()->get('remote_profile_submissions'); if ($allowRemoteSubmit) { self::$_actionLinks[CRM_Core_Action::PROFILE] = array('name' => ts('HTML Form Snippet'), 'url' => 'civicrm/admin/uf/group', 'qs' => 'action=profile&gid=%%id%%', 'title' => ts('HTML Form Snippet for this Profile')); } } return self::$_actionLinks; }
/** * Browse all uf data groups. * * @param * @return void * @access public * @static */ function browse($action = null) { $ufGroup = array(); $allUFGroups = array(); require_once 'CRM/Core/BAO/UFGroup.php'; $allUFGroups = CRM_Core_BAO_UFGroup::getModuleUFGroup(); if (empty($allUFGroups)) { return; } foreach ($allUFGroups as $id => $value) { $ufGroup[$id] = array(); $ufGroup[$id]['id'] = $id; $ufGroup[$id]['title'] = $value['title']; $ufGroup[$id]['weight'] = $value['weight']; $ufGroup[$id]['is_active'] = $value['is_active']; // form all action links $action = array_sum(array_keys($this->actionLinks())); // update enable/disable links depending on uf_group properties. if ($value['is_active']) { $action -= CRM_CORE_ACTION_ENABLE; } else { $action -= CRM_CORE_ACTION_DISABLE; } $ufGroup[$id]['action'] = CRM_Core_Action::formLink(CRM_UF_Page_Group::actionLinks(), $action, array('id' => $id)); //get the "Used For" from uf_join $ufGroup[$id]['module'] = implode(', ', CRM_Core_BAO_UFGroup::getUFJoinRecord($id, true)); } $this->assign('rows', $ufGroup); }
/** * Format getlist output * * @see _civicrm_api3_generic_getlist_output * * @param array $result * @param array $request * @param string $entity * @param array $fields * * @return array */ function _civicrm_api3_uf_group_getlist_output($result, $request, $entity, $fields) { $output = array(); if (!empty($result['values'])) { foreach ($result['values'] as $row) { $data = array('id' => $row[$request['id_field']], 'label' => $row[$request['label_field']]); if (!empty($request['description_field'])) { $data['description'] = array(); foreach ((array) $request['description_field'] as $field) { if (!empty($row[$field])) { // Special formatting for group_type field if ($field == 'group_type') { $groupTypes = CRM_UF_Page_Group::extractGroupTypes($row[$field]); $data['description'][] = CRM_UF_Page_Group::formatGroupTypes($groupTypes); continue; } if (!isset($fields[$field]['pseudoconstant'])) { $data['description'][] = $row[$field]; } else { $data['description'][] = CRM_Core_PseudoConstant::getLabel(_civicrm_api3_get_BAO($entity), $field, $row[$field]); } } } } if (!empty($request['image_field'])) { $data['image'] = isset($row[$request['image_field']]) ? $row[$request['image_field']] : ''; } $output[] = $data; } } return $output; }