示例#1
0
 function jbxl_is_teacher($uid, $cntxt, $inc_admin = true)
 {
     global $DB;
     if (!$cntxt) {
         return false;
     }
     if (!is_object($cntxt)) {
         $cntxt = jbxl_get_course_context($cntxt);
     }
     $ret = false;
     $roles = $DB->get_records('role', array('archetype' => 'editingteacher'), 'id', 'id');
     foreach ($roles as $role) {
         $ret = user_has_role_assignment($uid, $role->id, $cntxt->id);
         if ($ret) {
             return $ret;
         }
     }
     if ($inc_admin) {
         $ret = jbxl_is_admin($uid);
         if (!$ret) {
             $ret = jbxl_has_role($uid, $cntxt, 'manager');
         }
         if (!$ret) {
             $ret = jbxl_has_role($uid, $cntxt, 'coursecreator');
         }
     }
     return $ret;
 }
示例#2
0
<?php

defined('MOODLE_INTERNAL') || die;
global $USER, $CFG;
$TIME_OFFSET = 0;
if (property_exists($CFG, 'use_timeoffset')) {
    if ($CFG->use_timeoffset) {
        //
        $ver = jbxl_get_moodle_version();
        if ($ver >= 2.7) {
            $TIME_OFFSET = $CFG->timezone * ONE_HOUR_TIME;
        } else {
            if (jbxl_is_admin($USER->id)) {
                if ($USER->timezone != 99) {
                    $TIME_OFFSET = $USER->timezone * ONE_HOUR_TIME;
                } else {
                    if ($CFG->timezone != 99) {
                        $TIME_OFFSET = $CFG->timezone * ONE_HOUR_TIME;
                    }
                }
            }
        }
    }
}
//
$OMITTED_DAYS = array('0' => 'Sun', '1' => 'Mon', '2' => 'Tue', '3' => 'Wed', '4' => 'Thu', '5' => 'Fri', '6' => 'Sat');