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


PHP CRM_Utils_System类代码示例

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


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

示例1: route

 /**
  * @param array $cxn
  * @param string $entity
  * @param string $action
  * @param array $params
  * @return mixed
  */
 public static function route($cxn, $entity, $action, $params)
 {
     $SUPER_PERM = array('administer CiviCRM');
     require_once 'api/v3/utils.php';
     // FIXME: Shouldn't the X-Forwarded-Proto check be part of CRM_Utils_System::isSSL()?
     if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL') && !CRM_Utils_System::isSSL() && strtolower(CRM_Utils_Array::value('X_FORWARDED_PROTO', CRM_Utils_System::getRequestHeaders())) != 'https') {
         return civicrm_api3_create_error('System policy requires HTTPS.');
     }
     // Note: $cxn and cxnId are authenticated before router is called.
     $dao = new CRM_Cxn_DAO_Cxn();
     $dao->cxn_id = $cxn['cxnId'];
     if (empty($cxn['cxnId']) || !$dao->find(TRUE) || !$dao->cxn_id) {
         return civicrm_api3_create_error('Failed to lookup connection authorizations.');
     }
     if (!$dao->is_active) {
         return civicrm_api3_create_error('Connection is inactive.');
     }
     if (!is_string($entity) || !is_string($action) || !is_array($params)) {
         return civicrm_api3_create_error('API parameters are malformed.');
     }
     if (empty($cxn['perm']['api']) || !is_array($cxn['perm']['api']) || empty($cxn['perm']['grant']) || !(is_array($cxn['perm']['grant']) || is_string($cxn['perm']['grant']))) {
         return civicrm_api3_create_error('Connection has no permissions.');
     }
     $whitelist = \Civi\API\WhitelistRule::createAll($cxn['perm']['api']);
     \Civi::service('dispatcher')->addSubscriber(new \Civi\API\Subscriber\WhitelistSubscriber($whitelist));
     CRM_Core_Config::singleton()->userPermissionTemp = new CRM_Core_Permission_Temp();
     if ($cxn['perm']['grant'] === '*') {
         CRM_Core_Config::singleton()->userPermissionTemp->grant($SUPER_PERM);
     } else {
         CRM_Core_Config::singleton()->userPermissionTemp->grant($cxn['perm']['grant']);
     }
     $params['check_permissions'] = 'whitelist';
     return civicrm_api($entity, $action, $params);
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:41,代码来源:ApiRouter.php

示例2: run

 function run()
 {
     $upgrade = new CRM_Upgrade_Form();
     $message = ts('CiviCRM upgrade successful');
     if ($upgrade->checkVersion($upgrade->latestVersion)) {
         $message = ts('Your database has already been upgraded to CiviCRM %1', array(1 => $upgrade->latestVersion));
     } elseif ($upgrade->checkVersion('2.1.2') || $upgrade->checkVersion('2.1.3') || $upgrade->checkVersion('2.1.4') || $upgrade->checkVersion('2.1.5')) {
         // do nothing, db version is changed for all upgrades
     } elseif ($upgrade->checkVersion('2.1.0') || $upgrade->checkVersion('2.1') || $upgrade->checkVersion('2.1.1')) {
         // 2.1 to 2.1.2
         $this->runTwoOneTwo();
     } else {
         // 2.0 to 2.1
         for ($i = 1; $i <= 4; $i++) {
             $this->runForm($i);
         }
         // 2.1 to 2.1.2
         $this->runTwoOneTwo();
     }
     // just change the ver in the db, since nothing to upgrade
     $upgrade->setVersion($upgrade->latestVersion);
     // also cleanup the templates_c directory
     $config = CRM_Core_Config::singleton();
     $config->cleanup(1);
     $template = CRM_Core_Smarty::singleton();
     $template->assign('message', $message);
     $template->assign('pageTitle', ts('Upgrade CiviCRM to Version %1', array(1 => $upgrade->latestVersion)));
     $template->assign('menuRebuildURL', CRM_Utils_System::url('civicrm/menu/rebuild', 'reset=1'));
     $contents = $template->fetch('CRM/common/success.tpl');
     echo $contents;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:31,代码来源:Upgrade.php

示例3: run

function run()
{
    session_start();
    require_once '../civicrm.config.php';
    require_once 'CRM/Core/Config.php';
    $config = CRM_Core_Config::singleton();
    require_once 'Console/Getopt.php';
    $shortOptions = "n:p:k:pre";
    $longOptions = array('name=', 'pass=', 'key=', 'prefix=');
    $getopt = new Console_Getopt();
    $args = $getopt->readPHPArgv();
    array_shift($args);
    list($valid, $dontCare) = $getopt->getopt2($args, $shortOptions, $longOptions);
    $vars = array('name' => 'n', 'pass' => 'p', 'key' => 'k', 'prefix' => 'pre');
    foreach ($vars as $var => $short) {
        ${$var} = NULL;
        foreach ($valid as $v) {
            if ($v[0] == $short || $v[0] == "--{$var}") {
                ${$var} = $v[1];
                break;
            }
        }
        if (!${$var}) {
            ${$var} = CRM_Utils_Array::value($var, $_REQUEST);
        }
        $_REQUEST[$var] = ${$var};
    }
    // this does not return on failure
    // require_once 'CRM/Utils/System.php';
    CRM_Utils_System::authenticateScript(TRUE, $name, $pass);
    //log the execution of script
    CRM_Core_Error::debug_log_message('NormalizePhone.php');
    // process all phones
    processPhones($config, $prefix);
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:35,代码来源:NormalizePhone.php

示例4: buildQuickForm

 /**
  * Function to build the form
  *
  * @access public
  * @return None
  */
 function buildQuickForm()
 {
     CRM_Utils_System::setTitle(ts('Add Contacts to Organization'));
     $this->addElement('text', 'name', ts('Find Target Organization'));
     $this->add('select', 'relationship_type_id', ts('Relationship Type'), array('' => ts('- select -')) + CRM_Contact_BAO_Relationship::getRelationType("Organization"), true);
     $searchRows = $this->get('searchRows');
     $searchCount = $this->get('searchCount');
     if ($searchRows) {
         $checkBoxes = array();
         $chekFlag = 0;
         foreach ($searchRows as $id => $row) {
             if (!$chekFlag) {
                 $chekFlag = $id;
             }
             $checkBoxes[$id] = $this->createElement('radio', null, null, null, $id);
         }
         $this->addGroup($checkBoxes, 'contact_check');
         if ($chekFlag) {
             $checkBoxes[$chekFlag]->setChecked(true);
         }
         $this->assign('searchRows', $searchRows);
     }
     $this->assign('searchCount', $searchCount);
     $this->assign('searchDone', $this->get('searchDone'));
     $this->assign('contact_type_display', ts('Organization'));
     $this->addElement('submit', $this->getButtonName('refresh'), ts('Search'), array('class' => 'form-submit'));
     $this->addElement('submit', $this->getButtonName('cancel'), ts('Cancel'), array('class' => 'form-submit'));
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Add to Organization'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:35,代码来源:AddToOrganization.php

示例5: buildQuickForm

 /**
  * Build the form - it consists of
  *    - displaying the QILL (query in local language)
  *    - displaying elements for saving the search
  *
  * @access public
  * @return void
  */
 function buildQuickForm()
 {
     CRM_Utils_System::setTitle(ts('Smart Group'));
     require_once "CRM/Event/BAO/Query.php";
     // get the qill
     $query =& new CRM_Event_BAO_Query($this->get('formValues'));
     $qill = $query->qill();
     // need to save qill for the smarty template
     $this->assign('qill', $qill);
     // the name and description are actually stored with the group and not the saved search
     $this->add('text', 'title', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'title'), true);
     $this->addElement('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'description'));
     // get the group id for the saved search
     $groupId = null;
     if (isset($this->_id)) {
         $params = array('saved_search_id' => $this->_id);
         require_once "CRM/Contact/BAO/Group.php";
         CRM_Contact_BAO_Group::retrieve($params, $values);
         $groupId = $values['id'];
         $this->addDefaultButtons(ts('Update Smart Group'));
     } else {
         $this->addDefaultButtons(ts('Save Smart Group'));
     }
     $this->addRule('title', ts('Name already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Group', $groupId, 'title'));
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:33,代码来源:SaveSearch.php

示例6: buildQuickForm

 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     CRM_Utils_System::setTitle(ts('Settings - Search Preferences'));
     // @todo remove the following adds in favour of setting via the settings array (above).
     $this->addYesNo('includeWildCardInName', ts('Automatic Wildcard'));
     $this->addYesNo('includeEmailInName', ts('Include Email'));
     $this->addYesNo('includeNickNameInName', ts('Include Nickname'));
     $this->addYesNo('includeAlphabeticalPager', ts('Include Alphabetical Pager'));
     $this->addYesNo('includeOrderByClause', ts('Include Order By Clause'));
     $this->addElement('text', 'smartGroupCacheTimeout', ts('Smart group cache timeout'), array('size' => 3, 'maxlength' => 5));
     $types = array('Contact', 'Individual', 'Organization', 'Household');
     $profiles = CRM_Core_BAO_UFGroup::getProfiles($types);
     $this->add('select', 'defaultSearchProfileID', ts('Default Contact Search Profile'), array('' => ts('- none -')) + $profiles, FALSE, array('class' => 'crm-select2 huge'));
     // Autocomplete for Contact Search (quick search etc.)
     $options = array(ts('Contact Name') => 1) + array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', FALSE, FALSE, TRUE));
     $this->addCheckBox('autocompleteContactSearch', ts('Autocomplete Contact Search'), $options, NULL, NULL, NULL, NULL, array('&nbsp;&nbsp;'));
     $element = $this->getElement('autocompleteContactSearch');
     $element->_elements[0]->_flagFrozen = TRUE;
     // Autocomplete for Contact Reference (custom fields)
     $optionsCR = array(ts('Contact Name') => 1) + array_flip(CRM_Core_OptionGroup::values('contact_reference_options', FALSE, FALSE, TRUE));
     $this->addCheckBox('autocompleteContactReference', ts('Contact Reference Options'), $optionsCR, NULL, NULL, NULL, NULL, array('&nbsp;&nbsp;'));
     $element = $this->getElement('autocompleteContactReference');
     $element->_elements[0]->_flagFrozen = TRUE;
     parent::buildQuickForm();
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:28,代码来源:Search.php

示例7: preProcess

 /** 
  * Heart of the viewing process. The runner gets all the meta data for 
  * the contact and calls the appropriate type of page to view. 
  * 
  * @return void 
  * @access public 
  * 
  */
 function preProcess()
 {
     // Make sure case types have been configured for the component
     require_once 'CRM/Core/OptionGroup.php';
     $caseType = CRM_Core_OptionGroup::values('case_type');
     if (empty($caseType)) {
         $this->assign('notConfigured', 1);
         return;
     }
     $session =& CRM_Core_Session::singleton();
     $allCases = CRM_Utils_Request::retrieve('all', 'Positive', $session);
     CRM_Utils_System::setTitle(ts('CiviCase Dashboard'));
     $userID = $session->get('userID');
     if (!$allCases) {
         $this->assign('myCases', true);
     } else {
         $this->assign('myCases', false);
     }
     $this->assign('newClient', false);
     if (CRM_Core_Permission::check('add contacts')) {
         $this->assign('newClient', true);
     }
     require_once 'CRM/Case/BAO/Case.php';
     $summary = CRM_Case_BAO_Case::getCasesSummary($allCases, $userID);
     $upcoming = CRM_Case_BAO_Case::getCases($allCases, $userID, 'upcoming');
     $recent = CRM_Case_BAO_Case::getCases($allCases, $userID, 'recent');
     $this->assign('casesSummary', $summary);
     if (!empty($upcoming)) {
         $this->assign('upcomingCases', $upcoming);
     }
     if (!empty($recent)) {
         $this->assign('recentCases', $recent);
     }
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:42,代码来源:DashBoard.php

示例8: getBatchList

 /**
  * Retrieve records.
  */
 public static function getBatchList()
 {
     $sortMapper = array(0 => 'batch.title', 1 => 'batch.type_id', 2 => '', 3 => 'batch.total', 4 => 'batch.status_id', 5 => '');
     $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';
     $context = isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL;
     $params = $_REQUEST;
     if ($sort && $sortOrder) {
         $params['sortBy'] = $sort . ' ' . $sortOrder;
     }
     $params['page'] = $offset / $rowCount + 1;
     $params['rp'] = $rowCount;
     if ($context != 'financialBatch') {
         // data entry status batches
         $params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status', 'Data Entry', 'name');
     }
     $params['context'] = $context;
     // get batch list
     $batches = CRM_Batch_BAO_Batch::getBatchListSelector($params);
     $iFilteredTotal = $iTotal = $params['total'];
     if ($context == 'financialBatch') {
         $selectorElements = array('check', 'batch_name', 'payment_instrument', 'item_count', 'total', 'status', 'created_by', 'links');
     } else {
         $selectorElements = array('batch_name', 'type', 'item_count', 'total', 'status', 'created_by', 'links');
     }
     CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($batches, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:35,代码来源:AJAX.php

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

示例10: preProcess

 /**
  * set up variables to build the form
  *
  * @return void
  * @acess protected
  */
 function preProcess()
 {
     $this->_srcFID = CRM_Utils_Request::retrieve('fid', 'Positive', $this, true);
     $this->_srcGID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $this->_srcFID, 'custom_group_id');
     $this->_label = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $this->_srcFID, 'label');
     CRM_Utils_System::setTitle(ts('Custom Field Move: %1', array(1 => $this->_label)));
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:13,代码来源:MoveField.php

示例11: run

 function run()
 {
     $sql = "SELECT * FROM civicrm_metrics_server ORDER BY site_name, timestamp";
     $dao =& CRM_Core_DAO::executeQuery($sql);
     $rows = array();
     while ($dao->fetch()) {
         $row = array();
         $row['id'] = $dao->id;
         $row['site_name'] = $dao->site_name;
         $row['site_url'] = $dao->site_url;
         $row['timestamp'] = $dao->timestamp;
         $row['type'] = $dao->type;
         $row['data'] = $dao->data;
         $rows[] = $row;
     }
     if (array_key_exists("export", $_REQUEST) && $_REQUEST['export'] == 'csv') {
         header('Content-type: text/csv');
         header('Content-disposition: attachment;filename=metrics_data_' . date("Ymd_HiO") . '.csv');
         $output = fopen('php://output', 'w');
         $headers = array("Id", "Site Name", "Site URL", "Timestamp", "Metric Type", "Metric Data");
         fputcsv($output, $headers);
         foreach ($rows as $row) {
             fputcsv($output, $row);
         }
         fclose($output);
         die;
     } else {
         CRM_Utils_System::setTitle(ts('Metrics Report'));
         $this->assign('data', $rows);
         $this->assign('headers', array_keys($rows[0]));
         parent::run();
     }
 }
开发者ID:TobiasLounsbury,项目名称:civicrm-metrics-server,代码行数:33,代码来源:Report.php

示例12: __construct

 function __construct()
 {
     $this->initialize();
     CRM_Utils_System::authenticateScript(TRUE);
     //log the execution of script
     CRM_Core_Error::debug_log_message('CiviReportMail.php');
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:7,代码来源:CiviReportMail.php

示例13: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url('civicrm/member/import', 'reset=1'));
     // check for post max size
     CRM_Core_Config_Defaults::formatUnitSize(ini_get('post_max_size'), TRUE);
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:13,代码来源:DataSource.php

示例14: postProcess

 /**
  * Process the form submission.
  */
 public function postProcess()
 {
     CRM_Utils_System::flushCache('CRM_Core_DAO_LocationType');
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_Core_BAO_LocationType::del($this->_id);
         CRM_Core_Session::setStatus(ts('Selected Location type has been deleted.'), ts('Record Deleted'), 'success');
         return;
     }
     // store the submitted values in an array
     $params = $this->exportValues();
     $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
     $params['is_default'] = CRM_Utils_Array::value('is_default', $params, FALSE);
     // action is taken depending upon the mode
     $locationType = new CRM_Core_DAO_LocationType();
     $locationType->name = $params['name'];
     $locationType->display_name = $params['display_name'];
     $locationType->vcard_name = $params['vcard_name'];
     $locationType->description = $params['description'];
     $locationType->is_active = $params['is_active'];
     $locationType->is_default = $params['is_default'];
     if ($params['is_default']) {
         $query = "UPDATE civicrm_location_type SET is_default = 0";
         CRM_Core_DAO::executeQuery($query);
     }
     if ($this->_action & CRM_Core_Action::UPDATE) {
         $locationType->id = $this->_id;
     }
     $locationType->save();
     CRM_Core_Session::setStatus(ts("The location type '%1' has been saved.", array(1 => $locationType->name)), ts('Saved'), 'success');
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:33,代码来源:LocationType.php

示例15: preProcess

 /**
  * set up variables to build the form
  *
  * @param null
  *
  * @return void
  * @acess protected
  */
 function preProcess()
 {
     $this->_fid = $this->get('fid');
     $this->_title = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $this->_fid, 'label', 'id');
     $this->assign('title', $this->_title);
     CRM_Utils_System::setTitle(ts('Confirm Price Field Delete'));
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:15,代码来源:DeleteField.php


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