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_Campaign_Page_SurveyType
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
58 * The option group name in display format (capitalized, without underscores...etc)
71 protected $_gid = NULL;
74 * Obtains the group name from url and sets the title.
80 function preProcess() {
81 $this->_gName
= 'activity_type';
83 $this->_gid
= CRM_Core_DAO
::getFieldValue('CRM_Core_DAO_OptionGroup', $this->_gName
, 'id', 'name');
85 $this->_GName
= 'Survey Type';
87 $this->assign('gName', $this->_gName
);
88 $this->assign('GName', $this->_GName
);
90 CRM_Utils_System
::setTitle(ts('%1 Options', array(1 => $this->_GName
)));
92 $this->assign('addSurveyType', CRM_Utils_System
::url("civicrm/admin/campaign/surveyType", 'reset=1&action=add'));
98 * @return string Classname of BAO.
100 function getBAOName() {
101 return 'CRM_Core_BAO_OptionValue';
107 * @return array (reference) of action links
110 if (!(self
::$_links)) {
111 self
::$_links = array(
112 CRM_Core_Action
::UPDATE
=> array(
113 'name' => ts('Edit'),
114 'url' => 'civicrm/admin/campaign/surveyType',
115 'qs' => 'action=update&id=%%id%%&reset=1',
116 'title' => ts('Edit %1', array(1 => $this->_gName
)),
118 CRM_Core_Action
::DISABLE
=> array(
119 'name' => ts('Disable'),
120 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_OptionValue' . '\',\'' . 'enable-disable' . '\' );"',
121 'ref' => 'disable-action',
122 'title' => ts('Disable %1', array(1 => $this->_gName
)),
124 CRM_Core_Action
::ENABLE
=> array(
125 'name' => ts('Enable'),
126 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_OptionValue' . '\',\'' . 'disable-enable' . '\' );"',
127 'ref' => 'enable-action',
128 'title' => ts('Enable %1', array(1 => $this->_gName
)),
130 CRM_Core_Action
::DELETE
=> array(
131 'name' => ts('Delete'),
132 'url' => 'civicrm/admin/campaign/surveyType',
133 'qs' => 'action=delete&id=%%id%%',
134 'title' => ts('Delete %1 Type', array(1 => $this->_gName
)),
138 return self
::$_links;
142 * Run the basic page (run essentially starts execution for that page).
148 return parent
::run();
161 $campaingCompId = CRM_Core_Component
::getComponentID('CiviCampaign');
162 $groupParams = array('name' => $this->_gName
);
163 $optionValues = CRM_Core_OptionValue
::getRows($groupParams, $this->links(), 'component_id,weight');
165 foreach ($optionValues as $key => $optionValue) {
166 if (CRM_Utils_Array
::value('component_id', $optionValue) != $campaingCompId) {
167 unset($optionValues[$key]);
171 $returnURL = CRM_Utils_System
::url("civicrm/admin/campaign/surveyType",
174 $filter = "option_group_id = " . $this->_gid
;
175 CRM_Utils_Weight
::addOrder($optionValues, 'CRM_Core_DAO_OptionValue',
176 'id', $returnURL, $filter
178 $this->assign('rows', $optionValues);
182 * Get name of edit form
184 * @return string Classname of edit form.
186 function editForm() {
187 return 'CRM_Campaign_Form_SurveyType';
193 * @return string name of this page.
195 function editName() {
196 return $this->_GName
;
202 * @return string user context.
204 function userContext($mode = NULL) {
205 return 'civicrm/admin/campaign/surveyType';
209 * function to get userContext params
211 * @param int $mode mode that we are in
216 function userContextParams($mode = NULL) {