3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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-2014
37 * Page for displaying list of Gender
39 class CRM_Campaign_Page_SurveyType
extends CRM_Core_Page_Basic
{
41 public $useLivePageJS = TRUE;
44 * The action links that we need to display for the browse screen
49 static $_links = NULL;
52 * The option group name
60 * The option group name in display format (capitalized, without underscores...etc)
73 protected $_gid = NULL;
76 * Obtains the group name from url and sets the title.
81 public function preProcess() {
82 $this->_gName
= 'activity_type';
84 $this->_gid
= CRM_Core_DAO
::getFieldValue('CRM_Core_DAO_OptionGroup', $this->_gName
, 'id', 'name');
86 $this->_GName
= 'Survey Type';
88 $this->assign('gName', $this->_gName
);
89 $this->assign('GName', $this->_GName
);
91 CRM_Utils_System
::setTitle(ts('%1 Options', array(1 => $this->_GName
)));
93 $this->assign('addSurveyType', CRM_Utils_System
::url("civicrm/admin/campaign/surveyType", 'reset=1&action=add'));
99 * @return string Classname of BAO.
101 public function getBAOName() {
102 return 'CRM_Core_BAO_OptionValue';
108 * @return array (reference) of action links
110 public function &links() {
111 if (!(self
::$_links)) {
112 self
::$_links = array(
113 CRM_Core_Action
::UPDATE
=> array(
114 'name' => ts('Edit'),
115 'url' => 'civicrm/admin/campaign/surveyType',
116 'qs' => 'action=update&id=%%id%%&reset=1',
117 'title' => ts('Edit %1', array(1 => $this->_gName
)),
119 CRM_Core_Action
::DISABLE
=> array(
120 'name' => ts('Disable'),
121 'ref' => 'crm-enable-disable',
122 'title' => ts('Disable %1', array(1 => $this->_gName
)),
124 CRM_Core_Action
::ENABLE
=> array(
125 'name' => ts('Enable'),
126 'ref' => 'crm-enable-disable',
127 'title' => ts('Enable %1', array(1 => $this->_gName
)),
129 CRM_Core_Action
::DELETE
=> array(
130 'name' => ts('Delete'),
131 'url' => 'civicrm/admin/campaign/surveyType',
132 'qs' => 'action=delete&id=%%id%%',
133 'title' => ts('Delete %1 Type', array(1 => $this->_gName
)),
137 return self
::$_links;
141 * Run the basic page (run essentially starts execution for that page).
145 public function run() {
147 return parent
::run();
157 public function browse() {
158 $campaingCompId = CRM_Core_Component
::getComponentID('CiviCampaign');
159 $groupParams = array('name' => $this->_gName
);
160 $optionValues = CRM_Core_OptionValue
::getRows($groupParams, $this->links(), 'component_id,weight');
162 foreach ($optionValues as $key => $optionValue) {
163 if (CRM_Utils_Array
::value('component_id', $optionValue) != $campaingCompId) {
164 unset($optionValues[$key]);
168 $returnURL = CRM_Utils_System
::url("civicrm/admin/campaign/surveyType",
171 $filter = "option_group_id = " . $this->_gid
;
172 CRM_Utils_Weight
::addOrder($optionValues, 'CRM_Core_DAO_OptionValue',
173 'id', $returnURL, $filter
175 $this->assign('rows', $optionValues);
179 * Get name of edit form
181 * @return string Classname of edit form.
183 public function editForm() {
184 return 'CRM_Campaign_Form_SurveyType';
190 * @return string name of this page.
192 public function editName() {
193 return $this->_GName
;
201 * @return string user context.
203 public function userContext($mode = NULL) {
204 return 'civicrm/admin/campaign/surveyType';
208 * Get userContext params
210 * @param int $mode mode that we are in
214 public function userContextParams($mode = NULL) {