3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2013
37 * Page for displaying list of Gender
39 class CRM_Admin_Page_Options
extends CRM_Core_Page_Basic
{
42 * The action links that we need to display for the browse screen
47 static $_links = NULL;
50 * The option group name
55 static $_gName = NULL;
58 * The option group name in display format (capitalized, without underscores...etc)
63 static $_GName = NULL;
74 * Obtains the group name from url and sets the title.
80 function preProcess() {
82 self
::$_gName = CRM_Utils_Request
::retrieve('group', 'String', CRM_Core_DAO
::$_nullObject, FALSE, NULL, 'GET');
85 $this->set('gName', self
::$_gName);
88 self
::$_gName = $this->get('gName');
91 self
::$_gId = CRM_Core_DAO
::getFieldValue('CRM_Core_DAO_OptionGroup', self
::$_gName, 'id', 'name');
94 CRM_Core_Error
::fatal();
97 self
::$_GName = ucwords(str_replace('_', ' ', self
::$_gName));
99 $this->assign('gName', self
::$_gName);
100 $this->assign('GName', self
::$_GName);
102 if (self
::$_gName == 'acl_role') {
103 CRM_Utils_System
::setTitle(ts('Manage ACL Roles'));
104 // set breadcrumb to append to admin/access
105 $breadCrumb = array(array('title' => ts('Access Control'),
106 'url' => CRM_Utils_System
::url('civicrm/admin/access',
110 CRM_Utils_System
::appendBreadCrumb($breadCrumb);
113 CRM_Utils_System
::setTitle(ts("%1 Options", array(1 => self
::$_GName)));
115 if (in_array(self
::$_gName,
117 'from_email_address', 'email_greeting',
118 'postal_greeting', 'addressee',
119 'communication_style',
120 'case_status', 'encounter_medium',
121 'case_type', 'payment_instrument'
124 $this->assign('showIsDefault', TRUE);
126 if (self
::$_gName == 'participant_status') {
127 $this->assign('showCounted', TRUE);
128 $this->assign('showVisibility', TRUE);
131 if (self
::$_gName == 'participant_role') {
132 $this->assign('showCounted', TRUE);
134 $config = CRM_Core_Config
::singleton();
135 if (self
::$_gName == 'activity_type') {
136 $this->assign('showComponent', TRUE);
143 * @return string Classname of BAO.
145 function getBAOName() {
146 return 'CRM_Core_BAO_OptionValue';
152 * @return array (reference) of action links
155 if (!(self
::$_links)) {
156 self
::$_links = array(
157 CRM_Core_Action
::UPDATE
=> array(
158 'name' => ts('Edit'),
159 'url' => 'civicrm/admin/options/' . self
::$_gName,
160 'qs' => 'group=' . self
::$_gName . '&action=update&id=%%id%%&reset=1',
161 'title' => ts('Edit %1', array(1 => self
::$_gName)),
163 CRM_Core_Action
::DISABLE
=> array(
164 'name' => ts('Disable'),
165 'ref' => 'crm-enable-disable',
166 'title' => ts('Disable %1', array(1 => self
::$_gName)),
168 CRM_Core_Action
::ENABLE
=> array(
169 'name' => ts('Enable'),
170 'ref' => 'crm-enable-disable',
171 'title' => ts('Enable %1', array(1 => self
::$_gName)),
173 CRM_Core_Action
::DELETE
=> array(
174 'name' => ts('Delete'),
175 'url' => 'civicrm/admin/options/' . self
::$_gName,
176 'qs' => 'group=' . self
::$_gName . '&action=delete&id=%%id%%',
177 'title' => ts('Delete %1 Type', array(1 => self
::$_gName)),
181 if (self
::$_gName == 'custom_search') {
183 CRM_Core_Action
::FOLLOWUP
=> array(
185 'url' => 'civicrm/contact/search/custom',
186 'qs' => 'reset=1&csid=%%value%%',
187 'title' => ts('Run %1', array(1 => self
::$_gName)),
189 self
::$_links = $runLink + self
::$_links;
192 return self
::$_links;
196 * Run the basic page (run essentially starts execution for that page).
202 return parent
::run();
214 CRM_Core_Resources
::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
216 $groupParams = array('name' => self
::$_gName);
217 $optionValue = CRM_Core_OptionValue
::getRows($groupParams, $this->links(), 'component_id,weight');
218 $gName = self
::$_gName;
219 $returnURL = CRM_Utils_System
::url("civicrm/admin/options/$gName",
220 "reset=1&group=$gName"
222 $filter = "option_group_id = " . self
::$_gId;
223 CRM_Utils_Weight
::addOrder($optionValue, 'CRM_Core_DAO_OptionValue',
224 'id', $returnURL, $filter
227 // retrieve financial account name for the payment instrument page
228 if ($gName = "payment_instrument") {
229 foreach ($optionValue as $key => $option) {
230 $optionValue[$key]['financial_account'] = CRM_Financial_BAO_FinancialTypeAccount
::getFinancialAccount($key, 'civicrm_option_value');
233 $this->assign('includeWysiwygEditor', TRUE);
234 $this->assign('rows', $optionValue);
238 * Get name of edit form
240 * @return string Classname of edit form.
242 function editForm() {
243 return 'CRM_Admin_Form_Options';
249 * @return string name of this page.
251 function editName() {
252 return self
::$_GName;
258 * @return string user context.
260 function userContext($mode = NULL) {
261 return 'civicrm/admin/options/' . self
::$_gName;
265 * function to get userContext params
267 * @param int $mode mode that we are in
272 function userContextParams($mode = NULL) {
273 return 'group=' . self
::$_gName . '&reset=1&action=browse';