array( 'name' => ts('Edit'), 'url' => 'civicrm/admin/labelFormats', 'qs' => 'action=update&id=%%id%%&group=%%group%%&reset=1', 'title' => ts('Edit Label Format'), ), CRM_Core_Action::COPY => array( 'name' => ts('Copy'), 'url' => 'civicrm/admin/labelFormats', 'qs' => 'action=copy&id=%%id%%&group=%%group%%&reset=1', 'title' => ts('Copy Label Format'), ), CRM_Core_Action::DELETE => array( 'name' => ts('Delete'), 'url' => 'civicrm/admin/labelFormats', 'qs' => 'action=delete&id=%%id%%&group=%%group%%&reset=1', 'title' => ts('Delete Label Format'), ), ); } return self::$_links; } /** * Get name of edit form * * @return string Classname of edit form. */ function editForm() { return 'CRM_Admin_Form_LabelFormats'; } /** * Get edit form name * * @return string name of this page. */ function editName() { return 'Mailing Label Formats'; } /** * Get user context. * * @return string user context. */ function userContext($mode = NULL) { return 'civicrm/admin/labelFormats'; } /** * Browse all Label Format settings. * * @return void * @access public * @static */ function browse($action = NULL) { // Get list of configured Label Formats $labelFormatList= CRM_Core_BAO_LabelFormat::getList(); $nameFormatList= CRM_Core_BAO_LabelFormat::getList(false, 'name_badge'); // Add action links to each of the Label Formats foreach ($labelFormatList as & $format) { $action = array_sum(array_keys($this->links())); if (CRM_Utils_Array::value('is_reserved', $format)) { $action -= CRM_Core_Action::DELETE; } $format['groupName'] = ts('Mailing Label'); $format['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $format['id'], 'group' => 'label_format')); } // Add action links to each of the Label Formats foreach ($nameFormatList as & $format) { $format['groupName'] = ts('Name Badge'); } $labelFormatList = array_merge($labelFormatList, $nameFormatList); // Order Label Formats by weight $returnURL = CRM_Utils_System::url(self::userContext()); CRM_Core_BAO_LabelFormat::addOrder($labelFormatList, $returnURL); $this->assign('rows', $labelFormatList); } }