_gName = 'activity_type'; $this->_gid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $this->_gName, 'id', 'name'); $this->_GName = 'Survey Type'; $this->assign('gName', $this->_gName); $this->assign('GName', $this->_GName); CRM_Utils_System::setTitle(ts('%1 Options', array(1 => $this->_GName))); $this->assign('addSurveyType', CRM_Utils_System::url("civicrm/admin/campaign/surveyType", 'reset=1&action=add')); } /** * Get BAO Name * * @return string Classname of BAO. */ function getBAOName() { return 'CRM_Core_BAO_OptionValue'; } /** * Get action Links * * @return array (reference) of action links */ function &links() { if (!(self::$_links)) { self::$_links = array( CRM_Core_Action::UPDATE => array( 'name' => ts('Edit'), 'url' => 'civicrm/admin/campaign/surveyType', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit %1', array(1 => $this->_gName)), ), CRM_Core_Action::DISABLE => array( 'name' => ts('Disable'), 'ref' => 'crm-enable-disable', 'title' => ts('Disable %1', array(1 => $this->_gName)), ), CRM_Core_Action::ENABLE => array( 'name' => ts('Enable'), 'ref' => 'crm-enable-disable', 'title' => ts('Enable %1', array(1 => $this->_gName)), ), CRM_Core_Action::DELETE => array( 'name' => ts('Delete'), 'url' => 'civicrm/admin/campaign/surveyType', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete %1 Type', array(1 => $this->_gName)), ), ); } return self::$_links; } /** * Run the basic page (run essentially starts execution for that page). * * @return void */ function run() { $this->preProcess(); return parent::run(); } /** * Browse all options * * * @return void * @access public * @static */ function browse() { $this->assign('includeWysiwygEditor', TRUE); $campaingCompId = CRM_Core_Component::getComponentID('CiviCampaign'); $groupParams = array('name' => $this->_gName); $optionValues = CRM_Core_OptionValue::getRows($groupParams, $this->links(), 'component_id,weight'); foreach ($optionValues as $key => $optionValue) { if (CRM_Utils_Array::value('component_id', $optionValue) != $campaingCompId) { unset($optionValues[$key]); } } $returnURL = CRM_Utils_System::url("civicrm/admin/campaign/surveyType", "reset=1" ); $filter = "option_group_id = " . $this->_gid; CRM_Utils_Weight::addOrder($optionValues, 'CRM_Core_DAO_OptionValue', 'id', $returnURL, $filter ); $this->assign('rows', $optionValues); } /** * Get name of edit form * * @return string Classname of edit form. */ function editForm() { return 'CRM_Campaign_Form_SurveyType'; } /** * Get edit form name * * @return string name of this page. */ function editName() { return $this->_GName; } /** * Get user context. * * @return string user context. */ function userContext($mode = NULL) { return 'civicrm/admin/campaign/surveyType'; } /** * function to get userContext params * * @param int $mode mode that we are in * * @return string * @access public */ function userContextParams($mode = NULL) { return 'reset=1'; } }