Пример #1
0
 /**
  * Set variables up before form is built.
  *
  * @return void
  */
 public function preProcess()
 {
     // current contribution page id
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, NULL, 'REQUEST');
     $this->assign('contributionPageID', $this->_id);
     // get the requested action
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
     // setting title and 3rd level breadcrumb for html page if contrib page exists
     if ($this->_id) {
         $title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
         if ($this->_action == CRM_Core_Action::UPDATE) {
             $this->_single = TRUE;
         }
     }
     // CRM-16776 - show edit/copy/create buttons on Profiles Tab if user has required permission.
     if (CRM_Core_Permission::check('administer CiviCRM')) {
         $this->assign('perm', TRUE);
     }
     // set up tabs
     CRM_Contribute_Form_ContributionPage_TabHeader::build($this);
     if ($this->_action == CRM_Core_Action::UPDATE) {
         CRM_Utils_System::setTitle(ts('Configure Page - %1', array(1 => $title)));
     } elseif ($this->_action == CRM_Core_Action::VIEW) {
         CRM_Utils_System::setTitle(ts('Preview Page - %1', array(1 => $title)));
     } elseif ($this->_action == CRM_Core_Action::DELETE) {
         CRM_Utils_System::setTitle(ts('Delete Page - %1', array(1 => $title)));
     }
     //cache values.
     $this->_values = $this->get('values');
     if (!is_array($this->_values)) {
         $this->_values = array();
         if (isset($this->_id) && $this->_id) {
             $params = array('id' => $this->_id);
             CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_ContributionPage', $params, $this->_values);
         }
         $this->set('values', $this->_values);
     }
     // Preload libraries required by the "Profiles" tab
     $schemas = array('IndividualModel', 'OrganizationModel', 'ContributionModel');
     if (in_array('CiviMember', CRM_Core_Config::singleton()->enableComponents)) {
         $schemas[] = 'MembershipModel';
     }
     CRM_UF_Page_ProfileEditor::registerProfileScripts();
     CRM_UF_Page_ProfileEditor::registerSchemas($schemas);
 }
 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     // current contribution page id
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, NULL, 'REQUEST');
     $this->assign('contributionPageID', $this->_id);
     // get the requested action
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
     // setting title and 3rd level breadcrumb for html page if contrib page exists
     if ($this->_id) {
         $title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
         if ($this->_action == CRM_Core_Action::UPDATE) {
             $this->_single = TRUE;
         }
     }
     // set up tabs
     CRM_Contribute_Form_ContributionPage_TabHeader::build($this);
     if ($this->_action == CRM_Core_Action::UPDATE) {
         CRM_Utils_System::setTitle(ts('Configure Page - %1', array(1 => $title)));
     } elseif ($this->_action == CRM_Core_Action::VIEW) {
         CRM_Utils_System::setTitle(ts('Preview Page - %1', array(1 => $title)));
     } elseif ($this->_action == CRM_Core_Action::DELETE) {
         CRM_Utils_System::setTitle(ts('Delete Page - %1', array(1 => $title)));
     }
     //cache values.
     $this->_values = $this->get('values');
     if (!is_array($this->_values)) {
         $this->_values = array();
         if (isset($this->_id) && $this->_id) {
             $params = array('id' => $this->_id);
             CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_ContributionPage', $params, $this->_values);
         }
         $this->set('values', $this->_values);
     }
 }