本文整理汇总了PHP中CRM_Core_Error::fatal方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Error::fatal方法的具体用法?PHP CRM_Core_Error::fatal怎么用?PHP CRM_Core_Error::fatal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Error
的用法示例。
在下文中一共展示了CRM_Core_Error::fatal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
require_once 'CRM/Utils/Request.php';
$contact_id = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
$subscribe_id = CRM_Utils_Request::retrieve('sid', 'Integer', CRM_Core_DAO::$_nullObject);
$hash = CRM_Utils_Request::retrieve('h', 'String', CRM_Core_DAO::$_nullObject);
$activity_id = CRM_Utils_Request::retrieve('a', 'String', CRM_Core_DAO::$_nullObject);
$petition_id = CRM_Utils_Request::retrieve('p', 'String', CRM_Core_DAO::$_nullObject);
if (!$contact_id || !$subscribe_id || !$hash) {
CRM_Core_Error::fatal(ts("Missing input parameters"));
}
require_once 'CRM/Mailing/Event/BAO/Confirm.php';
$result = $this->confirm($contact_id, $subscribe_id, $hash, $activity_id, $petition_id);
if ($result === false) {
$this->assign('success', $result);
} else {
$this->assign('success', true);
// $this->assign( 'group' , $result );
}
require_once 'CRM/Contact/BAO/Contact/Location.php';
list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contact_id);
$this->assign('display_name', $displayName);
$this->assign('email', $email);
$this->assign('petition_id', $petition_id);
$this->assign('survey_id', $petition_id);
// send thank you email
require_once 'CRM/Campaign/Form/Petition/Signature.php';
$params['contactId'] = $contact_id;
$params['email-Primary'] = $email;
$params['sid'] = $petition_id;
$params['activityId'] = $activity_id;
CRM_Campaign_BAO_Petition::sendEmail($params, CRM_Campaign_Form_Petition_Signature::EMAIL_THANK);
parent::run();
}
示例2: preProcess
public function preProcess()
{
$this->_type = 'unsubscribe';
$this->_job_id = $job_id = CRM_Utils_Request::retrieve('jid', 'Integer', $this);
$this->_queue_id = $queue_id = CRM_Utils_Request::retrieve('qid', 'Integer', $this);
$this->_hash = $hash = CRM_Utils_Request::retrieve('h', 'String', $this);
if (!$job_id || !$queue_id || !$hash) {
CRM_Core_Error::fatal(ts("Missing Parameters"));
}
// verify that the three numbers above match
$q = CRM_Mailing_Event_BAO_Queue::verify($job_id, $queue_id, $hash);
if (!$q) {
CRM_Core_Error::fatal(ts("There was an error in your request"));
}
list($displayName, $email) = CRM_Mailing_Event_BAO_Queue::getContactInfo($queue_id);
$this->assign('display_name', $displayName);
$emailMasked = CRM_Utils_String::maskEmail($email);
$this->assign('email_masked', $emailMasked);
$this->assign('email', $email);
$this->_email = $email;
$groups = CRM_Mailing_Event_BAO_Unsubscribe::unsub_from_mailing($job_id, $queue_id, $hash, TRUE);
$this->assign('groups', $groups);
$groupExist = NULL;
foreach ($groups as $key => $value) {
if ($value) {
$groupExist = TRUE;
}
}
if (!$groupExist) {
$statusMsg = ts('Email: %1 has been successfully unsubscribed from this Mailing List/Group.', array(1 => $email));
CRM_Core_Session::setStatus($statusMsg, '', 'fail');
}
$this->assign('groupExist', $groupExist);
}
示例3: preProcess
/**
* For pre-processing
*
* @return void
*/
public function preProcess()
{
parent::preProcess();
$this->_key = CRM_Utils_Request::retrieve('key', 'String', $this, FALSE, 0);
$session = CRM_Core_Session::singleton();
$url = CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1&action=browse');
$session->pushUserContext($url);
$this->assign('id', $this->_id);
$this->assign('key', $this->_key);
switch ($this->_action) {
case CRM_Core_Action::ADD:
case CRM_Core_Action::DELETE:
case CRM_Core_Action::ENABLE:
case CRM_Core_Action::DISABLE:
$info = CRM_Extension_System::singleton()->getMapper()->keyToInfo($this->_key);
$extInfo = CRM_Admin_Page_Extensions::createExtendedInfo($info);
$this->assign('extension', $extInfo);
break;
case CRM_Core_Action::UPDATE:
if (!CRM_Extension_System::singleton()->getBrowser()->isEnabled()) {
CRM_Core_Error::fatal(ts('The system administrator has disabled this feature.'));
}
$info = CRM_Extension_System::singleton()->getBrowser()->getExtension($this->_key);
$extInfo = CRM_Admin_Page_Extensions::createExtendedInfo($info);
$this->assign('extension', $extInfo);
break;
default:
CRM_Core_Error::fatal(ts('Unsupported action'));
}
}
示例4: preProcess
/**
* Set variables up before form is built.
*
*
* @return void
*/
public function preProcess()
{
// current set id
$this->_id = $this->get('id');
if ($this->_id && ($isReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_id, 'is_reserved', 'id'))) {
CRM_Core_Error::fatal("You cannot edit the settings of a reserved custom field-set.");
}
// setting title for html page
if ($this->_action == CRM_Core_Action::UPDATE) {
$title = CRM_Core_BAO_CustomGroup::getTitle($this->_id);
CRM_Utils_System::setTitle(ts('Edit %1', array(1 => $title)));
} elseif ($this->_action == CRM_Core_Action::VIEW) {
$title = CRM_Core_BAO_CustomGroup::getTitle($this->_id);
CRM_Utils_System::setTitle(ts('Preview %1', array(1 => $title)));
} else {
CRM_Utils_System::setTitle(ts('New Custom Field Set'));
}
if (isset($this->_id)) {
$params = array('id' => $this->_id);
CRM_Core_BAO_CustomGroup::retrieve($params, $this->_defaults);
$subExtends = CRM_Utils_Array::value('extends_entity_column_value', $this->_defaults);
if (!empty($subExtends)) {
$this->_subtypes = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($subExtends, 1, -1));
}
}
}
示例5: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
$this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('action', $this->_action);
$this->assign('context', $this->_context);
//check permission for action.
if (!CRM_Core_Permission::checkActionPermission('CiviGrant', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
}
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$this->_noteId = null;
if ($this->_id) {
require_once 'CRM/Core/BAO/Note.php';
$noteDAO = new CRM_Core_BAO_Note();
$noteDAO->entity_table = 'civicrm_grant';
$noteDAO->entity_id = $this->_id;
if ($noteDAO->find(true)) {
$this->_noteId = $noteDAO->id;
}
}
//build custom data
CRM_Custom_Form_Customdata::preProcess($this, null, null, 1, 'Grant', $this->_id);
}
示例6: claimItem
/**
* Get the next item
*
* @param $lease_time seconds
*
* @return object with key 'data' that matches the inputted data
*/
function claimItem($lease_time = 3600)
{
$sql = "\n SELECT id, queue_name, submit_time, release_time, data\n FROM civicrm_queue_item\n WHERE queue_name = %1\n and (release_time is null OR release_time <= NOW())\n ORDER BY weight ASC, release_time ASC, id ASC\n LIMIT 1\n ";
$params = array(1 => array($this->getName(), 'String'));
$dao = CRM_Core_DAO::executeQuery($sql, $params, TRUE, 'CRM_Queue_DAO_QueueItem');
if (is_a($dao, 'DB_Error')) {
// FIXME - Adding code to allow tests to pass
CRM_Core_Error::fatal();
}
if ($dao->fetch()) {
$nowEpoch = CRM_Utils_Time::getTimeRaw();
if ($dao->release_time === NULL || strtotime($dao->release_time) < $nowEpoch) {
CRM_Core_DAO::executeQuery("UPDATE civicrm_queue_item SET release_time = %1 WHERE id = %2", array('1' => array(date('YmdHis', $nowEpoch + $lease_time), 'String'), '2' => array($dao->id, 'Integer')));
// work-around: inconsistent date-formatting causes unintentional breakage
# $dao->submit_time = date('YmdHis', strtotime($dao->submit_time));
# $dao->release_time = date('YmdHis', $nowEpoch + $lease_time);
# $dao->save();
$dao->data = unserialize($dao->data);
return $dao;
} else {
CRM_Core_Error::debug_var('not ready for release', $dao);
return FALSE;
}
} else {
CRM_Core_Error::debug_var('no items found');
return FALSE;
}
}
示例7: create
/**
* create or update a Volunteer Commendation
*
* This function is invoked from within the web form layer
*
* @param array $params An assoc array of name/value pairs
* - aid: activity id of an existing commendation to update
* - cid: id of contact to be commended
* - vid: id of project for which contact is to be commended
* - details: text about the contact's exceptional volunteerism
* @see self::requiredParamsArePresent for rules re required params
* @return array Result of api.activity.create
* @access public
* @static
*/
public static function create(array $params)
{
// check required params
if (!self::requiredParamsArePresent($params)) {
CRM_Core_Error::fatal('Not enough data to create commendation object.');
}
$activity_statuses = CRM_Activity_BAO_Activity::buildOptions('status_id', 'create');
$api_params = array('activity_type_id' => self::getActivityTypeId(), 'status_id' => CRM_Utils_Array::key('Completed', $activity_statuses));
$aid = CRM_Utils_Array::value('aid', $params);
if ($aid) {
$api_params['id'] = $aid;
}
$cid = CRM_Utils_Array::value('cid', $params);
if ($cid) {
$api_params['target_contact_id'] = $cid;
}
$vid = CRM_Utils_Array::value('vid', $params);
if ($vid) {
$project = CRM_Volunteer_BAO_Project::retrieveByID($vid);
$api_params['subject'] = ts('Volunteer Commendation for %1', array('1' => $project->title, 'domain' => 'org.civicrm.volunteer'));
$customFieldSpec = self::getCustomFields();
$volunteer_project_id_field_name = $customFieldSpec['volunteer_project_id']['custom_n'];
$api_params[$volunteer_project_id_field_name] = $vid;
}
if (array_key_exists('details', $params)) {
$api_params['details'] = CRM_Utils_Array::value('details', $params);
}
return civicrm_api3('Activity', 'create', $api_params);
}
示例8: preProcess
/**
* Function to set variables up before form is built
*
* @param null
*
* @return void
* @access public
*/
public function preProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
//check permission for action.
if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
}
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $this->_id, 'title');
$this->assign('title', $this->_title);
parent::preProcess();
}
if (!$this->_action) {
$action = CRM_Utils_Array::value('action', $_GET);
$id = CRM_Utils_Array::value('id', $_GET);
switch ($action) {
case 'delete':
require_once 'CRM/Contribute/BAO/PCP.php';
$title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $id, 'title');
CRM_Contribute_BAO_PCP::delete($id);
CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been deleted.", array(1 => $title)));
break;
case 'disable':
require_once 'CRM/Contribute/BAO/PCP.php';
CRM_Contribute_BAO_PCP::setDisable($id, '0');
break;
case 'enable':
require_once 'CRM/Contribute/BAO/PCP.php';
CRM_Contribute_BAO_PCP::setDisable($id, '1');
break;
}
$session =& CRM_Core_Session::singleton();
CRM_Utils_System::redirect($session->popUserContext());
}
}
示例9: preProcess
/**
* Function to pre-process
*
* @return None
* @access public
*/
public function preProcess()
{
parent::preProcess();
$session =& CRM_Core_Session::singleton();
if (!$this->_gName) {
$this->_gName = CRM_Utils_Request::retrieve('group', 'String', $this, false, 0);
$this->_gid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $this->_gName, 'id', 'name');
}
if ($this->_gName) {
$this->set('gName', $this->_gName);
} else {
$this->_gName = $this->get('gName');
}
$this->_GName = ucwords(str_replace('_', ' ', $this->_gName));
$url = "civicrm/admin/options/{$this->_gName}";
$params = "group={$this->_gName}&reset=1";
$session->pushUserContext(CRM_Utils_System::url($url, $params));
$this->assign('id', $this->_id);
require_once 'CRM/Core/OptionGroup.php';
if ($this->_id && in_array($this->_gName, CRM_Core_OptionGroup::$_domainIDGroups)) {
$domainID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $this->_id, 'domain_id', 'id');
if (CRM_Core_Config::domainID() != $domainID) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
}
}
}
示例10: checkProjectPerms
/**
* Checks whether the logged in user has permission to perform an action
* against a specified project.
*
* @param int $op
* See the constants in CRM_Core_Action.
* @param int $projectId
* Required for some but not all operations.
* @return boolean
* TRUE is the action is allowed; else FALSE.
*/
public static function checkProjectPerms($op, $projectId = NULL)
{
$opsRequiringProjectId = array(CRM_Core_Action::UPDATE, CRM_Core_Action::DELETE);
if (in_array($op, $opsRequiringProjectId) && empty($projectId)) {
CRM_Core_Error::fatal('Missing required parameter Project ID');
}
$contactId = CRM_Core_Session::getLoggedInContactID();
switch ($op) {
case CRM_Core_Action::ADD:
return self::check('create volunteer projects');
case CRM_Core_Action::UPDATE:
if (self::check('edit all volunteer projects')) {
return TRUE;
}
$projectOwners = CRM_Volunteer_BAO_Project::getContactsByRelationship($projectId, 'volunteer_owner');
if (self::check('edit own volunteer projects') && in_array($contactId, $projectOwners)) {
return TRUE;
}
break;
case CRM_Core_Action::DELETE:
if (self::check('delete all volunteer projects')) {
return TRUE;
}
$projectOwners = CRM_Volunteer_BAO_Project::getContactsByRelationship($projectId, 'volunteer_owner');
if (self::check('delete own volunteer projects') && in_array($contactId, $projectOwners)) {
return TRUE;
}
break;
case CRM_Core_Action::VIEW:
if (self::check('register to volunteer') || self::check('edit all volunteer projects')) {
return TRUE;
}
}
return FALSE;
}
示例11: __construct
/**
* Constructor
*
* @param string $mode the mode of operation: live or test
*
* @return void
*/
function __construct($mode, &$paymentProcessor)
{
if (empty($paymentProcessor)) {
CRM_Core_Error::fatal(ts('Could not find user name for payment processor'));
}
if ($paymentProcessor['name'] == 'Worldpay') {
return;
}
//select the key depending on the mode from the payment processor type into the DB
$sql = "select user_name,password,url_site from civicrm_payment_processor Where name = '" . $paymentProcessor['name'] . "'";
if ($mode == 'test') {
$sql .= " and is_test = 0";
} else {
$sql .= " and is_test = 1";
}
$dao = CRM_Core_DAO::executeQuery($sql);
if ($dao->fetch()) {
//variable declaration
$this->_service_key = $dao->user_name;
$this->_client_key = $dao->password;
$this->_endpoint = $dao->url_site;
}
$this->_timeout = 65;
$this->_disable_ssl = false;
$this->_use_external_JSON = false;
$this->_order_types = array('ECOM', 'MOTO', 'RECURRING');
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
$this->_processorName = ts('world pay payment processor');
}
示例12: run
public function run()
{
/**
* @var \Civi\Angular\Manager $angular
*/
//Use our manager instead of the one provided by core
$angular = new Civi\Angular\VolunteerManager(\CRM_Core_Resources::singleton());
$moduleNames = $this->parseModuleNames(\CRM_Utils_Request::retrieve('modules', 'String'), $angular);
switch (\CRM_Utils_Request::retrieve('format', 'String')) {
case 'json':
case '':
$this->send('application/javascript', json_encode($this->getMetadata($moduleNames, $angular)));
break;
case 'js':
$digest = $this->digestJs($angular->getResources($moduleNames, 'js', 'path'));
//Tell crmResource to use our ajax end-point
$digest = str_replace("ajax/angular-modules", "ajax/volunteer-angular-modules", $digest);
$this->send('application/javascript', $digest);
break;
case 'css':
$this->send('text/css', \CRM_Utils_File::concat($angular->getResources($moduleNames, 'css', 'path'), "\n"));
break;
default:
\CRM_Core_Error::fatal("Unrecognized format");
}
\CRM_Utils_System::civiExit();
}
示例13: preProcess
function preProcess()
{
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE);
$oid = CRM_Utils_Request::retrieve('oid', 'Positive', $this, FALSE);
if ($oid) {
$this->_id = CRM_Utils_Request::retrieve('oid', 'Positive', $this, FALSE);
} else {
$this->assign('hide_contact', TRUE);
$this->_id = $cid;
}
if (!CRM_Utils_Rule::positiveInteger($this->_id)) {
CRM_Core_Error::fatal('We need a valid discount ID for view');
}
$this->assign('id', $this->_id);
$defaults = array();
$params = array('id' => $this->_id);
require_once 'CRM/CiviDiscount/BAO/Item.php';
CRM_CiviDiscount_BAO_Item::retrieve($params, $defaults);
require_once 'CRM/CiviDiscount/BAO/Track.php';
if ($cid) {
$rows = CRM_CiviDiscount_BAO_Track::getUsageByContact($this->_id);
} else {
$rows = CRM_CiviDiscount_BAO_Track::getUsageByOrg($this->_id);
}
$this->assign('rows', $rows);
$this->assign('code_details', $defaults);
$this->ajaxResponse['tabCount'] = count($rows);
if (!empty($defaults['code'])) {
CRM_Utils_System::setTitle($defaults['code']);
}
}
示例14: preProcess
function preProcess()
{
// Make sure case types have been configured for the component
require_once 'CRM/Core/OptionGroup.php';
$caseType = CRM_Core_OptionGroup::values('case_type');
if (empty($caseType)) {
$this->assign('notConfigured', 1);
return;
}
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
// contact id is not mandatory for case form. If not found, don't call
// parent's pre-process and proceed further.
if ($this->_contactId) {
parent::preProcess();
} else {
// we would need action to proceed further.
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'add');
if ($this->_action & CRM_Core_Action::VIEW) {
CRM_Core_Error::fatal('Contact Id is required for view action.');
}
$this->assign('action', $this->_action);
}
$activityTypes = CRM_Case_PseudoConstant::activityType();
$this->assign('openCaseId', $activityTypes['Open Case']['id']);
$this->assign('changeCaseTypeId', $activityTypes['Change Case Type']['id']);
$this->assign('changeCaseStatusId', $activityTypes['Change Case Status']['id']);
$this->assign('changeCaseStartDateId', $activityTypes['Change Case Start Date']['id']);
}
示例15: __construct
/**
* @param $formValues
*
* @throws Exception
*/
public function __construct(&$formValues)
{
parent::__construct($formValues);
// unset search profile and other search params if set
unset($this->_formValues['uf_group_id']);
unset($this->_formValues['component_mode']);
unset($this->_formValues['operator']);
if (!empty($this->_formValues)) {
// add the country and state
if (!empty($this->_formValues['country_id'])) {
$this->_formValues['country'] = CRM_Core_PseudoConstant::country($this->_formValues['country_id']);
}
if (!empty($this->_formValues['state_province_id'])) {
$this->_formValues['state_province'] = CRM_Core_PseudoConstant::stateProvince($this->_formValues['state_province_id']);
}
// use the address to get the latitude and longitude
CRM_Utils_Geocode_Google::format($this->_formValues);
if (!is_numeric(CRM_Utils_Array::value('geo_code_1', $this->_formValues)) || !is_numeric(CRM_Utils_Array::value('geo_code_2', $this->_formValues)) || !isset($this->_formValues['distance'])) {
CRM_Core_Error::fatal(ts('Could not geocode input'));
}
$this->_latitude = $this->_formValues['geo_code_1'];
$this->_longitude = $this->_formValues['geo_code_2'];
if ($this->_formValues['prox_distance_unit'] == "miles") {
$conversionFactor = 1609.344;
} else {
$conversionFactor = 1000;
}
$this->_distance = $this->_formValues['distance'] * $conversionFactor;
}
$this->_group = CRM_Utils_Array::value('group', $this->_formValues);
$this->_tag = CRM_Utils_Array::value('tag', $this->_formValues);
$this->_columns = array(ts('Name') => 'sort_name', ts('Street Address') => 'street_address', ts('City') => 'city', ts('Postal Code') => 'postal_code', ts('State') => 'state_province', ts('Country') => 'country');
}