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


PHP CView::disableSlave方法代码示例

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


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

示例1: graphPatParHeureReveil

/**
 * Récuparation du graphique de répartition des patients en salle de reveil
 * par tranche horaire
 *
 * @param string $debut         Date de début
 * @param string $fin           Date de fin
 * @param int    $prat_id       Identifiant du praticien
 * @param int    $bloc_id       Identifiant du bloc
 * @param int    $discipline_id Identifiant de la discipline
 * @param string $codeCCAM      Code CCAM
 *
 * @return array
 */
function graphPatParHeureReveil($debut = null, $fin = null, $prat_id = 0, $bloc_id = 0, $func_id = 0, $discipline_id = null, $codeCCAM = '')
{
    // This stats uses temporary table, impossible on slave
    // @todo Get rid of temporary table
    CView::disableSlave();
    $ds = CSQLDataSource::get("std");
    if (!$debut) {
        $debut = CMbDT::date("-1 YEAR");
    }
    if (!$fin) {
        $fin = CMbDT::date();
    }
    $totalWorkDays = 0;
    for ($i = $debut; $i <= $fin; $i = CMbDT::date("+1 MONTH", $i)) {
        $totalWorkDays += CMbDT::workDaysInMonth(CMbDT::transform("+0 DAY", $i, "%Y-%m-01"));
    }
    $prat = new CMediusers();
    $prat->load($prat_id);
    $discipline = new CDiscipline();
    $discipline->load($discipline_id);
    $ticks = array();
    for ($i = 7; $i <= 21; $i++) {
        $ticks[] = array(count($ticks), CMbDT::transform("+0 DAY", "{$i}:00:00", "%Hh%M"));
    }
    $bloc = new CBlocOperatoire();
    if ($bloc_id) {
        $bloc->load($bloc_id);
    }
    $series = array();
    // Nombre de patients par heure
    foreach ($ticks as $i => $tick) {
        $query = "DROP TEMPORARY TABLE IF EXISTS pat_par_heure";
        $ds->exec($query);
        $query = "CREATE TEMPORARY TABLE pat_par_heure\n      SELECT COUNT(operations.operation_id) AS total_by_day,\n             '" . $tick[1] . "' AS heure,\n             operations.date AS date\n      FROM operations\n      INNER JOIN sallesbloc ON operations.salle_id = sallesbloc.salle_id\n      LEFT JOIN users_mediboard ON operations.chir_id = users_mediboard.user_id\n      WHERE sallesbloc.stats = '1'\n      AND operations.date BETWEEN '{$debut}' AND '{$fin}'\n      AND '" . $tick[1] . ":00' BETWEEN operations.entree_reveil AND operations.sortie_reveil_reel\n      AND operations.annulee = '0'";
        if ($prat_id) {
            $query .= "\nAND operations.chir_id = '{$prat_id}'";
        }
        if ($discipline_id) {
            $query .= "\nAND users_mediboard.discipline_id = '{$discipline_id}'";
        }
        if ($codeCCAM) {
            $query .= "\nAND operations.codes_ccam LIKE '%{$codeCCAM}%'";
        }
        if ($bloc_id) {
            $query .= "\nAND sallesbloc.bloc_id = '{$bloc_id}'";
        }
        $query .= "\nGROUP BY operations.date";
        $ds->exec($query);
        $query = "SELECT SUM(total_by_day) AS total, MAX(total_by_day) AS max,heure\n                FROM pat_par_heure\n                GROUP BY heure";
        $result = $ds->loadlist($query);
        if (count($result)) {
            $serie_moyenne["data"][] = array($i, $result[0]["total"] / $totalWorkDays);
            $serie_max["data"][] = array($i, $result[0]["max"]);
        } else {
            $serie_moyenne["data"][] = array($i, 0);
            $serie_max["data"][] = array($i, 0);
        }
    }
    // Nombre de patients non renseignés
    $query = "SELECT COUNT(operations.operation_id) AS total,\n    'err' AS heure\n    FROM operations\n    INNER JOIN sallesbloc ON operations.salle_id = sallesbloc.salle_id\n    LEFT JOIN users_mediboard ON operations.chir_id = users_mediboard.user_id\n    WHERE sallesbloc.stats = '1'\n    AND operations.date BETWEEN '{$debut}' AND '{$fin}'\n    AND (operations.entree_reveil IS NULL OR operations.sortie_reveil_reel IS NULL)\n    AND operations.annulee = '0'";
    if ($prat_id) {
        $query .= "\nAND operations.chir_id = '{$prat_id}'";
    }
    if ($discipline_id) {
        $query .= "\nAND users_mediboard.discipline_id = '{$discipline_id}'";
    }
    if ($codeCCAM) {
        $query .= "\nAND operations.codes_ccam LIKE '%{$codeCCAM}%'";
    }
    if ($bloc_id) {
        $query .= "\nAND sallesbloc.bloc_id = '{$bloc_id}'";
    }
    $query .= "\nGROUP BY heure";
    $result = $ds->loadlist($query);
    if (count($result)) {
        $serie_moyenne["data"][] = array(count($ticks), $result[0]["total"] / $totalWorkDays);
    } else {
        $serie_moyenne["data"][] = array(count($ticks), 0);
    }
    //$serie_max["data"][] = array(count($ticks), 0);
    $ticks[] = array(count($ticks), "Erreurs");
    $serie_moyenne["label"] = "moyenne";
    $serie_max["label"] = "max";
    $series[] = $serie_moyenne;
    $series[] = $serie_max;
    // Set up the title for the graph
    $title = "Patients moyens et max / heure du jour";
//.........这里部分代码省略.........
开发者ID:fbone,项目名称:mediboard4,代码行数:101,代码来源:graph_patparheure_reveil.php

示例2: exec

 /**
  * Execute a any query
  * 
  * @param string $query SQL Query
  * 
  * @return resource|bool The result resource on SELECT, true on others, false if failed
  **/
 function exec($query)
 {
     // Query colouring
     if (CSQLDataSource::$trace) {
         echo utf8_decode(CMbString::highlightCode("sql", $query, false, "white-space: pre-wrap;"));
     }
     // Chrono
     $this->chrono->start();
     $result = $this->query($query);
     $this->chrono->stop();
     // Error handling
     if (!$result) {
         // On slave error, retry exact same request on std
         if ($this->dsn == "slave") {
             $std = self::$dataSources["std"];
             $std->chrono->start();
             $result = $std->query($query);
             $std->chrono->stop();
             if ($result) {
                 CView::disableSlave();
                 return $result;
             }
         }
         $error = $this->error();
         trigger_error("SQL Error: {$error} for DSN '{$this->dsn}' on SQL query <em>{$query}</em>", E_USER_WARNING);
         return false;
     }
     // Chrono messaging
     if (CSQLDataSource::$trace) {
         $step = $this->chrono->latestStep * 1000;
         $total = $this->chrono->total * 1000;
         $pace = floor(2 * log10($step));
         $pace = max(0, min(6, $pace));
         $message = "query-pace-{$pace}";
         $type = floor(($pace + 3) / 2);
         CAppUI::stepMessage($type, $message, $this->dsn, $step, $total);
     }
     if (CSQLDataSource::$report) {
         $hash = self::hashQuery($query);
         if (!isset(self::$report_data[$hash])) {
             self::$report_data[$hash] = array();
         }
         self::$report_data[$hash][] = array($this->chrono->latestStep * 1000, $query);
     }
     return $result;
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:53,代码来源:CSQLDataSource.class.php

示例3: glob

    if ($dPconfig["offline_non_admin"] && CAppUI::$user->_id != 0 && !CAppUI::$user->isAdmin()) {
        CApp::goOffline("maintenance");
    }
}
CMbPerformance::mark("user");
// Load DB-stored configuration schema
$configurations = glob(__DIR__ . "/modules/*/configuration.php");
foreach ($configurations as $_configuration) {
    include $_configuration;
}
CMbPerformance::mark("config");
// Init output filter
CHTMLResourceLoader::initOutput(CValue::get("_aio"));
CApp::notify("BeforeMain");
// Check if the mobile feature is available and if the user agent is a mobile
$enable_mobile_ui = CAppUI::pref("MobileUI") || !CAppUI::$instance->user_id;
if (is_file(__DIR__ . "/mobile/main.php") && !empty($_SESSION["browser"]["mobile"]) && $enable_mobile_ui) {
    CAppUI::$mobile = true;
    include __DIR__ . "/mobile/main.php";
} else {
    include __DIR__ . "/includes/main.php";
}
CView::disableSlave();
CApp::notify("AfterMain");
// Send timing data in HTTP header
CMbPerformance::end();
CMbPerformance::writeHeader();
// Output HTML
$aio_options = array("ignore_scripts" => CValue::get("_aio_ignore_scripts"));
CHTMLResourceLoader::output($aio_options);
CApp::rip();
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:31,代码来源:index.php


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