* @author Jorge Frisancho Jibaja - select between dates
*/
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
// Access restrictions.
$is_allowedToTrack = api_is_platform_admin(true, true) ||
api_is_teacher() || api_is_course_tutor();
if (!$is_allowedToTrack) {
api_not_allowed(true);
exit;
}
// the section (for the tabs)
$this_section = SECTION_TRACKING;
$user_id = isset($_REQUEST['student']) ? (int) $_REQUEST['student'] : 0;
$session_id = (int) $_GET['id_session'];
$type = isset($_REQUEST['type']) ? Security::remove_XSS($_REQUEST['type']) : '';
$course_code = isset($_REQUEST['course']) ? Security::remove_XSS($_REQUEST['course']) : '';
$courseInfo = api_get_course_info($course_code);
if (empty($courseInfo)) {
api_not_allowed(true);
}
$courseId = (!empty($courseInfo['real_id']) ? $courseInfo['real_id'] : null);
$quote_simple = "'";
$form = new FormValidator(
'myform',
'get',
api_get_self(),
null,
['id' => 'myform']
);
$form->addElement('text', 'from', get_lang('From'), ['id' => 'date_from']);
$form->addElement('text', 'to', get_lang('Until'), ['id' => 'date_to']);
$form->addElement(
'select',
'type',
get_lang('Type'),
['day' => get_lang('Day'), 'month' => get_lang('Month')],
['id' => 'type']
);
$form->addElement('hidden', 'student', $user_id);
$form->addElement('hidden', 'course', $course_code);
$form->addRule('from', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('to', get_lang('ThisFieldIsRequired'), 'required');
$group = [
$form->createElement(
'label',
null,
Display::url(
get_lang('Search'),
'javascript://',
['onclick' => 'loadGraph();', 'class' => 'btn btn-default']
)
),
];
$form->addGroup($group);
$from = null;
$to = null;
$course = $course_code;
if ($form->validate()) {
$values = $form->getSubmitValues();
$from = $values['from'];
$to = $values['to'];
$type = $values['type'];
$course = $values['course'];
}
$url = api_get_path(WEB_AJAX_PATH).'myspace.ajax.php?a=access_detail_by_date&course='.$course.'&student='.$user_id.'&session_id='.$session_id;
$htmlHeadXtra[] = '';
$htmlHeadXtra[] = '';
$htmlHeadXtra[] = "";
$htmlHeadXtra[] = '';
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('AccessDetails')];
Display::display_header('');
$userInfo = api_get_user_info($user_id);
$result_to_print = '';
$sql_result = MySpace::get_connections_to_course($user_id, $courseInfo);
$result_to_print = convert_to_string($sql_result);
echo Display::page_header(get_lang('DetailsStudentInCourse'));
echo Display::page_subheader(
get_lang('User').': '.$userInfo['complete_name'].' - '.get_lang('Course').': '.$courseInfo['title'].' ('.$course_code.')'
);
$form->setDefaults(['from' => $from, 'to' => $to]);
$form->display();
?>