Esempio n. 1
0
 /**
  * Run the page.
  *
  * This method is called after the page is created. It checks for the  
  * type of action and executes that action. 
  * 
  * @param null
  * 
  * @return void
  * @access public
  */
 function run()
 {
     require_once 'CRM/Core/BAO/CustomField.php';
     // get the field id
     $this->_fid = CRM_Utils_Request::retrieve('fid', $this, false, 0);
     $this->_gid = CRM_Utils_Request::retrieve('gid', $this, false, 0);
     if ($this->_fid) {
         $fieldTitle = CRM_Core_BAO_CustomField::getTitle($this->_fid);
         $this->assign('fid', $this->_fid);
         $this->assign('fieldTitle', $fieldTitle);
         CRM_Utils_System::setTitle(ts('%1 - Multiple Choice Options', array(1 => $fieldTitle)));
     }
     // get the requested action
     $action = CRM_Utils_Request::retrieve('action', $this, false, 'browse');
     // default to 'browse'
     // assign vars to templates
     $this->assign('action', $action);
     $id = CRM_Utils_Request::retrieve('id', $this, false, 0);
     // what action to take ?
     if ($action & (CRM_CORE_ACTION_UPDATE | CRM_CORE_ACTION_ADD | CRM_CORE_ACTION_VIEW | CRM_CORE_ACTION_DELETE)) {
         $this->edit($action);
         // no browse for edit/update/view
     } else {
         if ($action & CRM_CORE_ACTION_DISABLE) {
             CRM_Core_BAO_CustomOption::setIsActive($id, 0);
         } else {
             if ($action & CRM_CORE_ACTION_ENABLE) {
                 CRM_Core_BAO_CustomOption::setIsActive($id, 1);
             }
         }
         $this->browse();
     }
     // Call the parents run method
     parent::run();
 }