function sessiondetails() { checkPerm('view'); require_once _base_ . '/lib/lib.table.php'; $idst_user = importVar('id', true, 0); $id_enter = importVar('id_enter', true, 0); $p_ini = importVar('p_ini'); $link = 'index.php?modname=statistic&op=sessiondetails&id=' . $idst_user . '&id_enter=' . $id_enter; $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'link'); $nav_bar->setLink($link . '&p_ini=' . $p_ini); $ini = $nav_bar->getSelectedElement(); $lang =& DoceboLanguage::createInstance('statistic', 'lms'); $acl_man = Docebo::user()->getAclManager(); $user_info =& $acl_man->getUser($idst_user, false); $query_track = "\r\n\tSELECT g.function, g.type, g.timeof, UNIX_TIMESTAMP(g.timeof) AS unix_time \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_trackingeneral AS g\r\n\tWHERE g.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND g.idUser = '******' AND " . " ( g.idEnter = '" . $id_enter . "' OR ( g.idEnter = 0 AND g.session_id = '" . importVar('sid') . "' ) ) " . " ORDER BY g.timeof \r\n\tLIMIT " . $ini . ", " . Get::sett('visuItem'); $re_tracks = sql_query($query_track); $query_tot_track = "\r\n\tSELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_trackingeneral \r\n\tWHERE idCourse = '" . (int) $_SESSION['idCourse'] . "' AND idUser = '******' AND idEnter = '" . $id_enter . "'"; list($tot_elem) = sql_fetch_row(sql_query($query_tot_track)); $nav_bar->setElementTotal($tot_elem); // Find modulename -> name int his course require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; $course_man = new Man_Course(); $mods_names =& $course_man->getModulesName($_SESSION['idCourse']); $page_title = array('index.php?modname=statistic&op=statistic' => $lang->def('_STATISTICS'), 'index.php?modname=statistic&op=userdetails&id=' . $idst_user . '&p_ini=' . $p_ini => $user_info[ACL_INFO_LASTNAME] . $user_info[ACL_INFO_FIRSTNAME] ? $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME] : $acl_man->relativeId($user_info[ACL_INFO_USERID]), $lang->def('_VIEW_SESSION_DETAILS')); $GLOBALS['page']->add(getTitleArea($page_title, 'statistic') . '<div class="std_block">' . getBackUi('index.php?modname=statistic&op=userdetails&id=' . $idst_user . '&p_ini=' . $p_ini, $lang->def('_BACK')), 'content'); $tb = new Table(0, $lang->def('_VIEW_SESSION_DETAILS'), $lang->def('_VIEW_SESSION_DETAILS')); $type_h = array('', '', ''); $cont_h = array($lang->def('_DATE'), $lang->def('_TYPE_OF_OPERATION'), $lang->def('_TIME_IN')); $tb->setColsStyle($type_h); $tb->addHead($cont_h); $type_h[2] = 'align_right'; $tb->setColsStyle($type_h); $total_sec = 0; $read_previous = false; while ($read = mysql_fetch_assoc($re_tracks)) { if ($read_previous !== false) { $time_in = $read['unix_time'] - $read_previous['unix_time']; $hours = (int) ($time_in / 3600); $minutes = (int) ($time_in % 3600 / 60); $seconds = (int) ($time_in % 60); if ($minutes < 10) { $minutes = '0' . $minutes; } if ($seconds < 10) { $seconds = '0' . $seconds; } $readable = $hours . 'h ' . $minutes . 'm ' . $seconds . 's '; $cont = array(Format::date($read_previous['timeof'], false, true), '<span class="text_bold">' . (isset($mods_names[$read_previous['function']]) ? $mods_names[$read_previous['function']] : $read_previous['function']) . '</span> [' . $read_previous['type'] . ']', $readable); $tb->addBody($cont); } $read_previous = $read; } $query_last_track = "\r\n\tSELECT g.function, g.type, g.timeof, UNIX_TIMESTAMP(g.timeof) AS unix_time \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_trackingeneral AS g\r\n\tWHERE g.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND g.idUser = '******' AND g.idEnter = '" . $id_enter . "' \r\n\tLIMIT " . ($ini + Get::sett('visuItem')) . ", 1"; $re_track = sql_query($query_last_track); if (mysql_num_rows($re_track) > 0) { $read = mysql_fetch_assoc($re_track); $time_in = $read['unix_time'] - $read_previous['unix_time']; $hours = (int) ($time_in / 3600); $minutes = (int) ($time_in % 3600 / 60); $seconds = (int) ($time_in % 60); if ($minutes < 10) { $minutes = '0' . $minutes; } if ($seconds < 10) { $seconds = '0' . $seconds; } $readable = $hours . 'h ' . $minutes . 'm ' . $seconds . 's '; } else { $readable = ''; } $cont = array(Format::date($read_previous['timeof']), '<span class="text_bold">' . (isset($mods_names[$read_previous['function']]) ? $mods_names[$read_previous['function']] : $read_previous['function']) . '</span> [' . $read_previous['type'] . ']', $readable); $tb->addBody($cont); $GLOBALS['page']->add($tb->getTable() . $nav_bar->getNavBar() . getBackUi('index.php?modname=statistic&op=userdetails&id=' . $idst_user . '&p_ini=' . $p_ini, $lang->def('_BACK')) . '</div>', 'content'); }