$PAGE->set_course($course);
$context = $PAGE->context;
if (has_capability('block/timetracker:manageworkers', $context)) {
    //supervisor
    print_error('This page is not accessible by a supervisor');
}
$worker = $DB->get_record('block_timetracker_workerinfo', array('id' => $userid));
if (!$worker) {
    print_error('usernotexist', 'block_timetracker', $CFG->wwwroot . '/blocks/timetracker/index.php?id=' . $course->id);
}
$index = new moodle_url($CFG->wwwroot . '/blocks/timetracker/index.php', $urlparams);
$index->remove_params('userid', 'start', 'end');
$timesheeturl = new moodle_url($CFG->wwwroot . '/blocks/timetracker/timesheet.php', $urlparams);
$timesheeturl->remove_params('start', 'end');
$workersigurl = new moodle_url($CFG->wwwroot . '/blocks/timetracker/workersig.php', $urlparams);
$conflicts = check_worker_hours_for_conflicts($userid, $start, $end);
if (sizeof($conflicts) == 0) {
    redirect($workersigurl);
}
$strtitle = get_string('pluginname', 'block_timetracker');
$PAGE->set_url($timesheeturl);
$PAGE->set_title($strtitle);
$PAGE->set_heading($strtitle);
$PAGE->set_pagelayout('base');
echo $OUTPUT->header();
$tabs = get_tabs($urlparams, false, $courseid);
$tabs = array($tabs);
print_tabs($tabs, 'home');
echo $OUTPUT->box_start();
echo "<p><h3>There are work units in this time range that conflict with your scheduled class\n    times. Please alert the below units to your supervisor and wait for them to be\n    corrected before you submit a timesheet.</h3></p>";
//echo '<p>'.$OUTPUT->action_link($timesheeturl, 'Timesheets').'</p>';
Example #2
0
<?php

define('CLI_SCRIPT', true);
require_once '../../../config.php';
require_once 'check_student_schedules.php';
$conflicts = check_worker_hours_for_conflicts(4, 1325438560, 1328030560);
if ($conflicts) {
    foreach ($conflicts as $conflict) {
        print_object($conflict);
    }
}