本文整理汇总了PHP中CRM_Case_BAO_Case::getCaseActivity方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Case_BAO_Case::getCaseActivity方法的具体用法?PHP CRM_Case_BAO_Case::getCaseActivity怎么用?PHP CRM_Case_BAO_Case::getCaseActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Case_BAO_Case
的用法示例。
在下文中一共展示了CRM_Case_BAO_Case::getCaseActivity方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCaseActivity
public static function getCaseActivity()
{
$caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
$contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
$userID = CRM_Utils_Type::escape($_GET['userID'], 'Integer');
$context = CRM_Utils_Type::escape(CRM_Utils_Array::value('context', $_GET), 'String');
$sortMapper = array(0 => 'display_date', 1 => 'ca.subject', 2 => 'ca.activity_type_id', 3 => 'acc.sort_name', 4 => 'cc.sort_name', 5 => 'ca.status_id');
$sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
$offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
$rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
$sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
$params = $_POST;
if ($sort && $sortOrder) {
$params['sortname'] = $sort;
$params['sortorder'] = $sortOrder;
}
$params['page'] = $offset / $rowCount + 1;
$params['rp'] = $rowCount;
// get the activities related to given case
$activities = CRM_Case_BAO_Case::getCaseActivity($caseID, $params, $contactID, $context, $userID);
$iFilteredTotal = $iTotal = $params['total'];
$selectorElements = array('display_date', 'subject', 'type', 'with_contacts', 'reporter', 'status', 'links', 'class');
header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($activities, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
示例2: getCaseActivity
public static function getCaseActivity()
{
// Should those params be passed through the validateParams method?
$caseID = CRM_Utils_Type::validate($_GET['caseID'], 'Integer');
$contactID = CRM_Utils_Type::validate($_GET['cid'], 'Integer');
$userID = CRM_Utils_Type::validate($_GET['userID'], 'Integer');
$context = CRM_Utils_Type::validate(CRM_Utils_Array::value('context', $_GET), 'String');
$optionalParameters = array('source_contact_id' => 'Integer', 'status_id' => 'Integer', 'activity_deleted' => 'Boolean', 'activity_type_id' => 'Integer', 'activity_date_low' => 'Date', 'activity_date_high' => 'Date');
$params = CRM_Core_Page_AJAX::defaultSortAndPagerParams();
$params += CRM_Core_Page_AJAX::validateParams(array(), $optionalParameters);
// get the activities related to given case
$activities = CRM_Case_BAO_Case::getCaseActivity($caseID, $params, $contactID, $context, $userID);
CRM_Utils_JSON::output($activities);
}
示例3: getCaseActivity
static function getCaseActivity()
{
$caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
$contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
$params = $_POST;
// get the activities related to given case
require_once "CRM/Case/BAO/Case.php";
$activities = CRM_Case_BAO_Case::getCaseActivity($caseID, $params, $contactID);
$page = CRM_Utils_Array::value('page', $_POST);
$total = $params['total'];
require_once "CRM/Utils/JSON.php";
$selectorElements = array('display_date', 'subject', 'type', 'reporter', 'status', 'links', 'class');
echo CRM_Utils_JSON::encodeSelector($activities, $page, $total, $selectorElements);
exit;
}
示例4: run
/**
* This function is the main function that is called when the page loads,
* it decides the which action has to be taken for the page.
*
* return null
* @access public
*/
function run()
{
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$type = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject);
$this->assign('action', $this->_action);
$this->assign('context', $this->_context);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$caseId = CRM_Utils_Request::retrieve('caseId', 'Positive', $this);
CRM_Case_Page_Tab::setContext();
$params = array('date_range' => 0);
$caseDetails = array();
if (CRM_Case_BAO_Case::accessCiviCase()) {
$caseDetails = CRM_Case_BAO_Case::getCaseActivity($caseId, $params, $this->_contactId, NULL, NULL, $type);
}
$this->assign('rows', $caseDetails);
$this->assign('caseId', $caseId);
$this->assign('contactId', $this->_contactId);
return parent::run();
}
示例5: run
/**
* the main function that is called when the page loads,
* it decides the which action has to be taken for the page.
*
* @return null
*/
public function run()
{
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$type = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject);
$this->assign('action', $this->_action);
$this->assign('context', $this->_context);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$caseId = CRM_Utils_Request::retrieve('caseId', 'Positive', $this);
CRM_Case_Page_Tab::setContext();
$params = array('date_range' => 0);
$caseDetails = array();
if (CRM_Case_BAO_Case::accessCiviCase()) {
$caseDetails = CRM_Case_BAO_Case::getCaseActivity($caseId, $params, $this->_contactId, NULL, NULL, $type);
}
$this->assign('rows', $caseDetails);
$this->assign('caseId', $caseId);
$this->assign('contactId', $this->_contactId);
// Make it easy to refresh this table
$params = array('caseId' => $caseId, 'type' => $type, 'context' => $this->_context, 'cid' => $this->_contactId, 'action' => $this->_action, 'snippet' => 4);
$this->assign('data_params', json_encode($params));
return parent::run();
}
示例6: run
/**
* This function is the main function that is called when the page loads,
* it decides the which action has to be taken for the page.
*
* return null
* @access public
*/
function run()
{
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse');
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('action', $this->_action);
$this->assign('context', $this->_context);
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$caseId = CRM_Utils_Request::retrieve('caseId', 'Positive', $this);
require_once 'CRM/Case/Page/Tab.php';
CRM_Case_Page_Tab::setContext();
require_once 'CRM/Case/BAO/Case.php';
$params = array('date_range' => 0);
$caseDetails = CRM_Case_BAO_Case::getCaseActivity($caseId, $params, $this->_contactId);
$this->assign('rows', $caseDetails);
$this->assign('caseId', $caseId);
$this->assign('contactId', $this->_contactId);
// check is the user has view/edit signer permission
$permission = 'view';
if (CRM_Core_Permission::check('edit cases')) {
$permission = 'edit';
}
$this->assign('permission', $permission);
return parent::run();
}
示例7: getCaseActivity
public static function getCaseActivity()
{
$caseID = CRM_Utils_Type::escape($_GET['caseID'], 'Integer');
$contactID = CRM_Utils_Type::escape($_GET['cid'], 'Integer');
$userID = CRM_Utils_Type::escape($_GET['userID'], 'Integer');
$context = CRM_Utils_Type::escape(CRM_Utils_Array::value('context', $_GET), 'String');
$sortMapper = array();
foreach ($_GET['columns'] as $key => $value) {
$sortMapper[$key] = $value['data'];
}
$offset = isset($_GET['start']) ? CRM_Utils_Type::escape($_GET['start'], 'Integer') : 0;
$rowCount = isset($_GET['length']) ? CRM_Utils_Type::escape($_GET['length'], 'Integer') : 25;
$sort = isset($_GET['order'][0]['column']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_GET['order'][0]['column'], 'Integer'), $sortMapper) : NULL;
$sortOrder = isset($_GET['order'][0]['dir']) ? CRM_Utils_Type::escape($_GET['order'][0]['dir'], 'String') : 'asc';
$params = $_GET;
if ($sort && $sortOrder) {
$params['sortBy'] = $sort . ' ' . $sortOrder;
}
$params['page'] = $offset / $rowCount + 1;
$params['rp'] = $rowCount;
// get the activities related to given case
$activities = CRM_Case_BAO_Case::getCaseActivity($caseID, $params, $contactID, $context, $userID);
CRM_Utils_JSON::output($activities);
}
示例8: preProcess
/**
* Build the form object.
*
* @return void
*/
public function preProcess()
{
$caseIds = CRM_Utils_Request::retrieve('caseid', 'String', $this);
$this->_caseId = explode(',', $caseIds);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
if (!$this->_context) {
$this->_context = 'caseActivity';
}
$this->_crmDir = 'Case';
$this->assign('context', $this->_context);
$result = parent::preProcess();
$scheduleStatusId = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name');
$this->assign('scheduleStatusId', $scheduleStatusId);
if (!$this->_caseId && $this->_activityId) {
$this->_caseId = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseActivity', $this->_activityId, 'case_id', 'activity_id');
}
if ($this->_caseId) {
$this->assign('caseId', $this->_caseId);
$this->assign('countId', count($this->_caseId));
$this->assign('caseID', CRM_Utils_Array::first($this->_caseId));
}
if (!$this->_caseId || !$this->_activityId && !$this->_activityTypeId) {
CRM_Core_Error::fatal('required params missing.');
}
//check for case activity access.
if (!CRM_Case_BAO_Case::accessCiviCase()) {
CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
}
//validate case id.
if ($this->_caseId && !CRM_Core_Permission::check('access all cases and activities')) {
$session = CRM_Core_Session::singleton();
$allCases = CRM_Case_BAO_Case::getCases(TRUE, $session->get('userID'), 'any');
if (!array_key_exists($this->_caseId, $allCases)) {
CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
}
}
//validate case activity id.
if ($this->_activityId && $this->_action & CRM_Core_Action::UPDATE) {
$valid = CRM_Case_BAO_Case::checkPermission($this->_activityId, 'edit', $this->_activityTypeId);
if (!$valid) {
CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
}
}
foreach ($this->_caseId as $casePos => $caseId) {
$this->_caseType[$casePos] = CRM_Case_BAO_Case::getCaseType($caseId, 'name');
}
$this->assign('caseType', $this->_caseType);
$xmlProcessorProcess = new CRM_Case_XMLProcessor_Process();
$isMultiClient = $xmlProcessorProcess->getAllowMultipleCaseClients();
$this->assign('multiClient', $isMultiClient);
foreach ($this->_caseId as $casePos => $caseId) {
$clients[] = CRM_Case_BAO_Case::getContactNames($caseId);
}
$this->assign('client_names', $clients);
$caseIds = implode(',', $this->_caseId);
// set context for pushUserContext and for statusBounce
if ($this->_context == 'fulltext') {
if ($this->_action == CRM_Core_Action::UPDATE || $this->_action == CRM_Core_Action::DELETE) {
$url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$caseIds}&show=1&context={$this->_context}");
} else {
$url = CRM_Utils_System::url('civicrm/contact/search/custom', 'force=1');
}
} else {
$url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$caseIds}&show=1");
}
if (!$this->_activityId) {
$caseTypes = CRM_Case_PseudoConstant::caseType();
if (empty($caseTypes) && $this->_activityTypeName == 'Change Case Type' && !$this->_caseId) {
$url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$caseIds}&show=1");
$session = CRM_Core_Session::singleton();
$session->pushUserContext($url);
CRM_Core_Error::statusBounce(ts("You do not have any active Case Types"));
}
// check if activity count is within the limit
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
foreach ($this->_caseId as $casePos => $caseId) {
$caseType = $this->_caseType[$casePos];
$activityInst = $xmlProcessor->getMaxInstance($caseType);
// If not bounce back and also provide activity edit link
if (isset($activityInst[$this->_activityTypeName])) {
$activityCount = CRM_Case_BAO_Case::getCaseActivityCount($caseId, $this->_activityTypeId);
if ($activityCount >= $activityInst[$this->_activityTypeName]) {
if ($activityInst[$this->_activityTypeName] == 1) {
$atArray = array('activity_type_id' => $this->_activityTypeId);
$activities = CRM_Case_BAO_Case::getCaseActivity($caseId, $atArray, $this->_currentUserId);
$activities = array_keys($activities);
$activities = $activities[0];
$editUrl = CRM_Utils_System::url('civicrm/case/activity', "reset=1&cid={$this->_currentlyViewedContactId}&caseid={$caseId}&action=update&id={$activities}");
}
CRM_Core_Error::statusBounce(ts("You can not add another '%1' activity to this case. %2", array(1 => $this->_activityTypeName, 2 => ts("Do you want to <a %1>edit the existing activity</a>?", array(1 => "href='{$editUrl}'")))), $url);
}
}
}
}
$session = CRM_Core_Session::singleton();
//.........这里部分代码省略.........
示例9: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
// process url params
if ($this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive')) {
$this->assign('contactID', $this->_contactID);
}
if ($this->_caseID = CRM_Utils_Request::retrieve('case_id', 'Positive')) {
$this->assign('case_id', $this->_caseID);
// get Vacancy ID
$vacancyID = CRM_HRRecruitment_BAO_HRVacancy::getVacancyIDByCase($this->_caseID);
//Get application and evaluaiton profile IDs
foreach (array('application_profile', 'evaluation_profile') as $profileName) {
$dao = new CRM_Core_DAO_UFJoin();
$dao->module = 'Vacancy';
$dao->entity_id = $vacancyID;
$dao->module_data = $profileName;
$dao->find(TRUE);
$profile[$profileName] = $dao->uf_group_id;
}
//Check for existing Evaluation activity type and assign variables to tpl
$this->assign('actions', 'add');
$params = array('activity_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Evaluation'));
$caseActivity = CRM_Case_BAO_Case::getCaseActivity($this->_caseID, $params, $this->_contactID);
foreach ($caseActivity as $caseActivity) {
$evalID = $caseActivity['id'];
$this->assign('id', $evalID);
$this->assign('actions', 'update');
}
$this->_profileID = $profile['application_profile'];
$this->_evalProfileID = $profile['evaluation_profile'];
}
}
示例10: preProcess
/**
* Function to build the form
*
* @return None
* @access public
*/
function preProcess()
{
$this->_caseId = CRM_Utils_Request::retrieve('caseid', 'Positive', $this);
$this->_context = 'caseActivity';
$this->_crmDir = 'Case';
$this->assign('context', $this->_context);
$result = parent::preProcess();
$scheduleStatusId = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name');
$this->assign('scheduleStatusId', $scheduleStatusId);
if ($this->_cdType || $this->_addAssigneeContact || $this->_addTargetContact) {
return $result;
}
if (!$this->_caseId && $this->_activityId) {
$this->_caseId = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseActivity', $this->_activityId, 'case_id', 'activity_id');
}
if ($this->_caseId) {
$this->assign('caseId', $this->_caseId);
}
if (!$this->_caseId || !$this->_activityId && !$this->_activityTypeId) {
CRM_Core_Error::fatal('required params missing.');
}
$caseType = CRM_Case_PseudoConstant::caseTypeName($this->_caseId);
$this->_caseType = $caseType['name'];
$this->assign('caseType', $this->_caseType);
$clientName = $this->_getDisplayNameById($this->_currentlyViewedContactId);
$this->assign('client_name', $clientName);
// set context for pushUserContext and for statusBounce
$url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_currentlyViewedContactId}&id={$this->_caseId}&show=1");
if (!$this->_activityId) {
// check if activity count is within the limit
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
$activityInst = $xmlProcessor->getMaxInstance($this->_caseType);
// If not bounce back and also provide activity edit link
if (isset($activityInst[$this->_activityTypeName])) {
$activityCount = CRM_Case_BAO_Case::getCaseActivityCount($this->_caseId, $this->_activityTypeId);
if ($activityCount >= $activityInst[$this->_activityTypeName]) {
if ($activityInst[$this->_activityTypeName] == 1) {
$atArray = array('activity_type_id' => $this->_activityTypeId);
$activities = CRM_Case_BAO_Case::getCaseActivity($this->_caseId, $atArray, $this->_currentUserId);
$activities = array_keys($activities);
$activities = $activities[0];
$editUrl = CRM_Utils_System::url('civicrm/case/activity', "reset=1&cid={$this->_currentlyViewedContactId}&caseid={$this->_caseId}&action=update&id={$activities}");
}
CRM_Core_Error::statusBounce(ts("You can not add another '%1' activity to this case. %2", array(1 => $this->_activityTypeName, 2 => "Do you want to <a href='{$editUrl}'>edit the existing activity</a> ?")), $url);
}
}
}
CRM_Utils_System::setTitle($this->_activityTypeName);
$session =& CRM_Core_Session::singleton();
$session->pushUserContext($url);
}