コード例 #1
0
 /**
  * Get observation results for this object
  *
  * @param CMbObject $object Reference object
  * @param bool      $utf8   Encode data int UTF-8
  *
  * @return array|CObservationResultSet[]
  */
 static function getResultsFor(CMbObject $object, $utf8 = true)
 {
     $request = new CRequest();
     $request->addTable("observation_result");
     $request->addSelect("*");
     $request->addLJoin(array("observation_result_set" => "observation_result_set.observation_result_set_id = observation_result.observation_result_set_id", "user_log" => "observation_result_set.observation_result_set_id = user_log.object_id AND\r\n                                     user_log.object_class = 'CObservationResultSet' AND user_log.type = 'create'", "users" => "users.user_id = user_log.user_id"));
     $request->addWhere(array("observation_result_set.context_class" => "= '{$object->_class}'", "observation_result_set.context_id" => "= '{$object->_id}'"));
     $request->addOrder("observation_result_set.datetime");
     $request->addOrder("observation_result.observation_result_id");
     $results = $object->_spec->ds->loadList($request->makeSelect());
     $times = array();
     $data = array();
     foreach ($results as $_result) {
         $_time = CMbDate::toUTCTimestamp($_result["datetime"]);
         $times[$_time] = $_result["datetime"];
         $unit_id = $_result["unit_id"] ? $_result["unit_id"] : "none";
         $label = null;
         if ($_result["label_id"]) {
             $label_obj = new CSupervisionGraphAxisValueLabel();
             $label_obj->load($_result["label_id"]);
             $label = $label_obj->title;
         }
         $float_value = $_result["value"];
         $float_value = CMbFieldSpec::checkNumeric($float_value, false);
         $_user_name = $_result["user_first_name"] . " " . $_result["user_last_name"];
         $data[$_result["value_type_id"]][$unit_id][] = array(0 => $_time, 1 => $float_value, "ts" => $_time, "value" => $_result["value"], "datetime" => $_result["datetime"], "file_id" => $_result["file_id"], "set_id" => $_result["observation_result_set_id"], "result_id" => $_result["observation_result_id"], "label_id" => $_result["label_id"], "label" => $utf8 ? utf8_encode($label) : $label, "user_id" => $_result["user_id"], "user" => $utf8 ? utf8_encode($_user_name) : $_user_name);
     }
     return array($data, $times);
 }
コード例 #2
0
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Patients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkAdmin();
$supervision_graph_axis_label_id = CValue::get("supervision_graph_axis_label_id");
$supervision_graph_axis_id = CValue::get("supervision_graph_axis_id");
$axis = new CSupervisionGraphAxis();
$axis->load($supervision_graph_axis_id);
$label = new CSupervisionGraphAxisValueLabel();
if (!$label->load($supervision_graph_axis_label_id)) {
    $label->supervision_graph_axis_id = $supervision_graph_axis_id;
}
$label->loadRefsNotes();
$smarty = new CSmartyDP();
$smarty->assign("label", $label);
$smarty->assign("axis", $axis);
$smarty->display("inc_edit_supervision_graph_axis_label.tpl");