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


PHP CRM_Utils_System::getServerResponse方法代码示例

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


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

示例1: getDashletInfo

 /**
  * Function to get details of each dashlets
  *
  * @param int $dashletID widget ID
  *
  * @return array associted array title and content
  * @access public
  * @static  
  */
 static function getDashletInfo($dashletID)
 {
     $dashletInfo = array();
     $dao = new CRM_Core_DAO_Dashboard();
     $dao->id = $dashletID;
     $dao->find(true);
     //reset content based on the cache time set in config
     $currentDate = strtotime(date('Y-m-d h:i:s'));
     $createdDate = strtotime($dao->created_date);
     $dateDiff = round(abs($currentDate - $createdDate) / 60);
     $config = CRM_Core_Config::singleton();
     if ($config->dashboardCacheTimeout <= $dateDiff) {
         $dao->content = NULL;
     }
     // if content is empty and url is set, retrieve it from url
     if (!$dao->content && $dao->url) {
         $url = $dao->url;
         // CRM-7087
         // -lets use relative url for internal use.
         // -make sure relative url should not be htmlize.
         if (substr($dao->url, 0, 4) != 'http') {
             if ($config->userFramework == 'Joomla' || $config->userFramework == 'Drupal' && !variable_get('clean_url', '0')) {
                 $url = CRM_Utils_System::url($dao->url, null, false, null, false);
             }
         }
         //get content from url
         $dao->content = CRM_Utils_System::getServerResponse($url);
         $dao->created_date = date("YmdHis");
         $dao->save();
     }
     $dashletInfo = array('title' => $dao->label, 'content' => $dao->content);
     if ($dao->is_fullscreen) {
         $dashletInfo['fullscreen'] = $dao->content;
     }
     return $dashletInfo;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:45,代码来源:Dashboard.php

示例2: getDashletInfo

 /**
  * Function to get details of each dashlets
  *
  * @param int $dashletID widget ID
  *
  * @return array associted array title and content
  * @access public
  * @static  
  */
 static function getDashletInfo($dashletID)
 {
     $dashletInfo = array();
     $dao = new CRM_Core_DAO_Dashboard();
     $dao->id = $dashletID;
     $dao->find(true);
     //reset content based on the cache time set in config
     $currentDate = strtotime(date('Y-m-d h:i:s'));
     $createdDate = strtotime($dao->created_date);
     $dateDiff = round(abs($currentDate - $createdDate) / 60);
     $config = CRM_Core_Config::singleton();
     if ($config->dashboardCacheTimeout <= $dateDiff) {
         $dao->content = NULL;
     }
     // if content is empty and url is set, retrieve it from url
     if (!$dao->content && $dao->url) {
         if (substr($dao->url, 0, 4) === 'http') {
             $url = $dao->url;
         } else {
             $url = CRM_Utils_System::url($dao->url, null, true, null, false);
         }
         //get content from url
         $dao->content = CRM_Utils_System::getServerResponse($url);
         $dao->created_date = date("YmdHis");
         $dao->save();
     }
     $dashletInfo = array('title' => $dao->label, 'content' => $dao->content);
     if ($dao->is_fullscreen) {
         $dashletInfo['fullscreen'] = $dao->content;
     }
     return $dashletInfo;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:41,代码来源:Dashboard.php

示例3: getDashletInfo

 /**
  * Get details of each dashlets.
  *
  * @param int $dashletID
  *   Widget ID.
  *
  * @return array
  *   associted array title and content
  */
 public static function getDashletInfo($dashletID)
 {
     $dashletInfo = array();
     $params = array(1 => array($dashletID, 'Integer'));
     $query = "SELECT name, label, url, fullscreen_url, is_fullscreen FROM civicrm_dashboard WHERE id = %1";
     $dashboadDAO = CRM_Core_DAO::executeQuery($query, $params);
     $dashboadDAO->fetch();
     // build the content
     $dao = new CRM_Contact_DAO_DashboardContact();
     $session = CRM_Core_Session::singleton();
     $dao->contact_id = $session->get('userID');
     $dao->dashboard_id = $dashletID;
     $dao->find(TRUE);
     //reset content based on the cache time set in config
     $createdDate = strtotime($dao->created_date);
     $dateDiff = round(abs(time() - $createdDate) / 60);
     $config = CRM_Core_Config::singleton();
     if ($config->dashboardCacheTimeout <= $dateDiff) {
         $dao->content = NULL;
     }
     // if content is empty and url is set, retrieve it from url
     if (!$dao->content && $dashboadDAO->url) {
         $url = $dashboadDAO->url;
         // CRM-7087
         // -lets use relative url for internal use.
         // -make sure relative url should not be htmlize.
         if (substr($dashboadDAO->url, 0, 4) != 'http') {
             $urlParam = explode('?', $dashboadDAO->url);
             $url = CRM_Utils_System::url($urlParam[0], $urlParam[1], TRUE, NULL, FALSE);
         }
         //get content from url
         $dao->content = CRM_Utils_System::getServerResponse($url);
         $dao->created_date = date("YmdHis");
         $dao->save();
     }
     $dashletInfo = array('title' => $dashboadDAO->label, 'name' => $dashboadDAO->name, 'content' => $dao->content);
     if ($dashboadDAO->is_fullscreen) {
         $fullscreenUrl = $dashboadDAO->fullscreen_url;
         if (substr($fullscreenUrl, 0, 4) != 'http') {
             $urlParam = explode('?', $dashboadDAO->fullscreen_url);
             $fullscreenUrl = CRM_Utils_System::url($urlParam[0], $urlParam[1], TRUE, NULL, FALSE);
         }
         $dashletInfo['fullscreenUrl'] = $fullscreenUrl;
     }
     return $dashletInfo;
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:55,代码来源:Dashboard.php

示例4: hrreport_civicrm_pageRun

/**
 * Implementation of hook_civicrm_pageRun
 *
 * @return void
 */
function hrreport_civicrm_pageRun(&$page)
{
    $pageName = $page->getVar('_name');
    $componentName = $page->getVar('_compName');
    //change page title from 'Case Report' to  'Assignment Report'
    if ($pageName == 'CRM_Report_Page_InstanceList' && $componentName == 'Case') {
        CRM_Utils_System::setTitle(ts('Assignment Reports'));
    }
    if ($pageName == 'CRM_Report_Page_InstanceList' || $pageName == 'CRM_Report_Page_TemplateList') {
        CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.hrreport', 'js/hrreport.js');
    }
    if ($pageName == 'CRM_Contact_Page_DashBoard') {
        $report_id = _hrreport_getId();
        $session = CRM_Core_Session::singleton();
        $contact_id = $session->get('userID');
        //to do entry of default casedashboard report and civicrm news report
        foreach (array('blog', 'casedashboard') as $name) {
            $caseDashlet = civicrm_api3('Dashboard', 'getsingle', array('return' => array("id", "url", "permission"), 'name' => $name));
            $dashboardContactId = civicrm_api3('DashboardContact', 'get', array('return' => array("id", "is_active"), 'dashboard_id' => $caseDashlet['id'], 'contact_id' => $contact_id));
            $url = CRM_Utils_System::getServerResponse($caseDashlet['url'], false);
            if (empty($dashboardContactId['id'])) {
                if ($name == 'blog') {
                    civicrm_api3('DashboardContact', 'create', array("dashboard_id" => $caseDashlet['id'], 'is_active' => '1', 'contact_id' => $contact_id, 'column_no' => '1', 'content' => $url));
                } elseif (CRM_Case_BAO_Case::accessCiviCase()) {
                    civicrm_api3('DashboardContact', 'create', array("dashboard_id" => $caseDashlet['id'], 'is_active' => '1', 'contact_id' => $contact_id, 'column_no' => '1', 'content' => $url));
                }
            }
            if (!empty($dashboardContactId['id']) && $name == 'casedashboard') {
                $id = $dashboardContactId['id'];
                if (!CRM_Case_BAO_Case::accessCiviCase()) {
                    _hrreport_createDashlet($id, '0');
                } elseif ($dashboardContactId['values'][$id]['is_active'] == 0) {
                    _hrreport_createDashlet($id, '1');
                }
            }
        }
        $i = 1;
        foreach ($report_id as $key => $val) {
            $dashletParams['url'] = "civicrm/report/instance/{$val}?reset=1&section=2&snippet=5&context=dashlet";
            $dashlet = civicrm_api3('Dashboard', 'get', array('name' => "report/{$val}"));
            if (!empty($dashlet['count']) && $dashlet['count'] > 0) {
                $contentUrl = CRM_Utils_System::getServerResponse($dashletParams['url']);
                $dashboardContact = civicrm_api3('DashboardContact', 'get', array('return' => array("id", "is_active"), 'dashboard_id' => $dashlet['id'], 'contact_id' => $contact_id));
                $dashId = $dashlet['id'];
                if (empty($dashboardContact['id'])) {
                    if (CRM_Core_Permission::check($dashlet['values'][$dashId]['permission'])) {
                        civicrm_api3('DashboardContact', 'create', array("dashboard_id" => $dashlet['id'], 'is_active' => '1', 'contact_id' => $contact_id, 'column_no' => $i, 'content' => CRM_Utils_System::getServerResponse($dashletParams['url'])));
                    }
                }
                if (!empty($dashboardContact['id'])) {
                    $id = $dashboardContact['id'];
                    if (!CRM_Core_Permission::check($dashlet['values'][$dashId]['permission'])) {
                        _hrreport_createDashlet($id, '0');
                    } elseif ($dashboardContact['values'][$id]['is_active'] == 0) {
                        _hrreport_createDashlet($id, '1');
                    }
                }
                $i = 0;
            }
        }
    }
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:67,代码来源:hrreport.php


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