• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CRM_Core_BAO_File类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: create

 /**
  * Create a new HRJobDetails based on array-data
  *
  * @param array $params key-value pairs
  * @return CRM_HRJob_DAO_HRJobDetails|NULL
  *
  */
 public static function create($params)
 {
     $hook = empty($params['id']) ? 'create' : 'edit';
     $previousDetailsRevisionId = null;
     if ($hook == 'create') {
         $previousRevisionResult = civicrm_api3('HRJobContractRevision', 'getcurrentrevision', array('sequential' => 1, 'jobcontract_id' => $params['jobcontract_id']));
         if (!empty($previousRevisionResult['values']['details_revision_id'])) {
             $previousDetailsRevisionId = $previousRevisionResult['values']['details_revision_id'];
         }
     }
     $instance = parent::create($params);
     // setting 'effective_date' if it's not set:
     $revision = civicrm_api3('HRJobContractRevision', 'get', array('sequential' => 1, 'jobcontract_id' => $params['jobcontract_id'], 'id' => $instance->jobcontract_revision_id));
     if (!empty($revision['values'][0])) {
         $revisionData = array_shift($revision['values']);
         if (!$revisionData['effective_date']) {
             civicrm_api3('HRJobContractRevision', 'create', array('id' => $revisionData['id'], 'effective_date' => $instance->period_start_date));
         }
     }
     $revisionResult = civicrm_api3('HRJobContractRevision', 'get', array('sequential' => 1, 'id' => $instance->jobcontract_revision_id));
     $revision = CRM_Utils_Array::first($revisionResult['values']);
     $duplicate = CRM_Utils_Array::value('action', $params, $hook);
     if ($hook == 'create' && empty($revision['role_revision_id']) && $duplicate != 'duplicate' && empty($params['import'])) {
         //civicrm_api3('HRJobRole', 'create', array('jobcontract_id' => $revision['jobcontract_id'],'title' => $instance->title, 'location'=> $instance->location, 'percent_pay_role' => 100, 'jobcontract_revision_id' => $instance->jobcontract_revision_id));
         CRM_Hrjobcontract_BAO_HRJobRole::create(array('jobcontract_id' => $revision['jobcontract_id'], 'title' => $instance->title, 'location' => $instance->location, 'percent_pay_role' => 100, 'jobcontract_revision_id' => $instance->jobcontract_revision_id));
     }
     if ($previousDetailsRevisionId) {
         CRM_Core_BAO_File::copyEntityFile('civicrm_hrjobcontract_details', $previousDetailsRevisionId, 'civicrm_hrjobcontract_details', $revision['details_revision_id']);
     }
     $contract = new CRM_Hrjobcontract_DAO_HRJobContract();
     $contract->id = $revision['jobcontract_id'];
     $contract->find(true);
     CRM_Hrjobcontract_JobContractDates::setDates($contract->contact_id, $revision['jobcontract_id'], $instance->period_start_date, $instance->period_end_date);
     return $instance;
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:42,代码来源:HRJobDetails.php


示例2: run

 public function run()
 {
     $entityID = CRM_Utils_Request::retrieve('entityID', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
     $fileID = CRM_Utils_Request::retrieve('fileID', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
     $file = false;
     if (is_numeric($fileID)) {
         $file = civicrm_api3('File', 'getsingle', array('id' => $fileID));
     }
     try {
         CRM_Core_BAO_File::deleteAttachment();
     } catch (Exception $e) {
         return null;
     }
     //Do the backend-service delete
     if ($file && !empty($file['description'])) {
         $details = json_decode($file['description']);
         if ($details && property_exists($details, "source") && $details->source == "securefiles") {
             //Check extension level permissions
             CRM_Securefiles_Permission::checkFilePerms(CRM_Core_Action::DELETE, $fileID, $entityID);
             $backendService = CRM_Securefiles_Backend::getBackendService();
             if ($backendService) {
                 //Check backend service permissions
                 if ($backendService->checkPermissions(CRM_Core_Action::DELETE, $fileID, $entityID) !== false) {
                     $backendService->deleteFile($file['uri'], $entityID);
                 }
             }
         }
     }
 }
开发者ID:ginkgostreet,项目名称:com.ginkgostreet.securefiles,代码行数:29,代码来源:DeleteFile.php


示例3: run

 function run()
 {
     require_once 'CRM/Utils/Request.php';
     require_once 'CRM/Core/DAO.php';
     $eid = CRM_Utils_Request::retrieve('eid', 'Positive', $this, true);
     $fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, false);
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, true);
     $quest = CRM_Utils_Request::retrieve('quest', 'String', $this);
     $action = CRM_Utils_Request::retrieve('action', 'String', $this);
     require_once 'CRM/Core/BAO/File.php';
     list($path, $mimeType) = CRM_Core_BAO_File::path($id, $eid, null, $quest);
     if (!$path) {
         CRM_Core_Error::statusBounce('Could not retrieve the file');
     }
     $buffer = file_get_contents($path);
     if (!$buffer) {
         CRM_Core_Error::statusBounce('The file is either empty or you do not have permission to retrieve the file');
     }
     if ($action & CRM_Core_Action::DELETE) {
         if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) {
             CRM_Core_BAO_File::delete($id, $eid, $fid);
             CRM_Core_Session::setStatus(ts('The attached file has been deleted.'));
             $session = CRM_Core_Session::singleton();
             $toUrl = $session->popUserContext();
             CRM_Utils_System::redirect($toUrl);
         } else {
             $wrapper = new CRM_Utils_Wrapper();
             return $wrapper->run('CRM_Custom_Form_DeleteFile', ts('Domain Information Page'), null);
         }
     } else {
         require_once 'CRM/Utils/File.php';
         CRM_Utils_System::download(CRM_Utils_File::cleanFileName(basename($path)), $mimeType, $buffer);
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:34,代码来源:File.php


示例4: __construct

 /**
  * Constructor.
  *
  * @param null $path
  *   The class Path of the form being implemented
  * @param bool $title
  * @param string $mode
  * @param bool $imageUpload
  * @param bool $addSequence
  *   Should we add a unique sequence number to the end of the key.
  * @param bool $ignoreKey
  *   Should we not set a qfKey for this controller (for standalone forms).
  * @param bool $attachUpload
  *
  * @return \CRM_Core_Controller_Simple
  */
 public function __construct($path, $title, $mode = NULL, $imageUpload = FALSE, $addSequence = FALSE, $ignoreKey = FALSE, $attachUpload = FALSE)
 {
     // by definition a single page is modal :). We use the form name as the scope for this controller
     parent::__construct($title, TRUE, $mode, $path, $addSequence, $ignoreKey);
     $this->_stateMachine = new CRM_Core_StateMachine($this);
     $params = array($path => NULL);
     $savedAction = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, NULL);
     if (!empty($savedAction) && $savedAction != $mode) {
         $mode = $savedAction;
     }
     $this->_stateMachine->addSequentialPages($params, $mode);
     $this->addPages($this->_stateMachine, $mode);
     //changes for custom data type File
     $uploadNames = $this->get('uploadNames');
     $config = CRM_Core_Config::singleton();
     if (is_array($uploadNames) && !empty($uploadNames)) {
         $uploadArray = $uploadNames;
         $this->addActions($config->customFileUploadDir, $uploadArray);
         $this->set('uploadNames', NULL);
     } else {
         // always allow a single upload file with same name
         if ($attachUpload) {
             $this->addActions($config->uploadDir, CRM_Core_BAO_File::uploadNames());
         } elseif ($imageUpload) {
             $this->addActions($config->imageUploadDir, array('uploadFile'));
         } else {
             $this->addActions();
         }
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:46,代码来源:Simple.php


示例5: __construct

 /**
  * constructor
  *
  * @param string  path        the class Path of the form being implemented
  * @param string  title       the descriptive name for the page
  * @param int     mode        the mode that the form will operate on
  * @param boolean addSequence should we add a unique sequence number to the end of the key
  * @param boolean ignoreKey    should we not set a qfKey for this controller (for standalone forms)
  *
  * @return object
  * @access public
  */
 function __construct($path, $title, $mode = null, $imageUpload = false, $addSequence = false, $ignoreKey = false, $attachUpload = false)
 {
     // by definition a single page is modal :). We use the form name as the scope for this controller
     parent::__construct($title, true, $mode, $path, $addSequence, $ignoreKey);
     $this->_stateMachine =& new CRM_Core_StateMachine($this);
     $params = array($path => null);
     $this->_stateMachine->addSequentialPages($params, $mode);
     $this->addPages($this->_stateMachine, $mode);
     //changes for custom data type File
     $uploadNames = $this->get('uploadNames');
     $config =& CRM_Core_Config::singleton();
     if (is_array($uploadNames) && !empty($uploadNames)) {
         $uploadArray = $uploadNames;
         $this->addActions($config->customFileUploadDir, $uploadArray);
         $this->set('uploadNames', null);
     } else {
         // always allow a single upload file with same name
         if ($attachUpload) {
             require_once 'CRM/Core/BAO/File.php';
             $this->addActions($config->uploadDir, CRM_Core_BAO_File::uploadNames());
         } else {
             if ($imageUpload) {
                 $this->addActions($config->imageUploadDir, array('uploadFile'));
             } else {
                 $this->addActions();
             }
         }
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:41,代码来源:Simple.php


示例6: buildQuickForm

 public function buildQuickForm()
 {
     $session =& CRM_Core_Session::singleton();
     $this->add('text', 'test_email', ts('Send to This Address'));
     $defaults['test_email'] = $session->get('ufUniqID');
     $qfKey = $this->get('qfKey');
     $this->add('select', 'test_group', ts('Send to This Group'), array('' => ts('- none -')) + CRM_Core_PseudoConstant::group('Mailing'));
     $this->setDefaults($defaults);
     $this->add('submit', 'sendtest', ts('Send a Test Mailing'));
     //FIXME : currently we are hiding save an continue later when
     //search base mailing, we should handle it when we fix CRM-3876
     $buttons = array(array('type' => 'back', 'name' => '<< Previous'), array('type' => 'next', 'name' => ts('Next >>'), 'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;', 'isDefault' => true), array('type' => 'submit', 'name' => ts('Save & Continue Later')), array('type' => 'cancel', 'name' => ts('Cancel')));
     if ($this->get('context') == 'search' && $this->get('ssID')) {
         $buttons = array(array('type' => 'back', 'name' => '<< Previous'), array('type' => 'next', 'name' => ts('Next >>'), 'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel')));
     }
     $this->addButtons($buttons);
     $mailingID = $this->get('mailing_id');
     $textFile = $this->get('textFile');
     $htmlFile = $this->get('htmlFile');
     $subject = $this->get('subject');
     $this->assign('subject', $subject);
     $this->addFormRule(array('CRM_Mailing_Form_Test', 'testMail'), $this);
     $preview = array();
     if ($textFile) {
         $preview['text_link'] = CRM_Utils_System::url('civicrm/mailing/preview', "type=text&qfKey={$qfKey}");
     }
     if ($htmlFile) {
         $preview['html_link'] = CRM_Utils_System::url('civicrm/mailing/preview', "type=html&qfKey={$qfKey}");
     }
     require_once 'CRM/Core/BAO/File.php';
     $preview['attachment'] = CRM_Core_BAO_File::attachmentInfo('civicrm_mailing', $mailingID);
     $this->assign('preview', $preview);
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:33,代码来源:Test.php


示例7: run

 public function run()
 {
     $eid = CRM_Utils_Request::retrieve('eid', 'Positive', $this, TRUE);
     $fid = CRM_Utils_Request::retrieve('fid', 'Positive', $this, FALSE);
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
     $quest = CRM_Utils_Request::retrieve('quest', 'String', $this);
     $action = CRM_Utils_Request::retrieve('action', 'String', $this);
     list($path, $mimeType) = CRM_Core_BAO_File::path($id, $eid, NULL, $quest);
     if (!$path) {
         CRM_Core_Error::statusBounce('Could not retrieve the file');
     }
     $buffer = file_get_contents($path);
     if (!$buffer) {
         CRM_Core_Error::statusBounce('The file is either empty or you do not have permission to retrieve the file');
     }
     if ($action & CRM_Core_Action::DELETE) {
         if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) {
             CRM_Core_BAO_File::deleteFileReferences($id, $eid, $fid);
             CRM_Core_Session::setStatus(ts('The attached file has been deleted.'), ts('Complete'), 'success');
             $session = CRM_Core_Session::singleton();
             $toUrl = $session->popUserContext();
             CRM_Utils_System::redirect($toUrl);
         }
     } else {
         CRM_Utils_System::download(CRM_Utils_File::cleanFileName(basename($path)), $mimeType, $buffer);
     }
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:27,代码来源:File.php


示例8: postProcess

 /**
  * Process the form when submitted
  *
  * @return void
  * @access public
  */
 public function postProcess()
 {
     CRM_Core_BAO_File::delete($this->_id, $this->_eid);
     CRM_Core_Session::setStatus(ts('The attached file has been deleted.'));
     $session = CRM_Core_Session::singleton();
     $toUrl = $session->popUserContext();
     CRM_Utils_System::redirect($toUrl);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:14,代码来源:DeleteFile.php


示例9: fileDelete

 function fileDelete()
 {
     // delete file
     $postParams = $_POST;
     $fileId = $postParams['fileID'];
     CRM_Core_BAO_File::deleteEntityFile($postParams['entityTable'], $postParams['entityID'], $fileTypeID = NULL, $fileId);
     CRM_Utils_System::civiExit();
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:8,代码来源:Files.php


示例10: template

 /**
  * Fetch the template text/html messages
  */
 public static function template()
 {
     $templateId = CRM_Utils_Type::escape($_POST['tid'], 'Integer');
     $messageTemplate = new CRM_Core_DAO_MessageTemplate();
     $messageTemplate->id = $templateId;
     $messageTemplate->selectAdd();
     $messageTemplate->selectAdd('msg_text, msg_html, msg_subject, pdf_format_id');
     $messageTemplate->find(TRUE);
     $messages = array('subject' => $messageTemplate->msg_subject, 'msg_text' => $messageTemplate->msg_text, 'msg_html' => $messageTemplate->msg_html, 'pdf_format_id' => $messageTemplate->pdf_format_id);
     $documentInfo = CRM_Core_BAO_File::getEntityFile('civicrm_msg_template', $templateId);
     foreach ((array) $documentInfo as $info) {
         list($messages['document_body']) = CRM_Utils_PDF_Document::docReader($info['fullPath'], $info['mime_type']);
     }
     CRM_Utils_JSON::output($messages);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:18,代码来源:AJAX.php


示例11: run

 /** 
  * run this page (figure out the action needed and perform it).
  * 
  * @return void
  */
 function run()
 {
     require_once 'CRM/Mailing/BAO/Mailing.php';
     $session =& CRM_Core_Session::singleton();
     $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', CRM_Core_DAO::$_nullObject, false, 'text');
     $type = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject, false, 'text');
     $options = array();
     $session->getVars($options, "CRM_Mailing_Controller_Send_{$qfKey}");
     //get the options if control come from search context, CRM-3711
     if (empty($options)) {
         $session->getVars($options, "CRM_Contact_Controller_Search_{$qfKey}");
     }
     // FIXME: the below and CRM_Mailing_Form_Test::testMail()
     // should be refactored
     $fromEmail = null;
     $mailing =& new CRM_Mailing_BAO_Mailing();
     if (!empty($options)) {
         $mailing->id = $options['mailing_id'];
         $fromEmail = $options['from_email'];
     }
     $mailing->find(true);
     CRM_Mailing_BAO_Mailing::tokenReplace($mailing);
     if (defined('CIVICRM_MAIL_SMARTY')) {
         require_once 'CRM/Core/Smarty/resources/String.php';
         civicrm_smarty_register_string_resource();
     }
     // get and format attachments
     require_once 'CRM/Core/BAO/File.php';
     $attachments =& CRM_Core_BAO_File::getEntityFile('civicrm_mailing', $mailing->id);
     //get details of contact with token value including Custom Field Token Values.CRM-3734
     $returnProperties = $mailing->getReturnProperties();
     $params = array('contact_id' => $session->get('userID'));
     $details = $mailing->getDetails($params, $returnProperties);
     $mime =& $mailing->compose(null, null, null, $session->get('userID'), $fromEmail, $fromEmail, true, $details[0][$session->get('userID')], $attachments);
     // there doesn't seem to be a way to get to Mail_Mime's text and HTML
     // parts, so we steal a peek at Mail_Mime's private properties, render
     // them and exit
     // note that preview does not display any attachments
     $mime->get();
     if ($type == 'html') {
         header('Content-Type: text/html; charset=utf-8');
         print $mime->_htmlbody;
     } else {
         header('Content-Type: text/plain; charset=utf-8');
         print $mime->_txtbody;
     }
     exit;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:53,代码来源:Preview.php


示例12: preProcess

 /**
  * Set variables up before form is built.
  *
  * @return void
  */
 public function preProcess()
 {
     $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->assign('context', $context);
     $values = array();
     $params['id'] = $this->_id;
     CRM_Grant_BAO_Grant::retrieve($params, $values);
     $grantType = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'grant_type_id');
     $grantStatus = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'status_id');
     $this->assign('grantType', $grantType[$values['grant_type_id']]);
     $this->assign('grantStatus', $grantStatus[$values['status_id']]);
     $grantTokens = array('amount_total', 'amount_requested', 'amount_granted', 'rationale', 'grant_report_received', 'application_received_date', 'decision_date', 'money_transfer_date', 'grant_due_date');
     foreach ($grantTokens as $token) {
         $this->assign($token, CRM_Utils_Array::value($token, $values));
     }
     if (isset($this->_id)) {
         $noteDAO = new CRM_Core_BAO_Note();
         $noteDAO->entity_table = 'civicrm_grant';
         $noteDAO->entity_id = $this->_id;
         if ($noteDAO->find(TRUE)) {
             $this->_noteId = $noteDAO->id;
         }
     }
     if (isset($this->_noteId)) {
         $this->assign('note', CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Note', $this->_noteId, 'note'));
     }
     // add Grant to Recent Items
     $url = CRM_Utils_System::url('civicrm/contact/view/grant', "action=view&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
     $title = CRM_Contact_BAO_Contact::displayName($values['contact_id']) . ' - ' . ts('Grant') . ': ' . CRM_Utils_Money::format($values['amount_total']) . ' (' . $grantType[$values['grant_type_id']] . ')';
     $recentOther = array();
     if (CRM_Core_Permission::checkActionPermission('CiviGrant', CRM_Core_Action::UPDATE)) {
         $recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/grant', "action=update&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
     }
     if (CRM_Core_Permission::checkActionPermission('CiviGrant', CRM_Core_Action::DELETE)) {
         $recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/grant', "action=delete&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
     }
     CRM_Utils_Recent::add($title, $url, $values['id'], 'Grant', $values['contact_id'], NULL, $recentOther);
     $attachment = CRM_Core_BAO_File::attachmentInfo('civicrm_grant', $this->_id);
     $this->assign('attachment', $attachment);
     $grantType = CRM_Core_DAO::getFieldValue("CRM_Grant_DAO_Grant", $this->_id, "grant_type_id");
     $groupTree =& CRM_Core_BAO_CustomGroup::getTree("Grant", $this, $this->_id, 0, $grantType);
     CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $this->_id);
     $this->assign('id', $this->_id);
     $this->setPageTitle(ts('Grant'));
 }
开发者ID:scardinius,项目名称:civicrm-core,代码行数:52,代码来源:GrantView.php


示例13: __construct

 /**
  * Class constructor.
  *
  * @param string $title
  * @param bool|int $action
  * @param bool $modal
  */
 public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
 {
     parent::__construct($title, $modal, NULL, FALSE, TRUE);
     $mailingID = CRM_Utils_Request::retrieve('mid', 'String', $this, FALSE, NULL);
     // also get the text and html file
     $txtFile = CRM_Utils_Request::retrieve('txtFile', 'String', CRM_Core_DAO::$_nullObject, FALSE, NULL);
     $config = CRM_Core_Config::singleton();
     if ($txtFile && file_exists($config->uploadDir . $txtFile)) {
         $this->set('textFilePath', $config->uploadDir . $txtFile);
     }
     $this->_stateMachine = new CRM_SMS_StateMachine_Send($this, $action, $mailingID);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $uploadNames = array_merge(array('textFile'), CRM_Core_BAO_File::uploadNames());
     $this->addActions(CRM_Core_Config::singleton()->uploadDir, $uploadNames);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:24,代码来源:Send.php


示例14: create

 /**
  * Create a new HRJobPension based on array-data
  *
  * @param array $params key-value pairs
  * @return CRM_HRJob_DAO_HRJobPension|NULL
  * 
  */
 public static function create($params)
 {
     $hook = empty($params['id']) ? 'create' : 'edit';
     $previousPensionRevisionId = null;
     if ($hook == 'create') {
         $previousRevisionResult = civicrm_api3('HRJobContractRevision', 'getcurrentrevision', array('sequential' => 1, 'jobcontract_id' => $params['jobcontract_id']));
         if (!empty($previousRevisionResult['values']['pension_revision_id'])) {
             $previousPensionRevisionId = $previousRevisionResult['values']['pension_revision_id'];
         }
     }
     $instance = parent::create($params);
     $revisionResult = civicrm_api3('HRJobContractRevision', 'get', array('sequential' => 1, 'id' => $instance->jobcontract_revision_id));
     $revision = CRM_Utils_Array::first($revisionResult['values']);
     if ($previousPensionRevisionId) {
         CRM_Core_BAO_File::copyEntityFile('civicrm_hrjobcontract_pension', $previousPensionRevisionId, 'civicrm_hrjobcontract_pension', $revision['pension_revision_id']);
     }
     return $instance;
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:25,代码来源:HRJobPension.php


示例15: view

 /**
  * View details of a note
  *
  * @return void
  * @access public
  */
 function view()
 {
     $note = new CRM_Core_DAO_Note();
     $note->id = $this->_id;
     if ($note->find(TRUE)) {
         $values = array();
         CRM_Core_DAO::storeValues($note, $values);
         $values['privacy'] = CRM_Core_OptionGroup::optionLabel('note_privacy', $values['privacy']);
         $this->assign('note', $values);
     }
     $comments = CRM_Core_BAO_Note::getNoteTree($values['id'], 1);
     if (!empty($comments)) {
         $this->assign('comments', $comments);
     }
     // add attachments part
     $currentAttachmentInfo = CRM_Core_BAO_File::getEntityFile('civicrm_note', $this->_id);
     $this->assign('currentAttachmentInfo', $currentAttachmentInfo);
 }
开发者ID:hguru,项目名称:224Civi,代码行数:24,代码来源:Note.php


示例16: __construct

 /**
  * class constructor
  */
 function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
 {
     parent::__construct($title, $modal);
     $this->_stateMachine = new CRM_Event_StateMachine_Search($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     $session = CRM_Core_Session::singleton();
     $uploadNames = $session->get('uploadNames');
     if (!empty($uploadNames)) {
         $uploadNames = array_merge($uploadNames, CRM_Core_BAO_File::uploadNames());
     } else {
         $uploadNames = CRM_Core_BAO_File::uploadNames();
     }
     $config = CRM_Core_Config::singleton();
     $uploadDir = $config->uploadDir;
     // add all the actions
     $this->addActions($uploadDir, $uploadNames);
 }
开发者ID:hguru,项目名称:224Civi,代码行数:21,代码来源:Search.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);
     $values = array();
     $params['id'] = $this->_id;
     require_once 'CRM/Grant/BAO/Grant.php';
     CRM_Grant_BAO_Grant::retrieve($params, $values);
     require_once 'CRM/Grant/PseudoConstant.php';
     $grantType = CRM_Grant_PseudoConstant::grantType();
     $grantStatus = CRM_Grant_PseudoConstant::grantStatus();
     $this->assign('grantType', $grantType[$values['grant_type_id']]);
     $this->assign('grantStatus', $grantStatus[$values['status_id']]);
     $grantTokens = array('amount_total', 'amount_requested', 'amount_granted', 'rationale', 'grant_report_received', 'application_received_date', 'decision_date', 'money_transfer_date', 'grant_due_date');
     foreach ($grantTokens as $token) {
         $this->assign($token, CRM_Utils_Array::value($token, $values));
     }
     if (isset($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;
         }
     }
     if (isset($this->_noteId)) {
         $this->assign('note', CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Note', $this->_noteId, 'note'));
     }
     // add Grant to Recent Items
     require_once 'CRM/Utils/Recent.php';
     require_once 'CRM/Contact/BAO/Contact.php';
     require_once 'CRM/Utils/Money.php';
     $url = CRM_Utils_System::url('civicrm/contact/view/grant', "action=view&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
     $title = CRM_Contact_BAO_Contact::displayName($values['contact_id']) . ' - ' . ts('Grant') . ': ' . CRM_Utils_Money::format($values['amount_total']) . ' (' . $grantType[$values['grant_type_id']] . ')';
     CRM_Utils_Recent::add($title, $url, $values['id'], 'Grant', $values['contact_id'], null);
     require_once 'CRM/Core/BAO/File.php';
     $attachment = CRM_Core_BAO_File::attachmentInfo('civicrm_grant', $this->_id);
     $this->assign('attachment', $attachment);
     $groupTree =& CRM_Core_BAO_CustomGroup::getTree("Grant", $this, $this->_id, 0);
     CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
     $this->assign('id', $this->_id);
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:49,代码来源:GrantView.php


示例18: __construct

 /**
  * class constructor
  */
 function __construct($title = null, $action = CRM_Core_Action::NONE, $modal = true)
 {
     require_once 'CRM/Event/StateMachine/Search.php';
     parent::__construct($title, $modal);
     $this->_stateMachine =& new CRM_Event_StateMachine_Search($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     require_once 'CRM/Core/BAO/File.php';
     $session =& CRM_Core_Session::singleton();
     $uploadNames = $session->get('uploadNames');
     if (!empty($uploadNames)) {
         $uploadNames = array_merge($uploadNames, CRM_Core_BAO_File::uploadNames());
     } else {
         $uploadNames = CRM_Core_BAO_File::uploadNames();
     }
     $config =& CRM_Core_Config::singleton();
     $uploadDir = $config->uploadDir;
     // add all the actions
     $this->addActions($uploadDir, $uploadNames);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:23,代码来源:Search.php


示例19: __construct

 /**
  * Class constructor.
  *
  * @param null $title
  * @param bool|int $action
  * @param bool $modal
  */
 public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
 {
     parent::__construct($title, $modal);
     $this->_stateMachine = new CRM_Tournament_Team_StateMachine($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // hack for now, set Search to Basic mode
     //$this->_pages['Basic']->setAction(CRM_Core_Action::BASIC);
     // add all the actions
     $config = CRM_Core_Config::singleton();
     // to handle file type custom data
     $uploadDir = $config->uploadDir;
     $uploadNames = $this->get('uploadNames');
     if (!empty($uploadNames)) {
         $uploadNames = array_merge($uploadNames, CRM_Core_BAO_File::uploadNames());
     } else {
         $uploadNames = CRM_Core_BAO_File::uploadNames();
     }
     // add all the actions
     $this->addActions($uploadDir, $uploadNames);
 }
开发者ID:agloa,项目名称:tournament,代码行数:28,代码来源:Controller.php


示例20: 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 ($context != 'home') {
         $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);
     $params = array('id' => $activityId);
     CRM_Activity_BAO_Activity::retrieve($params, $defaults);
     //set activity type name and description to template
     require_once 'CRM/Core/BAO/OptionValue.php';
     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);
         require_once 'CRM/Mailing/BAO/Mailing.php';
         $mailingReport =& CRM_Mailing_BAO_Mailing::report($this->_mailing_id, true);
         CRM_Mailing_BAO_Mailing::getMailingContent($mailingReport, $this);
         $this->assign('mailingReport', $mailingReport);
     }
     foreach ($defaults as $key => $value) {
         if (substr($key, -3) != '_id') {
             $values[$key] = $value;
         }
     }
     require_once 'CRM/Core/BAO/File.php';
     $values['attachment'] = CRM_Core_BAO_File::attachmentInfo('civicrm_activity', $activityId);
     $this->assign('values', $values);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:46,代码来源:ActivityView.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CRM_Core_BAO_FinancialTrxn类代码示例发布时间:2022-05-20
下一篇:
PHP CRM_Core_BAO_EntityTag类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap