3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * Page for displaying list of Gender.
21 class CRM_Campaign_Page_SurveyType
extends CRM_Core_Page_Basic
{
23 public $useLivePageJS = TRUE;
26 * The action links that we need to display for the browse screen.
30 public static $_links = NULL;
33 * The option group name.
40 * The option group name in display format (capitalized, without underscores...etc)
47 * The option group id.
51 protected $_gid = NULL;
54 * Obtains the group name from url and sets the title.
56 public function preProcess() {
57 $this->_gName
= 'activity_type';
59 $this->_gid
= CRM_Core_DAO
::getFieldValue('CRM_Core_DAO_OptionGroup', $this->_gName
, 'id', 'name');
61 $this->_GName
= 'Survey Type';
63 $this->assign('gName', $this->_gName
);
64 $this->assign('GName', $this->_GName
);
66 CRM_Utils_System
::setTitle(ts('%1 Options', [1 => $this->_GName
]));
68 $this->assign('addSurveyType', ["civicrm/admin/campaign/surveyType", "reset=1&action=add"]);
77 public function getBAOName() {
78 return 'CRM_Core_BAO_OptionValue';
85 * (reference) of action links
87 public function &links() {
88 if (!(self
::$_links)) {
90 CRM_Core_Action
::UPDATE
=> [
92 'url' => 'civicrm/admin/campaign/surveyType',
93 'qs' => 'action=update&id=%%id%%&reset=1',
94 'title' => ts('Edit %1', [1 => $this->_gName
]),
96 CRM_Core_Action
::DISABLE
=> [
97 'name' => ts('Disable'),
98 'ref' => 'crm-enable-disable',
99 'title' => ts('Disable %1', [1 => $this->_gName
]),
101 CRM_Core_Action
::ENABLE
=> [
102 'name' => ts('Enable'),
103 'ref' => 'crm-enable-disable',
104 'title' => ts('Enable %1', [1 => $this->_gName
]),
106 CRM_Core_Action
::DELETE
=> [
107 'name' => ts('Delete'),
108 'url' => 'civicrm/admin/campaign/surveyType',
109 'qs' => 'action=delete&id=%%id%%',
110 'title' => ts('Delete %1 Type', [1 => $this->_gName
]),
114 return self
::$_links;
118 * Run the basic page (run essentially starts execution for that page).
120 public function run() {
122 return parent
::run();
126 * Browse all options.
128 public function browse() {
129 $campaingCompId = CRM_Core_Component
::getComponentID('CiviCampaign');
130 $groupParams = ['name' => $this->_gName
];
131 $optionValues = CRM_Core_OptionValue
::getRows($groupParams, $this->links(), 'component_id,weight');
133 foreach ($optionValues as $key => $optionValue) {
134 if (CRM_Utils_Array
::value('component_id', $optionValue) != $campaingCompId) {
135 unset($optionValues[$key]);
139 $returnURL = CRM_Utils_System
::url("civicrm/admin/campaign/surveyType",
142 $filter = "option_group_id = " . $this->_gid
;
143 CRM_Utils_Weight
::addOrder($optionValues, 'CRM_Core_DAO_OptionValue',
144 'id', $returnURL, $filter
146 $this->assign('rows', $optionValues);
150 * Get name of edit form.
153 * Classname of edit form.
155 public function editForm() {
156 return 'CRM_Campaign_Form_SurveyType';
160 * Get edit form name.
165 public function editName() {
166 return $this->_GName
;
177 public function userContext($mode = NULL) {
178 return 'civicrm/admin/campaign/surveyType';
182 * Get userContext params.
185 * Mode that we are in.
189 public function userContextParams($mode = NULL) {