/**
 * $Id: httpreq_vw_check_list.php 25957 2014-11-20 09:00:54Z aurelie17 $
 *
 * @package    Mediboard
 * @subpackage SalleOp
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 25957 $
 */
CCanDo::checkRead();
$check_list_id = CValue::get("check_list_id");
$check_list = new CDailyCheckList();
$check_list->load($check_list_id);
$check_list->loadItemTypes();
$check_list->loadRefsFwd();
$check_list->loadBackRefs('items');
$check_list->loadRefListType();
$anesth_id = null;
if ($check_list->object_class == "COperation") {
    $check_list->_ref_object->loadRefChir();
    $anesth_id = $check_list->_ref_object->anesth_id;
}
$anesth = new CMediusers();
$anesth->load($anesth_id);
$type_personnel = array("op", "op_panseuse");
if (!$check_list->validator_id && $check_list->_id) {
    $validateurs = explode("|", $check_list->_ref_list_type->type_validateur);
    $type_personnel = array();
    foreach ($validateurs as $valid) {
        $type_personnel[] = $valid;
/** @var CDailyCheckList[] $list_check_lists */
$list_check_lists = $check_list->loadList($where, 'date DESC, date_validate DESC, object_class, object_id, type', "{$start},40", null, $ljoin);
$count_check_lists = $check_list->countList($where, null, $ljoin);
foreach ($list_check_lists as $_check_list) {
    $_check_list->loadRefListType();
    if ($_check_list->_ref_object) {
        $_check_list->_ref_object->loadRefsFwd();
    }
}
$check_list_filter = new CDailyCheckList();
$check_list_filter->object_class = $object_class;
$check_list_filter->object_id = $object_id;
$check_list_filter->_date_min = $date_min;
$check_list_filter->_date_max = $date_max;
$check_list_filter->_type = $_type;
$check_list_filter->type = $type;
$check_list_filter->loadRefsFwd();
$list_rooms = CDailyCheckList::getRooms();
$empty = new COperation();
$empty->updateFormFields();
$list_rooms["COperation"] = array($empty);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("list_check_lists", $list_check_lists);
$smarty->assign("count_check_lists", $count_check_lists);
$smarty->assign("list_rooms", $list_rooms);
$smarty->assign("check_list", $check_list);
$smarty->assign("object_guid", $object_guid);
$smarty->assign("check_list_filter", $check_list_filter);
$smarty->assign("start", $start);
$smarty->display("vw_daily_check_traceability.tpl");