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.
  * Finally it calls the parent's run method.
  */
 public function run()
 {
     // get the requested action
     $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
     // assign vars to templates
     $this->assign('action', $action);
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
     // set breadcrumb to append to admin/access
     $breadCrumb = array(array('title' => ts('Access Control'), 'url' => CRM_Utils_System::url('civicrm/admin/access', 'reset=1')));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     // what action to take ?
     if ($action & (CRM_Core_Action::ADD | CRM_Core_Action::DELETE)) {
         $this->edit($action, $id);
     }
     if ($action & CRM_Core_Action::UPDATE) {
         $this->edit($action, $id);
         if (isset($id)) {
             $aclName = CRM_Core_DAO::getFieldValue('CRM_ACL_DAO_ACL', $id);
             CRM_Utils_System::setTitle(ts('Edit ACL -  %1', array(1 => $aclName)));
         }
     }
     // finally browse the acl's
     if ($action & CRM_Core_Action::BROWSE) {
         $this->browse();
     }
     // parent run
     return parent::run();
 }
Esempio n. 2
0
 /**
  * Run the page.
  *
  * This method is called after the page is created. It checks for the
  * type of action and executes that action.
  * Finally it calls the parent's run method.
  */
 public function run()
 {
     // get the requested action
     $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
     // assign vars to templates
     $this->assign('action', $action);
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
     // set breadcrumb to append to admin/access
     $breadCrumb = array(array('title' => ts('Access Control'), 'url' => CRM_Utils_System::url('civicrm/admin/access', 'reset=1')));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     CRM_Utils_System::setTitle(ts('Assign Users to Roles'));
     // what action to take ?
     if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD | CRM_Core_Action::DELETE)) {
         $this->edit($action, $id);
     }
     // reset cache if enabled/disabled
     if ($action & (CRM_Core_Action::DISABLE | CRM_Core_Action::ENABLE)) {
         CRM_ACL_BAO_Cache::resetCache();
     }
     // finally browse the acl's
     if ($action & CRM_Core_Action::BROWSE) {
     }
     // parent run
     return parent::run();
 }
Esempio n. 3
0
 public function preProcess()
 {
     require_once 'CRM/Contact/BAO/SearchCustom.php';
     $csID = CRM_Utils_Request::retrieve('csid', 'Integer', $this);
     $ssID = CRM_Utils_Request::retrieve('ssID', 'Integer', $this);
     $gID = CRM_Utils_Request::retrieve('gid', 'Integer', $this);
     list($this->_customSearchID, $this->_customSearchClass, $formValues) = CRM_Contact_BAO_SearchCustom::details($csID, $ssID, $gID);
     if (!$this->_customSearchID) {
         CRM_Core_Error::fatal('Could not get details for custom search.');
     }
     if (!empty($formValues)) {
         $this->_formValues = $formValues;
     }
     // set breadcrumb to return to Custom Search listings page
     $breadCrumb = array(array('title' => ts('Custom Searches'), 'url' => CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1')));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     // use the custom selector
     require_once 'CRM/Contact/Selector/Custom.php';
     $this->_selectorName = 'CRM_Contact_Selector_Custom';
     $this->set('customSearchID', $this->_customSearchID);
     $this->set('customSearchClass', $this->_customSearchClass);
     parent::preProcess();
     // instantiate the new class
     eval('$this->_customClass = new ' . $this->_customSearchClass . '( $this->_formValues );');
 }
Esempio n. 4
0
 public function preProcess()
 {
     $this->set('searchFormName', 'Custom');
     $this->set('context', 'custom');
     $csID = CRM_Utils_Request::retrieve('csid', 'Integer', $this);
     $ssID = CRM_Utils_Request::retrieve('ssID', 'Integer', $this);
     $gID = CRM_Utils_Request::retrieve('gid', 'Integer', $this);
     list($this->_customSearchID, $this->_customSearchClass, $formValues) = CRM_Contact_BAO_SearchCustom::details($csID, $ssID, $gID);
     if (!$this->_customSearchID) {
         CRM_Core_Error::fatal('Could not get details for custom search.');
     }
     // stash this as a hidden element so we can potentially go there if the session
     // is reset but this is available in the POST
     $this->addElement('hidden', 'csid', $csID);
     if (!empty($formValues)) {
         $this->_formValues = $formValues;
     }
     // set breadcrumb to return to Custom Search listings page
     $breadCrumb = array(array('title' => ts('Custom Searches'), 'url' => CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1')));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     // use the custom selector
     self::$_selectorName = 'CRM_Contact_Selector_Custom';
     $this->set('customSearchID', $this->_customSearchID);
     $this->set('customSearchClass', $this->_customSearchClass);
     parent::preProcess();
     // instantiate the new class
     $this->_customClass = new $this->_customSearchClass($this->_formValues);
     // CRM-12747
     if (isset($this->_customClass->_permissionedComponent) && !self::isPermissioned($this->_customClass->_permissionedComponent)) {
         CRM_Utils_System::permissionDenied();
     }
 }
 function __construct()
 {
     // don’t display the ‘Add these Contacts to Group’ button
     $this->_add2groupSupported = FALSE;
     $dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
     $this->db = $dsn['database'];
     $this->log_conn_id = CRM_Utils_Request::retrieve('log_conn_id', 'Integer', CRM_Core_DAO::$_nullObject);
     $this->log_date = CRM_Utils_Request::retrieve('log_date', 'String', CRM_Core_DAO::$_nullObject);
     $this->cid = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
     $this->raw = CRM_Utils_Request::retrieve('raw', 'Boolean', CRM_Core_DAO::$_nullObject);
     parent::__construct();
     CRM_Utils_System::resetBreadCrumb();
     $breadcrumb = array(array('title' => ts('Home'), 'url' => CRM_Utils_System::url()), array('title' => ts('CiviCRM'), 'url' => CRM_Utils_System::url('civicrm', 'reset=1')), array('title' => ts('View Contact'), 'url' => CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->cid}")), array('title' => ts('Search Results'), 'url' => CRM_Utils_System::url('civicrm/contact/search', "force=1")));
     CRM_Utils_System::appendBreadCrumb($breadcrumb);
     if (CRM_Utils_Request::retrieve('revert', 'Boolean', CRM_Core_DAO::$_nullObject)) {
         $reverter = new CRM_Logging_Reverter($this->log_conn_id, $this->log_date);
         $reverter->revert($this->tables);
         CRM_Core_Session::setStatus(ts('The changes have been reverted.'));
         if ($this->cid) {
             CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view', "reset=1&selectedChild=log&cid={$this->cid}", FALSE, NULL, FALSE));
         } else {
             CRM_Utils_System::redirect(CRM_Report_Utils_Report::getNextUrl($this->summary, 'reset=1', FALSE, TRUE));
         }
     }
     // make sure the report works even without the params
     if (!$this->log_conn_id or !$this->log_date) {
         $dao = new CRM_Core_DAO();
         $dao->query("SELECT log_conn_id, log_date FROM `{$this->db}`.log_{$this->tables[0]} WHERE log_action = 'Update' ORDER BY log_date DESC LIMIT 1");
         $dao->fetch();
         $this->log_conn_id = $dao->log_conn_id;
         $this->log_date = $dao->log_date;
     }
     $this->_columnHeaders = array('field' => array('title' => ts('Field')), 'from' => array('title' => ts('Changed From')), 'to' => array('title' => ts('Changed To')));
 }
Esempio n. 6
0
 public function preProcess()
 {
     parent::preProcess();
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->assign('context', $this->_context);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
     if ($this->_action & CRM_Core_Action::UPDATE) {
         CRM_Utils_System::setTitle(ts('Configure Survey') . ' - ' . $this->_surveyTitle);
     }
     // when custom data is included in this page
     if (!empty($_POST['hidden_custom'])) {
         CRM_Custom_Form_CustomData::preProcess($this);
         CRM_Custom_Form_CustomData::buildQuickForm($this);
     }
     if ($this->_name != 'Petition') {
         $url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey');
         CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('Survey Dashboard'), 'url' => $url)));
     }
     $this->_values = $this->get('values');
     if (!is_array($this->_values)) {
         $this->_values = array();
         if ($this->_surveyId) {
             $params = array('id' => $this->_surveyId);
             CRM_Campaign_BAO_Survey::retrieve($params, $this->_values);
         }
         $this->set('values', $this->_values);
     }
     $this->assign('action', $this->_action);
     $this->assign('surveyId', $this->_surveyId);
     // for custom data
     $this->assign('entityID', $this->_surveyId);
 }
Esempio n. 7
0
 /**
  * Build all the data structures needed to build the form.
  *
  * @return void
  */
 public function preProcess()
 {
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
     if ($id) {
         $this->_contributionIds = array($id);
         $this->_componentClause = " civicrm_contribution.id IN ( {$id} ) ";
         $this->_single = TRUE;
         $this->assign('totalSelectedContributions', 1);
     } else {
         parent::preProcess();
     }
     // check that all the contribution ids have pending status
     $query = "\nSELECT count(*)\nFROM   civicrm_contribution\nWHERE  contribution_status_id != 1\nAND    {$this->_componentClause}";
     $count = CRM_Core_DAO::singleValueQuery($query);
     if ($count != 0) {
         CRM_Core_Error::statusBounce("Please select only online contributions with Completed status.");
     }
     // we have all the contribution ids, so now we get the contact ids
     parent::setContactIDs();
     $this->assign('single', $this->_single);
     $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
     $urlParams = 'force=1';
     if (CRM_Utils_Rule::qfKey($qfKey)) {
         $urlParams .= "&qfKey={$qfKey}";
     }
     $url = CRM_Utils_System::url('civicrm/contribute/search', $urlParams);
     $breadCrumb = array(array('url' => $url, 'title' => ts('Search Results')));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     CRM_Utils_System::setTitle(ts('Print Contribution Receipts'));
 }
Esempio n. 8
0
 /**
  * Run the page.
  *
  * This method is called after the page is created. It checks for the  
  * type of action and executes that action.
  * Finally it calls the parent's run method.
  *
  * @return void
  * @access public
  *
  */
 function run()
 {
     // set title and breadcrumb
     CRM_Utils_System::setTitle(ts('Settings - Payment Processor'));
     $breadCrumb = array(array('title' => ts('Global Settings'), 'url' => CRM_Utils_System::url('civicrm/admin/setting', 'reset=1')));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     return parent::run();
 }
 function preProcess()
 {
     $this->_soInstance = CRM_Utils_Array::value('instance', $_GET);
     $this->assign('soInstance', $this->_soInstance);
     $breadCrumbUrl = CRM_Utils_System::url('civicrm/admin/options/wordreplacements', "reset=1");
     $breadCrumb = array(array('title' => ts('Word Replacements'), 'url' => $breadCrumbUrl));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
 }
Esempio n. 10
0
 /**
  * Run the page.
  *
  * This method is called after the page is created. It checks for the
  * type of action and executes that action.
  * Finally it calls the parent's run method.
  *
  * @return void
  * @access public
  *
  */
 function run()
 {
     // set title and breadcrumb
     CRM_Utils_System::setTitle(ts('Settings - Scheduled Jobs Log'));
     $breadCrumb = array(array('title' => ts('Administration'), 'url' => CRM_Utils_System::url('civicrm/admin', 'reset=1')));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     return parent::run();
 }
 function preProcess()
 {
     $this->_soInstance = CRM_Utils_Array::value('instance', $_GET);
     $this->assign('soInstance', $this->_soInstance);
     $breadCrumbUrl = CRM_Utils_System::url('civicrm/participant/config', "reset=1");
     $breadCrumb = array(array('title' => ts('Max Participants Setting '), 'url' => $breadCrumbUrl));
     $this->_getreturn = CRM_Core_BAO_Setting::getItem(self::EVENT_SETTING_GROUP, 'max_participants', NULL, FALSE);
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
 }
Esempio n. 12
0
 function preProcess()
 {
     CRM_Utils_System::setTitle(ts('Domain Information'));
     $breadCrumbPath = CRM_Utils_System::url('civicrm/admin', 'reset=1');
     CRM_Utils_System::appendBreadCrumb(ts('Administer CiviCRM'), $breadCrumbPath);
     $this->_id = CRM_Core_Config::domainID();
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'view');
     //location blocks.
     CRM_Contact_Form_Location::preProcess($this);
 }
Esempio n. 13
0
 /**
  * Run the page.
  *
  * This method is called after the page is created. It checks for the
  * type of action and executes that action.
  * Finally it calls the parent's run method.
  */
 public function run()
 {
     // set title and breadcrumb
     CRM_Utils_System::setTitle(ts('Settings - SMS Provider'));
     $breadCrumb = array(array('title' => ts('SMS Provider'), 'url' => CRM_Utils_System::url('civicrm/admin/sms/provider', 'reset=1')));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     $this->_id = CRM_Utils_Request::retrieve('id', 'String', $this, FALSE, 0);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 0);
     return parent::run();
 }
Esempio n. 14
0
 /**
  * Run the page.
  *
  * This method is called after the page is created. It checks for the
  * type of action and executes that action.
  * Finally it calls the parent's run method.
  */
 public function run()
 {
     // set title and breadcrumb
     CRM_Utils_System::setTitle(ts('Settings - Payment Processor'));
     //CRM-15546
     $paymentProcessorTypes = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_PaymentProcessor', 'payment_processor_type_id', array('labelColumn' => 'name', 'flip' => 1));
     $this->assign('defaultPaymentProcessorType', $paymentProcessorTypes['PayPal']);
     $breadCrumb = array(array('title' => ts('Administration'), 'url' => CRM_Utils_System::url('civicrm/admin', 'reset=1')));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     return parent::run();
 }
Esempio n. 15
0
 function preProcess()
 {
     CRM_Utils_System::setTitle(ts('Organization Address and Contact Info'));
     $breadCrumbPath = CRM_Utils_System::url('civicrm/admin', 'reset=1');
     CRM_Utils_System::appendBreadCrumb(ts('Administer CiviCRM'), $breadCrumbPath);
     $session = CRM_Core_Session::singleton();
     $session->replaceUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1'));
     $this->_id = CRM_Core_Config::domainID();
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'view');
     //location blocks.
     $location = new CRM_Contact_Form_Location();
     $location->preProcess($this);
 }
 function preProcess()
 {
     // This controller was originally written to CRUD $config->locale_custom_strings,
     // but that's no longer the canonical store. Re-sync from canonical store to ensure
     // that we display that latest data. This is inefficient - at some point, we
     // should rewrite this UI.
     CRM_Core_BAO_WordReplacement::rebuild();
     $this->_soInstance = CRM_Utils_Array::value('instance', $_GET);
     $this->assign('soInstance', $this->_soInstance);
     $breadCrumbUrl = CRM_Utils_System::url('civicrm/admin/options/wordreplacements', "reset=1");
     $breadCrumb = array(array('title' => ts('Word Replacements'), 'url' => $breadCrumbUrl));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
 }
Esempio n. 17
0
 /**
  * Class constructor.
  */
 public function __construct()
 {
     $this->storeDB();
     $this->parsePropertiesFromUrl();
     parent::__construct();
     CRM_Utils_System::resetBreadCrumb();
     $breadcrumb = array(array('title' => ts('Home'), 'url' => CRM_Utils_System::url()), array('title' => ts('CiviCRM'), 'url' => CRM_Utils_System::url('civicrm', 'reset=1')), array('title' => ts('View Contact'), 'url' => CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->cid}")), array('title' => ts('Search Results'), 'url' => CRM_Utils_System::url('civicrm/contact/search', "force=1")));
     CRM_Utils_System::appendBreadCrumb($breadcrumb);
     if (CRM_Utils_Request::retrieve('revert', 'Boolean')) {
         $this->revert();
     }
     $this->_columnHeaders = array('field' => array('title' => ts('Field')), 'from' => array('title' => ts('Changed From')), 'to' => array('title' => ts('Changed To')));
 }
Esempio n. 18
0
 /**
  * Set variables up before form is built.
  */
 public function preProcess()
 {
     $this->_sid = CRM_Utils_Request::retrieve('sid', 'Positive', $this, FALSE, NULL, 'REQUEST');
     $this->_fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, FALSE, NULL, 'REQUEST');
     $url = CRM_Utils_System::url('civicrm/admin/price/field', "reset=1&action=browse&sid={$this->_sid}");
     $breadCrumb = array(array('title' => ts('Price Set Fields'), 'url' => $url));
     $this->_extendComponentId = array();
     $extendComponentId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'extends', 'id');
     if ($extendComponentId) {
         $this->_extendComponentId = explode(CRM_Core_DAO::VALUE_SEPARATOR, $extendComponentId);
     }
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     $this->setPageTitle(ts('Price Field'));
 }
Esempio n. 19
0
File: Job.php Progetto: kidaa30/yes
 /**
  * Run the page.
  *
  * This method is called after the page is created. It checks for the
  * type of action and executes that action.
  * Finally it calls the parent's run method.
  *
  * @return void
  */
 public function run()
 {
     // set title and breadcrumb
     CRM_Utils_System::setTitle(ts('Settings - Scheduled Jobs'));
     $breadCrumb = array(array('title' => ts('Scheduled Jobs'), 'url' => CRM_Utils_System::url('civicrm/admin', 'reset=1')));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     $this->_id = CRM_Utils_Request::retrieve('id', 'String', $this, FALSE, 0);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 0);
     if ($this->_action == 'export') {
         $session = CRM_Core_Session::singleton();
         $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/job', 'reset=1'));
     }
     return parent::run();
 }
Esempio n. 20
0
 function edit($id, $startDate, $endDate)
 {
     $addcurrentPath = "reset=1&id={$id}";
     isset($startDate) ? $addcurrentPath .= "&startDate={$startDate}" : null;
     isset($endDate) ? $addcurrentPath .= "&endDate={$endDate}" : null;
     // set breadcrumb
     $breadCrumb = array(array('title' => ts('Browse Activities'), 'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(), $addcurrentPath)));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     $session =& CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), $addcurrentPath));
     $controller =& new CRM_Core_Controller_Simple('SFS_Form_ExtendedCare', 'Edit Activity block');
     $controller->process();
     $controller->run();
 }
Esempio n. 21
0
 /**
  * Set up variables to build the form.
  *
  * @return void
  * @acess protected
  */
 public function preProcess()
 {
     // TODO: quit if user can't access any registration groups (remove from nav menu?)
     // CRM_Core_Error::statusBounce(ts("You do not have sufficient permission to change settings for this reserved group."));
     $this->_id = $this->get('id');
     if ($this->_id) {
         $breadCrumb = array(array('title' => ts('Manage Teams'), 'url' => CRM_Utils_System::url('civicrm/tournament/team', 'reset=1')));
         CRM_Utils_System::appendBreadCrumb($breadCrumb);
         $this->_groupValues = array();
         $params = array('id' => $this->_id);
         $this->_group = CRM_Contact_BAO_Group::retrieve($params, $this->_groupValues);
         $this->_title = $this->_groupValues['title'];
     }
     $this->assign('action', $this->_action);
     $this->assign('showBlockJS', TRUE);
     if ($this->_action == CRM_Core_Action::DELETE) {
         if (isset($this->_id)) {
             $this->assign('title', $this->_title);
             $this->assign('count', CRM_Contact_BAO_Group::memberCount($this->_id));
             CRM_Utils_System::setTitle(ts('Confirm Group Delete'));
         }
         if ($this->_groupValues['is_reserved'] == 1 && !CRM_Core_Permission::check('administer reserved groups')) {
             CRM_Core_Error::statusBounce(ts("You do not have sufficient permission to delete this reserved group."));
         }
     } else {
         if ($this->_groupValues['is_reserved'] == 1 && !CRM_Core_Permission::check('administer reserved groups')) {
             CRM_Core_Error::statusBounce(ts("You do not have sufficient permission to change settings for this reserved group."));
         }
         if (isset($this->_id)) {
             $groupValues = array('id' => $this->_id, 'title' => $this->_title, 'saved_search_id' => isset($this->_groupValues['saved_search_id']) ? $this->_groupValues['saved_search_id'] : '');
             if (isset($this->_groupValues['saved_search_id'])) {
                 $groupValues['mapping_id'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_groupValues['saved_search_id'], 'mapping_id');
                 $groupValues['search_custom_id'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_groupValues['saved_search_id'], 'search_custom_id');
             }
             if (!empty($this->_groupValues['created_id'])) {
                 $groupValues['created_by'] = CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['created_id'], 'sort_name', 'id');
             }
             if (!empty($this->_groupValues['modified_id'])) {
                 $groupValues['modified_by'] = CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['modified_id'], 'sort_name', 'id');
             }
             $this->assign_by_ref('group', $groupValues);
             CRM_Utils_System::setTitle(ts('Team Settings: %1', array(1 => $this->_title)));
         }
         $session = CRM_Core_Session::singleton();
         $session->pushUserContext(CRM_Utils_System::url('civicrm/tournament/team', 'reset=1'));
     }
     //build custom data
     CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Group', $this->_id);
 }
Esempio n. 22
0
 public function preProcess()
 {
     parent::preProcess();
     if ($this->_action & (CRM_Core_Action::UPDATE | CRM_Core_Action::DELETE)) {
         $this->_surveyId = CRM_Utils_Request::retrieve('id', 'Positive', $this, true);
         if ($this->_action & CRM_Core_Action::UPDATE) {
             CRM_Utils_System::setTitle(ts('Edit Petition'));
         } else {
             CRM_Utils_System::setTitle(ts('Delete Petition'));
         }
     }
     $session = CRM_Core_Session::singleton();
     $url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=petition');
     $session->pushUserContext($url);
     CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('Petition Dashboard'), 'url' => $url)));
 }
Esempio n. 23
0
 /**
  * Run page.
  *
  * @return string
  */
 public function run()
 {
     // If the form was submitted, take appropriate action.
     if (!empty($_POST['revert'])) {
         self::deleteConfigFile();
     } elseif (!empty($_POST['config'])) {
         $this->save($_POST);
     }
     CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'bower_components/ckeditor/ckeditor.js', 0, 'html-header')->addScriptFile('civicrm', 'bower_components/ckeditor/samples/toolbarconfigurator/js/fulltoolbareditor.js', 1)->addScriptFile('civicrm', 'bower_components/ckeditor/samples/toolbarconfigurator/js/abstracttoolbarmodifier.js', 2)->addScriptFile('civicrm', 'bower_components/ckeditor/samples/toolbarconfigurator/js/toolbarmodifier.js', 3)->addScriptFile('civicrm', 'js/wysiwyg/admin.ckeditor-configurator.js', 10)->addStyleFile('civicrm', 'bower_components/ckeditor/samples/toolbarconfigurator/css/fontello.css')->addStyleFile('civicrm', 'bower_components/ckeditor/samples/css/samples.css')->addVars('ckConfig', array('plugins' => array_values($this->getCKPlugins())));
     $this->assign('skins', $this->getCKSkins());
     $this->assign('skin', $this->getConfigSetting('skin'));
     $this->assign('extraPlugins', $this->getConfigSetting('extraPlugins'));
     $this->assign('configUrl', self::getConfigUrl());
     $this->assign('revertConfirm', htmlspecialchars(ts('Are you sure you want to revert all changes?', array('escape' => 'js'))));
     CRM_Utils_System::appendBreadCrumb(array(array('url' => CRM_Utils_System::url('civicrm/admin/setting/preferences/display', 'reset=1'), 'title' => ts('Display Preferences'))));
     return parent::run();
 }
Esempio n. 24
0
 /**
  * Set variables up before form is built.
  *
  * @return void
  */
 public function preProcess()
 {
     // current set id
     $this->_sid = $this->get('sid');
     // setting title for html page
     $title = ts('New Price Set');
     if ($this->_sid) {
         $title = CRM_Price_BAO_PriceSet::getTitle($this->_sid);
     }
     if ($this->_action & CRM_Core_Action::UPDATE) {
         $title = ts('Edit %1', array(1 => $title));
     } elseif ($this->_action & CRM_Core_Action::VIEW) {
         $title = ts('Preview %1', array(1 => $title));
     }
     CRM_Utils_System::setTitle($title);
     $url = CRM_Utils_System::url('civicrm/admin/price', 'reset=1');
     $breadCrumb = array(array('title' => ts('Price Sets'), 'url' => $url));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
 }
Esempio n. 25
0
 /**
  * Pre processing work done here.
  *
  * gets session variables for group or field id
  *
  * @return void
  */
 public function preProcess()
 {
     // get the controller vars
     $groupId = $this->get('groupId');
     $fieldId = $this->get('fieldId');
     if ($fieldId) {
         $groupTree = CRM_Price_BAO_PriceSet::getSetDetail($groupId);
         $this->_groupTree[$groupId]['fields'][$fieldId] = $groupTree[$groupId]['fields'][$fieldId];
         $this->assign('preview_type', 'field');
         $url = CRM_Utils_System::url('civicrm/admin/price/field', "reset=1&action=browse&sid={$groupId}");
         $breadCrumb = array(array('title' => ts('Price Set Fields'), 'url' => $url));
     } else {
         // group preview
         $this->_groupTree = CRM_Price_BAO_PriceSet::getSetDetail($groupId);
         $this->assign('preview_type', 'group');
         $this->assign('setTitle', CRM_Price_BAO_PriceSet::getTitle($groupId));
         $url = CRM_Utils_System::url('civicrm/admin/price', 'reset=1');
         $breadCrumb = array(array('title' => ts('Price Sets'), 'url' => $url));
     }
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
 }
Esempio n. 26
0
 function run()
 {
     $action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 0);
     $this->assign('action', $action);
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, 0);
     $this->_term = CRM_Utils_Request::retrieve('term', 'String', $this, false, null);
     if ($action && (array_key_exists($action, self::actionLinks()) || $action & CRM_Core_Action::ADD)) {
         // set breadcrumb
         $breadCrumb = array(array('title' => ts('Class Information'), 'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1')));
         CRM_Utils_System::appendBreadCrumb($breadCrumb);
         CRM_Utils_System::setTitle(ts('Configure Class'));
         $session =& CRM_Core_Session::singleton();
         $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1'));
         $controller =& new CRM_Core_Controller_Simple('SFS_Form_Class', 'Configure Class');
         $controller->process();
         return $controller->run();
     } else {
         $this->browse();
         CRM_Utils_System::setTitle(ts('Class'));
     }
     parent::run();
 }
Esempio n. 27
0
 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     // For VIEW we only want Done button
     if ($this->_action & CRM_Core_Action::VIEW) {
         // currently, the above action is used solely for previewing default workflow templates
         $cancelURL = CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=workflow&reset=1');
         $cancelURL = str_replace('&', '&', $cancelURL);
         $this->addButtons(array(array('type' => 'cancel', 'name' => ts('Done'), 'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"), 'isDefault' => true)));
     } else {
         parent::buildQuickForm();
     }
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     require_once 'CRM/Utils/System.php';
     $breadCrumb = array(array('title' => ts('Message Templates'), 'url' => CRM_Utils_System::url('civicrm/admin/messageTemplates', 'action=browse&reset=1')));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'msg_title', ts('Message Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplates', 'msg_title'), true);
     $this->add('text', 'msg_subject', ts('Message Subject'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplates', 'msg_subject'));
     //get the tokens.
     $tokens = CRM_Core_SelectValues::contactTokens();
     //sorted in ascending order tokens by ignoring word case
     natcasesort($tokens);
     $this->assign('tokens', $tokens);
     $this->add('select', 'token1', ts('Insert Tokens'), $tokens, false, array('size' => "5", 'multiple' => true, 'onchange' => "return tokenReplText(this);"));
     $this->add('select', 'token2', ts('Insert Tokens'), $tokens, false, array('size' => "5", 'multiple' => true, 'onchange' => "return tokenReplHtml(this);"));
     $this->add('select', 'token3', ts('Insert Tokens'), $tokens, false, array('size' => "5", 'multiple' => true, 'onchange' => "return tokenReplText(this);"));
     $this->add('textarea', 'msg_text', ts('Text Message'), "cols=50 rows=6");
     $this->add('textarea', 'msg_html', ts('HTML Message'), "cols=50 rows=6");
     $this->add('checkbox', 'is_active', ts('Enabled?'));
     if ($this->_action & CRM_Core_Action::VIEW) {
         $this->freeze();
         CRM_Utils_System::setTitle(ts('View System Default Message Template'));
     }
 }
Esempio n. 28
0
 /**
  * Processing needed for buildForm and later.
  */
 public function preProcess()
 {
     $this->_search = CRM_Utils_Array::value('search', $_GET);
     $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
     $this->_surveyId = CRM_Utils_Request::retrieve('sid', 'Positive', $this);
     $this->_interviewerId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     //does control come from voting tab interface.
     $this->_votingTab = $this->get('votingTab');
     $this->_subVotingTab = $this->get('subVotingTab');
     $this->_searchVoterFor = 'gotv';
     if ($this->_votingTab) {
         if ($this->_subVotingTab == 'searchANDReserve') {
             $this->_searchVoterFor = 'reserve';
         } elseif ($this->_subVotingTab == 'searchANDInterview') {
             $this->_searchVoterFor = 'interview';
         }
     }
     $this->assign('force', $this->_force);
     $this->assign('votingTab', $this->_votingTab);
     $this->assign('searchParams', json_encode($this->get('searchParams')));
     $this->assign('buildSelector', $this->_search);
     $this->assign('searchVoterFor', $this->_searchVoterFor);
     $this->set('searchVoterFor', $this->_searchVoterFor);
     $surveyTitle = NULL;
     if ($this->_surveyId) {
         $surveyTitle = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $this->_surveyId, 'title');
     }
     $this->assign('surveyTitle', $surveyTitle);
     //append breadcrumb to survey dashboard.
     if (CRM_Campaign_BAO_Campaign::accessCampaign()) {
         $url = CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey');
         CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('Survey(s)'), 'url' => $url)));
     }
     //set the form title.
     CRM_Utils_System::setTitle(ts('GOTV (Voter Tracking)'));
 }
Esempio n. 29
0
 /**
  * Given a menu item, call the appropriate controller and return the response
  *
  * @param array $item see CRM_Core_Menu
  * @return string, HTML
  */
 public static function runItem($item)
 {
     $config = CRM_Core_Config::singleton();
     if ($config->userFramework == 'Joomla' && $item) {
         $config->userFrameworkURLVar = 'task';
         // joomla 1.5RC1 seems to push this in the POST variable, which messes
         // QF and checkboxes
         unset($_POST['option']);
         CRM_Core_Joomla::sidebarLeft();
     }
     // set active Component
     $template = CRM_Core_Smarty::singleton();
     $template->assign('activeComponent', 'CiviCRM');
     $template->assign('formTpl', 'default');
     if ($item) {
         // CRM-7656 - make sure we send a clean sanitized path to create printer friendly url
         $printerFriendly = CRM_Utils_System::makeURL('snippet', FALSE, FALSE, CRM_Utils_Array::value('path', $item)) . '2';
         $template->assign('printerFriendly', $printerFriendly);
         if (!array_key_exists('page_callback', $item)) {
             CRM_Core_Error::debug('Bad item', $item);
             CRM_Core_Error::fatal(ts('Bad menu record in database'));
         }
         // check that we are permissioned to access this page
         if (!CRM_Core_Permission::checkMenuItem($item)) {
             CRM_Utils_System::permissionDenied();
             return;
         }
         // check if ssl is set
         if (CRM_Utils_Array::value('is_ssl', $item)) {
             CRM_Utils_System::redirectToSSL();
         }
         if (isset($item['title'])) {
             CRM_Utils_System::setTitle($item['title']);
         }
         if (isset($item['breadcrumb']) && !isset($item['is_public'])) {
             CRM_Utils_System::appendBreadCrumb($item['breadcrumb']);
         }
         $pageArgs = NULL;
         if (CRM_Utils_Array::value('page_arguments', $item)) {
             $pageArgs = CRM_Core_Menu::getArrayForPathArgs($item['page_arguments']);
         }
         $template = CRM_Core_Smarty::singleton();
         if (!empty($item['is_public'])) {
             $template->assign('urlIsPublic', TRUE);
         } else {
             $template->assign('urlIsPublic', FALSE);
             self::versionCheck($template);
         }
         if (isset($item['return_url'])) {
             $session = CRM_Core_Session::singleton();
             $args = CRM_Utils_Array::value('return_url_args', $item, 'reset=1');
             $session->pushUserContext(CRM_Utils_System::url($item['return_url'], $args));
         }
         $result = NULL;
         if (is_array($item['page_callback'])) {
             $newArgs = explode('/', $_GET[$config->userFrameworkURLVar]);
             require_once str_replace('_', DIRECTORY_SEPARATOR, $item['page_callback'][0]) . '.php';
             $result = call_user_func($item['page_callback'], $newArgs);
         } elseif (strstr($item['page_callback'], '_Form')) {
             $wrapper = new CRM_Utils_Wrapper();
             $result = $wrapper->run(CRM_Utils_Array::value('page_callback', $item), CRM_Utils_Array::value('title', $item), isset($pageArgs) ? $pageArgs : NULL);
         } else {
             $newArgs = explode('/', $_GET[$config->userFrameworkURLVar]);
             require_once str_replace('_', DIRECTORY_SEPARATOR, $item['page_callback']) . '.php';
             $mode = 'null';
             if (isset($pageArgs['mode'])) {
                 $mode = $pageArgs['mode'];
                 unset($pageArgs['mode']);
             }
             $title = CRM_Utils_Array::value('title', $item);
             if (strstr($item['page_callback'], '_Page')) {
                 $object = new $item['page_callback']($title, $mode);
             } elseif (strstr($item['page_callback'], '_Controller')) {
                 $addSequence = 'false';
                 if (isset($pageArgs['addSequence'])) {
                     $addSequence = $pageArgs['addSequence'];
                     $addSequence = $addSequence ? 'true' : 'false';
                     unset($pageArgs['addSequence']);
                 }
                 $object = new $item['page_callback']($title, true, $mode, null, $addSequence);
             } else {
                 CRM_Core_Error::fatal();
             }
             $result = $object->run($newArgs, $pageArgs);
         }
         CRM_Core_Session::storeSessionObjects();
         return $result;
     }
     CRM_Core_Menu::store();
     CRM_Core_Session::setStatus(ts('Menu has been rebuilt'), ts('Complete'), 'success');
     return CRM_Utils_System::redirect();
 }
Esempio n. 30
0
 /**
  * Heart of the viewing process.
  *
  * The runner gets all the meta data for the contact and calls the appropriate type of page to view.
  */
 public function preProcess()
 {
     // process url params
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->assign('id', $this->_id);
     $qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
     //validate the qfKey
     if (!CRM_Utils_Rule::qfKey($qfKey)) {
         $qfKey = NULL;
     }
     $this->assign('searchKey', $qfKey);
     // retrieve the group contact id, so that we can get contact id
     $gcid = CRM_Utils_Request::retrieve('gcid', 'Positive', $this);
     if (!$gcid) {
         $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
     } else {
         $this->_contactId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_GroupContact', $gcid, 'contact_id');
     }
     if (!$this->_contactId) {
         CRM_Core_Error::statusBounce(ts('We could not find a contact id.'), CRM_Utils_System::url('civicrm/dashboard', 'reset=1'));
     }
     // ensure that the id does exist
     if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'id') != $this->_contactId) {
         CRM_Core_Error::statusBounce(ts('A Contact with that ID does not exist: %1', array(1 => $this->_contactId)), CRM_Utils_System::url('civicrm/dashboard', 'reset=1'));
     }
     $this->assign('contactId', $this->_contactId);
     // see if we can get prev/next positions from qfKey
     $navContacts = array('prevContactID' => NULL, 'prevContactName' => NULL, 'nextContactID' => NULL, 'nextContactName' => NULL, 'nextPrevError' => 0);
     if ($qfKey) {
         $pos = CRM_Core_BAO_PrevNextCache::getPositions("civicrm search {$qfKey}", $this->_contactId, $this->_contactId);
         $found = FALSE;
         if (isset($pos['prev'])) {
             $navContacts['prevContactID'] = $pos['prev']['id1'];
             $navContacts['prevContactName'] = $pos['prev']['data'];
             $found = TRUE;
         }
         if (isset($pos['next'])) {
             $navContacts['nextContactID'] = $pos['next']['id1'];
             $navContacts['nextContactName'] = $pos['next']['data'];
             $found = TRUE;
         }
         $context = CRM_Utils_Array::value('context', $_GET);
         if (!$found) {
             // seems like we did not find any contacts
             // maybe due to bug CRM-9096
             // however we should account for 1 contact results (which dont have prev next)
             if (!$pos['foundEntry']) {
                 $navContacts['nextPrevError'] = 1;
             }
         } elseif ($context) {
             $this->assign('context', $context);
             CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('Search Results'), 'url' => CRM_Utils_System::url("civicrm/contact/search/{$context}", array('qfKey' => $qfKey)))));
         }
     }
     $this->assign($navContacts);
     $path = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $this->_contactId);
     CRM_Utils_System::appendBreadCrumb(array(array('title' => ts('View Contact'), 'url' => $path)));
     if ($image_URL = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'image_URL')) {
         //CRM-7265 --time being fix.
         $config = CRM_Core_Config::singleton();
         $image_URL = str_replace('https://', 'http://', $image_URL);
         if (Civi::settings()->get('enableSSL')) {
             $image_URL = str_replace('http://', 'https://', $image_URL);
         }
         list($imageWidth, $imageHeight) = getimagesize(CRM_Utils_String::unstupifyUrl($image_URL));
         list($imageThumbWidth, $imageThumbHeight) = CRM_Contact_BAO_Contact::getThumbSize($imageWidth, $imageHeight);
         $this->assign("imageWidth", $imageWidth);
         $this->assign("imageHeight", $imageHeight);
         $this->assign("imageThumbWidth", $imageThumbWidth);
         $this->assign("imageThumbHeight", $imageThumbHeight);
         $this->assign("imageURL", $image_URL);
     }
     // also store in session for future use
     $session = CRM_Core_Session::singleton();
     $session->set('view.id', $this->_contactId);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
     $this->assign('action', $this->_action);
     // check logged in user permission
     self::checkUserPermission($this);
     list($displayName, $contactImage, $contactType, $contactSubtype, $contactImageUrl) = self::getContactDetails($this->_contactId);
     $this->assign('displayName', $displayName);
     $this->set('contactType', $contactType);
     // note: there could still be multiple subtypes. We just trimming the outer separator.
     $this->set('contactSubtype', trim($contactSubtype, CRM_Core_DAO::VALUE_SEPARATOR));
     // add to recently viewed block
     $isDeleted = (bool) CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'is_deleted');
     $recentOther = array('imageUrl' => $contactImageUrl, 'subtype' => $contactSubtype, 'isDeleted' => $isDeleted);
     if (CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
         $recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/add', "reset=1&action=update&cid={$this->_contactId}");
     }
     if ($session->get('userID') != $this->_contactId && CRM_Core_Permission::check('delete contacts') && !$isDeleted) {
         $recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/delete', "reset=1&delete=1&cid={$this->_contactId}");
     }
     CRM_Utils_Recent::add($displayName, CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_contactId}"), $this->_contactId, $contactType, $this->_contactId, $displayName, $recentOther);
     $this->assign('isDeleted', $isDeleted);
     // set page title
     $title = self::setTitle($this->_contactId, $isDeleted);
     $this->assign('title', $title);
     // Check if this is default domain contact CRM-10482
     if (CRM_Contact_BAO_Contact::checkDomainContact($this->_contactId)) {
         $this->assign('domainContact', TRUE);
     } else {
         $this->assign('domainContact', FALSE);
     }
     // Add links for actions menu
     self::addUrls($this, $this->_contactId);
     if ($contactType == 'Organization' && CRM_Core_Permission::check('administer Multiple Organizations') && Civi::settings()->get('is_enabled')) {
         //check is any relationship between the organization and groups
         $groupOrg = CRM_Contact_BAO_GroupOrganization::hasGroupAssociated($this->_contactId);
         if ($groupOrg) {
             $groupOrganizationUrl = CRM_Utils_System::url('civicrm/group', "reset=1&oid={$this->_contactId}");
             $this->assign('groupOrganizationUrl', $groupOrganizationUrl);
         }
     }
 }