本文整理汇总了PHP中CRM_Activity_BAO_Activity::getFileForActivityTypeId方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Activity_BAO_Activity::getFileForActivityTypeId方法的具体用法?PHP CRM_Activity_BAO_Activity::getFileForActivityTypeId怎么用?PHP CRM_Activity_BAO_Activity::getFileForActivityTypeId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Activity_BAO_Activity
的用法示例。
在下文中一共展示了CRM_Activity_BAO_Activity::getFileForActivityTypeId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
//.........这里部分代码省略.........
$this->assign('single', $this->_single);
$this->assign('action', $this->_action);
if ($this->_action & CRM_Core_Action::VIEW) {
// Get the tree of custom fields.
$this->_groupTree =& CRM_Core_BAO_CustomGroup::getTree('Activity', $this, $this->_activityId, 0, $this->_activityTypeId);
}
if ($this->_activityTypeId) {
// Set activity type name and description to template.
list($this->_activityTypeName, $activityTypeDescription) = CRM_Core_BAO_OptionValue::getActivityTypeDetails($this->_activityTypeId);
$this->assign('activityTypeName', $this->_activityTypeName);
$this->assign('activityTypeDescription', $activityTypeDescription);
}
// set user context
$urlParams = $urlString = NULL;
$qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
if (!$qfKey) {
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
}
// Validate the qfKey.
if (!CRM_Utils_Rule::qfKey($qfKey)) {
$qfKey = NULL;
}
if ($this->_context == 'fulltext') {
$keyName = '&qfKey';
$urlParams = 'force=1';
$urlString = 'civicrm/contact/search/custom';
if ($this->_action == CRM_Core_Action::UPDATE) {
$keyName = '&key';
$urlParams .= '&context=fulltext&action=view';
$urlString = 'civicrm/contact/view/activity';
}
if ($qfKey) {
$urlParams .= "{$keyName}={$qfKey}";
}
$this->assign('searchKey', $qfKey);
} elseif (in_array($this->_context, array('standalone', 'home', 'dashlet', 'dashletFullscreen'))) {
$urlParams = 'reset=1';
$urlString = 'civicrm/dashboard';
} elseif ($this->_context == 'search') {
$urlParams = 'force=1';
if ($qfKey) {
$urlParams .= "&qfKey={$qfKey}";
}
$path = CRM_Utils_System::currentPath();
if ($this->_compContext == 'advanced') {
$urlString = 'civicrm/contact/search/advanced';
} elseif ($path == 'civicrm/group/search' || $path == 'civicrm/contact/search' || $path == 'civicrm/contact/search/advanced' || $path == 'civicrm/contact/search/custom' || $path == 'civicrm/group/search') {
$urlString = $path;
} else {
$urlString = 'civicrm/activity/search';
}
$this->assign('searchKey', $qfKey);
} elseif ($this->_context != 'caseActivity') {
$urlParams = "action=browse&reset=1&cid={$this->_currentlyViewedContactId}&selectedChild=activity";
$urlString = 'civicrm/contact/view';
}
if ($urlString) {
$session->pushUserContext(CRM_Utils_System::url($urlString, $urlParams));
}
// hack to retrieve activity type id from post variables
if (!$this->_activityTypeId) {
$this->_activityTypeId = CRM_Utils_Array::value('activity_type_id', $_POST);
}
// when custom data is included in this page
if (!empty($_POST['hidden_custom'])) {
// We need to set it in the session for the code below to work.
// CRM-3014
// Need to assign custom data subtype to the template.
$this->set('type', 'Activity');
$this->set('subType', $this->_activityTypeId);
$this->set('entityId', $this->_activityId);
CRM_Custom_Form_CustomData::preProcess($this, NULL, $this->_activityTypeId, 1, 'Activity', $this->_activityId);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
// add attachments part
CRM_Core_BAO_File::buildAttachment($this, 'civicrm_activity', $this->_activityId, NULL, TRUE);
// figure out the file name for activity type, if any
if ($this->_activityTypeId && ($this->_activityTypeFile = CRM_Activity_BAO_Activity::getFileForActivityTypeId($this->_activityTypeId, $this->_crmDir))) {
$this->assign('activityTypeFile', $this->_activityTypeFile);
$this->assign('crmDir', $this->_crmDir);
}
$this->setFields();
if ($this->_activityTypeFile) {
$className = "CRM_{$this->_crmDir}_Form_Activity_{$this->_activityTypeFile}";
$className::preProcess($this);
}
$this->_values = $this->get('values');
if (!is_array($this->_values)) {
$this->_values = array();
if (isset($this->_activityId) && $this->_activityId) {
$params = array('id' => $this->_activityId);
CRM_Activity_BAO_Activity::retrieve($params, $this->_values);
}
$this->set('values', $this->_values);
}
if ($this->_action & CRM_Core_Action::UPDATE) {
CRM_Core_Form_RecurringEntity::preProcess('civicrm_activity');
}
}
示例2: preProcess
/**
* Function to build the form
*
* @return None
* @access public
*/
function preProcess()
{
$this->_cdType = CRM_Utils_Array::value('type', $_GET);
$this->assign('cdType', FALSE);
if ($this->_cdType) {
$this->assign('cdType', TRUE);
return CRM_Custom_Form_CustomData::preProcess($this);
}
$this->_caseId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_currentlyViewedContactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
if ($this->_action & CRM_Core_Action::ADD && !$this->_currentlyViewedContactId) {
// check for add contacts permissions
if (!CRM_Core_Permission::check('add contacts')) {
CRM_Utils_System::permissionDenied();
return;
}
}
//CRM-4418
if (!CRM_Core_Permission::checkActionPermission('CiviCase', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
}
if ($this->_action & CRM_Core_Action::DELETE || $this->_action & CRM_Core_Action::RENEW) {
return TRUE;
}
if (!$this->_caseId) {
$caseAttributes = array('case_type' => CRM_Case_PseudoConstant::caseType(), 'case_status' => CRM_Case_PseudoConstant::caseStatus(), 'encounter_medium' => CRM_Case_PseudoConstant::encounterMedium());
foreach ($caseAttributes as $key => $values) {
if (empty($values)) {
CRM_Core_Error::fatal(ts('You do not have any active %1', array(1 => str_replace('_', ' ', $key))));
break;
}
}
}
if ($this->_action & CRM_Core_Action::ADD) {
$this->_activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', 'Open Case', 'name');
if (!$this->_activityTypeId) {
CRM_Core_Error::fatal(ts('The Open Case activity type is missing or disabled. Please have your site administrator check Administer > Option Lists > Activity Types for the CiviCase component.'));
}
}
//check for case permissions.
if (!CRM_Case_BAO_Case::accessCiviCase()) {
CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
}
if ($this->_action & CRM_Core_Action::ADD && (!CRM_Core_Permission::check('access all cases and activities') && !CRM_Core_Permission::check('add cases'))) {
CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
}
if ($this->_activityTypeFile = CRM_Activity_BAO_Activity::getFileForActivityTypeId($this->_activityTypeId, 'Case')) {
$this->assign('activityTypeFile', $this->_activityTypeFile);
}
$details = CRM_Case_PseudoConstant::caseActivityType(FALSE);
CRM_Utils_System::setTitle($details[$this->_activityTypeId]['label']);
$this->assign('activityType', $details[$this->_activityTypeId]['label']);
$this->assign('activityTypeDescription', $details[$this->_activityTypeId]['description']);
if (isset($this->_currentlyViewedContactId)) {
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $this->_currentlyViewedContactId;
if (!$contact->find(TRUE)) {
CRM_Core_Error::statusBounce(ts('Client contact does not exist: %1', array(1 => $this->_currentlyViewedContactId)));
}
$this->assign('clientName', $contact->display_name);
}
$session = CRM_Core_Session::singleton();
$this->_currentUserId = $session->get('userID');
//when custom data is included in this page
CRM_Custom_Form_CustomData::preProcess($this, NULL, $this->_activityTypeId, 1, 'Activity');
eval("CRM_Case_Form_Activity_{$this->_activityTypeFile}::preProcess( \$this );");
$activityGroupTree = $this->_groupTree;
// for case custom fields to populate with defaults
if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
}
// so that grouptree is not populated with case fields, since the grouptree is used
// for populating activity custom fields.
$this->_groupTree = $activityGroupTree;
}
示例3: preProcess
//.........这里部分代码省略.........
$this->_action = CRM_Core_Action::PROFILE;
break;
case 'custom':
$this->_action = CRM_Core_Action::COPY;
$searchType = $seachPath;
break;
}
parent::preProcess();
$this->_single = false;
$this->assign('urlPath', "civicrm/contact/search/{$searchType}");
$this->assign('urlPathVar', "_qf_Activity_display=true&qfKey={$this->controller->_key}");
}
$this->assign('single', $this->_single);
$this->assign('action', $this->_action);
if ($this->_action & CRM_Core_Action::VIEW) {
// get the tree of custom fields
$this->_groupTree =& CRM_Core_BAO_CustomGroup::getTree('Activity', $this, $this->_activityId, 0, $this->_activityTypeId);
}
if ($this->_activityTypeId) {
//set activity type name and description to template
require_once 'CRM/Core/BAO/OptionValue.php';
list($this->_activityTypeName, $activityTypeDescription) = CRM_Core_BAO_OptionValue::getActivityTypeDetails($this->_activityTypeId);
$this->assign('activityTypeName', $this->_activityTypeName);
$this->assign('activityTypeDescription', $activityTypeDescription);
}
// set user context
$urlParams = $urlString = null;
$qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
//validate the qfKey
require_once 'CRM/Utils/Rule.php';
if (!CRM_Utils_Rule::qfKey($qfKey)) {
$qfKey = null;
}
if ($this->_context == 'fulltext') {
$keyName = '&qfKey';
$urlParams = 'force=1';
$urlString = 'civicrm/contact/search/custom';
if ($this->_action == CRM_Core_Action::UPDATE) {
$keyName = '&key';
$urlParams .= '&context=fulltext&action=view';
$urlString = 'civicrm/contact/view/activity';
}
if ($qfKey) {
$urlParams .= "{$keyName}={$qfKey}";
}
$this->assign('searchKey', $qfKey);
} else {
if (in_array($this->_context, array('standalone', 'home'))) {
$urlParams = 'reset=1';
$urlString = 'civicrm/dashboard';
} else {
if ($this->_context == 'search') {
$urlParams = 'force=1';
if ($qfKey) {
$urlParams .= "&qfKey={$qfKey}";
}
if ($this->_compContext == 'advanced') {
$urlString = 'civicrm/contact/search/advanced';
}
$this->assign('searchKey', $qfKey);
} else {
if ($this->_context != 'caseActivity') {
$urlParams = "action=browse&reset=1&cid={$this->_currentlyViewedContactId}&selectedChild=activity";
$urlString = 'civicrm/contact/view';
}
}
}
}
if ($urlString) {
$session->pushUserContext(CRM_Utils_System::url($urlString, $urlParams));
}
// hack to retrieve activity type id from post variables
if (!$this->_activityTypeId) {
$this->_activityTypeId = CRM_Utils_Array::value('activity_type_id', $_POST);
}
// when custom data is included in this page
if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
// we need to set it in the session for the below code to work
// CRM-3014
//need to assign custom data subtype to the template
$this->set('type', 'Activity');
$this->set('subType', $this->_activityTypeId);
$this->set('entityId', $this->_activityId);
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
// add attachments part
CRM_Core_BAO_File::buildAttachment($this, 'civicrm_activity', $this->_activityId);
// figure out the file name for activity type, if any
if ($this->_activityTypeId && ($this->_activityTypeFile = CRM_Activity_BAO_Activity::getFileForActivityTypeId($this->_activityTypeId, $this->_crmDir))) {
require_once "CRM/{$this->_crmDir}/Form/Activity/{$this->_activityTypeFile}.php";
$this->assign('activityTypeFile', $this->_activityTypeFile);
$this->assign('crmDir', $this->_crmDir);
}
$this->setFields();
if ($this->_activityTypeFile) {
eval("CRM_{$this->_crmDir}_Form_Activity_{$this->_activityTypeFile}::preProcess( \$this );");
}
}
示例4: preProcess
//.........这里部分代码省略.........
$this->_currentlyViewedContactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
}
$this->_activityTypeId = CRM_Utils_Request::retrieve('atype', 'Positive', $this);
$this->assign('atype', $this->_activityTypeId);
if (!$this->_activityTypeId && $this->_activityId) {
$this->_activityTypeId = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $this->_activityId, 'activity_type_id');
}
//Assigning Activity type name
if ($this->_activityTypeId) {
require_once 'CRM/Core/OptionGroup.php';
$activityTName = CRM_Core_OptionGroup::values('activity_type', false, false, false, 'AND v.value = ' . $this->_activityTypeId, 'name');
if ($activityTName[$this->_activityTypeId]) {
$this->assign('activityTName', $activityTName[$this->_activityTypeId]);
}
}
//check the mode when this form is called either single or as
//search task action
if ($this->_activityTypeId || $this->_context == 'standalone' || $this->_currentlyViewedContactId) {
$this->_single = true;
$this->assign('urlPath', 'civicrm/activity');
} else {
//set the appropriate action
$advanced = null;
$builder = null;
$session =& CRM_Core_Session::singleton();
$advanced = $session->get('isAdvanced');
$builder = $session->get('isSearchBuilder');
$searchType = "basic";
if ($advanced == 1) {
$this->_action = CRM_Core_Action::ADVANCED;
$searchType = "advanced";
} else {
if ($advanced == 2 && ($builder = 1)) {
$this->_action = CRM_Core_Action::PROFILE;
$searchType = "builder";
} else {
if ($advanced == 3) {
$searchType = "custom";
}
}
}
parent::preProcess();
$this->_single = false;
$this->assign('urlPath', "civicrm/contact/search/{$searchType}");
$this->assign('urlPathVar', "_qf_Activity_display=true&qfKey={$this->controller->_key}");
}
$this->assign('single', $this->_single);
$this->assign('action', $this->_action);
if ($this->_action & CRM_Core_Action::VIEW) {
// get the tree of custom fields
$this->_groupTree =& CRM_Core_BAO_CustomGroup::getTree("Activity", $this, $this->_activityId, 0, $this->_activityTypeId);
}
if ($this->_activityTypeId) {
//set activity type name and description to template
require_once 'CRM/Core/BAO/OptionValue.php';
list($this->_activityTypeName, $activityTypeDescription) = CRM_Core_BAO_OptionValue::getActivityTypeDetails($this->_activityTypeId);
$this->assign('activityTypeName', $this->_activityTypeName);
$this->assign('activityTypeDescription', $activityTypeDescription);
}
$url = null;
// set user context
if (in_array($this->_context, array('standalone', 'home', 'search'))) {
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
} else {
if ($this->_context != 'caseActivity') {
$url = CRM_Utils_System::url('civicrm/contact/view', "action=browse&reset=1&cid={$this->_currentlyViewedContactId}&selectedChild=activity");
}
}
if ($url) {
$session->pushUserContext($url);
}
// hack to retrieve activity type id from post variables
if (!$this->_activityTypeId) {
$this->_activityTypeId = CRM_Utils_Array::value('activity_type_id', $_POST);
}
// when custom data is included in this page
if (CRM_Utils_Array::value("hidden_custom", $_POST)) {
// we need to set it in the session for the below code to work
// CRM-3014
//need to assign custom data subtype to the template
$this->set('type', 'Activity');
$this->set('subType', $this->_activityTypeId);
$this->set('entityId', $this->_activityId);
CRM_Custom_Form_CustomData::preProcess($this);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
// add attachments part
CRM_Core_BAO_File::buildAttachment($this, 'civicrm_activity', $this->_activityId);
// figure out the file name for activity type, if any
if ($this->_activityTypeId && ($this->_activityTypeFile = CRM_Activity_BAO_Activity::getFileForActivityTypeId($this->_activityTypeId, $this->_crmDir))) {
require_once "CRM/{$this->_crmDir}/Form/Activity/{$this->_activityTypeFile}.php";
$this->assign('activityTypeFile', $this->_activityTypeFile);
$this->assign('crmDir', $this->_crmDir);
}
$this->setFields();
if ($this->_activityTypeFile) {
eval("CRM_{$this->_crmDir}_Form_Activity_{$this->_activityTypeFile}::preProcess( \$this );");
}
}
示例5: preProcess
/**
* Function to build the form
*
* @return None
* @access public
*/
function preProcess()
{
$this->_caseId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_currentlyViewedContactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
if ($this->_action & CRM_Core_Action::ADD && !$this->_currentlyViewedContactId) {
// check for add contacts permissions
require_once 'CRM/Core/Permission.php';
if (!CRM_Core_Permission::check('add contacts')) {
CRM_Utils_System::permissionDenied();
return;
}
}
//CRM-4418
if (!CRM_Core_Permission::checkActionPermission('CiviCase', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
}
if ($this->_action & CRM_Core_Action::DELETE || $this->_action & CRM_Core_Action::RENEW) {
return true;
}
if ($this->_action & CRM_Core_Action::ADD) {
require_once 'CRM/Core/OptionGroup.php';
$this->_activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', 'Open Case', 'name');
}
if ($this->_activityTypeFile = CRM_Activity_BAO_Activity::getFileForActivityTypeId($this->_activityTypeId, 'Case')) {
require_once "CRM/Case/Form/Activity/{$this->_activityTypeFile}.php";
$this->assign('activityTypeFile', $this->_activityTypeFile);
}
$details = CRM_Case_PseudoConstant::activityType(false);
CRM_Utils_System::setTitle($details[$this->_activityTypeId]['label']);
$this->assign('activityType', $details[$this->_activityTypeId]['label']);
if (isset($this->_currentlyViewedContactId)) {
require_once 'CRM/Contact/BAO/Contact.php';
$contact =& new CRM_Contact_DAO_Contact();
$contact->id = $this->_currentlyViewedContactId;
if (!$contact->find(true)) {
CRM_Core_Error::statusBounce(ts('Client contact does not exist: %1', array(1 => $this->_currentlyViewedContactId)));
}
$this->assign('clientName', $contact->display_name);
}
$session =& CRM_Core_Session::singleton();
$this->_currentUserId = $session->get('userID');
//when custom data is included in this page
CRM_Custom_Form_Customdata::preProcess($this, null, $this->_activityTypeId, 1, 'Activity');
eval("CRM_Case_Form_Activity_{$this->_activityTypeFile}::preProcess( \$this );");
}