本文整理汇总了PHP中CRM_Core_Error类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Error类的具体用法?PHP CRM_Core_Error怎么用?PHP CRM_Core_Error使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Core_Error类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: isConditionValid
public function isConditionValid(CRM_Civirules_EventData_EventData $eventData)
{
$contactId = $eventData->getContactId();
$entityData = $eventData->getEntityData('ContributionSoft');
$contacts = array();
$query = $this->conditionParams['smart_group_query'];
if (!empty($query)) {
$subQueries = explode(';', $query);
// To run only first and select statement in query string
if (!empty($subQueries) && !preg_match('/^(insert|update|delete|create|drop|replace)/i', $subQueries[0])) {
CRM_Core_Error::debug_var('CiviRules::Custom Query Contact Condition Query', $subQueries[0]);
CRM_Core_Error::debug_var('CiviRules::Custom Query Contact Condition Param Contribution', $entityData['contribution_id']);
$dao = CRM_Core_DAO::executeQuery('SELECT ' . $subQueries[0], array(1 => array($entityData['contribution_id'], 'Int')));
while ($dao->fetch()) {
$contacts[] = $dao->contact_id;
}
}
}
CRM_Core_Error::debug_var('CiviRules::Custom Query Contact Condition Contacts', $contacts);
if (!empty($contacts)) {
$eventData->setConditionOutputData('ContributionSoft', $contacts);
return TRUE;
} else {
return FALSE;
}
}
开发者ID:Kajakaran,项目名称:org.civicoop.civirules,代码行数:26,代码来源:CustomQueryContact.php
示例2: preProcess
/**
* This function is called prior to building and submitting the form
*/
function preProcess()
{
// check contact_id
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
if (empty($this->_contactId)) {
CRM_Core_Error::statusBounce(ts('Could not get a contact id.'), NULL, ts('Lidmaatschap Wijziging - Contact'));
// this also redirects to the default civicrm page
}
// check for permissions
$session = CRM_Core_Session::singleton();
if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to edit this contact.'), NULL, ts('Lidmaatschap Wijziging - Contact'));
// this also redirects to the default civicrm page
}
// get request
$this->_request = CRM_Utils_Request::retrieve('request', 'String', $this, FALSE, 'choose');
// get session
$session = CRM_Core_Session::singleton();
// get values
$this->_configRelationship = CRM_Lidmaatschapwijziging_ConfigRelationship::singleton($this->_contactId);
$this->_values = $this->_configRelationship->getContact();
// set contact id
$this->_values['contact_id'] = $this->_contactId;
// set display name
$this->_display_name = $this->_values['display_name'];
// set request
$this->_values['request'] = $this->_request;
// set title
CRM_Utils_System::setTitle('LidmaatschapWijziging - Relatie - ' . $this->_values['display_name']);
// request
if ('empty' == $this->_request) {
}
if ('choose' == $this->_request) {
// if there is no relatiosnhips then the options are empty, we
// show a message that there are no memebrships and a submit butten to
// go to the relationship, first we redirect them to request empty
$relationships = $this->_configRelationship->getRelationships();
if (empty($relationships)) {
// redirect user
$url = CRM_Utils_System::url('civicrm/lidmaatschapwijziging/relationship', 'reset=1&request=empty&cid=' . $this->_contactId);
CRM_Utils_System::redirect($url);
}
}
if ('update' == $this->_request) {
// get relationship id
$this->_relationshipId = CRM_Utils_Request::retrieve('relationship_id', 'Positive', $this);
$this->_values['relationship_id'] = $this->_relationshipId;
// get relationship
$this->_values = array_merge($this->_values, $this->_configRelationship->getRelationship($this->_relationshipId));
if (!empty($this->_values['contact_a']['display_name'])) {
$this->assign('sort_name_a', $this->_values['contact_a']['display_name']);
}
if (!empty($this->_values['contact_b']['display_name'])) {
$this->assign('sort_name_b', $this->_values['contact_b']['display_name']);
}
// note
$this->_values['note_id'] = $this->_values['notes']['id'];
$this->_values['note'] = $this->_values['notes']['note'];
}
}
开发者ID:jvos,项目名称:nl.vnv.lidmaatschapwijziging_old,代码行数:63,代码来源:LidmaatschapwijzigingRelationship.php
示例3: smarty_function_crmAPI
/**
*/
function smarty_function_crmAPI($params, &$smarty)
{
if (!array_key_exists('action', $params)) {
$params['action'] = "get";
}
if (!array_key_exists('sequential', $params)) {
$params['sequential'] = 1;
}
if (!array_key_exists('entity', $params)) {
$smarty->trigger_error("assign: missing 'entity' parameter");
return "crmAPI: missing 'entity' parameter";
}
CRM_Core_Error::setCallback(array('CRM_Utils_REST', 'fatal'));
$action = $params['action'];
$entity = $params['entity'];
unset($params['entity']);
unset($params['method']);
unset($params['assign']);
$params['version'] = 3;
require_once 'api/api.php';
$result = civicrm_api($entity, $action, $params);
CRM_Core_Error::setCallback();
if ($result === FALSE) {
$smarty->trigger_error("Unkown error");
return;
}
if (!array_key_exists('var', $params)) {
return json_encode($result);
}
if (!empty($params['json'])) {
$smarty->assign($params["var"], json_encode($result));
} else {
$smarty->assign($params["var"], $result);
}
}
开发者ID:hguru,项目名称:224Civi,代码行数:37,代码来源:function.crmAPI.php
示例4: checkLogFileIsNotAccessible
/**
* Check if our logfile is directly accessible.
*
* Per CiviCRM default the logfile sits in a folder which is
* web-accessible, and is protected by a default .htaccess
* configuration. If server config causes the .htaccess not to
* function as intended, there may be information disclosure.
*
* The debug log may be jam-packed with sensitive data, we don't
* want that.
*
* Being able to be retrieved directly doesn't mean the logfile
* is browseable or visible to search engines; it means it can be
* requested directly.
*
* @return array
* Array of messages
* @see CRM-14091
*/
public function checkLogFileIsNotAccessible()
{
$messages = array();
$config = CRM_Core_Config::singleton();
$log = CRM_Core_Error::createDebugLogger();
$log_filename = str_replace('\\', '/', $log->_filename);
$filePathMarker = $this->getFilePathMarker();
// Hazard a guess at the URL of the logfile, based on common
// CiviCRM layouts.
if ($upload_url = explode($filePathMarker, $config->imageUploadURL)) {
$url[] = $upload_url[0];
if ($log_path = explode($filePathMarker, $log_filename)) {
// CRM-17149: check if debug log path includes $filePathMarker
if (count($log_path) > 1) {
$url[] = $log_path[1];
$log_url = implode($filePathMarker, $url);
$headers = @get_headers($log_url);
if (stripos($headers[0], '200')) {
$docs_url = $this->createDocUrl('checkLogFileIsNotAccessible');
$msg = 'The <a href="%1">CiviCRM debug log</a> should not be downloadable.' . '<br />' . '<a href="%2">Read more about this warning</a>';
$messages[] = new CRM_Utils_Check_Message(__FUNCTION__, ts($msg, array(1 => $log_url, 2 => $docs_url)), ts('Security Warning'), \Psr\Log\LogLevel::WARNING, 'fa-lock');
}
}
}
}
return $messages;
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:46,代码来源:Security.php
示例5: 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'));
}
}
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:35,代码来源:Extensions.php
示例6: __construct
function __construct()
{
$this->initialize();
CRM_Utils_System::authenticateScript(TRUE);
//log the execution of script
CRM_Core_Error::debug_log_message('CiviReportMail.php');
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:7,代码来源:CiviReportMail.php
示例7: 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);
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:34,代码来源:Unsubscribe.php
示例8: preProcess
static function preProcess(&$form)
{
if (!$form->get('page_id')) {
CRM_Core_Error::fatal(ts("Can't determine pcp id."));
}
$form->assign('component_page_id', $form->get('component_page_id'));
}
开发者ID:eruraindil,项目名称:uk.co.vedaconsulting.pcpteams,代码行数:7,代码来源:TeamJoin.php
示例9: run
/**
* Perform an upgrade without using the web-frontend
*
* @param bool $enablePrint
*
* @throws Exception
* @return array, with keys:
* - message: string, HTML-ish blob
*/
public function run($enablePrint = TRUE)
{
// lets get around the time limit issue if possible for upgrades
if (!ini_get('safe_mode')) {
set_time_limit(0);
}
$upgrade = new CRM_Upgrade_Form();
list($currentVer, $latestVer) = $upgrade->getUpgradeVersions();
if ($error = $upgrade->checkUpgradeableVersion($currentVer, $latestVer)) {
throw new Exception($error);
}
// Disable our SQL triggers
CRM_Core_DAO::dropTriggers();
// CRM-11156
$preUpgradeMessage = NULL;
$upgrade->setPreUpgradeMessage($preUpgradeMessage, $currentVer, $latestVer);
$postUpgradeMessageFile = CRM_Utils_File::tempnam('civicrm-post-upgrade');
$queueRunner = new CRM_Queue_Runner(array('title' => ts('CiviCRM Upgrade Tasks'), 'queue' => CRM_Upgrade_Form::buildQueue($currentVer, $latestVer, $postUpgradeMessageFile)));
$queueResult = $queueRunner->runAll();
if ($queueResult !== TRUE) {
$errorMessage = CRM_Core_Error::formatTextException($queueResult['exception']);
CRM_Core_Error::debug_log_message($errorMessage);
if ($enablePrint) {
print $errorMessage;
}
throw $queueResult['exception'];
// FIXME test
}
CRM_Upgrade_Form::doFinish();
$message = file_get_contents($postUpgradeMessageFile);
return array('latestVer' => $latestVer, 'message' => $message, 'text' => CRM_Utils_String::htmlToText($message));
}
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:41,代码来源:Headless.php
示例10: __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');
}
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:38,代码来源:Proximity.php
示例11: fetch
/**
* Download the remote zipfile.
*
* @param string $remoteFile URL of a .zip file
* @param string $localFile path at which to store the .zip file
* @return STATUS_OK|STATUS_WRITE_ERROR|STATUS_DL_ERROR
*/
public function fetch($remoteFile, $localFile)
{
// Download extension zip file ...
if (!function_exists('curl_init')) {
CRM_Core_Error::fatal('Cannot install this extension - curl is not installed!');
}
list($ch, $caConfig) = $this->createCurl($remoteFile);
if (preg_match('/^https:/', $remoteFile) && !$caConfig->isEnableSSL()) {
CRM_Core_Error::fatal('Cannot install this extension - does not support SSL');
}
$fp = @fopen($localFile, "w");
if (!$fp) {
CRM_Core_Session::setStatus(ts('Unable to write to %1.<br />Is the location writable?', array(1 => $localFile)), ts('Write Error'), 'error');
return self::STATUS_WRITE_ERROR;
}
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
if (curl_errno($ch)) {
CRM_Core_Session::setStatus(ts('Unable to download extension from %1. Error Message: %2', array(1 => $remoteFile, 2 => curl_error($ch))), ts('Download Error'), 'error');
return self::STATUS_DL_ERROR;
} else {
curl_close($ch);
}
fclose($fp);
return self::STATUS_OK;
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:33,代码来源:HttpClient.php
示例12: __construct
/**
* @param object $controller
* @param const|int $action
*/
public function __construct($controller, $action = CRM_Core_Action::NONE)
{
parent::__construct($controller, $action);
$cart = CRM_Event_Cart_BAO_Cart::find_or_create_for_current_session();
$cart->load_associations();
if ($cart->is_empty()) {
CRM_Core_Error::statusBounce(ts("You don't have any events in you cart. Please add some events."), CRM_Utils_System::url('civicrm/event'));
}
$pages = array();
$is_monetary = FALSE;
$is_conference = FALSE;
foreach ($cart->events_in_carts as $event_in_cart) {
if ($event_in_cart->event->is_monetary) {
$is_monetary = TRUE;
}
}
$pages["CRM_Event_Cart_Form_Checkout_ParticipantsAndPrices"] = NULL;
foreach ($cart->events_in_carts as $event_in_cart) {
if ($event_in_cart->is_parent_event()) {
foreach ($event_in_cart->participants as $participant) {
$pages["CRM_Event_Cart_Form_Checkout_ConferenceEvents_{$event_in_cart->event_id}_{$participant->id}"] = array('className' => 'CRM_Event_Cart_Form_Checkout_ConferenceEvents', 'title' => "Select {$event_in_cart->event->title} Events For {$participant->email}");
}
}
}
$pages["CRM_Event_Cart_Form_Checkout_Payment"] = NULL;
$pages["CRM_Event_Cart_Form_Checkout_ThankYou"] = NULL;
$this->addSequentialPages($pages, $action);
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:32,代码来源:Checkout.php
示例13: preProcess
/**
* Build all the data structures needed to build the form.
*/
public function preProcess()
{
// reset action from the session
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'update');
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$rcid = CRM_Utils_Request::retrieve('rcid', 'Positive', $this);
$rcid = $rcid ? "&id={$rcid}" : '';
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/user', "reset=1{$rcid}"));
if ($this->_contactId) {
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $this->_contactId;
if (!$contact->find(TRUE)) {
CRM_Core_Error::statusBounce(ts('contact does not exist: %1', array(1 => $this->_contactId)));
}
$this->_contactType = $contact->contact_type;
// check for permissions
if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to edit this contact.'));
}
list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_contactId);
CRM_Utils_System::setTitle($displayName, $contactImage . ' ' . $displayName);
} else {
CRM_Core_Error::statusBounce(ts('Could not get a contact_id and/or contact_type'));
}
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:29,代码来源:RelatedContact.php
示例14: preProcess
/**
* TODO: How many checks do we need to do? Should we check to make sure the
* activity is the right type? That the cid and aid are associated? Seems like
* if you are messing with URL params you are kind of asking for trouble...
*/
function preProcess()
{
$this->_aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this, FALSE);
$this->_cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE);
$this->_vid = CRM_Utils_Request::retrieve('vid', 'Positive', $this, FALSE);
if (!CRM_Volunteer_Permission::checkProjectPerms(CRM_Core_Action::UPDATE, $this->_vid)) {
CRM_Utils_System::permissionDenied();
}
if (!$this->_aid && !($this->_cid && $this->_vid)) {
CRM_Core_Error::fatal("Form expects an activity ID or both a contact and a volunteer project ID.");
}
$check = array('Activity' => $this->_aid, 'Contact' => $this->_cid, 'VolunteerProject' => $this->_vid);
$errors = array();
foreach ($check as $entityType => $entityID) {
if (!$this->entityExists($entityType, $entityID)) {
$errors[] = "No {$entityType} with ID {$entityID} exists.";
}
}
if (count($errors)) {
CRM_Core_Error::fatal("Invalid parameter(s) passed to commendation form: " . implode(' ', $errors));
}
$contact_display_name = civicrm_api3('Contact', 'getvalue', array('id' => $this->_cid, 'return' => 'display_name'));
CRM_Utils_System::setTitle(ts('Commend %1', array(1 => $contact_display_name, 'domain' => 'org.civicrm.volunteer')));
parent::preProcess();
}
开发者ID:TobiasLounsbury,项目名称:org.civicrm.volunteer,代码行数:30,代码来源:Commendation.php
示例15: __construct
function __construct(&$formValues)
{
parent::__construct($formValues);
$this->_earthFlattening = 1.0 / 298.257223563;
$this->_earthRadiusSemiMajor = 6378137.0;
$this->_earthRadiusSemiMinor = $this->_earthRadiusSemiMajor * (1.0 - $this->_earthFlattening);
$this->_earthEccentricitySQ = 2 * $this->_earthFlattening - pow($this->_earthFlattening, 2);
// unset search profile if set
unset($this->_formValues['uf_group_id']);
if (!empty($this->_formValues)) {
// add the country and state
if (CRM_Utils_Array::value('country_id', $this->_formValues)) {
$this->_formValues['country'] = CRM_Core_PseudoConstant::country($this->_formValues['country_id']);
}
if (CRM_Utils_Array::value('state_province_id', $this->_formValues)) {
$this->_formValues['state_province'] = CRM_Core_PseudoConstant::stateProvince($this->_formValues['state_province_id']);
}
// use the address to get the latitude and longitude
require_once 'CRM/Utils/Geocode/Google.php';
CRM_Utils_Geocode_Google::format($this->_formValues);
if (!isset($this->_formValues['geo_code_1']) || !isset($this->_formValues['geo_code_2']) || !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'];
$this->_distance = $this->_formValues['distance'] * 1000;
}
$this->_earthDistanceSQL = $this->earthDistanceSQL($this->_latitude, $this->_longitude);
$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');
}
开发者ID:bhirsch,项目名称:voipdev,代码行数:31,代码来源:Proximity.php
示例16: 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);
}
开发者ID:adam-edison,项目名称:org.civicrm.volunteer,代码行数:44,代码来源:Commendation.php
示例17: 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);
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:33,代码来源:Grant.php
示例18: postProcess
/**
* Process the form submission.
*
* @return void
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$errors = CRM_Financial_BAO_FinancialType::del($this->_id);
if (!empty($errors)) {
CRM_Core_Error::statusBounce($errors['error_message'], CRM_Utils_System::url('civicrm/admin/financial/financialType', "reset=1&action=browse"), ts('Cannot Delete'));
}
CRM_Core_Session::setStatus(ts('Selected financial type has been deleted.'), ts('Record Deleted'), 'success');
} else {
$params = $ids = array();
// store the submitted values in an array
$params = $this->exportValues();
if ($this->_action & CRM_Core_Action::UPDATE) {
$ids['financialType'] = $this->_id;
}
$financialType = CRM_Financial_BAO_FinancialType::add($params, $ids);
if ($this->_action & CRM_Core_Action::UPDATE) {
$url = CRM_Utils_System::url('civicrm/admin/financial/financialType', 'reset=1&action=browse');
CRM_Core_Session::setStatus(ts('The financial type "%1" has been updated.', array(1 => $financialType->name)), ts('Saved'), 'success');
} else {
$url = CRM_Utils_System::url('civicrm/admin/financial/financialType/accounts', 'reset=1&action=browse&aid=' . $financialType->id);
$statusArray = array(1 => $financialType->name, 2 => $financialType->name, 3 => CRM_Utils_Array::value(0, $financialType->titles), 4 => CRM_Utils_Array::value(1, $financialType->titles), 5 => CRM_Utils_Array::value(2, $financialType->titles));
if (empty($financialType->titles)) {
$text = ts('Your Financial "%1" Type has been created and assigned to an existing financial account with the same title. You should review the assigned account and determine whether additional account relationships are needed.', $statusArray);
} else {
$text = ts('Your Financial "%1" Type has been created, along with a corresponding income account "%2". That income account, along with standard financial accounts "%3", "%4" and "%5" have been linked to the financial type. You may edit or replace those relationships here.', $statusArray);
}
CRM_Core_Session::setStatus($text, ts('Saved'), 'success', array('expires' => 0));
}
$session = CRM_Core_Session::singleton();
$session->replaceUserContext($url);
}
}
开发者ID:nganivet,项目名称:civicrm-core,代码行数:38,代码来源:FinancialType.php
示例19: preProcess
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();
}
}
开发者ID:hguru,项目名称:224Civi,代码行数:32,代码来源:Custom.php
示例20: preProcess
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 );');
}
开发者ID:bhirsch,项目名称:voipdev,代码行数:25,代码来源:Custom.php
注:本文中的CRM_Core_Error类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论