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. */ public function editForm() { return 'CRM_Admin_Form_LabelFormats'; } /** * Get edit form name. * * @return string * name of this page. */ public function editName() { return 'Mailing Label Formats'; } /** * Get user context. * * @param null $mode * * @return string * user context. */ public function userContext($mode = NULL) { return 'civicrm/admin/labelFormats'; } /** * Browse all Label Format settings. * * @param null $action */ public 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 (!empty($format['is_reserved'])) { $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'), ts('more'), FALSE, 'labelFormat.manage.action', 'LabelFormat', $format['id'] ); } // 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); } }