Beispiel #1
0
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$patient_id = CValue::get("patient_id");
$sejour_id = CValue::get("sejour_id");
$check_collision = CValue::get("check_collision");
$date_entree_prevue = CValue::get("date_entree_prevue");
$hour_entree_prevue = CValue::get("hour_entree_prevue");
$min_entree_prevue = CValue::get("min_entree_prevue");
$collision_sejour = null;
$patient = new CPatient();
$patient->load($patient_id);
$patient->loadRefsSejours();
if (!$patient->_id) {
    CAppUI::stepMessage(UI_MSG_WARNING, "Patient '%s' inexistant", $patient_id);
    return;
}
$date = $date_entree_prevue;
$date .= " " . str_pad($hour_entree_prevue, 2, "0", STR_PAD_LEFT);
$date .= ":" . str_pad($min_entree_prevue, 2, "0", STR_PAD_LEFT);
$date .= ":00";
foreach ($patient->_ref_sejours as $_sejour) {
    // Séjours proches
    if ($_sejour->sortie) {
        $_date = CMbDT::dateTime("+" . CAppUI::conf("dPplanningOp CSejour hours_sejour_proche") . "HOUR", $_sejour->sortie);
        if ($_date > $date && $date > $_sejour->sortie) {
            $_sejour->_is_proche = 1;
        }
    }
    $_sejour->loadNDA();
$accordDossier = CValue::get("accordDossier", 0);
$category_id = CValue::get("category_id");
$only_list = isset($_GET["category_id"]);
// Liste des Class
$listCategory = CFilesCategory::listCatClass($object_class);
// Chargement de l'utilisateur courant
$mediuser = CMediusers::get();
$mediuser->loadRefs();
$object = null;
$canFile = false;
$canDoc = false;
$praticienId = null;
$affichageFile = array();
$nbItems = 0;
if (!$object_class && !$object_id) {
    CAppUI::stepMessage(UI_MSG_ERROR, "Problème de récupération de la liste des fichiers");
    CApp::rip();
}
// Chargement de l'objet
/** @var CMbObject $object */
$object = new $object_class();
$object->load($object_id);
$file = new CFile();
$canFile = $file->canCreate($object);
$cr = new CCompteRendu();
$canDoc = $cr->canCreate($object);
// To add the modele selector in the toolbar
if ($object_class == 'CConsultation') {
    $object->loadRefPlageConsult();
    $praticienId = $object->_praticien_id;
} else {
Beispiel #3
0
 * $Id: export_actes_pmsi.php 28465 2015-06-02 08:54:31Z lryo $
 *
 * @package    Mediboard
 * @subpackage PMSI
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 28465 $
 */
global $m, $tab;
$module = CValue::get("module");
if (!$module) {
    $module = $m;
}
$canUnlockActes = $module == "dPpmsi" || CModule::getCanDo("dPsalleOp")->admin;
if (null == ($object_class = CValue::get("object_class"))) {
    CAppUI::stepMessage(UI_MSG_WARNING, "{$tab}-msg-mode-missing");
    return;
}
$unlock_dossier = CValue::get("unlock_dossier", 0);
$NDA = "";
$IPP = "";
switch ($object_class) {
    case "COperation":
        $object = new COperation();
        // Chargement de l'opération et génération du document
        $operation_id = CValue::post("mb_operation_id", CValue::getOrSession("object_id"));
        if ($object->load($operation_id)) {
            $object->loadRefs();
            $codes = explode("|", $object->codes_ccam);
            $actes = CMbArray::pluck($object->_ref_actes_ccam, "code_acte");
            foreach ($object->_ref_actes_ccam as $acte_ccam) {
 * $Id$
 *
 * @package    Mediboard
 * @subpackage dPprescription
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license     GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$sejour_id = CValue::get("sejour_id");
$offline = CValue::get("offline");
$in_modal = CValue::get("in_modal");
$embed = CValue::get("embed");
$period = CValue::get("period");
$forms_limit = CValue::get("forms_limit");
if (!$sejour_id) {
    CAppUI::stepMessage(UI_MSG_WARNING, "Veuillez sélectionner un sejour pour visualiser le dossier complet");
    return;
}
$fiches_anesthesies = array();
$formulaires = null;
global $atc_classes;
$atc_classes = array();
$datetime_min = "";
if ($period) {
    $datetime_min = CMbDT::dateTime("- {$period} HOURS");
}
// Chargement du sejour
$sejour = new CSejour();
$sejour->load($sejour_id);
$sejour->loadNDA();
$sejour->loadExtDiagnostics();
 /**
  * Trace a query chrono
  *
  * @param string $trace Trace label
  *
  * @return void
  */
 static function traceChrono($trace)
 {
     // Allways log slow queries
     $log_step = floor(self::$chrono->latestStep);
     if ($log_step) {
         $query = self::$last_query;
         $values = implode(", ", self::$last_values);
         mbLog("slow '{$trace}' in '{$log_step}' seconds", "CRecordSante400");
         if ($trace != "connection") {
             mbLog("last query was \n {$query} \n with values [{$values}]", "CRecordSante400");
         }
     }
     // Trace to output
     if (self::$verbose) {
         $step = self::$chrono->latestStep * 1000;
         $total = self::$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, $trace, $step, $total);
     }
 }
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage SSR
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
$code = CValue::get("code");
$activite = CActiviteCsARR::get($code);
if (!$activite->code) {
    CAppUI::stepMessage(UI_MSG_ERROR, "Activité CsARR '{$code}' non trouvée");
    return;
}
$activite->loadRefsElementsByCat();
$activite->loadRefsAllExecutants();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("activite", $activite);
$smarty->display("vw_activite_srr_stats.tpl");
Beispiel #7
0
 *	@version $Revision$
 *  @author SARL OpenXtrem
 *  @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 */
global $m;
CCanDo::checkEdit();
$service_id = CValue::getOrSession('service_id');
$endowment_id = CValue::getOrSession('endowment_id');
// Services list
$service = new CService();
$where = array();
$where["group_id"] = "= '" . CGroups::loadCurrent()->_id . "'";
$where["cancelled"] = "= '0'";
$list_services = $service->loadListWithPerms(PERM_READ, $where);
if ($m == "dPurgences") {
    foreach ($list_services as $_id => $_service) {
        if (!$_service->urgence) {
            unset($list_services[$_id]);
        }
    }
}
if (count($list_services) == 0) {
    CAppUI::stepMessage(UI_MSG_WARNING, "Vous n'avez accès à aucun service pour effectuer des commandes");
    return;
}
// Création du template
$smarty = new CSmartyDP("modules/soins");
$smarty->assign('service_id', $service_id);
$smarty->assign('list_services', $list_services);
$smarty->assign('endowment_id', $endowment_id);
$smarty->display('vw_stocks_service.tpl');
 * $Id$
 *
 * @category Hprimsante
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$message_string = CValue::post("message");
if (!$message_string) {
    return;
}
$message_string = stripslashes($message_string);
CValue::setSession("message", $message_string);
try {
    $message = new CHPrimSanteMessage();
    $message->parse($message_string);
    $message->_errors_msg = !$message->isOK(CHL7v2Error::E_ERROR);
    $message->_warnings_msg = !$message->isOK(CHL7v2Error::E_WARNING);
    $message->_xml = CMbString::highlightCode("xml", $message->toXML()->saveXML());
} catch (CHL7v2Exception $e) {
    CAppUI::stepMessage(UI_MSG_ERROR, $e->getMessage() . " (" . $e->extraData . ")");
    return;
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("message", $message);
$smarty->assign("key", "input");
$smarty->display("inc_display_hprim_message.tpl");
list($action, $extention) = explode(".", $view);
$user = CUser::get();
$params["m"] = $module;
$params["raw"] = $action;
$params["info"] = 1;
// Could be done throw session cookie forwarding too
$token = new CViewAccessToken();
$token->_spec->loggable = false;
$token->user_id = $user->_id;
$token->params = CMbString::toQuery($params);
$token->datetime_start = "now";
$token->ttl_hours = 1;
$token->store();
$base = CAppUI::conf("base_url");
$url = "{$base}/?token={$token->hash}";
$content = file_get_contents($url);
$token->delete();
// Try and get view properties
if (null == ($props = json_decode($content))) {
    CAppUI::stepMessage(UI_MSG_ERROR, "regression_checker-noviewinfo");
    return;
}
CAppUI::stepMessage(UI_MSG_OK, "regression_checker-viewinfo-found");
$plan = CView::sampleCheckPlan($props);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("module", $module);
$smarty->assign("action", $action);
$smarty->assign("props", $props);
$smarty->assign("plan", $plan);
$smarty->display("regression_view_check.tpl");
Beispiel #10
0
<?php

/**
 * $Id$
 *  
 * @category Files
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
if (CFile::shrinkPDF(CAppUI::conf("root_dir") . "/modules/printing/samples/test_page.pdf")) {
    CAppUI::stepMessage(UI_MSG_OK, "Le fichier a été shrinké");
} else {
    CAppUI::stepMessage(UI_MSG_ERROR, "Le fichier n'a pas été shrinké");
}
Beispiel #11
0
$max = CValue::get("max", CAppUI::conf("sante400 nb_rows"));
// Load mouvements
$class = CValue::get("class");
$type = CValue::getOrSession("type");
$mouvs = array();
$count = 0;
$procs = 0;
if (!in_array($type, $types)) {
    $type = null;
}
// Mouvement type (or class) provided
if ($type || $class) {
    // Mouvement construction by factory
    $mouv = $class ? new $class() : CMouvFactory::create($type);
    if (!$mouv) {
        CAppUI::stepMessage(UI_MSG_ERROR, "CMouvFactory-error-noclass", CValue::first($type, $class));
        return;
    }
    // Initialisation d'un fichier de verrou
    $class = $mouv->class;
    $lock = new CMbLock("synchro_sante400/{$class}");
    // Mouvements counting
    $count = $mouv->count($marked);
    // Mouvements loading
    /** @var CMouvement400[] $mouvs */
    $mouvs = array();
    if ($rec = CValue::get("rec")) {
        try {
            $mouv->load($rec);
            $mouvs = array($mouv);
        } catch (Exception $e) {
$prop_type = explode(" ", $prop);
$prop_type = reset($prop_type);
if ($spec_type) {
    if (!array_key_exists($prop_type, CMbFieldSpecFact::$classes)) {
        $prop = "{$spec_type} {$prop}";
    } else {
        if (strpos($prop, " ") !== false) {
            $prop = $spec_type . " " . substr($prop, strpos($prop, " ") + 1);
        } else {
            $prop = $spec_type;
        }
    }
}
$spec = CExConcept::getConceptSpec($prop);
if (!$spec->prop) {
    CAppUI::stepMessage(UI_MSG_ALERT, "Enregistrez le champ avant de pouvoir changer les propriétés");
    return;
}
// UGLY hack because of the default value of the Boolspec
if ($spec instanceof CBoolSpec && strpos($prop, "default|") === false) {
    $spec->default = null;
}
if ($spec instanceof CEnumSpec || $spec instanceof CBoolSpec) {
    if ($spec->typeEnum === null || !in_array($spec->typeEnum, $spec->_options["typeEnum"])) {
        $spec->typeEnum = reset($spec->_options["typeEnum"]);
    }
}
$exclude = array("confidential", "mask", "format", "reported", "perm", "seekable", "pattern", "autocomplete", "cascade", "delimiter", "canonical", "protected", "class", "alphaAndNum", "byteUnit", "length", "loggable");
$boolean = array("notNull", "vertical", "progressive", "cascade");
$options = $spec->_options;
foreach ($exclude as $_exclude) {
 function warnUsage()
 {
     /** @var self $that */
     $that = new $this->_class();
     $that->loadMatchingObject("date DESC");
     $warn = $that->date >= CMbDT::date("-1 DAY") ? 1 : 0;
     CAppUI::stepMessage($warn ? UI_MSG_OK : UI_MSG_WARNING, "COperationMiner-warnusage-{$warn}", CAppUI::tr("{$that->_class}"), $that->date);
 }
 /**
  * Displays the SQL report
  *
  * @return void
  */
 static function displayReport()
 {
     $totals = array();
     $distribution = array();
     foreach (self::$report_data as $_hash => $_data) {
         $totals[$_hash] = array_sum(CMbArray::pluck($_data, 0));
         $_distribution = array("", "", "", "", "", "", "", "", "");
         foreach ($_data as $_pair) {
             $duration = $_pair[0] * 1000;
             $log = (int) floor(log10($duration) + 0.5);
             if (!isset($_distribution[$log])) {
                 $_distribution[$log] = "";
             }
             $_distribution[$log] .= "#";
         }
         $distribution[$_hash] = $_distribution;
     }
     arsort($totals);
     foreach ($totals as $_hash => $_total) {
         CAppUI::stepMessage(UI_MSG_OK, "Query was called %d times for %01.3fms", count(self::$report_data[$_hash]), $_total);
         echo utf8_decode(CMbString::highlightCode("sql", self::$report_data[$_hash][0][1], false, "white-space: pre-wrap;"));
         $_dist = $distribution[$_hash];
         // No input for 1µs and 10µs magnitudes (< 31.6µs)
         $lines = array("100µs {$_dist['2']}", "  1ms {$_dist['3']}", " 10ms {$_dist['4']}", "100ms {$_dist['5']}", "   1s {$_dist['6']}", "  10s {$_dist['7']}");
         echo "<pre>" . implode("\n", $lines) . "</pre>";
     }
 }
 * @category Modèles
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$modeles_ids = CView::post("modeles_ids", "str");
$object_class = CView::post("object_class", "str");
$owner = CView::post("owner", "str");
CView::checkin();
$modeles_ids = explode("-", $modeles_ids);
CMbArray::removeValue(array(), $modeles_ids);
if (!count($modeles_ids)) {
    CAppUI::stepMessage("Aucun modèle à exporter");
    CApp::rip();
}
$doc = new CMbXMLDocument(null);
$root = $doc->createElement("modeles");
$doc->appendChild($root);
$where = array("compte_rendu_id" => CSQLDataSource::prepareIn($modeles_ids));
// Récupération des header_id, footer_id, preface_id et ending_id
$ds = CSQLDataSource::get("std");
$request = new CRequest();
$request->addTable("compte_rendu");
$request->addWhere($where);
$components_ids = array();
foreach (array("header_id", "footer_id", "preface_id", "ending_id") as $_component) {
    $request->select = array();
    $request->addSelect($_component);
<?php

/**
 * $Id: ajax_vw_dossier_soin.php 28685 2015-06-23 12:01:35Z flaviencrochard $
 *
 * @package    Mediboard
 * @subpackage soins
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 28685 $
 */
CCanDo::checkRead();
if (CMedicament::getBase() == "vidal") {
    CAppUI::stepMessage(UI_MSG_WARNING, "Cette fonctionnalité n'est pas encore présente.");
    CApp::rip();
}
$group = CGroups::loadCurrent();
$sejour_id = CValue::getOrSession("sejour_id");
$date = CValue::getOrSession("date_plan_soins");
$nb_decalage = CValue::get("nb_decalage");
$mode_dossier = CValue::get("mode_dossier", "administration");
$chapitre = CValue::get("chapitre");
// Chapitre a rafraichir
$object_id = CValue::get("object_id");
$object_class = CValue::get("object_class");
$unite_prise = CValue::get("unite_prise");
$without_check_date = CValue::get("without_check_date", "0");
$hide_close = CValue::get("hide_close", 0);
$regroup_lines = CValue::get("regroup_lines");
$hide_old_lines = CValue::get("hide_old_lines", CAppUI::conf("soins suivi hide_old_line", $group->_guid));
$hide_line_inactive = CValue::get("hide_line_inactive", CAppUI::pref("hide_line_inactive"));
 * @category dPsante400
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:$
 * @link     http://www.mediboard.org
 */
$idex_id = CValue::get("idex_id");
$dialog = CValue::get("dialog");
$page = intval(CValue::get('page', 0));
$object_id = CValue::get("object_id");
$object_class = CValue::get("object_class");
$tag = CValue::get("tag");
$id400 = CValue::get("id400");
if (!$object_id && !$object_class && !$tag && !$id400) {
    CAppUI::stepMessage(UI_MSG_WARNING, "No filter");
    CApp::rip();
}
// Chargement de la liste des id4Sante400 pour le filtre
$filter = new CIdSante400();
$filter->object_id = $object_id;
$filter->object_class = $object_class;
$filter->tag = $tag;
$filter->id400 = $id400;
$filter->nullifyEmptyFields();
// Chargement de la cible si objet unique
$target = null;
if ($filter->object_id && $filter->object_class) {
    $target = new $filter->object_class();
    $target->load($filter->object_id);
}
Beispiel #18
0
    $tplHeader->assign("allInOne", CValue::get("_aio"));
    $tplHeader->assign("portal", array("help" => mbPortalURL($m, $tab), "tracker" => mbPortalURL("tracker")));
    $tplHeader->display("header.tpl");
}
// Check muters
if ($muters = CValue::get("muters")) {
    $muters = explode("-", $muters);
    if (count($muters) % 2 != 0) {
        trigger_error("Muters should come by min-max intervals time pairs", E_USER_WARNING);
    } else {
        $time_now = CMbDT::time();
        while (count($muters)) {
            $time_min = array_shift($muters);
            $time_max = array_shift($muters);
            if (CMbRange::in($time_now, $time_min, $time_max)) {
                CAppUI::stepMessage(UI_MSG_OK, "msg-common-system-muted", $time_now, $time_min, $time_max);
                return;
            }
        }
    }
}
// Check whether we should trace SQL queries
if ($query_trace = CValue::get("query_trace")) {
    CSQLDataSource::$trace = true;
}
if ($query_report = CValue::get("query_report")) {
    CSQLDataSource::$report = true;
}
// tabBox et inclusion du fichier demandé
if ($tab !== null) {
    $module->showTabs();
$operation_id = CValue::post('operation_id');
$consult_anesth_id = CValue::post('consult_anesth_id');
$operation = new COperation();
$operation->load($operation_id);
$consult_anesth = new CConsultAnesth();
$consult_anesth->load($consult_anesth_id);
$fields = array();
$fields['type_anesth'] = CValue::post('type_anesth', 'COperation');
$fields['ASA'] = CValue::post('ASA', 'COperation');
$fields['position'] = CValue::post('position', 'COperation');
$fields['rques'] = CValue::post('rques', 'COperation');
if (CAppUI::conf('dPplanningOp COperation show_duree_uscpo')) {
    $fields['passage_uscpo'] = CValue::post('passage_uscpo', 'COperation');
    $fields['duree_uscpo'] = CValue::post('duree_uscpo', 'COperation');
}
foreach ($fields as $_field => $_object) {
    if ($_object == 'CConsultAnesth') {
        $operation->{$_field} = $consult_anesth->{$_field};
    } else {
        $consult_anesth->{$_field} = $operation->{$_field};
    }
}
$consult_anesth->operation_id = $operation_id;
if ($msg = $operation->store()) {
    CAppUI::stepAjax($msg, UI_MSG_ERROR);
}
if ($msg = $consult_anesth->store()) {
    CAppUI::stepAjax($msg, UI_MSG_ERROR);
}
CAppUI::stepMessage(UI_MSG_OK, 'CConsultAnesth.operation_linked');
CApp::rip();
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 * @version    $Revision$
 */
CCanDo::checkEdit();
// Période
$filter = new CPlageconsult();
$filter->_date_min = CValue::getOrSession("_date_min");
$filter->_date_max = CValue::getOrSession("_date_max");
// Tri sur les praticiens
$mediuser = CMediusers::get();
$mediuser->loadRefFunction();
$prat = new CMediusers();
$prat->load(CValue::getOrSession("chir"));
if (!$prat->_id) {
    CAppUI::stepMessage(UI_MSG_WARNING, "CMediusers-warning-undefined");
    return;
}
$prat->loadRefFunction();
$listPrat = array($prat->_id => $prat);
$plageconsult = new CPlageconsult();
$ljoin = array();
$ljoin["consultation"] = "consultation.plageconsult_id = plageconsult.plageconsult_id";
$where = array();
$where[] = "\n  (plageconsult.chir_id  <> '{$prat->_id}' AND \n    (plageconsult.remplacant_id = '{$prat->_id}' OR plageconsult.pour_compte_id = '{$prat->_id}'))\n  OR \n  (plageconsult.chir_id  = '{$prat->_id}' AND \n    ((plageconsult.remplacant_id <> '{$prat->_id}' AND plageconsult.remplacant_id IS NOT NULL)\n      OR \n     (plageconsult.pour_compte_id <> '{$prat->_id}' AND plageconsult.pour_compte_id IS NOT NULL))\n   )";
$where["plageconsult.date"] = " BETWEEN '{$filter->_date_min}' AND '{$filter->_date_max}'";
$where["consultation.annule"] = "= '0'";
$order = "chir_id ASC";
$listPlages = $plageconsult->loadList($where, $order, null, null, $ljoin);
$plages = array();
foreach ($listPlages as $plage) {
Beispiel #21
0
 * @subpackage System
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
// Minute courante
$time = CMbDT::time();
$minute = intval(CMbDT::transform($time, null, "%M"));
$hour = intval(CMbDT::transform($time, null, "%H"));
// Opératue de l'envoi
$user = new CUser();
$user->user_username = CValue::get("username", CUser::get()->user_username);
$user->user_password = CValue::get("password");
if (!$user->user_password) {
    CAppUI::stepMessage(UI_MSG_WARNING, "CViewSender-send-no-password");
}
// Chargement des senders
$sender = new CViewSender();
$where = array("active" => "= '1'");
/** @var CViewSender[] $senders */
$senders = $sender->loadList($where, "name");
// Envoi de vues
foreach ($senders as $_sender) {
    $_sender->makeUrl($user);
    if (!$_sender->getActive($minute, $hour)) {
        unset($senders[$_sender->_id]);
        continue;
    }
    if ($user->user_password) {
        $_sender->makeUrl($user);
Beispiel #22
0
 * @package Mediboard
 * @subpackage ecap
 * @version $Revision: 8419 $
 * @author SARL OpenXtrem
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 */
CCanDo::checkAdmin();
$max_rows = CView::request("max_rows", "num default|1000");
$max_lines = CView::request("max_lines", "num default|1000000");
$phase = CView::request("phase", "enum list|connection|query|multiple_load_execute");
$min_duration = CView::request("min_duration", "num default|1");
CView::checkin();
$phase = strtr($phase, "_", " ");
$path = CAppUI::getTmpPath("mb-log.html");
if (false == ($resource = fopen($path, "r"))) {
    CAppUI::stepMessage("no log available");
}
$lines_count = 0;
$entries = array();
while (($line = fgets($resource)) !== false) {
    if ($max_lines && $lines_count >= $max_lines) {
        break;
    }
    $lines_count++;
    $matches = array();
    if (preg_match("/\\[(.*)\\] CRecordSante400: slow '(.*)' in '(.*)' seconds/", $line, $matches)) {
        $entry = array("datetime" => $matches[1], "phase" => $matches[2], "duration" => $matches[3]);
        // Filter on actions
        if ($phase && $entry["phase"] != $phase) {
            continue;
        }
Beispiel #23
0
 /**
  * Renders a failed acquisition message
  *
  * @return void
  */
 function failedMessage()
 {
     CAppUI::stepMessage(UI_MSG_OK, "CMbLock-failed-message", $this->key);
 }
Beispiel #24
0
/**
 * $Id$
 *  
 * @category Modèles
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$owner_guid = CView::post("owner_guid", "str");
CView::checkin();
$owner = CMbObject::loadFromGuid($owner_guid);
if (!$owner || !$owner->_id) {
    CAppUI::stepMessage(UI_MSG_WARNING, "Le propriétaire souhaité n'existe pas.");
}
$user_id = "";
$function_id = "";
$group_id = "";
switch ($owner->_class) {
    case "CMediusers":
    default:
        $user_id = $owner->_id;
        break;
    case "CFunctions":
        $function_id = $owner->_id;
        break;
    case "CGroups":
        $group_id = $owner->_id;
}
Beispiel #25
0
<?php

/**
 * $Id: $
 *
 * @package    Mediboard
 * @subpackage Cabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: $
 */
CCanDo::checkRead();
if (!CModule::getActive('bcb')) {
    CAppUI::stepMessage(UI_MSG_ERROR, "Le module de médicament autonome est en cours de developpement.\n    Pour être utilisé, ce module a pour le moment besoin d'être connecté à une base de données de médicaments externe");
    return;
}
$lettre = CValue::get("lettre");
$category_id = CValue::getOrSession("category_id", CAppUI::conf('dPmedicament CBcbProduitLivretTherapeutique product_category_id'));
$listProduits = array();
// Chargement des functions
$function = new CFunctions();
$functions = $function->loadSpecialites(PERM_EDIT);
// Si on est admin ou que $functions contient plus d'un élément,
// on récupère la fonction en session
if (CAppUI::$user->isAdmin() || count($functions) > 1) {
    $function_guid = CValue::getOrSession("function_guid", reset($functions)->_guid);
} else {
    // Sinon, c'est la fonction de l'utilisateur
    $function_guid = "CFunctions-" . CAppUI::$user->function_id;
}
$function = CMbObject::loadFromGuid($function_guid);
Beispiel #26
0
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage developpement
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
if (!class_exists("CMbCodeSniffer")) {
    CAppUI::stepMessage(UI_MSG_WARNING, "CMbCodeSniffer-error-PEAR_needed");
    return;
}
$file = CValue::get("file");
$file = str_replace(":", "/", $file);
// Has to be a file, not a directory
if (!is_file($file)) {
    CAppUI::stepAjax("sniff-file-nofile-error", UI_MSG_ERROR, $file);
}
$sniffer = new CMbCodeSniffer();
$sniffer->process($file);
$sniffer->report($file);
$stats = $sniffer->stat($file);
$errors = reset($sniffer->getFilesErrors());
$alerts = $sniffer->getFlattenAlerts();
// Cuz sniffer changes work dir but restores it at destruction
// Be aware that unset() won't call __destruct() anyhow
$sniffer->__destruct();
    $dates[] = array(count($dates), CMbDT::dateToLocale($date_temp));
    $date_temp = CMbDT::date("+1 day", $date_temp);
}
// Table temporaraire de dates pour les jointures
$tab_name = CSQLDataSource::tempTableDates($date_min, $date_max);
// Nombre de lits totaux sur le service
$lit = new C**t();
$where = array();
$ljoin = array();
$ljoin["chambre"] = "chambre.chambre_id = lit.chambre_id";
$where["service_id"] = " = '{$service_id}'";
$where["lit.annule"] = " = '0'";
$nb_lits = $lit->countList($where, null, $ljoin);
if (!$nb_lits) {
    $smarty->display("inc_form_stats.tpl");
    CAppUI::stepMessage(UI_MSG_WARNING, "warning-hospi-stats-no_beds");
    return;
}
// Lits ouverts (non bloqués - non compris les blocages des urgence)
$serie = array("data" => array(), "label" => utf8_encode("Ouvert / Total"), "markers" => array("show" => true));
// Sauvegarde des lits ouverts par date
$lits_ouverts_par_date = array();
foreach ($dates as $key => $_date) {
    $date = CMbDT::dateFromLocale($_date[1]);
    $query = "SELECT count(DISTINCT l.lit_id) as lits_ouverts\n    FROM lit l\n    JOIN affectation a ON a.lit_id = l.lit_id AND\n    DATE_FORMAT(a.entree, '%Y-%m-%d') <= '{$date}' AND DATE_FORMAT(a.sortie, '%Y-%m-%d') >= '{$date}'\n    AND a.sejour_id != 0\n    LEFT JOIN chambre c ON c.chambre_id = l.chambre_id\n    WHERE  c.service_id = '{$service_id}'";
    $lits_ouverts = $ds->loadResult($query);
    $serie['data'][] = array(count($serie['data']) - 0.3, $lits_ouverts, $lits_ouverts / $nb_lits);
    $lits_ouverts_par_date[$date] = $lits_ouverts;
}
// Pour les autres stats, on a besoin du nombre de lits ouverts,
// donc la calculer dans tous les cas