/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false); $lid = CRM_Utils_Request::retrieve('lid', 'Positive', $this, false); $eid = CRM_Utils_Request::retrieve('eid', 'Positive', $this, false); $profileGID = CRM_Utils_Request::retrieve('profileGID', 'Integer', $this, false); $this->assign('profileGID', $profileGID); $seachType = CRM_Utils_Request::retrieve('searchType', 'String', $this, false); $type = 'Contact'; if ($cid) { $ids = array($cid); $this->_single = true; if ($seachType && !$profileGID) { $fragment = '/basic'; if ($seachType == 'advance') { $fragment = '/advanced'; } elseif ($seachType == 'custom') { $fragment = '/custom'; } $session =& CRM_Core_Session::singleton(); $url = CRM_Utils_System::url('civicrm/contact/search' . $fragment, 'force=1'); $session->replaceUserContext($url); } } else { if ($eid) { $ids = $eid; $type = 'Event'; } else { if ($profileGID) { require_once "CRM/Profile/Page/Listings.php"; $ids = CRM_Profile_Page_Listings::getProfileContact($profileGID); } else { parent::preProcess(); $ids = $this->_contactIds; } } } self::createMapXML($ids, $lid, $this, true, $type); $this->assign('single', $this->_single); }
/** * This function contains the actions for profile arguments * * @param $args array this array contains the arguments of the url * * @static * @access public */ static function profile($args) { if ($args[1] !== 'profile') { return; } $secondArg = CRM_Utils_Array::value(2, $args, ''); if ($secondArg == 'map') { $controller = new CRM_Core_Controller_Simple('CRM_Contact_Form_Task_Map', ts('Map Contact'), NULL, FALSE, FALSE, TRUE); $gids = explode(',', CRM_Utils_Request::retrieve('gid', 'String', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET')); if (count($gids) > 1) { foreach ($gids as $pfId) { $profileIds[] = CRM_Utils_Type::escape($pfId, 'Positive'); } $controller->set('gid', $profileIds[0]); $profileGID = $profileIds[0]; } else { $profileGID = CRM_Utils_Request::retrieve('gid', 'Integer', $controller, TRUE); } // make sure that this profile enables mapping // CRM-8609 $isMap = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileGID, 'is_map'); if (!$isMap) { CRM_Core_Error::statusBounce(ts('This profile does not have the map feature turned on.')); } $profileView = CRM_Utils_Request::retrieve('pv', 'Integer', $controller, FALSE); // set the userContext stack $session = CRM_Core_Session::singleton(); if ($profileView) { $session->pushUserContext(CRM_Utils_System::url('civicrm/profile/view')); } else { $session->pushUserContext(CRM_Utils_System::url('civicrm/profile', 'force=1')); } $controller->set('profileGID', $profileGID); $controller->process(); return $controller->run(); } if ($secondArg == 'edit' || $secondArg == 'create') { // set the userContext stack $session = CRM_Core_Session::singleton(); $session->pushUserContext(CRM_Utils_System::url('civicrm/profile', 'reset=1')); if ($secondArg == 'edit') { $controller = new CRM_Core_Controller_Simple('CRM_Profile_Form_Edit', ts('Create Profile'), CRM_Core_Action::UPDATE, FALSE, FALSE, TRUE); $controller->set('edit', 1); $controller->process(); return $controller->run(); } else { $wrapper = new CRM_Utils_Wrapper(); return $wrapper->run('CRM_Profile_Form_Edit', ts('Create Profile'), array('mode' => CRM_Core_Action::ADD, 'ignoreKey' => TRUE)); } } if ($secondArg == 'view' || empty($secondArg)) { $page = new CRM_Profile_Page_Listings(); return $page->run(); } CRM_Utils_System::permissionDenied(); return; }
/** * Build all the data structures needed to build the form. */ public function preProcess() { $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE); $lid = CRM_Utils_Request::retrieve('lid', 'Positive', $this, FALSE); $eid = CRM_Utils_Request::retrieve('eid', 'Positive', $this, FALSE); $profileGID = CRM_Utils_Request::retrieve('profileGID', 'Integer', $this, FALSE); $this->assign('profileGID', $profileGID); $context = CRM_Utils_Request::retrieve('context', 'String', $this); $type = 'Contact'; if ($cid) { $ids = array($cid); $this->_single = TRUE; if ($profileGID) { // this does a check and ensures that the user has permission on this profile // CRM-11766 $profileIDs = CRM_Profile_Page_Listings::getProfileContact($profileGID); if (!in_array($cid, $profileIDs)) { CRM_Core_Error::fatal(); } } elseif ($context) { $qfKey = CRM_Utils_Request::retrieve('key', 'String', $this); $urlParams = 'force=1'; if (CRM_Utils_Rule::qfKey($qfKey)) { $urlParams .= "&qfKey={$qfKey}"; } $session = CRM_Core_Session::singleton(); $urlString = "civicrm/contact/search/{$context}"; if ($context == 'search') { $urlString = 'civicrm/contact/search'; } $url = CRM_Utils_System::url($urlString, $urlParams); $session->replaceUserContext($url); } } elseif ($eid) { $ids = $eid; $type = 'Event'; } else { if ($profileGID) { $ids = CRM_Profile_Page_Listings::getProfileContact($profileGID); } else { parent::preProcess(); $ids = $this->_contactIds; } } self::createMapXML($ids, $lid, $this, TRUE, $type); $this->assign('single', $this->_single); }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false); $lid = CRM_Utils_Request::retrieve('lid', 'Positive', $this, false); $eid = CRM_Utils_Request::retrieve('eid', 'Positive', $this, false); $profileGID = CRM_Utils_Request::retrieve('profileGID', 'Integer', $this, false); $this->assign('profileGID', $profileGID); $context = CRM_Utils_Request::retrieve('context', 'String', $this); $type = 'Contact'; if ($cid) { $ids = array($cid); $this->_single = true; if ($context && !$profileGID) { $qfKey = CRM_Utils_Request::retrieve('key', 'String', $this); $urlParams = 'force=1'; if (CRM_Utils_Rule::qfKey($qfKey)) { $urlParams .= "&qfKey={$qfKey}"; } $session = CRM_Core_Session::singleton(); $urlString = "civicrm/contact/search/{$context}"; if ($context == 'search') { $urlString = 'civicrm/contact/search'; } $url = CRM_Utils_System::url($urlString, $urlParams); $session->replaceUserContext($url); } } else { if ($eid) { $ids = $eid; $type = 'Event'; } else { if ($profileGID) { require_once "CRM/Profile/Page/Listings.php"; $ids = CRM_Profile_Page_Listings::getProfileContact($profileGID); } else { parent::preProcess(); $ids = $this->_contactIds; } } } self::createMapXML($ids, $lid, $this, true, $type); $this->assign('single', $this->_single); }
function run() { CRM_Core_Resources::singleton()->addStyleFile('org.civicrm.hrprofile', 'css/hrprofile.css'); parent::run(); }
/** * This function contains the actions for profile arguments * * @param $args array this array contains the arguments of the url * * @static * @access public */ static function profile($args) { if ($args[1] !== 'profile') { return; } $secondArg = CRM_Utils_Array::value(2, $args, ''); if ($secondArg == 'map') { $controller = new CRM_Core_Controller_Simple('CRM_Contact_Form_Task_Map', ts('Map Contact'), NULL, FALSE, FALSE, TRUE); $gids = explode(',', CRM_Utils_Request::retrieve('gid', 'String', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET')); if (count($gids) > 1) { foreach ($gids as $pfId) { $profileIds[] = CRM_Utils_Type::escape($pfId, 'Positive'); } $controller->set('gid', $profileIds[0]); $profileGID = $profileIds[0]; } else { $profileGID = CRM_Utils_Request::retrieve('gid', 'Integer', $controller, TRUE); } // make sure that this profile enables mapping // CRM-8609 $isMap = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileGID, 'is_map'); if (!$isMap) { CRM_Core_Error::statusBounce(ts('This profile does not have the map feature turned on.')); } $profileView = CRM_Utils_Request::retrieve('pv', 'Integer', $controller, FALSE); // set the userContext stack $session = CRM_Core_Session::singleton(); if ($profileView) { $session->pushUserContext(CRM_Utils_System::url('civicrm/profile/view')); } else { $session->pushUserContext(CRM_Utils_System::url('civicrm/profile', 'force=1')); } $controller->set('profileGID', $profileGID); $controller->process(); return $controller->run(); } if ($secondArg == 'edit' || $secondArg == 'create') { // set the userContext stack $session = CRM_Core_Session::singleton(); $session->pushUserContext(CRM_Utils_System::url('civicrm/profile', 'reset=1')); $buttonType = CRM_Utils_Array::value('_qf_Edit_cancel', $_POST); // CRM-5849: we should actually check the button *type*, but we get the *value*, potentially translated; // we should keep both English and translated checks just to make sure we also handle untranslated Cancels if ($buttonType == 'Cancel' or $buttonType == ts('Cancel')) { $cancelURL = CRM_Utils_Request::retrieve('cancelURL', 'String', CRM_Core_DAO::$_nullObject, FALSE, NULL, $_POST); if ($cancelURL) { CRM_Utils_System::redirect($cancelURL); } } if ($secondArg == 'edit') { $controller = new CRM_Core_Controller_Simple('CRM_Profile_Form_Edit', ts('Create Profile'), CRM_Core_Action::UPDATE, FALSE, FALSE, TRUE); $controller->set('edit', 1); $controller->process(); return $controller->run(); } else { $wrapper = new CRM_Utils_Wrapper(); return $wrapper->run('CRM_Profile_Form_Edit', ts('Create Profile'), array('mode' => CRM_Core_Action::ADD, 'ignoreKey' => TRUE)); } } $page = new CRM_Profile_Page_Listings(); return $page->run(); }