本文整理汇总了PHP中CRM_Activity_BAO_Activity::getLatestActivityId方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Activity_BAO_Activity::getLatestActivityId方法的具体用法?PHP CRM_Activity_BAO_Activity::getLatestActivityId怎么用?PHP CRM_Activity_BAO_Activity::getLatestActivityId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Activity_BAO_Activity
的用法示例。
在下文中一共展示了CRM_Activity_BAO_Activity::getLatestActivityId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* Process the view.
*
*
* @return void
*/
public function preProcess()
{
$contactID = CRM_Utils_Request::retrieve('cid', 'Integer', $this, TRUE);
$activityID = CRM_Utils_Request::retrieve('aid', 'Integer', $this, TRUE);
$revs = CRM_Utils_Request::retrieve('revs', 'Boolean', CRM_Core_DAO::$_nullObject);
$caseID = CRM_Utils_Request::retrieve('caseID', 'Boolean', CRM_Core_DAO::$_nullObject);
$activitySubject = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $activityID, 'subject');
//check for required permissions, CRM-6264
if ($activityID && !CRM_Activity_BAO_Activity::checkPermission($activityID, CRM_Core_Action::VIEW)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
$this->assign('contactID', $contactID);
$this->assign('caseID', $caseID);
// CRM-9145
$this->assign('activityID', $activityID);
$xmlProcessor = new CRM_Case_XMLProcessor_Report();
$report = $xmlProcessor->getActivityInfo($contactID, $activityID, TRUE);
$attachmentUrl = CRM_Core_BAO_File::attachmentInfo('civicrm_activity', $activityID);
if ($attachmentUrl) {
$report['fields'][] = array('label' => 'Attachment(s)', 'value' => $attachmentUrl, 'type' => 'Link');
}
$tags = CRM_Core_BAO_EntityTag::getTag($activityID, 'civicrm_activity');
if (!empty($tags)) {
$allTag = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
foreach ($tags as $tid) {
$tags[$tid] = $allTag[$tid];
}
$report['fields'][] = array('label' => 'Tags', 'value' => implode('<br />', $tags), 'type' => 'String');
}
$this->assign('report', $report);
$latestRevisionID = CRM_Activity_BAO_Activity::getLatestActivityId($activityID);
$viewPriorActivities = array();
$priorActivities = CRM_Activity_BAO_Activity::getPriorAcitivities($activityID);
foreach ($priorActivities as $activityId => $activityValues) {
if (CRM_Case_BAO_Case::checkPermission($activityId, 'view', NULL, $contactID)) {
$viewPriorActivities[$activityId] = $activityValues;
}
}
if ($revs) {
CRM_Utils_System::setTitle(ts('Activity Revision History'));
$this->assign('revs', $revs);
$this->assign('result', $viewPriorActivities);
$this->assign('subject', $activitySubject);
$this->assign('latestRevisionID', $latestRevisionID);
} else {
if (count($viewPriorActivities) > 1) {
$this->assign('activityID', $activityID);
}
if ($latestRevisionID != $activityID) {
$this->assign('latestRevisionID', $latestRevisionID);
}
}
$parentID = CRM_Activity_BAO_Activity::getParentActivity($activityID);
if ($parentID) {
$this->assign('parentID', $parentID);
}
//viewing activity should get diplayed in recent list.CRM-4670
$activityTypeID = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $activityID, 'activity_type_id');
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
$activityTargetContacts = CRM_Activity_BAO_ActivityContact::retrieveContactIdsByActivityId($activityID, $targetID);
if (!empty($activityTargetContacts)) {
$recentContactId = $activityTargetContacts[0];
} else {
$recentContactId = $contactID;
}
if (!isset($caseID)) {
$caseID = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseActivity', $activityID, 'case_id', 'activity_id');
}
$url = CRM_Utils_System::url('civicrm/case/activity/view', "reset=1&aid={$activityID}&cid={$recentContactId}&caseID={$caseID}&context=home");
$recentContactDisplay = CRM_Contact_BAO_Contact::displayName($recentContactId);
// add the recently created Activity
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
$title = "";
if (isset($activitySubject)) {
$title = $activitySubject . ' - ';
}
$title = $title . $recentContactDisplay . ' (' . $activityTypes[$activityTypeID] . ')';
$recentOther = array();
if (CRM_Case_BAO_Case::checkPermission($activityID, 'edit')) {
$recentOther['editUrl'] = CRM_Utils_System::url('civicrm/case/activity', "reset=1&action=update&id={$activityID}&cid={$recentContactId}&caseid={$caseID}&context=home");
}
if (CRM_Case_BAO_Case::checkPermission($activityID, 'delete')) {
$recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/case/activity', "reset=1&action=delete&id={$activityID}&cid={$recentContactId}&caseid={$caseID}&context=home");
}
CRM_Utils_Recent::add($title, $url, $activityID, 'Activity', $recentContactId, $recentContactDisplay, $recentOther);
}
示例2: __construct
/**
* Class constructor.
*
* @param int $id
* The contact id.
* @param int $gid
* The group id.
*
* @param $restrict
* @param bool $skipPermission
* @param null $profileIds
*
* @return \CRM_Profile_Page_Dynamic
*/
public function __construct($id, $gid, $restrict, $skipPermission = FALSE, $profileIds = NULL)
{
parent::__construct();
$this->_id = $id;
$this->_gid = $gid;
$this->_restrict = $restrict;
$this->_skipPermission = $skipPermission;
if (!array_key_exists('multiRecord', $_GET)) {
$this->set('multiRecord', NULL);
}
if (!array_key_exists('recordId', $_GET)) {
$this->set('recordId', NULL);
}
if (!array_key_exists('allFields', $_GET)) {
$this->set('allFields', NULL);
}
//specifies the action being done on a multi record field
$multiRecordAction = CRM_Utils_Request::retrieve('multiRecord', 'String', $this);
$this->_multiRecord = !is_numeric($multiRecordAction) ? CRM_Core_Action::resolve($multiRecordAction) : $multiRecordAction;
if ($this->_multiRecord) {
$this->set('multiRecord', $this->_multiRecord);
}
if ($this->_multiRecord & CRM_Core_Action::VIEW) {
$this->_recordId = CRM_Utils_Request::retrieve('recordId', 'Positive', $this);
$this->_allFields = CRM_Utils_Request::retrieve('allFields', 'Integer', $this);
}
if ($profileIds) {
$this->_profileIds = $profileIds;
} else {
$this->_profileIds = array($gid);
}
$this->_activityId = CRM_Utils_Request::retrieve('aid', 'Positive', $this, FALSE, 0, 'GET');
if (is_numeric($this->_activityId)) {
$latestRevisionId = CRM_Activity_BAO_Activity::getLatestActivityId($this->_activityId);
if ($latestRevisionId) {
$this->_activityId = $latestRevisionId;
}
}
$this->_isContactActivityProfile = CRM_Core_BAO_UFField::checkContactActivityProfileType($this->_gid);
}
示例3: preProcess
/**
* Pre processing work done here.
*
* gets session variables for table name, id of entity in table, type of entity and stores them.
*
* @param
*
* @return void
*/
public function preProcess()
{
$this->_id = $this->get('id');
$this->_profileIds = $this->get('profileIds');
$this->_grid = CRM_Utils_Request::retrieve('grid', 'Integer', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
//unset from session when $_GET doesn't have it
//except when the form is submitted
if (empty($_POST)) {
if (!array_key_exists('multiRecord', $_GET)) {
$this->set('multiRecord', NULL);
}
if (!array_key_exists('recordId', $_GET)) {
$this->set('recordId', NULL);
}
}
$this->_session = CRM_Core_Session::singleton();
$this->_currentUserID = $this->_session->get('userID');
if ($this->_mode == self::MODE_EDIT) {
//specifies the action being done on a multi record field
$multiRecordAction = CRM_Utils_Request::retrieve('multiRecord', 'String', $this);
$this->_multiRecord = !is_numeric($multiRecordAction) ? CRM_Core_Action::resolve($multiRecordAction) : $multiRecordAction;
if ($this->_multiRecord) {
$this->set('multiRecord', $this->_multiRecord);
}
if ($this->_multiRecord && !in_array($this->_multiRecord, array(CRM_Core_Action::UPDATE, CRM_Core_Action::ADD, CRM_Core_Action::DELETE))) {
CRM_Core_Error::fatal(ts('Proper action not specified for this custom value record profile'));
}
}
$this->_duplicateButtonName = $this->getButtonName('upload', 'duplicate');
$gids = explode(',', CRM_Utils_Request::retrieve('gid', 'String', CRM_Core_DAO::$_nullObject, FALSE, 0));
if (count($gids) > 1 && !$this->_profileIds && empty($this->_profileIds)) {
if (!empty($gids)) {
foreach ($gids as $pfId) {
$this->_profileIds[] = CRM_Utils_Type::escape($pfId, 'Positive');
}
}
// check if we are rendering mixed profiles
if (CRM_Core_BAO_UFGroup::checkForMixProfiles($this->_profileIds)) {
CRM_Core_Error::fatal(ts('You cannot combine profiles of multiple types.'));
}
// for now consider 1'st profile as primary profile and validate it
// i.e check for profile type etc.
// FIX ME: validations for other than primary
$this->_gid = $this->_profileIds[0];
$this->set('gid', $this->_gid);
$this->set('profileIds', $this->_profileIds);
}
if (!$this->_gid) {
$this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE, 0);
$this->set('gid', $this->_gid);
}
$this->_activityId = CRM_Utils_Request::retrieve('aid', 'Positive', $this, FALSE, 0, 'GET');
if (is_numeric($this->_activityId)) {
$latestRevisionId = CRM_Activity_BAO_Activity::getLatestActivityId($this->_activityId);
if ($latestRevisionId) {
$this->_activityId = $latestRevisionId;
}
}
$this->_isContactActivityProfile = CRM_Core_BAO_UFField::checkContactActivityProfileType($this->_gid);
//get values for ufGroupName, captch and dupe update.
if ($this->_gid) {
$dao = new CRM_Core_DAO_UFGroup();
$dao->id = $this->_gid;
if ($dao->find(TRUE)) {
$this->_isUpdateDupe = $dao->is_update_dupe;
$this->_isAddCaptcha = $dao->add_captcha;
$this->_ufGroup = (array) $dao;
}
$dao->free();
if (!CRM_Utils_Array::value('is_active', $this->_ufGroup)) {
CRM_Core_Error::fatal(ts('The requested profile (gid=%1) is inactive or does not exist.', array(1 => $this->_gid)));
}
}
$this->assign('ufGroupName', $this->_ufGroup['name']);
$gids = empty($this->_profileIds) ? $this->_gid : $this->_profileIds;
// if we dont have a gid use the default, else just use that specific gid
if (($this->_mode == self::MODE_REGISTER || $this->_mode == self::MODE_CREATE) && !$this->_gid) {
$this->_ctype = CRM_Utils_Request::retrieve('ctype', 'String', $this, FALSE, 'Individual', 'REQUEST');
$this->_fields = CRM_Core_BAO_UFGroup::getRegistrationFields($this->_action, $this->_mode, $this->_ctype);
} elseif ($this->_mode == self::MODE_SEARCH) {
$this->_fields = CRM_Core_BAO_UFGroup::getListingFields($this->_action, CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY | CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY, FALSE, $gids, TRUE, NULL, $this->_skipPermission, CRM_Core_Permission::SEARCH);
} else {
$this->_fields = CRM_Core_BAO_UFGroup::getFields($gids, FALSE, NULL, NULL, NULL, FALSE, NULL, $this->_skipPermission, NULL, $this->_action == CRM_Core_Action::ADD ? CRM_Core_Permission::CREATE : CRM_Core_Permission::EDIT);
$multiRecordFieldListing = FALSE;
//using selector for listing of multirecord fields
if ($this->_mode == self::MODE_EDIT && $this->_gid) {
CRM_Core_BAO_UFGroup::shiftMultiRecordFields($this->_fields, $this->_multiRecordFields);
if ($this->_multiRecord) {
if ($this->_multiRecord != CRM_Core_Action::ADD) {
$this->_recordId = CRM_Utils_Request::retrieve('recordId', 'Positive', $this);
//.........这里部分代码省略.........
示例4: preProcess
/**
* Function to process the view
*
* @access public
* @return None
*/
public function preProcess()
{
$contactID = CRM_Utils_Request::retrieve('cid', 'Integer', $this, true);
$activityID = CRM_Utils_Request::retrieve('aid', 'Integer', $this, true);
$revs = CRM_Utils_Request::retrieve('revs', 'Boolean', CRM_Core_DAO::$_nullObject);
$caseID = CRM_Utils_Request::retrieve('caseID', 'Boolean', CRM_Core_DAO::$_nullObject);
$activitySubject = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $activityID, 'subject');
$this->assign('contactID', $contactID);
$this->assign('caseID', $caseID);
require_once 'CRM/Case/XMLProcessor/Report.php';
$xmlProcessor = new CRM_Case_XMLProcessor_Report();
$report = $xmlProcessor->getActivityInfo($contactID, $activityID, true);
require_once 'CRM/Core/BAO/File.php';
$attachmentUrl = CRM_Core_BAO_File::attachmentInfo('civicrm_activity', $activityID);
if ($attachmentUrl) {
$report['fields'][] = array('label' => 'Attachment(s)', 'value' => $attachmentUrl, 'type' => 'Link');
}
$this->assign('report', $report);
$latestRevisionID = CRM_Activity_BAO_Activity::getLatestActivityId($activityID);
if ($revs) {
$this->assign('revs', $revs);
$priorActivities = CRM_Activity_BAO_Activity::getPriorAcitivities($activityID);
$this->assign('result', $priorActivities);
$this->assign('subject', $activitySubject);
$this->assign('latestRevisionID', $latestRevisionID);
} else {
$countPriorActivities = CRM_Activity_BAO_Activity::getPriorCount($activityID);
if ($countPriorActivities >= 1) {
$this->assign('activityID', $activityID);
}
if ($latestRevisionID != $activityID) {
$this->assign('latestRevisionID', $latestRevisionID);
}
}
$parentID = CRM_Activity_BAO_Activity::getParentActivity($activityID);
if ($parentID) {
$this->assign('parentID', $parentID);
}
//viewing activity should get diplayed in recent list.CRM-4670
$activityTypeID = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $activityID, 'activity_type_id');
$activityTargetContacts = CRM_Activity_BAO_ActivityTarget::retrieveTargetIdsByActivityId($activityID);
if (!empty($activityTargetContacts)) {
$recentContactId = $activityTargetContacts[1];
} else {
$recentContactId = $contactID;
}
if (!isset($caseID)) {
$caseID = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseActivity', $activityID, 'case_id', 'activity_id');
}
require_once 'CRM/Utils/Recent.php';
$url = CRM_Utils_System::url('civicrm/case/activity/view', "reset=1&aid={$activityID}&cid={$recentContactId}&caseID={$caseID}");
require_once 'CRM/Contact/BAO/Contact.php';
$recentContactDisplay = CRM_Contact_BAO_Contact::displayName($recentContactId);
// add the recently created Activity
$activityTypes = CRM_Core_Pseudoconstant::activityType(true, true);
$title = "";
if (isset($activitySubject)) {
$title = $activitySubject . ' - ';
}
$title = $title . $recentContactDisplay . ' (' . $activityTypes[$activityTypeID] . ')';
CRM_Utils_Recent::add($title, $url, $activityID, 'Activity', $recentContactId, $recentContactDisplay);
}
示例5: __construct
/**
* class constructor
*
* @param int $id the contact id
* @param int $gid the group id
*
* @return void
* @access public
*/
function __construct($id, $gid, $restrict, $skipPermission = FALSE, $profileIds = NULL)
{
parent::__construct();
$this->_id = $id;
$this->_gid = $gid;
$this->_restrict = $restrict;
$this->_skipPermission = $skipPermission;
if ($profileIds) {
$this->_profileIds = $profileIds;
} else {
$this->_profileIds = array($gid);
}
$this->_activityId = CRM_Utils_Request::retrieve('aid', 'Positive', $this, FALSE, 0, 'GET');
if (is_numeric($this->_activityId)) {
$latestRevisionId = CRM_Activity_BAO_Activity::getLatestActivityId($this->_activityId);
if ($latestRevisionId) {
$this->_activityId = $latestRevisionId;
}
}
$this->_isContactActivityProfile = CRM_Core_BAO_UFField::checkContactActivityProfileType($this->_gid);
}
示例6: preProcess
/**
* pre processing work done here.
*
* gets session variables for table name, id of entity in table, type of entity and stores them.
*
* @param
*
* @return void
*
* @access public
*/
function preProcess()
{
$this->_id = $this->get('id');
$this->_gid = $this->get('gid');
$this->_profileIds = $this->get('profileIds');
$this->_grid = CRM_Utils_Request::retrieve('grid', 'Integer', $this);
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->_duplicateButtonName = $this->getButtonName('upload', 'duplicate');
$gids = explode(',', CRM_Utils_Request::retrieve('gid', 'String', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET'));
if (count($gids) > 1 && !$this->_profileIds && empty($this->_profileIds)) {
if (!empty($gids)) {
foreach ($gids as $pfId) {
$this->_profileIds[] = CRM_Utils_Type::escape($pfId, 'Positive');
}
}
// check if we are rendering mixed profiles
if (CRM_Core_BAO_UFGroup::checkForMixProfiles($this->_profileIds)) {
CRM_Core_Error::fatal(ts('You cannot combine profiles of multiple types.'));
}
// for now consider 1'st profile as primary profile and validate it
// i.e check for profile type etc.
// FIX ME: validations for other than primary
$this->_gid = $this->_profileIds[0];
$this->set('gid', $this->_gid);
$this->set('profileIds', $this->_profileIds);
}
if (!$this->_gid) {
$this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE, 0, 'GET');
}
$this->_activityId = CRM_Utils_Request::retrieve('aid', 'Positive', $this, FALSE, 0, 'GET');
if (is_numeric($this->_activityId)) {
$latestRevisionId = CRM_Activity_BAO_Activity::getLatestActivityId($this->_activityId);
if ($latestRevisionId) {
$this->_activityId = $latestRevisionId;
}
}
$this->_isContactActivityProfile = CRM_Core_BAO_UFField::checkContactActivityProfileType($this->_gid);
//get values for captch and dupe update.
if ($this->_gid) {
$dao = new CRM_Core_DAO_UFGroup();
$dao->id = $this->_gid;
if ($dao->find(TRUE)) {
$this->_isUpdateDupe = $dao->is_update_dupe;
$this->_isAddCaptcha = $dao->add_captcha;
}
$dao->free();
}
if (empty($this->_profileIds)) {
$gids = $this->_gid;
} else {
$gids = $this->_profileIds;
}
// if we dont have a gid use the default, else just use that specific gid
if (($this->_mode == self::MODE_REGISTER || $this->_mode == self::MODE_CREATE) && !$this->_gid) {
$this->_ctype = CRM_Utils_Request::retrieve('ctype', 'String', $this, FALSE, 'Individual', 'REQUEST');
$this->_fields = CRM_Core_BAO_UFGroup::getRegistrationFields($this->_action, $this->_mode, $this->_ctype);
} elseif ($this->_mode == self::MODE_SEARCH) {
$this->_fields = CRM_Core_BAO_UFGroup::getListingFields($this->_action, CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY | CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY, FALSE, $gids, TRUE, NULL, $this->_skipPermission, CRM_Core_Permission::SEARCH);
} else {
$this->_fields = CRM_Core_BAO_UFGroup::getFields($gids, FALSE, NULL, NULL, NULL, FALSE, NULL, $this->_skipPermission, NULL, $this->_action == CRM_Core_Action::ADD ? CRM_Core_Permission::CREATE : CRM_Core_Permission::EDIT);
// is profile double-opt in?
if (CRM_Utils_Array::value('group', $this->_fields) && CRM_Core_BAO_UFGroup::isProfileDoubleOptin()) {
$emailField = FALSE;
foreach ($this->_fields as $name => $values) {
if (substr($name, 0, 6) == 'email-') {
$emailField = TRUE;
}
}
if (!$emailField) {
$session = CRM_Core_Session::singleton();
$status = ts("Email field should be included in profile if you want to use Group(s) when Profile double-opt in process is enabled.");
$session->setStatus($status);
}
}
}
if (!is_array($this->_fields)) {
$session = CRM_Core_Session::singleton();
CRM_Core_Session::setStatus(ts('This feature is not currently available.'));
return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm', 'reset=1'));
}
if ($this->_mode != self::MODE_SEARCH) {
CRM_Core_BAO_UFGroup::setRegisterDefaults($this->_fields, $defaults);
$this->setDefaults($defaults);
}
}