当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Activity_BAO_Activity类代码示例

本文整理汇总了PHP中CRM_Activity_BAO_Activity的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Activity_BAO_Activity类的具体用法?PHP CRM_Activity_BAO_Activity怎么用?PHP CRM_Activity_BAO_Activity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CRM_Activity_BAO_Activity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: addResources

 /**
  * Load needed JS, CSS and settings for the backend Volunteer Management UI
  */
 public static function addResources($entity_id, $entity_table)
 {
     static $loaded = FALSE;
     $ccr = CRM_Core_Resources::singleton();
     if ($loaded || $ccr->isAjaxMode()) {
         return;
     }
     $loaded = TRUE;
     $config = CRM_Core_Config::singleton();
     // Vendor libraries
     $ccr->addScriptFile('civicrm', 'packages/backbone/json2.js', 100, 'html-header', FALSE);
     $ccr->addScriptFile('civicrm', 'packages/backbone/backbone-min.js', 120, 'html-header', FALSE);
     $ccr->addScriptFile('civicrm', 'packages/backbone/backbone.marionette.min.js', 125, 'html-header', FALSE);
     // Our stylesheet
     $ccr->addStyleFile('org.civicrm.volunteer', 'css/volunteer_app.css');
     // Add all scripts for our js app
     $weight = 0;
     $baseDir = CRM_Extension_System::singleton()->getMapper()->keyToBasePath('org.civicrm.volunteer') . '/';
     // This glob pattern will recurse the js directory up to 4 levels deep
     foreach (glob($baseDir . 'js/backbone/{*,*/*,*/*/*,*/*/*/*}.js', GLOB_BRACE) as $file) {
         $fileName = substr($file, strlen($baseDir));
         $ccr->addScriptFile('org.civicrm.volunteer', $fileName, $weight++);
     }
     // Add our template
     CRM_Core_Smarty::singleton()->assign('isModulePermissionSupported', CRM_Core_Config::singleton()->userPermissionClass->isModulePermissionSupported());
     CRM_Core_Region::instance('page-header')->add(array('template' => 'CRM/Volunteer/Form/Manage.tpl'));
     // Fetch event so we can set the default start time for needs
     // FIXME: Not the greatest for supporting non-events
     $entity = civicrm_api3(str_replace('civicrm_', '', $entity_table), 'getsingle', array('id' => $entity_id));
     // Static variables
     $ccr->addSetting(array('pseudoConstant' => array('volunteer_need_visibility' => array_flip(CRM_Volunteer_BAO_Need::buildOptions('visibility_id', 'validate')), 'volunteer_role' => CRM_Volunteer_BAO_Need::buildOptions('role_id', 'get'), 'volunteer_status' => CRM_Activity_BAO_Activity::buildOptions('status_id', 'validate')), 'volunteer' => array('default_date' => CRM_Utils_Array::value('start_date', $entity)), 'config' => array('timeInputFormat' => $config->timeInputFormat), 'constants' => array('CRM_Core_Action' => array('NONE' => 0, 'ADD' => 1, 'UPDATE' => 2, 'VIEW' => 4, 'DELETE' => 8, 'BROWSE' => 16, 'ENABLE' => 32, 'DISABLE' => 64, 'EXPORT' => 128, 'BASIC' => 256, 'ADVANCED' => 512, 'PREVIEW' => 1024, 'FOLLOWUP' => 2048, 'MAP' => 4096, 'PROFILE' => 8192, 'COPY' => 16384, 'RENEW' => 32768, 'DETACH' => 65536, 'REVERT' => 131072, 'CLOSE' => 262144, 'REOPEN' => 524288, 'MAX_ACTION' => 1048575))));
     // Check for problems
     _volunteer_checkResourceUrl();
 }
开发者ID:TobiasLounsbury,项目名称:org.civicrm.volunteer,代码行数:37,代码来源:Manage.php

示例3: addResources

 /**
  * Load needed JS, CSS and settings for the backend Volunteer Management UI
  */
 public static function addResources($entity_id, $entity_table)
 {
     static $loaded = FALSE;
     if ($loaded) {
         return;
     }
     $loaded = TRUE;
     $config = CRM_Core_Config::singleton();
     $ccr = CRM_Core_Resources::singleton();
     // Vendor libraries
     $ccr->addScriptFile('civicrm', 'packages/backbone/json2.js', 100, 'html-header', FALSE);
     $ccr->addScriptFile('civicrm', 'packages/backbone/backbone-min.js', 120, 'html-header');
     $ccr->addScriptFile('civicrm', 'packages/backbone/backbone.marionette.min.js', 125, 'html-header', FALSE);
     // Our stylesheet
     $ccr->addStyleFile('org.civicrm.volunteer', 'css/volunteer_app.css');
     // Add all scripts for our js app
     $weight = 0;
     $baseDir = CRM_Extension_System::singleton()->getMapper()->keyToBasePath('org.civicrm.volunteer') . '/';
     // This glob pattern will recurse the js directory up to 4 levels deep
     foreach (glob($baseDir . 'js/{*,*/*,*/*/*,*/*/*/*}.js', GLOB_BRACE) as $file) {
         $fileName = substr($file, strlen($baseDir));
         $ccr->addScriptFile('org.civicrm.volunteer', $fileName, $weight++);
     }
     // Add our template
     CRM_Core_Smarty::singleton()->assign('isModulePermissionSupported', CRM_Core_Config::singleton()->userPermissionClass->isModulePermissionSupported());
     CRM_Core_Region::instance('page-header')->add(array('template' => 'CRM/Volunteer/Form/Manage.tpl'));
     // Fetch event so we can set the default start time for needs
     // FIXME: Not the greatest for supporting non-events
     $entity = civicrm_api3(str_replace('civicrm_', '', $entity_table), 'getsingle', array('id' => $entity_id));
     // Static variables
     $ccr->addSetting(array('pseudoConstant' => array('volunteer_need_visibility' => array_flip(CRM_Volunteer_BAO_Need::buildOptions('visibility_id', 'validate')), 'volunteer_role' => CRM_Volunteer_BAO_Need::buildOptions('role_id', 'get'), 'volunteer_status' => CRM_Activity_BAO_Activity::buildOptions('status_id', 'validate')), 'volunteer' => array('default_date' => CRM_Utils_Array::value('start_date', $entity)), 'config' => array('timeInputFormat' => $config->timeInputFormat)));
     // Check for problems
     _volunteer_civicrm_check_resource_url();
 }
开发者ID:relldoesphp,项目名称:civivolunteer,代码行数:37,代码来源:Manage.php

示例4: postProcess

 /**
  * Process the form after the input has been submitted and validated.
  */
 public function postProcess()
 {
     $formparams = $this->exportValues();
     $caseId = $formparams['unclosed_case_id'];
     $filedActivities = 0;
     foreach ($this->_activityHolderIds as $key => $id) {
         $targetContactValues = $defaults = array();
         $params = array('id' => $id);
         CRM_Activity_BAO_Activity::retrieve($params, $defaults);
         if (CRM_Case_BAO_Case::checkPermission($id, 'File On Case', $defaults['activity_type_id'])) {
             if (!CRM_Utils_Array::crmIsEmptyArray($defaults['target_contact'])) {
                 $targetContactValues = array_combine(array_unique($defaults['target_contact']), explode(';', trim($defaults['target_contact_value'])));
                 $targetContactValues = implode(',', array_keys($targetContactValues));
             }
             $params = array('caseID' => $caseId, 'activityID' => $id, 'newSubject' => empty($defaults['subject']) ? '' : $defaults['subject'], 'targetContactIds' => $targetContactValues, 'mode' => 'file');
             $error_msg = CRM_Activity_Page_AJAX::_convertToCaseActivity($params);
             if (empty($error_msg['error_msg'])) {
                 $filedActivities++;
             } else {
                 CRM_Core_Session::setStatus($error_msg['error_msg'], ts("Error"), "error");
             }
         } else {
             CRM_Core_Session::setStatus(ts('Not permitted to file activity %1 %2.', array(1 => empty($defaults['subject']) ? '' : $defaults['subject'], 2 => $defaults['activity_date_time'])), ts("Error"), "error");
         }
     }
     CRM_Core_Session::setStatus($filedActivities, ts("Filed Activities"), "success");
     CRM_Core_Session::setStatus("", ts('Total Selected Activities: %1', array(1 => count($this->_activityHolderIds))), "info");
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:31,代码来源:FileOnCase.php

示例5: array

 static function &getFields()
 {
     $fields = array();
     $fields = CRM_Case_BAO_Case::exportableFields();
     // add activity related fields
     $fields = array_merge($fields, CRM_Activity_BAO_Activity::exportableFields('Case'));
     return $fields;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:8,代码来源:Query.php

示例6: _civicrm_api3_volunteer_assignment_create_spec

/**
 * Adjust Metadata for Create action
 *
 * The metadata is used for setting defaults, documentation & validation
 * @param array $params array or parameters determined by getfields
 */
function _civicrm_api3_volunteer_assignment_create_spec(&$params)
{
    $params['volunteer_need_id']['api.required'] = 1;
    $params['assignee_contact_id']['api.required'] = 1;
    $params['assignee_contact_id']['api.aliases'] = array('contact_id');
    $volunteerStatus = CRM_Activity_BAO_Activity::buildOptions('status_id', 'validate');
    $params['status_id']['api.default'] = array_search('Scheduled', $volunteerStatus);
}
开发者ID:adam-edison,项目名称:org.civicrm.volunteer,代码行数:14,代码来源:VolunteerAssignment.php

示例7: setDefaultValues

 function setDefaultValues()
 {
     if (isset($this->_activityId)) {
         $params = array('id' => $this->_activityId);
         CRM_Activity_BAO_Activity::retrieve($params, $defaults);
         $defaults['html_message'] = $defaults['details'];
         return $defaults;
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:9,代码来源:PDF.php

示例8: array_merge

 /**
  * Get fields.
  *
  * @param bool $excludeActivityFields
  *
  * @return array
  */
 public static function &getFields($excludeActivityFields = FALSE)
 {
     $fields = CRM_Case_BAO_Case::exportableFields();
     // add activity related fields
     if (!$excludeActivityFields) {
         $fields = array_merge($fields, CRM_Activity_BAO_Activity::exportableFields('Case'));
     }
     return $fields;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:16,代码来源:Query.php

示例9: array

 static function &getFields()
 {
     require_once 'CRM/Case/BAO/Case.php';
     $fields = array();
     $fields = CRM_Case_BAO_Case::exportableFields();
     // add activity related fields
     require_once 'CRM/Activity/BAO/Activity.php';
     $fields = array_merge($fields, CRM_Activity_BAO_Activity::exportableFields('Case'));
     return $fields;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:10,代码来源:Query.php

示例10: setDefaultValues

 /**
  * Set default values for the form.
  */
 public function setDefaultValues()
 {
     $defaults = array();
     if (isset($this->_activityId)) {
         $params = array('id' => $this->_activityId);
         CRM_Activity_BAO_Activity::retrieve($params, $defaults);
         $defaults['html_message'] = CRM_Utils_Array::value('details', $defaults);
     }
     $defaults = $defaults + CRM_Contact_Form_Task_PDFLetterCommon::setDefaultValues();
     return $defaults;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:14,代码来源:PDF.php

示例11: setDefaultValues

 /**
  * This function sets the default values for the form. For edit/view mode
  * the default values are retrieved from the database
  *
  * @access public
  *
  * @return None
  */
 function setDefaultValues()
 {
     $targetContactValues = $defaults = array();
     $params = array('id' => $this->_activityId);
     CRM_Activity_BAO_Activity::retrieve($params, $defaults);
     $defaults['case_activity_subject'] = $defaults['subject'];
     if (!CRM_Utils_Array::crmIsEmptyArray($defaults['target_contact'])) {
         $targetContactValues = array_combine(array_unique($defaults['target_contact']), explode(';', trim($defaults['target_contact_value'])));
     }
     $this->assign('targetContactValues', empty($targetContactValues) ? FALSE : $targetContactValues);
     return $defaults;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:20,代码来源:ActivityToCase.php

示例12: postProcess

 /**
  * process the form after the input has been submitted and validated
  *
  * @access public
  *
  * @return void
  */
 public function postProcess()
 {
     $deletedActivities = 0;
     foreach ($this->_activityHolderIds as $activityId['id']) {
         $moveToTrash = CRM_Case_BAO_Case::isCaseActivity($activityId['id']);
         if (CRM_Activity_BAO_Activity::deleteActivity($activityId, $moveToTrash)) {
             $deletedActivities++;
         }
     }
     CRM_Core_Session::setStatus($deletedActivities, ts('Deleted Activities'), "success");
     CRM_Core_Session::setStatus("", ts('Total Selected Activities: %1', array(1 => count($this->_activityHolderIds))), "info");
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:19,代码来源:Delete.php

示例13: setDefaultValues

 function setDefaultValues()
 {
     $defaults = array();
     if (isset($this->_activityId)) {
         $params = array('id' => $this->_activityId);
         CRM_Activity_BAO_Activity::retrieve($params, $defaults);
         $defaults['html_message'] = $defaults['details'];
     } else {
         $defaults['thankyou_update'] = 1;
     }
     $defaults = $defaults + CRM_Contact_Form_Task_PDFLetterCommon::setDefaultValues();
     return $defaults;
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:13,代码来源:PDFLetter.php

示例14: postProcess

 /**
  * process the form after the input has been submitted and validated
  *
  * @access public
  * @return None
  */
 public function postProcess()
 {
     $deletedActivities = 0;
     foreach ($this->_activityHolderIds as $activityId['id']) {
         require_once 'CRM/Case/BAO/Case.php';
         $moveToTrash = CRM_Case_BAO_Case::isCaseActivity($activityId['id']);
         if (CRM_Activity_BAO_Activity::deleteActivity($activityId, $moveToTrash)) {
             $deletedActivities++;
         }
     }
     $status = array(ts('Deleted Activities: %1', array(1 => $deletedActivities)), ts('Total Selected Activities: %1', array(1 => count($this->_activityHolderIds))));
     CRM_Core_Session::setStatus($status);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:19,代码来源:Delete.php

示例15: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     //get the activity values
     $activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     //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.'));
     }
     $session = CRM_Core_Session::singleton();
     if (!in_array($context, array('home', 'dashlet', 'dashletFullscreen'))) {
         $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
     } else {
         $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
     }
     $session->pushUserContext($url);
     $defaults = array();
     $params = array('id' => $activityId);
     CRM_Activity_BAO_Activity::retrieve($params, $defaults);
     //set activity type name and description to template
     list($activityTypeName, $activityTypeDescription) = CRM_Core_BAO_OptionValue::getActivityTypeDetails($defaults['activity_type_id']);
     $this->assign('activityTypeName', $activityTypeName);
     $this->assign('activityTypeDescription', $activityTypeDescription);
     if (CRM_Utils_Array::value('mailingId', $defaults)) {
         $this->_mailing_id = CRM_Utils_Array::value('source_record_id', $defaults);
         $mailingReport = CRM_Mailing_BAO_Mailing::report($this->_mailing_id, TRUE);
         CRM_Mailing_BAO_Mailing::getMailingContent($mailingReport, $this);
         $this->assign('mailingReport', $mailingReport);
         $full_open_report = CRM_Mailing_Event_BAO_Opened::getRows($this->_mailing_id, NULL, FALSE, NULL, NULL, NULL, $cid);
         $this->assign('openreport', $full_open_report);
         $click_thru_report = CRM_Mailing_Event_BAO_TrackableURLOpen::getRows($this->_mailing_id, NULL, FALSE, NULL, NULL, NULL, NULL, $cid);
         $this->assign('clickreport', $click_thru_report);
     }
     foreach ($defaults as $key => $value) {
         if (substr($key, -3) != '_id') {
             $values[$key] = $value;
         }
     }
     //get the campaign
     if ($campaignId = CRM_Utils_Array::value('campaign_id', $defaults)) {
         $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($campaignId);
         $values['campaign'] = $campaigns[$campaignId];
     }
     if ($engagementLevel = CRM_Utils_Array::value('engagement_level', $defaults)) {
         $engagementLevels = CRM_Campaign_PseudoConstant::engagementLevel();
         $values['engagement_level'] = CRM_Utils_Array::value($engagementLevel, $engagementLevels, $engagementLevel);
     }
     $values['attachment'] = CRM_Core_BAO_File::attachmentInfo('civicrm_activity', $activityId);
     $this->assign('values', $values);
 }
开发者ID:hguru,项目名称:224Civi,代码行数:57,代码来源:ActivityView.php


注:本文中的CRM_Activity_BAO_Activity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。