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 'case_status', 'encounter_medium',
123 $this->assign('showIsDefault', TRUE);
125 if (self
::$_gName == 'participant_status') {
126 $this->assign('showCounted', TRUE);
127 $this->assign('showVisibility', TRUE);
130 if (self
::$_gName == 'participant_role') {
131 $this->assign('showCounted', TRUE);
133 $config = CRM_Core_Config
::singleton();
134 if (self
::$_gName == 'activity_type') {
135 $this->assign('showComponent', TRUE);
142 * @return string Classname of BAO.
144 function getBAOName() {
145 return 'CRM_Core_BAO_OptionValue';
151 * @return array (reference) of action links
154 if (!(self
::$_links)) {
155 self
::$_links = array(
156 CRM_Core_Action
::UPDATE
=> array(
157 'name' => ts('Edit'),
158 'url' => 'civicrm/admin/options/' . self
::$_gName,
159 'qs' => 'group=' . self
::$_gName . '&action=update&id=%%id%%&reset=1',
160 'title' => ts('Edit %1', array(1 => self
::$_gName)),
162 CRM_Core_Action
::DISABLE
=> array(
163 'name' => ts('Disable'),
164 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_OptionValue' . '\',\'' . 'enable-disable' . '\' );"',
165 'ref' => 'disable-action',
166 'title' => ts('Disable %1', array(1 => self
::$_gName)),
168 CRM_Core_Action
::ENABLE
=> array(
169 'name' => ts('Enable'),
170 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_OptionValue' . '\',\'' . 'disable-enable' . '\' );"',
171 'ref' => 'enable-action',
172 'title' => ts('Enable %1', array(1 => self
::$_gName)),
174 CRM_Core_Action
::DELETE
=> array(
175 'name' => ts('Delete'),
176 'url' => 'civicrm/admin/options/' . self
::$_gName,
177 'qs' => 'group=' . self
::$_gName . '&action=delete&id=%%id%%',
178 'title' => ts('Delete %1 Type', array(1 => self
::$_gName)),
182 if (self
::$_gName == 'custom_search') {
184 CRM_Core_Action
::FOLLOWUP
=> array(
186 'url' => 'civicrm/contact/search/custom',
187 'qs' => 'reset=1&csid=%%value%%',
188 'title' => ts('Run %1', array(1 => self
::$_gName)),
190 self
::$_links = $runLink + self
::$_links;
193 return self
::$_links;
197 * Run the basic page (run essentially starts execution for that page).
203 return parent
::run();
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('rows', $optionValue);
237 * Get name of edit form
239 * @return string Classname of edit form.
241 function editForm() {
242 return 'CRM_Admin_Form_Options';
248 * @return string name of this page.
250 function editName() {
251 return self
::$_GName;
257 * @return string user context.
259 function userContext($mode = NULL) {
260 return 'civicrm/admin/options/' . self
::$_gName;
264 * function to get userContext params
266 * @param int $mode mode that we are in
271 function userContextParams($mode = NULL) {
272 return 'group=' . self
::$_gName . '&reset=1&action=browse';