示例#1
0
 public function preProcess()
 {
     if (!CRM_Campaign_BAO_Campaign::accessCampaign()) {
         CRM_Utils_System::permissionDenied();
     }
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add', 'REQUEST');
     $this->_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
     if ($this->_surveyId) {
         $this->_single = TRUE;
         $params = array('id' => $this->_surveyId);
         CRM_Campaign_BAO_Survey::retrieve($params, $surveyInfo);
         $this->_surveyTitle = $surveyInfo['title'];
         $this->assign('surveyTitle', $this->_surveyTitle);
         CRM_Utils_System::setTitle(ts('Configure Survey - %1', array(1 => $this->_surveyTitle)));
     }
     $this->assign('action', $this->_action);
     $this->assign('surveyId', $this->_surveyId);
     // when custom data is included in this page
     if (!empty($_POST['hidden_custom'])) {
         $this->set('type', 'Event');
         $this->set('entityId', $this->_surveyId);
         CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Survey', $this->_surveyId);
         CRM_Custom_Form_CustomData::buildQuickForm($this);
         CRM_Custom_Form_CustomData::setDefaultValues($this);
     }
     // CRM-11480, CRM-11682
     // Preload libraries required by the "Questions" tab
     CRM_UF_Page_ProfileEditor::registerProfileScripts();
     CRM_UF_Page_ProfileEditor::registerSchemas(array('IndividualModel', 'ActivityModel'));
     CRM_Campaign_Form_Survey_TabHeader::build($this);
 }
示例#2
0
 /**
  * @param $form
  *
  * @return array
  */
 static function build(&$form)
 {
     $tabs = $form->get('tabHeader');
     if (!$tabs || empty($_GET['reset'])) {
         $tabs = self::process($form);
         $form->set('tabHeader', $tabs);
     }
     $form->assign_by_ref('tabHeader', $tabs);
     CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js')->addSetting(array('tabSettings' => array('active' => self::getCurrentTab($tabs))));
     // Preload libraries required by Online Registration Include Profiles
     $schemas = array('IndividualModel', 'ParticipantModel');
     if (in_array('CiviMember', CRM_Core_Config::singleton()->enableComponents)) {
         $schemas[] = 'MembershipModel';
     }
     CRM_UF_Page_ProfileEditor::registerProfileScripts();
     CRM_UF_Page_ProfileEditor::registerSchemas($schemas);
     return $tabs;
 }
示例#3
0
 function run()
 {
     $wid = CRM_Utils_Request::retrieve('wid', 'Positive', $this, false, 0);
     if ($wid) {
         $wsql = "SELECT * FROM civicrm_workflow WHERE id = {$wid} LIMIT 1";
         $dao =& CRM_Core_DAO::executeQuery($wsql);
         if (!$dao->fetch()) {
             $workflow = null;
         } else {
             $workflow = (array) $dao;
         }
         $dsql = "SELECT * FROM civicrm_workflow_detail WHERE workflow_id = {$wid} ORDER BY `order`";
         $dao =& CRM_Core_DAO::executeQuery($dsql);
         $details = array();
         while ($dao->fetch()) {
             $details[$dao->order] = (array) $dao;
             if ($dao->entity_table == "Profile") {
                 $result = civicrm_api3('UFGroup', 'get', array('sequential' => 1, 'return' => "title", 'id' => $dao->entity_id));
                 $details[$dao->order]['name'] = $result['values'][0]['title'];
             }
             if ($dao->entity_table == "Page") {
                 $result = civicrm_api3('ContributionPage', 'get', array('sequential' => 1, 'return' => "title", 'id' => $dao->entity_id));
                 $details[$dao->order]['name'] = $result['values'][0]['title'];
             }
         }
         CRM_Utils_System::setTitle(ts("Details for " . $workflow['name'] . ":"));
     } else {
         $workflow = null;
         $details = array();
     }
     $result = civicrm_api3('ContributionPage', 'get', array('sequential' => 1, 'return' => array("id", "title")));
     $pages = $result['values'];
     $this->assign("pages", $pages);
     $this->assign('workflow', $workflow);
     $this->assign('details', $details);
     //Add Stylesheet
     CRM_Core_Resources::singleton()->addStyleFile('org.botany.workflow', 'workflow_profiles.css');
     CRM_UF_Page_ProfileEditor::registerProfileScripts();
     parent::run();
 }
示例#4
0
文件: Survey.php 项目: hguru/224Civi
 public function preProcess()
 {
     if (!CRM_Campaign_BAO_Campaign::accessCampaign()) {
         CRM_Utils_System::permissionDenied();
     }
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add', 'REQUEST');
     $this->_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
     if ($this->_surveyId) {
         $this->_single = TRUE;
         $params = array('id' => $this->_surveyId);
         CRM_Campaign_BAO_Survey::retrieve($params, $surveyInfo);
         $this->_surveyTitle = $surveyInfo['title'];
         $this->assign('surveyTitle', $this->_surveyTitle);
         CRM_Utils_System::setTitle(ts('Configure Survey - %1', array(1 => $this->_surveyTitle)));
     }
     $this->assign('action', $this->_action);
     $this->assign('surveyId', $this->_surveyId);
     // CRM-11480, CRM-11682
     // Preload libraries required by the "Questions" tab
     CRM_UF_Page_ProfileEditor::registerProfileScripts();
     CRM_UF_Page_ProfileEditor::registerSchemas(array('IndividualModel', 'ActivityModel'));
     CRM_Campaign_Form_Survey_TabHeader::build($this);
 }
示例#5
0
 /**
  * Add a widget for selecting/editing/creating/copying a profile form
  *
  * @param string $name
  *   HTML form-element name.
  * @param string $label
  *   Printable label.
  * @param string $allowCoreTypes
  *   Only present a UFGroup if its group_type includes a subset of $allowCoreTypes; e.g. 'Individual', 'Activity'.
  * @param string $allowSubTypes
  *   Only present a UFGroup if its group_type is compatible with $allowSubypes.
  * @param array $entities
  * @param bool $default
  *   //CRM-15427.
  */
 public function addProfileSelector($name, $label, $allowCoreTypes, $allowSubTypes, $entities, $default = FALSE, $usedFor = NULL)
 {
     // Output widget
     // FIXME: Instead of adhoc serialization, use a single json_encode()
     CRM_UF_Page_ProfileEditor::registerProfileScripts();
     CRM_UF_Page_ProfileEditor::registerSchemas(CRM_Utils_Array::collect('entity_type', $entities));
     $this->add('text', $name, $label, array('class' => 'crm-profile-selector', 'data-group-type' => CRM_Core_BAO_UFGroup::encodeGroupType($allowCoreTypes, $allowSubTypes, ';;'), 'data-entities' => json_encode($entities), 'data-default' => $default, 'data-usedfor' => json_encode($usedFor)));
 }
示例#6
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);
 }
示例#7
0
 /**
  * Pre-load libraries required by Online Registration Profile fields
  */
 public static function addProfileEditScripts()
 {
     CRM_UF_Page_ProfileEditor::registerProfileScripts();
     CRM_UF_Page_ProfileEditor::registerSchemas(array('IndividualModel', 'ParticipantModel'));
 }
示例#8
0
<?php

CRM_UF_Page_ProfileEditor::registerProfileScripts();