コード例 #1
0
/**
 * Prints the page headers, breadcrumb trail, page heading, (optional) dropdown navigation menu and
 * (optional) navigation tabs for any gradebook page. All gradebook pages MUST use these functions
 * in favour of the usual print_header(), print_header_simple(), print_heading() etc.
 * !IMPORTANT! Use of tabs.php file in gradebook pages is forbidden unless tabs are switched off at
 * the site level for the gradebook ($CFG->grade_navmethod = GRADE_NAVMETHOD_DROPDOWN).
 *
 * @param int $courseid
 * @param string $active_type The type of the current page (report, settings, import, export, scales, outcomes, letters)
 * @param string $active_plugin The plugin of the current page (grader, fullview etc...)
 * @param string $heading The heading of the page. Tries to guess if none is given
 * @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function
 * @param string $bodytags Additional attributes that will be added to the <body> tag
 * @param string $buttons Additional buttons to display on the page
 *
 * @return string HTML code or nothing if $return == false
 */
function print_grade_page_head_local($courseid, $active_type, $active_plugin = null, $heading = false, $return = false, $bodytags = '', $buttons = false, $extracss = array())
{
    global $CFG, $COURSE;
    $strgrades = get_string('grades');
    $plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
    // Determine the string of the active plugin
    $stractive_plugin = $active_plugin ? $plugin_info['strings']['active_plugin_str'] : $heading;
    $stractive_type = $plugin_info['strings'][$active_type];
    $navlinks = array();
    $first_link = '';
    if ($active_type == 'settings' && $active_plugin != 'coursesettings') {
        $first_link = $plugin_info['report'][$active_plugin]['link'];
    } elseif ($active_type != 'report') {
        $first_link = $CFG->wwwroot . '/grade/index.php?id=' . $COURSE->id;
    }
    if ($active_type == 'preferences') {
        $CFG->stylesheets[] = $CFG->wwwroot . '/grade/report/styles.css';
    }
    foreach ($extracss as $css_url) {
        $CFG->stylesheets[] = $css_url;
    }
    $navlinks[] = array('name' => $strgrades, 'link' => $first_link, 'type' => 'misc');
    $active_type_link = '';
    if (!empty($plugin_info[$active_type]['link']) && $plugin_info[$active_type]['link'] != qualified_me()) {
        $active_type_link = $plugin_info[$active_type]['link'];
    }
    if (!empty($plugin_info[$active_type]['parent']['link'])) {
        $active_type_link = $plugin_info[$active_type]['parent']['link'];
        $navlinks[] = array('name' => $stractive_type, 'link' => $active_type_link, 'type' => 'misc');
    }
    if (empty($plugin_info[$active_type]['id'])) {
        $navlinks[] = array('name' => $stractive_type, 'link' => $active_type_link, 'type' => 'misc');
    }
    $navlinks[] = array('name' => $stractive_plugin, 'link' => null, 'type' => 'misc');
    $navigation = build_navigation($navlinks);
    $title = ': ' . $stractive_plugin;
    if (empty($plugin_info[$active_type]['id']) || !empty($plugin_info[$active_type]['parent'])) {
        $title = ': ' . $stractive_type . ': ' . $stractive_plugin;
    }
    $returnval = print_header_simple($strgrades . ': ' . $stractive_type, $title, $navigation, '', $bodytags, true, $buttons, navmenu($COURSE), false, '', $return);
    // Guess heading if not given explicitly
    if (!$heading) {
        $heading = $stractive_plugin;
    }
    if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_DROPDOWN) {
        $returnval .= print_grade_plugin_selector($plugin_info, $return);
    }
    $returnval .= print_heading($heading);
    if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_TABS) {
        $returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return);
    }
    if ($return) {
        return $returnval;
    }
}
コード例 #2
0
ファイル: default.php プロジェクト: veritech/pare-project
 function print_header_and_tabs($cm, $course, $quiz, $reportmode = "overview", $meta = "")
 {
     global $CFG;
     /// Define some strings
     $strquizzes = get_string("modulenameplural", "quiz");
     $strquiz = get_string("modulename", "quiz");
     /// Print the page header
     print_header_simple(format_string($quiz->name), "", "<a href=\"index.php?id={$course->id}\">{$strquizzes}</a>\n                      -> " . format_string($quiz->name), '', $meta, true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));
     /// Print the tabs
     $currenttab = 'reports';
     $mode = $reportmode;
     require $CFG->dirroot . '/mod/quiz/tabs.php';
 }
コード例 #3
0
 function print_header_and_tabs($cm, $course, $quiz, $reportmode = "overview", $meta = "")
 {
     global $CFG;
     /// Define some strings
     $strquizzes = get_string("modulenameplural", "quiz");
     $strquiz = get_string("modulename", "quiz");
     /// Print the page header
     $navigation = build_navigation('', $cm);
     print_header_simple(format_string($quiz->name), "", $navigation, '', $meta, true, update_module_button($cm->id, $course->id, $strquiz), user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm));
     /// Print the tabs
     $currenttab = 'reports';
     $mode = $reportmode;
     require $CFG->dirroot . '/mod/quiz/tabs.php';
 }
コード例 #4
0
ファイル: pagelib.php プロジェクト: JackCanada/moodle-hacks
 function print_header()
 {
     global $USER, $CFG;
     $tagname = tag_display_name($this->tag_object);
     $navlinks = array();
     $navlinks[] = array('name' => get_string('tags', 'tag'), 'link' => "{$CFG->wwwroot}/tag/search.php", 'type' => '');
     $navlinks[] = array('name' => $tagname, 'link' => '', 'type' => '');
     $navigation = build_navigation($navlinks);
     $title = get_string('tag', 'tag') . ' - ' . $tagname;
     $button = '';
     if ($this->user_allowed_editing()) {
         $button = update_tag_button($this->id);
     }
     print_header_simple($title, '', $navigation, '', '', '', $button);
 }
コード例 #5
0
 public static function printHeader($title = '', $course_id = SITEID, $cache = false)
 {
     $navlinks = array();
     if ($course_id != SITEID) {
         $navlinks[] = array('name' => get_field('course', 'shortname', 'id', $course_id), 'link' => $GLOBALS['CFG']->wwwroot . '/course/view.php?id=' . $course_id, 'type' => 'title');
     }
     $navlinks[] = array('name' => $title, 'link' => '', 'type' => 'title');
     print_header_simple($title, '', build_navigation($navlinks), '', '', $cache);
     echo '<div style="float:right;">';
     /*		helpbutton('repository', sharing_cart_plugins::get_string('title', 'repository'),
     				'block_sharing_cart/plugins/repository', true, false, '', false);*/
     echo '</div>';
     echo '<div style="clear:both;"><!-- clear float --></div>';
     print_heading($title);
 }
コード例 #6
0
 function print_header_and_tabs($cm, $course, $quiz, $reportmode = "overview", $meta = "")
 {
     global $CFG;
     /// Define some strings
     $strquizzes = get_string("modulenameplural", "quiz");
     $strquiz = get_string("modulename", "quiz");
     /// Print the page header
     $navlinks = array();
     $navlinks[] = array('name' => $strquizzes, 'link' => "index.php?id={$course->id}", 'type' => 'activity');
     $navlinks[] = array('name' => format_string($quiz->name), 'link' => '', 'type' => 'activityinstance');
     $navigation = build_navigation($navlinks);
     print_header_simple(format_string($quiz->name), "", $navigation, '', $meta, true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));
     /// Print the tabs
     $currenttab = 'reports';
     $mode = $reportmode;
     require $CFG->dirroot . '/mod/quiz/tabs.php';
 }
コード例 #7
0
function webquestscorm_print_header($name, $currenttab = '', $course = NULL, $cm = NULL, $cmid = 0)
{
    global $CFG;
    if ($cmid) {
        if (!isset($cm)) {
            if (!($cm = get_coursemodule_from_id('webquestscorm', $cmid))) {
                error('Course Module ID was incorrect');
            }
        }
        if (!isset($course)) {
            if (!($course = get_record('course', 'id', $this->cm->course))) {
                error('Course is misconfigured');
            }
        }
        if (!isset($name)) {
            if (!($webquestscorm = get_record('webquestscorm', 'id', $this->cm->instance))) {
                error('webquestscorm ID was incorrect');
            }
            $name = $webquestscorm->name;
        }
    } else {
        if (!isset($cm)) {
            error('Course Module ID was incorrect');
        }
        if (!isset($course)) {
            error('Course is misconfigured');
        }
        if (!isset($name)) {
            error('webquestscorm name was incorrect');
        }
    }
    $strwebquestscorms = get_string('modulenameplural', 'webquestscorm');
    $strwebquestscorm = get_string('modulename', 'webquestscorm');
    $strname = format_string($name);
    $button = update_module_button($cm->id, $course->id, $strwebquestscorm);
    $meta = '';
    if ($CFG->version < 2007101500) {
        print_header_simple(format_string($strname), "", "<a href=\"index.php?id={$course->id}\">{$strwebquestscorms}</a> -> " . format_string($name), "", "", true, update_module_button($cm->id, $course->id, $strwebquestscorm), navmenu($course, $cm));
    } else {
        $navigation = build_navigation('', $cm);
        print_header($course->shortname . ':' . $strname, $course->fullname, $navigation, '', $meta, true, $button, navmenu($course, $cm));
    }
    print_heading(format_string($name, true));
    require_once "tabs.php";
}
コード例 #8
0
 function print_header_and_tabs($cm, $course, $game, $reportmode = "overview", $meta = "")
 {
     global $CFG;
     /// Define some strings
     $strgames = get_string("modulenameplural", "game");
     $strgame = get_string("modulename", "game");
     /// Print the page header
     if (function_exists('build_navigation')) {
         $navigation = build_navigation('', $cm);
         print_header($course->shortname, $course->shortname, $navigation);
     } else {
         print_header_simple(format_string($game->name), "", "<a href=\"index.php?id={$course->id}\">{$strgames}</a>\n                      -> " . format_string($game->name), '', $meta, true, update_module_button($cm->id, $course->id, $strgame), navmenu($course, $cm));
     }
     /// Print the tabs
     $currenttab = 'reports';
     $mode = $reportmode;
     include 'tabs.php';
 }
コード例 #9
0
ファイル: default.php プロジェクト: ajv/Offline-Caching
 function print_header_and_tabs($cm, $course, $quiz, $reportmode = "overview")
 {
     global $CFG;
     /// Define some strings
     $strquizzes = get_string("modulenameplural", "quiz");
     $strquiz = get_string("modulename", "quiz");
     /// Print the page header
     $navigation = build_navigation('', $cm);
     print_header_simple(format_string($quiz->name), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));
     /// Print the tabs
     $currenttab = 'reports';
     $mode = $reportmode;
     require $CFG->dirroot . '/mod/quiz/tabs.php';
     $course_context = get_context_instance(CONTEXT_COURSE, $course->id);
     if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) {
         echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">' . get_string('seeallcoursegrades', 'grades') . '</a></div>';
     }
 }
コード例 #10
0
 function print_header($title, $morebreadcrumbs = NULL)
 {
     global $USER, $CFG, $WS;
     $this->init_full();
     if ($this->user_allowed_editing()) {
         $buttons = wiki_table_start('', true);
         $buttons .= update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'wiki'));
         if (!empty($CFG->showblocksonmodpages)) {
             $buttons .= wiki_change_column('', true);
             $prop = null;
             $prop->method = "get";
             $prop->action = "view.php";
             $prop->events = 'onsubmit="this.target=\'_top\'; return true"';
             $buttons .= wiki_form_start($prop, true);
             $buttons .= wiki_div_start('', true);
             $prop = null;
             $prop->name = "id";
             $prop->value = $this->modulerecord->id;
             $buttons .= wiki_input_hidden($prop, true);
             $prop = null;
             $prop->name = "edit";
             $prop->value = $this->user_is_editing() ? 'off' : 'on';
             $buttons .= wiki_input_hidden($prop, true);
             $prop = null;
             $prop->value = get_string($this->user_is_editing() ? 'blockseditoff' : 'blocksediton');
             $buttons .= wiki_input_submit($prop, true);
             $buttons .= wiki_div_end(true);
             $buttons .= wiki_form_end(true);
         }
         $buttons .= wiki_table_end('', true);
     } else {
         $buttons = '&nbsp;';
     }
     //        print_header($title, $this->courserecord->fullname, $crumbtext, '', '', true, $buttons, navmenu($this->courserecord, $this->modulerecord));
     /// Print header.
     $navlinks = array();
     $navlinks[] = array('name' => get_string('modulenameplural', 'wiki'), 'link' => $CFG->wwwroot . '/mod/wiki/index.php?id=' . $this->courserecord->id, 'type' => 'activity');
     $navlinks[] = array('name' => format_string($this->activityrecord->name), 'link' => "view.php", 'type' => 'activityinstance');
     $navigation = build_navigation($navlinks);
     print_header_simple(format_string($this->activityrecord->name), "", $navigation, "", "", true, $buttons, navmenu($this->courserecord, $WS->cm));
 }
コード例 #11
0
ファイル: key.php プロジェクト: BackupTheBerlios/samouk-svn
}
/// First create the form
$editform = new key_form();
$editform->set_data($key);
if ($editform->is_cancelled()) {
    redirect($returnurl);
} elseif ($data = $editform->get_data()) {
    if ($data->id) {
        $record = new object();
        $record->id = $data->id;
        $record->iprestriction = $data->iprestriction;
        $record->validuntil = $data->validuntil;
        update_record('user_private_key', $record);
    } else {
        create_user_key('grade/export', $USER->id, $course->id, $data->iprestriction, $data->validuntil);
    }
    redirect($returnurl);
}
$strkeys = get_string('userkeys', 'userkey');
$strgrades = get_string('grades');
if ($id) {
    $strheading = get_string('edituserkey', 'userkey');
} else {
    $strheading = get_string('createuserkey', 'userkey');
}
$navlinks = array(array('name' => $strgrades, 'link' => $CFG->wwwroot . '/grade/index.php?id=' . $courseid, 'type' => 'misc'), array('name' => $strkeys, 'link' => $CFG->wwwroot . '/grade/export/keymanager.php?id=' . $courseid, 'type' => 'misc'), array('name' => $strheading, 'link' => '', 'type' => 'misc'));
$navigation = build_navigation($navlinks);
/// Print header
print_header_simple($strkeys, ': ' . $strkeys, $navigation, '', '', true, '', navmenu($course));
$editform->display();
print_footer($course);
コード例 #12
0
ファイル: index.php プロジェクト: r007/PMoodle
/// processing posted grades & feedback here
if ($data = data_submitted() and confirm_sesskey() and has_capability('moodle/grade:edit', $context)) {
    $warnings = $report->process_data($data);
} else {
    $warnings = array();
}
// Override perpage if set in URL
if ($perpageurl) {
    $report->user_prefs['studentsperpage'] = $perpageurl;
}
// final grades MUST be loaded after the processing
$report->load_users();
$numusers = $report->get_numusers();
$report->load_final_grades();
/// Print header
print_header_simple($strgrades . ': ' . $reportname, ': ' . $strgrades, $navigation, '', '', true, $buttons, navmenu($course));
/// Print the plugin selector at the top
print_grade_plugin_selector($courseid, 'report', 'grader');
// Add tabs
$currenttab = 'graderreport';
require 'tabs.php';
echo $report->group_selector;
echo '<div class="clearer"></div>';
echo $report->get_toggles_html();
//show warnings if any
foreach ($warnings as $warning) {
    notify($warning);
}
$studentsperpage = $report->get_pref('studentsperpage');
// Don't use paging if studentsperpage is empty or 0 at course AND site levels
if (!empty($studentsperpage)) {
コード例 #13
0
            //delete responses.
            redirect("view.php?id={$cm->id}");
        }
    }
    $answer = optional_param('answer', '', PARAM_INT);
    if (empty($answer)) {
        redirect("view.php?id={$cm->id}", get_string('mustchooseone', 'choice'));
    } else {
        choice_user_submit_response($answer, $choice, $USER->id, $course->id, $cm);
    }
    redirect("view.php?id={$cm->id}");
    exit;
}
/// Display the choice and possibly results
$navigation = build_navigation('', $cm);
print_header_simple(format_string($choice->name), "", $navigation, "", "", true, update_module_button($cm->id, $course->id, $strchoice), navmenu($course, $cm));
add_to_log($course->id, "choice", "view", "view.php?id={$cm->id}", $choice->id, $cm->id);
/// Check to see if groups are being used in this choice
$groupmode = groups_get_activity_groupmode($cm);
groups_get_activity_group($cm, true);
groups_print_activity_menu($cm, 'view.php?id=' . $id);
if (has_capability('mod/choice:readresponses', $context)) {
    choice_show_reportlink($choice, $course->id, $cm, $groupmode);
}
echo '<div class="clearer"></div>';
if ($choice->text) {
    print_box(format_text($choice->text, $choice->format), 'generalbox', 'intro');
}
//if user has already made a selection, and they are not allowed to update it, show their selected answer.
if (!empty($USER->id) && ($current = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $USER->id)) && empty($choice->allowupdate)) {
    print_simple_box(get_string("yourselection", "choice", userdate($choice->timeopen)) . ": " . format_string(choice_get_option_text($choice, $current->optionid)), "center");
コード例 #14
0
ファイル: complete.php プロジェクト: kai707/ITSA-backup
    } else {
        error("courseid is not correct");
    }
}
if (!$capabilities->complete) {
    error(get_string('error'));
}
/// Print the page header
$strfeedbacks = get_string("modulenameplural", "feedback");
$strfeedback = get_string("modulename", "feedback");
$buttontext = update_module_button($cm->id, $course->id, $strfeedback);
$navlinks = array();
$navlinks[] = array('name' => $strfeedbacks, 'link' => "index.php?id={$course->id}", 'type' => 'activity');
$navlinks[] = array('name' => format_string($feedback->name), 'link' => "", 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
print_header_simple(format_string($feedback->name), "", $navigation, "", "", true, $buttontext, navmenu($course, $cm));
//ishidden check.
//feedback in courses
if (empty($cm->visible) and !$capabilities->viewhiddenactivities and $course->id != SITEID) {
    notice(get_string("activityiscurrentlyhidden"));
}
//ishidden check.
//feedback on mainsite
if (empty($cm->visible) and !$capabilities->viewhiddenactivities and $courseid == SITEID) {
    notice(get_string("activityiscurrentlyhidden"));
}
feedback_print_errors();
//check, if the feedback is open (timeopen, timeclose)
$checktime = time();
if ($feedback->timeopen > $checktime or $feedback->timeclose < $checktime and $feedback->timeclose > 0) {
    // print_simple_box_start('center');
コード例 #15
0
ファイル: approverequest.php プロジェクト: nadavkav/MoodleTAO
if (!($course = get_record('course', 'id', $certrequest->courseid))) {
    error('Invalid Course');
}
if ($certrequest->status != 'submitted') {
    error('Invalid Certification');
}
require_login($course->id);
$strtitle = get_string('approvecertification', 'block_tao_certification_path');
//check this user is an MT for this user.
$ptcontext = get_context_instance(CONTEXT_USER, $certrequest->userid);
require_capability('moodle/local:ismt', $ptcontext);
$navlinks = array();
$navlinks[] = array('name' => get_string('certification', 'block_tao_certification_path'), 'link' => "{$CFG->wwwroot}/local/lp/certification.php", 'type' => 'misc');
$navlinks[] = array('name' => $strtitle, 'link' => "", 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header_simple($strtitle, $strtitle, $navigation);
if ($action == 'approved') {
    $certrequest->status = 'approved';
    $certrequest->changeuserid = $USER->id;
    $certrequest->timechanged = time();
    $certrequest->description = $description;
    if (!update_record('tao_user_certification_status', $certrequest)) {
        notify("Error updating certification status");
        print_footer(NULL, $course);
        die;
    }
    //now save event
    $eventdata = new object();
    $eventdata->userid = $certrequest->userid;
    $eventdata->course = $course->id;
    $eventdata->certification = $certrequest->certtype;
コード例 #16
0
ファイル: mod.php プロジェクト: veritech/pare-project
            }
        }
    }
}
require_login($course->id);
// needed to setup proper $COURSE
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('moodle/course:manageactivities', $context);
$streditinga = get_string("editinga", "moodle", $fullmodulename);
$strmodulenameplural = get_string("modulenameplural", $module->name);
if ($module->name == "label") {
    $focuscursor = "form.content";
} else {
    $focuscursor = "form.name";
}
print_header_simple($streditinga, '', "<a href=\"{$CFG->wwwroot}/mod/{$module->name}/index.php?id={$course->id}\">{$strmodulenameplural}</a> ->\n     {$strnav} {$streditinga}", $focuscursor, "", false);
if (!empty($cm->id)) {
    $context = get_context_instance(CONTEXT_MODULE, $cm->id);
    $currenttab = 'update';
    include_once $CFG->dirroot . '/' . $CFG->admin . '/roles/tabs.php';
}
unset($SESSION->modform);
// Clear any old ones that may be hanging around.
$modform = "../mod/{$module->name}/mod.html";
if (file_exists($modform)) {
    if ($usehtmleditor = can_use_html_editor()) {
        $defaultformat = FORMAT_HTML;
        $editorfields = '';
    } else {
        $defaultformat = FORMAT_MOODLE;
    }
コード例 #17
0
    if ($user->id == $USER->id) {
        $context = get_context_instance(CONTEXT_SYSTEM);
    } else {
        $context = get_context_instance(CONTEXT_USER, $user->id);
    }
    $link_values = '?concernspost=' . $concernspost;
    $title = "{$strconcerns}: " . fullname($user);
    $footer = '';
}
$navlinks[] = array('name' => $strilps, 'link' => "{$CFG->wwwroot}/blocks/ilp/list.php?courseid={$courseid}", 'type' => 'misc');
$navlinks[] = array('name' => $strilp, 'link' => "{$CFG->wwwroot}/blocks/ilp/view.php?id={$user->id}&amp;courseid={$courseid}", 'type' => 'misc');
$navlinks[] = array('name' => fullname($user), 'link' => FALSE, 'type' => 'misc');
$navlinks[] = array('name' => $strconcerns, 'link' => FALSE, 'type' => 'misc');
$navlinks[] = array('name' => $strcomments, 'link' => FALSE, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header_simple($title, '', $navigation, '', '', true, '', '');
//Allow users to see their own profile, but prevent others
if (has_capability('moodle/legacy:guest', $context, NULL, false)) {
    error("You are logged in as Guest.");
}
if ($USER->id != $user->id) {
    require_capability('mod/ilpconcern:view', $context);
}
$mform = new ilpconcern_updatecomment_form('', array('userid' => $user->id, 'id' => $id, 'courseid' => $courseid, 'concernspost' => $concernspost, 'commentid' => $commentid));
echo '<div class="ilp_post yui-t4">';
echo '<div class="bd" role="main">';
echo '<div class="yui-main">';
echo '<div class="yui-b">';
if (isset($post->name)) {
    echo '<div class="yui-gd">';
    echo '<div class="yui-u first">';
コード例 #18
0
ファイル: index.php プロジェクト: JackCanada/moodle-hacks
require_once "lib.php";
$id = required_param('id', PARAM_INT);
// course
if (!($course = get_record("course", "id", $id))) {
    error("Course ID is incorrect");
}
require_course_login($course);
add_to_log($course->id, "journal", "view all", "index.php?id={$course->id}", "");
$strjournal = get_string("modulename", "journal");
$strjournals = get_string("modulenameplural", "journal");
$strweek = get_string("week");
$strtopic = get_string("topic");
$navlinks = array();
$navlinks[] = array('name' => $strjournals, 'link' => '', 'type' => 'activity');
$navigation = build_navigation($navlinks);
print_header_simple("{$strjournals}", "", $navigation, "", "", true, "", navmenu($course));
if (!($journals = get_all_instances_in_course("journal", $course))) {
    notice(get_string('thereareno', 'moodle', $strjournals), "../../course/view.php?id={$course->id}");
    die;
}
$timenow = time();
if ($course->format == "weeks") {
    $strsection = $strweek;
} else {
    if ($course->format == "topics") {
        $strsection = $strtopic;
    } else {
        $strsection = "";
    }
}
foreach ($journals as $journal) {
コード例 #19
0
ファイル: export.php プロジェクト: ajv/Offline-Caching
    } else {
        print_error('nofieldindatabase', 'data');
    }
}
// populate objets for this databases fields
$fields = array();
foreach ($fieldrecords as $fieldrecord) {
    $fields[] = data_get_field($fieldrecord, $data);
}
$mform = new mod_data_export_form('export.php?d=' . $data->id, $fields, $cm);
if ($mform->is_cancelled()) {
    redirect('view.php?d=' . $data->id);
} elseif (!($formdata = (array) $mform->get_data())) {
    // build header to match the rest of the UI
    $nav = build_navigation('', $cm);
    print_header_simple($data->name, '', $nav, '', '', true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')), navmenu($course, $cm), '', '');
    echo $OUTPUT->heading(format_string($data->name));
    // these are for the tab display
    $currentgroup = groups_get_activity_group($cm);
    $groupmode = groups_get_activity_groupmode($cm);
    $currenttab = 'export';
    include 'tabs.php';
    $mform->display();
    echo $OUTPUT->footer();
    die;
}
if (array_key_exists('portfolio', $formdata) && !empty($formdata['portfolio'])) {
    // fake  portfolio callback stuff and redirect
    $formdata['id'] = $cm->id;
    $formdata['exporttype'] = 'csv';
    // force for now
コード例 #20
0
/**
 * Print the standard header for pagemenu module
 *
 * @uses $CFG
 * @uses $USER tabs.php requires it
 * @param object $cm Course module record object
 * @param object $course Couse record object
 * @param object $pagemenu pagemenu module record object
 * @param string $currenttab File location and tab to be selected
 * @param string $focus Focus
 * @param boolean $showtabs Display tabs yes/no
 * @return void
 **/
function pagemenu_print_header($cm, $course, $pagemenu, $currenttab = 'view', $focus = '', $showtabs = true)
{
    global $CFG, $USER;
    $strpagemenus = get_string('modulenameplural', 'pagemenu');
    $strpagemenu = get_string('modulename', 'pagemenu');
    $strname = format_string($pagemenu->name);
    /// Log it!
    add_to_log($course->id, 'pagemenu', $currenttab, "{$currenttab}.php?id={$cm->id}", $strname, $cm->id);
    /// Print header, heading, tabs and messages
    print_header_simple($strname, $strname, build_navigation('', $cm), $focus, '', true, update_module_button($cm->id, $course->id, $strpagemenu), navmenu($course, $cm));
    print_heading($strname);
    if ($showtabs) {
        pagemenu_print_tabs($cm, $currenttab);
    }
    pagemenu_print_messages();
}
コード例 #21
0
$currentgroup = groups_get_activity_group($cm, true);
if (empty($currentgroup)) {
    $currentgroup = 0;
}
if (empty($elluminate->meetingid) && $elluminate->groupmode != 0) {
    elluminate_group_instance_check($elluminate, $cm->id);
}
$baseurl = $CFG->wwwroot . '/mod/elluminate/preload.php?id=' . $elluminate->id;
/// Print the page header
$strelluminates = get_string('modulenameplural', 'elluminate');
$strelluminate = get_string('modulename', 'elluminate');
$straddpreload = get_string('addpreload', 'elluminate');
$strdelpreload = get_string('deletewhiteboardpreload', 'elluminate');
$buttontext = update_module_button($cm->id, $course->id, $strelluminate);
$navigation = build_navigation(empty($delete) ? $straddpreload : $strdelpreload, $cm);
print_header_simple(format_string($elluminate->name), '', $navigation, '', '', true, $buttontext, navmenu($course, $cm));
/// Delete a preload file for this meeting.
if (!empty($delete)) {
    if (!empty($elluminate->meetingid)) {
        if ($preload = elluminate_list_meeting_preloads($elluminate->meetingid)) {
            if ($preload->presentationid == $delete) {
                /// Delete the preload from the meeting.
                if (!elluminate_delete_preload($preload->presentationid, $elluminate->meetingid)) {
                    error(get_string('preloaddeleteerror', 'elluminate'));
                }
                redirect($CFG->wwwroot . '/mod/elluminate/view.php?id=' . $cm->id, get_string('preloaddeletesuccess', 'elluminate'), 5);
            }
        }
    }
}
if (($data = data_submitted($CFG->wwwroot . '/mod/elluminate/preload.php')) && confirm_sesskey()) {
コード例 #22
0
ファイル: messagegroup.php プロジェクト: nadavkav/MoodleTAO
 *
 */
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once $CFG->libdir . '/formslib.php';
require_once $CFG->dirroot . '/local/forms.php';
$strheading = get_string('messagegroup', 'block_tao_team_groups');
$courseid = required_param('id', PARAM_INT);
$groupid = required_param('groupid', PARAM_INT);
if (!($COURSE = get_record('course', 'id', $courseid))) {
    error('Invalid course idnumber');
}
if (!empty($groupid) && !($group = get_record('groups', 'id', $groupid, 'courseid', $courseid))) {
    error('Invalid group id');
}
require_login();
print_header_simple($strheading, $strheading, build_navigation($strheading));
if (groups_is_member($groupid)) {
    $grpmembers = groups_get_members($groupid);
    if (count($grpmembers) > 1) {
        require_once $CFG->dirroot . '/local/forms.php';
        require_once $CFG->dirroot . '/message/lib.php';
        $messageform = new tao_group_message_send_form('', array('course' => $COURSE, 'group' => $group, 'count' => count($grpmembers) - 1));
        if ($data = $messageform->get_data()) {
            foreach ($grpmembers as $touser) {
                if ($touser->id != $USER->id) {
                    //don't send a message to yourself.
                    message_post_message($USER, $touser, $data->body, $data->format, 'direct');
                }
            }
            notify(get_string('groupmessagesent', 'block_tao_team_groups'), 'notifysuccess');
            print_continue($CFG->wwwroot . '/course/view.php?id=' . $COURSE->id);
コード例 #23
0
ファイル: lib.php プロジェクト: ajv/Offline-Caching
 /**
  *  Display all the submissions ready for grading
  *
  * @global object
  * @global object
  * @global object
  * @global object
  * @param string $message
  * @return bool|void
  */
 function display_submissions($message = '')
 {
     global $CFG, $DB, $USER, $DB, $OUTPUT;
     require_once $CFG->libdir . '/gradelib.php';
     /* first we check to see if the form has just been submitted
      * to request user_preference updates
      */
     if (isset($_POST['updatepref'])) {
         $perpage = optional_param('perpage', 10, PARAM_INT);
         $perpage = $perpage <= 0 ? 10 : $perpage;
         set_user_preference('assignment_perpage', $perpage);
         set_user_preference('assignment_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL));
     }
     /* next we get perpage and quickgrade (allow quick grade) params
      * from database
      */
     $perpage = get_user_preferences('assignment_perpage', 10);
     $quickgrade = get_user_preferences('assignment_quickgrade', 0);
     $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id);
     if (!empty($CFG->enableoutcomes) and !empty($grading_info->outcomes)) {
         $uses_outcomes = true;
     } else {
         $uses_outcomes = false;
     }
     $page = optional_param('page', 0, PARAM_INT);
     $strsaveallfeedback = get_string('saveallfeedback', 'assignment');
     /// Some shortcuts to make the code read better
     $course = $this->course;
     $assignment = $this->assignment;
     $cm = $this->cm;
     $tabindex = 1;
     //tabindex for quick grading tabbing; Not working for dropdowns yet
     add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id=' . $this->cm->id, $this->assignment->id, $this->cm->id);
     $navigation = build_navigation($this->strsubmissions, $this->cm);
     print_header_simple(format_string($this->assignment->name, true), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $this->strassignment), navmenu($course, $cm));
     $course_context = get_context_instance(CONTEXT_COURSE, $course->id);
     if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) {
         echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">' . get_string('seeallcoursegrades', 'grades') . '</a></div>';
     }
     if (!empty($message)) {
         echo $message;
         // display messages here if any
     }
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     /// Check to see if groups are being used in this assignment
     /// find out current groups mode
     $groupmode = groups_get_activity_groupmode($cm);
     $currentgroup = groups_get_activity_group($cm, true);
     groups_print_activity_menu($cm, 'submissions.php?id=' . $this->cm->id);
     /// Get all ppl that are allowed to submit assignments
     if ($users = get_users_by_capability($context, 'mod/assignment:submit', 'u.id', '', '', '', $currentgroup, '', false)) {
         $users = array_keys($users);
     }
     // if groupmembersonly used, remove users who are not in any group
     if ($users and !empty($CFG->enablegroupings) and $cm->groupmembersonly) {
         if ($groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id')) {
             $users = array_intersect($users, array_keys($groupingusers));
         }
     }
     $tablecolumns = array('picture', 'fullname', 'grade', 'submissioncomment', 'timemodified', 'timemarked', 'status', 'finalgrade');
     if ($uses_outcomes) {
         $tablecolumns[] = 'outcome';
         // no sorting based on outcomes column
     }
     $tableheaders = array('', get_string('fullname'), get_string('grade'), get_string('comment', 'assignment'), get_string('lastmodified') . ' (' . get_string('submission', 'assignment') . ')', get_string('lastmodified') . ' (' . get_string('grade') . ')', get_string('status'), get_string('finalgrade', 'grades'));
     if ($uses_outcomes) {
         $tableheaders[] = get_string('outcome', 'grades');
     }
     require_once $CFG->libdir . '/tablelib.php';
     $table = new flexible_table('mod-assignment-submissions');
     $table->define_columns($tablecolumns);
     $table->define_headers($tableheaders);
     $table->define_baseurl($CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id . '&amp;currentgroup=' . $currentgroup);
     $table->sortable(true, 'lastname');
     //sorted by lastname by default
     $table->collapsible(true);
     $table->initialbars(true);
     $table->column_suppress('picture');
     $table->column_suppress('fullname');
     $table->column_class('picture', 'picture');
     $table->column_class('fullname', 'fullname');
     $table->column_class('grade', 'grade');
     $table->column_class('submissioncomment', 'comment');
     $table->column_class('timemodified', 'timemodified');
     $table->column_class('timemarked', 'timemarked');
     $table->column_class('status', 'status');
     $table->column_class('finalgrade', 'finalgrade');
     if ($uses_outcomes) {
         $table->column_class('outcome', 'outcome');
     }
     $table->set_attribute('cellspacing', '0');
     $table->set_attribute('id', 'attempts');
     $table->set_attribute('class', 'submissions');
     $table->set_attribute('width', '100%');
     //$table->set_attribute('align', 'center');
     $table->no_sorting('finalgrade');
     $table->no_sorting('outcome');
     // Start working -- this is necessary as soon as the niceties are over
     $table->setup();
     if (empty($users)) {
         echo $OUTPUT->heading(get_string('nosubmitusers', 'assignment'));
         return true;
     }
     /// Construct the SQL
     if ($where = $table->get_sql_where()) {
         $where .= ' AND ';
     }
     if ($sort = $table->get_sql_sort()) {
         $sort = ' ORDER BY ' . $sort;
     }
     $select = 'SELECT u.id, u.firstname, u.lastname, u.picture, u.imagealt,
                       s.id AS submissionid, s.grade, s.submissioncomment,
                       s.timemodified, s.timemarked,
                       COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status ';
     $sql = 'FROM {user} u ' . 'LEFT JOIN {assignment_submissions} s ON u.id = s.userid
                                                               AND s.assignment = ' . $this->assignment->id . ' ' . 'WHERE ' . $where . 'u.id IN (' . implode(',', $users) . ') ';
     $table->pagesize($perpage, count($users));
     ///offset used to calculate index of student in that particular query, needed for the pop up to know who's next
     $offset = $page * $perpage;
     $strupdate = get_string('update');
     $strgrade = get_string('grade');
     $grademenu = make_grades_menu($this->assignment->grade);
     if (($ausers = $DB->get_records_sql($select . $sql . $sort, null, $table->get_page_start(), $table->get_page_size())) !== false) {
         $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, array_keys($ausers));
         foreach ($ausers as $auser) {
             $final_grade = $grading_info->items[0]->grades[$auser->id];
             $grademax = $grading_info->items[0]->grademax;
             $final_grade->formatted_grade = round($final_grade->grade, 2) . ' / ' . round($grademax, 2);
             $locked_overridden = 'locked';
             if ($final_grade->overridden) {
                 $locked_overridden = 'overridden';
             }
             /// Calculate user status
             $auser->status = $auser->timemarked > 0 && $auser->timemarked >= $auser->timemodified;
             $picture = $OUTPUT->user_picture(moodle_user_picture::make($auser, $course->id));
             if (empty($auser->submissionid)) {
                 $auser->grade = -1;
                 //no submission yet
             }
             if (!empty($auser->submissionid)) {
                 ///Prints student answer and student modified date
                 ///attach file or print link to student answer, depending on the type of the assignment.
                 ///Refer to print_student_answer in inherited classes.
                 if ($auser->timemodified > 0) {
                     $studentmodified = '<div id="ts' . $auser->id . '">' . $this->print_student_answer($auser->id) . userdate($auser->timemodified) . '</div>';
                 } else {
                     $studentmodified = '<div id="ts' . $auser->id . '">&nbsp;</div>';
                 }
                 ///Print grade, dropdown or text
                 if ($auser->timemarked > 0) {
                     $teachermodified = '<div id="tt' . $auser->id . '">' . userdate($auser->timemarked) . '</div>';
                     if ($final_grade->locked or $final_grade->overridden) {
                         $grade = '<div id="g' . $auser->id . '" class="' . $locked_overridden . '">' . $final_grade->formatted_grade . '</div>';
                     } else {
                         if ($quickgrade) {
                             $select = html_select::make(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'));
                             $select->nothingvalue = '-1';
                             $select->tabindex = $tabindex++;
                             $menu = $OUTPUT->select($select);
                             $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>';
                         } else {
                             $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>';
                         }
                     }
                 } else {
                     $teachermodified = '<div id="tt' . $auser->id . '">&nbsp;</div>';
                     if ($final_grade->locked or $final_grade->overridden) {
                         $grade = '<div id="g' . $auser->id . '" class="' . $locked_overridden . '">' . $final_grade->formatted_grade . '</div>';
                     } else {
                         if ($quickgrade) {
                             $select = html_select::make(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'));
                             $select->nothingvalue = '-1';
                             $select->tabindex = $tabindex++;
                             $menu = $OUTPUT->select($select);
                             $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>';
                         } else {
                             $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>';
                         }
                     }
                 }
                 ///Print Comment
                 if ($final_grade->locked or $final_grade->overridden) {
                     $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($final_grade->str_feedback), 15) . '</div>';
                 } else {
                     if ($quickgrade) {
                         $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>';
                     } else {
                         $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($auser->submissioncomment), 15) . '</div>';
                     }
                 }
             } else {
                 $studentmodified = '<div id="ts' . $auser->id . '">&nbsp;</div>';
                 $teachermodified = '<div id="tt' . $auser->id . '">&nbsp;</div>';
                 $status = '<div id="st' . $auser->id . '">&nbsp;</div>';
                 if ($final_grade->locked or $final_grade->overridden) {
                     $grade = '<div id="g' . $auser->id . '">' . $final_grade->formatted_grade . '</div>';
                 } else {
                     if ($quickgrade) {
                         // allow editing
                         $select = html_select::make(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'));
                         $select->nothingvalue = '-1';
                         $select->tabindex = $tabindex++;
                         $menu = $OUTPUT->select($select);
                         $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>';
                     } else {
                         $grade = '<div id="g' . $auser->id . '">-</div>';
                     }
                 }
                 if ($final_grade->locked or $final_grade->overridden) {
                     $comment = '<div id="com' . $auser->id . '">' . $final_grade->str_feedback . '</div>';
                 } else {
                     if ($quickgrade) {
                         $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>';
                     } else {
                         $comment = '<div id="com' . $auser->id . '">&nbsp;</div>';
                     }
                 }
             }
             if (empty($auser->status)) {
                 /// Confirm we have exclusively 0 or 1
                 $auser->status = 0;
             } else {
                 $auser->status = 1;
             }
             $buttontext = $auser->status == 1 ? $strupdate : $strgrade;
             ///No more buttons, we use popups ;-).
             $popup_url = '/mod/assignment/submissions.php?id=' . $this->cm->id . '&userid=' . $auser->id . '&mode=single' . '&offset=' . $offset++;
             $link = html_link::make($popup_url, $buttontext);
             $link->add_action(new popup_action('click', $link->url, 'grade' . $auser->id, array('height' => 600, 'width' => 700)));
             $link->title = $buttontext;
             $button = $OUTPUT->link($link);
             $status = '<div id="up' . $auser->id . '" class="s' . $auser->status . '">' . $button . '</div>';
             $finalgrade = '<span id="finalgrade_' . $auser->id . '">' . $final_grade->str_grade . '</span>';
             $outcomes = '';
             if ($uses_outcomes) {
                 foreach ($grading_info->outcomes as $n => $outcome) {
                     $outcomes .= '<div class="outcome"><label>' . $outcome->name . '</label>';
                     $options = make_grades_menu(-$outcome->scaleid);
                     if ($outcome->grades[$auser->id]->locked or !$quickgrade) {
                         $options[0] = get_string('nooutcome', 'grades');
                         $outcomes .= ': <span id="outcome_' . $n . '_' . $auser->id . '">' . $options[$outcome->grades[$auser->id]->grade] . '</span>';
                     } else {
                         $outcomes .= ' ';
                         $select = html_select::make($options, 'outcome_' . $n . '[' . $auser->id . ']', $outcome->grades[$auser->id]->grade, get_string('nooutcome', 'grades'));
                         $select->nothingvalue = '0';
                         $select->tabindex = $tabindex++;
                         $select->id = 'outcome_' . $n . '_' . $auser->id;
                         $outcomes .= $OUTPUT->select($select);
                     }
                     $outcomes .= '</div>';
                 }
             }
             $userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&amp;course=' . $course->id . '">' . fullname($auser) . '</a>';
             $row = array($picture, $userlink, $grade, $comment, $studentmodified, $teachermodified, $status, $finalgrade);
             if ($uses_outcomes) {
                 $row[] = $outcomes;
             }
             $table->add_data($row);
         }
     }
     /// Print quickgrade form around the table
     if ($quickgrade) {
         echo '<form action="submissions.php" id="fastg" method="post">';
         echo '<div>';
         echo '<input type="hidden" name="id" value="' . $this->cm->id . '" />';
         echo '<input type="hidden" name="mode" value="fastgrade" />';
         echo '<input type="hidden" name="page" value="' . $page . '" />';
         echo '</div>';
     }
     $table->print_html();
     /// Print the whole table
     if ($quickgrade) {
         $lastmailinfo = get_user_preferences('assignment_mailinfo', 1) ? 'checked="checked"' : '';
         echo '<div class="fgcontrols">';
         echo '<div class="emailnotification">';
         echo '<label for="mailinfo">' . get_string('enableemailnotification', 'assignment') . '</label>';
         echo '<input type="hidden" name="mailinfo" value="0" />';
         echo '<input type="checkbox" id="mailinfo" name="mailinfo" value="1" ' . $lastmailinfo . ' />';
         echo $OUTPUT->help_icon(moodle_help_icon::make('emailnotification', get_string('enableemailnotification', 'assignment'), 'assignment')) . '</p></div>';
         echo '</div>';
         echo '<div class="fastgbutton"><input type="submit" name="fastg" value="' . get_string('saveallfeedback', 'assignment') . '" /></div>';
         echo '</div>';
         echo '</form>';
     }
     /// End of fast grading form
     /// Mini form for setting user preference
     echo '<div class="qgprefs">';
     echo '<form id="options" action="submissions.php?id=' . $this->cm->id . '" method="post"><div>';
     echo '<input type="hidden" name="updatepref" value="1" />';
     echo '<table id="optiontable">';
     echo '<tr><td>';
     echo '<label for="perpage">' . get_string('pagesize', 'assignment') . '</label>';
     echo '</td>';
     echo '<td>';
     echo '<input type="text" id="perpage" name="perpage" size="1" value="' . $perpage . '" />';
     echo $OUTPUT->help_icon(moodle_help_icon::make('pagesize', get_string('pagesize', 'assignment'), 'assignment'));
     echo '</td></tr>';
     echo '<tr><td>';
     echo '<label for="quickgrade">' . get_string('quickgrade', 'assignment') . '</label>';
     echo '</td>';
     echo '<td>';
     $checked = $quickgrade ? 'checked="checked"' : '';
     echo '<input type="checkbox" id="quickgrade" name="quickgrade" value="1" ' . $checked . ' />';
     echo $OUTPUT->help_icon(moodle_help_icon::make('quickgrade', get_string('quickgrade', 'assignment'), 'assignment')) . '</p></div>';
     echo '</td></tr>';
     echo '<tr><td colspan="2">';
     echo '<input type="submit" value="' . get_string('savepreferences') . '" />';
     echo '</td></tr></table>';
     echo '</div></form></div>';
     ///End of mini form
     echo $OUTPUT->footer();
 }
コード例 #24
0
ファイル: activities.php プロジェクト: nadavkav/MoodleTAO
    $contextinstance = CONTEXT_COURSE;
}
$context = get_context_instance($contextinstance, $course->id);
require_capability('format/cms:editpage', $context);
$modinfo = unserialize($course->modinfo);
$table = new stdClass();
$stractres = get_string('activities') . '/' . get_string('resources');
$straction = get_string('action');
$strchoose = get_string('choose');
$stradministration = get_string("administration");
$strcms = get_string("cms", "cms");
$navlinks = array();
$navlinks[] = array('name' => $strcms . ' ' . $stradministration, 'link' => "index.php?course={$course->id}&amp;sesskey={$USER->sesskey}", 'type' => 'misc');
$navlinks[] = array('name' => $stractres, 'link' => "", 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header_simple($stractres, "", $navigation, "", "", true);
?>

<script type="text/javascript">
// <![CDATA[
function set_value(url) {
    var baseurl = '<?php 
p($CFG->wwwroot);
?>
';
    var frm = opener.document.forms['cmsEditPage'].elements['url'];

    if ( frm ) {
        frm.value = baseurl + url;
        frm.select();
        frm.focus();
コード例 #25
0
ファイル: edit.php プロジェクト: JackCanada/moodle-hacks
        if (!$ineditperiod || $USER->id != $fromdb->userid and !has_capability('mod/glossary:manageentries', $context)) {
            if ($USER->id != $fromdb->userid) {
                print_error('errcannoteditothers', 'glossary');
            } elseif (!$ineditperiod) {
                print_error('erredittimeexpired', 'glossary');
            }
            die;
        }
        if ($aliases = get_records_menu("glossary_alias", "entryid", $e, '', 'id, alias')) {
            $toform->aliases = implode("\n", $aliases) . "\n";
        }
        $mform->set_data($toform);
    }
}
$stredit = empty($e) ? get_string('addentry', 'glossary') : get_string("edit");
$navigation = build_navigation($stredit, $cm);
print_header_simple(format_string($glossary->name), "", $navigation, "", "", true, "", navmenu($course, $cm));
print_heading(format_string($glossary->name));
/// Info box
///if ( $glossary->intro ) {
///    print_simple_box(format_text($glossary->intro), 'center', '70%', '', 5, 'generalbox', 'intro');
///}
/// Tabbed browsing sections
///$tab = GLOSSARY_ADDENTRY_VIEW;
///include("tabs.php");
if (!$e) {
    require_capability('mod/glossary:write', $context);
}
$mform->display();
///glossary_print_tabbed_table_end();
print_footer($course);
コード例 #26
0
 /**
  * Display the file resource
  *
  * Displays a file resource embedded, in a frame, or in a popup.
  * Output depends on type of file resource.
  *
  * @param    CFG     global object
  */
 function display()
 {
     global $CFG, $THEME, $USER;
     /// Set up generic stuff first, including checking for access
     parent::display();
     /// Set up some shorthand variables
     $cm = $this->cm;
     $course = $this->course;
     $resource = $this->resource;
     $this->set_parameters();
     // set the parameters array
     ///////////////////////////////////////////////
     /// Possible display modes are:
     /// File displayed in a frame in a normal window
     /// File displayed embedded in a normal page
     /// File displayed in a popup window
     /// File displayed emebedded in a popup window
     /// First, find out what sort of file we are dealing with.
     require_once $CFG->libdir . '/filelib.php';
     $querystring = '';
     $resourcetype = '';
     $embedded = false;
     $mimetype = mimeinfo("type", $resource->reference);
     $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
     $formatoptions = new object();
     $formatoptions->noclean = true;
     if ($resource->options != "bogusoption_usedtobe_frame") {
         // TODO nicolasconnault 14-03-07: This option should be renamed "embed"
         if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) {
             // It's an image
             $resourcetype = "image";
             $embedded = true;
         } else {
             if ($mimetype == "audio/mp3") {
                 // It's an MP3 audio file
                 $resourcetype = "mp3";
                 $embedded = true;
             } else {
                 if ($mimetype == "video/x-flv") {
                     // It's a Flash video file
                     $resourcetype = "flv";
                     $embedded = true;
                 } else {
                     if (substr($mimetype, 0, 10) == "video/x-ms") {
                         // It's a Media Player file
                         $resourcetype = "mediaplayer";
                         $embedded = true;
                     } else {
                         if ($mimetype == "video/quicktime") {
                             // It's a Quicktime file
                             $resourcetype = "quicktime";
                             $embedded = true;
                         } else {
                             if ($mimetype == "application/x-shockwave-flash") {
                                 // It's a Flash file
                                 $resourcetype = "flash";
                                 $embedded = true;
                             } else {
                                 if ($mimetype == "video/mpeg") {
                                     // It's a Mpeg file
                                     $resourcetype = "mpeg";
                                     $embedded = true;
                                 } else {
                                     if ($mimetype == "text/html") {
                                         // It's a web page
                                         $resourcetype = "html";
                                     } else {
                                         if ($mimetype == "application/zip") {
                                             // It's a zip archive
                                             $resourcetype = "zip";
                                             $embedded = true;
                                         } else {
                                             if ($mimetype == 'application/pdf' || $mimetype == 'application/x-pdf') {
                                                 $resourcetype = "pdf";
                                                 $embedded = true;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $isteamspeak = stripos($resource->reference, 'teamspeak://') === 0;
     /// Form the parse string
     if (!empty($resource->alltext)) {
         $querys = array();
         $parray = explode(',', $resource->alltext);
         foreach ($parray as $fieldstring) {
             $field = explode('=', $fieldstring);
             $querys[] = urlencode($field[1]) . '=' . urlencode($this->parameters[$field[0]]['value']);
         }
         if ($isteamspeak) {
             $querystring = implode('?', $querys);
         } else {
             $querystring = implode('&amp;', $querys);
         }
     }
     /// Set up some variables
     $inpopup = optional_param('inpopup', 0, PARAM_BOOL);
     if (resource_is_url($resource->reference)) {
         $fullurl = $resource->reference;
         if (!empty($querystring)) {
             $urlpieces = parse_url($resource->reference);
             if (empty($urlpieces['query']) or $isteamspeak) {
                 $fullurl .= '?' . $querystring;
             } else {
                 $fullurl .= '&amp;' . $querystring;
             }
         }
     } else {
         if ($CFG->resource_allowlocalfiles and strpos($resource->reference, RESOURCE_LOCALPATH) === 0) {
             // Localpath
             $localpath = get_user_preferences('resource_localpath', 'D:');
             $relativeurl = str_replace(RESOURCE_LOCALPATH, $localpath, $resource->reference);
             if ($querystring) {
                 $relativeurl .= '?' . $querystring;
             }
             $relativeurl = str_replace('\\', '/', $relativeurl);
             $relativeurl = str_replace(' ', '%20', $relativeurl);
             $fullurl = 'file:///' . htmlentities($relativeurl);
             $localpath = true;
         } else {
             // Normal uploaded file
             if ($CFG->slasharguments) {
                 $relativeurl = "/file.php/{$course->id}/{$resource->reference}";
                 if ($querystring) {
                     $relativeurl .= '?' . $querystring;
                 }
             } else {
                 $relativeurl = "/file.php?file=/{$course->id}/{$resource->reference}";
                 if ($querystring) {
                     $relativeurl .= '&amp;' . $querystring;
                 }
             }
             $fullurl = "{$CFG->wwwroot}{$relativeurl}";
         }
     }
     /// Print a notice and redirect if we are trying to access a file on a local file system
     /// and the config setting has been disabled
     if (!$CFG->resource_allowlocalfiles and strpos($resource->reference, RESOURCE_LOCALPATH) === 0) {
         if ($inpopup) {
             print_header($pagetitle, $course->fullname);
         } else {
             $this->navlinks[] = array('name' => format_string($resource->name), 'link' => null, 'type' => 'misc');
             $this->navigation = build_navigation($this->navlinks);
             print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
         }
         notify(get_string('notallowedlocalfileaccess', 'resource', ''));
         if ($inpopup) {
             close_window_button();
         }
         print_footer('none');
         die;
     }
     /// Check whether this is supposed to be a popup, but was called directly
     if ($resource->popup and !$inpopup) {
         /// Make a page and a pop-up window
         $this->navlinks[] = array('name' => format_string($resource->name), 'link' => null, 'type' => 'misc');
         $this->navigation = build_navigation($this->navlinks);
         print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
         echo "\n<script type=\"text/javascript\">";
         echo "\n<!--\n";
         echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n";
         echo "\n-->\n";
         echo '</script>';
         if (trim(strip_tags($resource->summary))) {
             print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions), "center");
         }
         $link = "<a href=\"{$CFG->wwwroot}/mod/resource/view.php?inpopup=true&amp;id={$cm->id}\" " . "onclick=\"this.target='resource{$resource->id}'; return openpopup('/mod/resource/view.php?inpopup=true&amp;id={$cm->id}', " . "'resource{$resource->id}','{$resource->popup}');\">" . format_string($resource->name, true) . "</a>";
         echo '<div class="popupnotice">';
         print_string('popupresource', 'resource');
         echo '<br />';
         print_string('popupresourcelink', 'resource', $link);
         echo '</div>';
         print_footer($course);
         exit;
     }
     /// Now check whether we need to display a frameset
     $frameset = optional_param('frameset', '', PARAM_ALPHA);
     if (empty($frameset) and !$embedded and !$inpopup and $resource->options == "frame" and empty($USER->screenreader)) {
         @header('Content-Type: text/html; charset=utf-8');
         echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n";
         echo "<html dir=\"ltr\">\n";
         echo '<head>';
         echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
         echo "<title>" . format_string($course->shortname) . ": " . strip_tags(format_string($resource->name, true)) . "</title></head>\n";
         echo "<frameset rows=\"{$CFG->resource_framesize},*\">";
         echo "<frame src=\"view.php?id={$cm->id}&amp;type={$resource->type}&amp;frameset=top\" title=\"" . get_string('modulename', 'resource') . "\"/>";
         if (!empty($localpath)) {
             // Show it like this so we interpose some HTML
             echo "<frame src=\"view.php?id={$cm->id}&amp;type={$resource->type}&amp;inpopup=true\" title=\"" . get_string('modulename', 'resource') . "\"/>";
         } else {
             echo "<frame src=\"{$fullurl}\" title=\"" . get_string('modulename', 'resource') . "\"/>";
         }
         echo "</frameset>";
         echo "</html>";
         exit;
     }
     /// We can only get here once per resource, so add an entry to the log
     add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
     /// If we are in a frameset, just print the top of it
     if (!empty($frameset) and $frameset == "top") {
         $this->navlinks[] = array('name' => format_string($resource->name), 'link' => null, 'type' => 'misc');
         $this->navigation = build_navigation($this->navlinks);
         print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "parent"));
         $options = new object();
         $options->para = false;
         echo '<div class="summary">' . format_text($resource->summary, FORMAT_HTML, $options) . '</div>';
         if (!empty($localpath)) {
             // Show some help
             echo '<div align="right" class="helplink">';
             link_to_popup_window('/mod/resource/type/file/localpath.php', get_string('localfile', 'resource'), get_string('localfilehelp', 'resource'), 400, 500, get_string('localfilehelp', 'resource'));
             echo '</div>';
         }
         echo '</div></div></body></html>';
         exit;
     }
     /// Display the actual resource
     if ($embedded) {
         // Display resource embedded in page
         $strdirectlink = get_string("directlink", "resource");
         if ($inpopup) {
             print_header($pagetitle);
         } else {
             $this->navlinks[] = array('name' => format_string($resource->name, true), 'link' => $fullurl, 'type' => 'misc');
             $this->navigation = build_navigation($this->navlinks);
             print_header_simple($pagetitle, '', $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "self"));
         }
         if ($resourcetype == "image") {
             echo '<div class="resourcecontent resourceimg">';
             echo "<img title=\"" . strip_tags(format_string($resource->name, true)) . "\" class=\"resourceimage\" src=\"{$fullurl}\" alt=\"\" />";
             echo '</div>';
         } else {
             if ($resourcetype == "mp3") {
                 if (!empty($THEME->resource_mp3player_colors)) {
                     $c = $THEME->resource_mp3player_colors;
                     // You can set this up in your theme/xxx/config.php
                 } else {
                     $c = 'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&' . 'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&' . 'font=Arial&fontColour=FF33FF&buffer=10&waitForPlay=no&autoPlay=yes';
                 }
                 $c .= '&volText=' . get_string('vol', 'resource') . '&panText=' . get_string('pan', 'resource');
                 $c = htmlentities($c);
                 $id = 'filter_mp3_' . time();
                 //we need something unique because it might be stored in text cache
                 $cleanurl = addslashes_js($fullurl);
                 // If we have Javascript, use UFO to embed the MP3 player, otherwise depend on plugins
                 echo '<div class="resourcecontent resourcemp3">';
                 echo '<span class="mediaplugin mediaplugin_mp3" id="' . $id . '"></span>' . '<script type="text/javascript">' . "\n" . '//<![CDATA[' . "\n" . 'var FO = { movie:"' . $CFG->wwwroot . '/lib/mp3player/mp3player.swf?src=' . $cleanurl . '",' . "\n" . 'width:"600", height:"70", majorversion:"6", build:"40", flashvars:"' . $c . '", quality: "high" };' . "\n" . 'UFO.create(FO, "' . $id . '");' . "\n" . '//]]>' . "\n" . '</script>' . "\n";
                 echo '<noscript>';
                 echo "<object type=\"audio/mpeg\" data=\"{$fullurl}\" width=\"600\" height=\"70\">";
                 echo "<param name=\"src\" value=\"{$fullurl}\" />";
                 echo '<param name="quality" value="high" />';
                 echo '<param name="autoplay" value="true" />';
                 echo '<param name="autostart" value="true" />';
                 echo '</object>';
                 echo '<p><a href="' . $fullurl . '">' . $fullurl . '</a></p>';
                 echo '</noscript>';
                 echo '</div>';
             } else {
                 if ($resourcetype == "flv") {
                     $id = 'filter_flv_' . time();
                     //we need something unique because it might be stored in text cache
                     $cleanurl = addslashes_js($fullurl);
                     // If we have Javascript, use UFO to embed the FLV player, otherwise depend on plugins
                     echo '<div class="resourcecontent resourceflv">';
                     echo '<span class="mediaplugin mediaplugin_flv" id="' . $id . '"></span>' . '<script type="text/javascript">' . "\n" . '//<![CDATA[' . "\n" . 'var FO = { movie:"' . $CFG->wwwroot . '/filter/mediaplugin/flvplayer.swf?file=' . $cleanurl . '",' . "\n" . 'width:"600", height:"400", majorversion:"6", build:"40", allowscriptaccess:"never", quality: "high" };' . "\n" . 'UFO.create(FO, "' . $id . '");' . "\n" . '//]]>' . "\n" . '</script>' . "\n";
                     echo '<noscript>';
                     echo "<object type=\"video/x-flv\" data=\"{$fullurl}\" width=\"600\" height=\"400\">";
                     echo "<param name=\"src\" value=\"{$fullurl}\" />";
                     echo '<param name="quality" value="high" />';
                     echo '<param name="autoplay" value="true" />';
                     echo '<param name="autostart" value="true" />';
                     echo '</object>';
                     echo '<p><a href="' . $fullurl . '">' . $fullurl . '</a></p>';
                     echo '</noscript>';
                     echo '</div>';
                 } else {
                     if ($resourcetype == "mediaplayer") {
                         echo '<div class="resourcecontent resourcewmv">';
                         echo '<object type="video/x-ms-wmv" data="' . $fullurl . '">';
                         echo '<param name="controller" value="true" />';
                         echo '<param name="autostart" value="true" />';
                         echo "<param name=\"src\" value=\"{$fullurl}\" />";
                         echo '<param name="scale" value="noScale" />';
                         echo "<a href=\"{$fullurl}\">{$fullurl}</a>";
                         echo '</object>';
                         echo '</div>';
                     } else {
                         if ($resourcetype == "mpeg") {
                             echo '<div class="resourcecontent resourcempeg">';
                             echo '<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
                           codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsm p2inf.cab#Version=5,1,52,701"
                           type="application/x-oleobject">';
                             echo "<param name=\"fileName\" value=\"{$fullurl}\" />";
                             echo '<param name="autoStart" value="true" />';
                             echo '<param name="animationatStart" value="true" />';
                             echo '<param name="transparentatStart" value="true" />';
                             echo '<param name="showControls" value="true" />';
                             echo '<param name="Volume" value="-450" />';
                             echo '<!--[if !IE]>-->';
                             echo '<object type="video/mpeg" data="' . $fullurl . '">';
                             echo '<param name="controller" value="true" />';
                             echo '<param name="autostart" value="true" />';
                             echo "<param name=\"src\" value=\"{$fullurl}\" />";
                             echo "<a href=\"{$fullurl}\">{$fullurl}</a>";
                             echo '<!--<![endif]-->';
                             echo '<a href="' . $fullurl . '">' . $fullurl . '</a>';
                             echo '<!--[if !IE]>-->';
                             echo '</object>';
                             echo '<!--<![endif]-->';
                             echo '</object>';
                             echo '</div>';
                         } else {
                             if ($resourcetype == "quicktime") {
                                 echo '<style type="text/css">';
                                 echo '/* class to hide nested objects in IE */';
                                 echo '/* hides the second object from all versions of IE */';
                                 echo '* html object.hiddenObjectForIE { display: none; }';
                                 echo '/* display the second object only for IE5 Mac */';
                                 echo '/* IE Mac \\*//*/';
                                 echo '* html object.hiddenObjectForIE { display: inline; }';
                                 echo '/**/';
                                 echo '</style>';
                                 echo '<div class="resourcecontent resourceqt">';
                                 echo '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"';
                                 echo '        codebase="http://www.apple.com/qtactivex/qtplugin.cab">';
                                 echo "<param name=\"src\" value=\"{$fullurl}\" />";
                                 echo '<param name="autoplay" value="true" />';
                                 echo '<param name="loop" value="true" />';
                                 echo '<param name="controller" value="true" />';
                                 echo '<param name="scale" value="aspect" />';
                                 echo "<object class=\"hiddenObjectForIE\" type=\"video/quicktime\" data=\"{$fullurl}\">";
                                 echo '<param name="controller" value="true" />';
                                 echo '<param name="autoplay" value="true" />';
                                 echo '<param name="loop" value="true" />';
                                 echo '<param name="scale" value="aspect" />';
                                 echo '</object>';
                                 echo '<a href="' . $fullurl . '">' . $fullurl . '</a>';
                                 echo '</object>';
                                 echo '</div>';
                             } else {
                                 if ($resourcetype == "flash") {
                                     echo '<div class="resourcecontent resourceswf">';
                                     echo '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">';
                                     echo "<param name=\"movie\" value=\"{$fullurl}\" />";
                                     echo '<param name="autoplay" value="true" />';
                                     echo '<param name="loop" value="true" />';
                                     echo '<param name="controller" value="true" />';
                                     echo '<param name="scale" value="aspect" />';
                                     echo '<!--[if !IE]>-->';
                                     echo "<object type=\"application/x-shockwave-flash\" data=\"{$fullurl}\">";
                                     echo '<param name="controller" value="true" />';
                                     echo '<param name="autoplay" value="true" />';
                                     echo '<param name="loop" value="true" />';
                                     echo '<param name="scale" value="aspect" />';
                                     echo '<!--<![endif]-->';
                                     echo '<a href="' . $fullurl . '">' . $fullurl . '</a>';
                                     echo '<!--[if !IE]>-->';
                                     echo '</object>';
                                     echo '<!--<![endif]-->';
                                     echo '</object>';
                                     echo '</div>';
                                 } elseif ($resourcetype == 'zip') {
                                     echo '<div class="resourcepdf">';
                                     echo get_string('clicktoopen', 'resource') . '<a href="' . $fullurl . '">' . format_string($resource->name) . '</a>';
                                     echo '</div>';
                                 } elseif ($resourcetype == 'pdf') {
                                     echo '<div class="resourcepdf">';
                                     echo '<object data="' . $fullurl . '" type="application/pdf">';
                                     echo get_string('clicktoopen', 'resource') . '<a href="' . $fullurl . '">' . format_string($resource->name) . '</a>';
                                     echo '</object>';
                                     echo '</div>';
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if (trim($resource->summary)) {
             print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
         }
         if ($inpopup) {
             echo "<div class=\"popupnotice\">(<a href=\"{$fullurl}\">{$strdirectlink}</a>)</div>";
         } else {
             print_spacer(20, 20);
             print_footer($course);
         }
     } else {
         // Display the resource on it's own
         if (!empty($localpath)) {
             // Show a link to help work around browser security
             echo '<div align="right" class="helplink">';
             link_to_popup_window('/mod/resource/type/file/localpath.php', get_string('localfile', 'resource'), get_string('localfilehelp', 'resource'), 400, 500, get_string('localfilehelp', 'resource'));
             echo '</div>';
             echo "<div class=\"popupnotice\">(<a href=\"{$fullurl}\">{$fullurl}</a>)</div>";
         }
         redirect($fullurl);
     }
 }
コード例 #27
0
} elseif ($data = $editform->get_data()) {
    if ($data->id) {
        if (!groups_update_group($data, $editform->_upload_manager)) {
            error('Error updating group');
        }
    } else {
        if (!($id = groups_create_group($data, $editform->_upload_manager))) {
            error('Error creating group');
        }
        $returnurl = $CFG->wwwroot . '/group/index.php?id=' . $course->id . '&amp;group=' . $id;
    }
    redirect($returnurl);
}
$strgroups = get_string('groups');
$strparticipants = get_string('participants');
if ($id) {
    $strheading = get_string('editgroupsettings', 'group');
} else {
    $strheading = get_string('creategroup', 'group');
}
$navlinks = array(array('name' => $strparticipants, 'link' => $CFG->wwwroot . '/user/index.php?id=' . $courseid, 'type' => 'misc'), array('name' => $strgroups, 'link' => $CFG->wwwroot . '/group/index.php?id=' . $courseid, 'type' => 'misc'), array('name' => $strheading, 'link' => '', 'type' => 'misc'));
$navigation = build_navigation($navlinks);
/// Print header
print_header_simple($strgroups, ': ' . $strgroups, $navigation, '', '', true, '', user_login_string($course) . '<hr style="width:95%">' . navmenu($course));
echo '<div id="grouppicture">';
if ($id) {
    print_group_picture($group, $course->id);
}
echo '</div>';
$editform->display();
print_footer($course);
コード例 #28
0
    error("Course ID is incorrect");
}
require_login($course->id);
$studynotess = get_all_instances_in_course("studynotes", $course);
if (count($studynotess) == 1) {
    header("Location: " . $CFG->wwwroot . '/mod/studynotes/view.php?id=' . $studynotess[0]->coursemodule);
}
add_to_log($course->id, "studynotes", "view all", "index.php?id={$course->id}", "");
/// Get all required stringsstudynotes
$strstudynotess = get_string("modulenameplural", "studynotes");
$strstudynotes = get_string("modulename", "studynotes");
/// Print the header
$navlinks = array();
$navlinks[] = array('name' => $strstudynotess, 'link' => '', 'type' => 'activity');
$navigation = build_navigation($navlinks);
print_header_simple("{$strstudynotess}", "", $navigation, "", "", true, "", navmenu($course));
/// Get all the appropriate data
if (!$studynotess) {
    notice("There are no studynotess", "../../course/view.php?id={$course->id}");
    die;
}
/// Print the list of instances (your module will probably extend this)
$timenow = time();
$strname = get_string("name");
$strweek = get_string("week");
$strtopic = get_string("topic");
if ($course->format == "weeks") {
    $table = (object) null;
    $table->head = array($strweek, $strname);
    $table->align = array("center", "left");
} else {
コード例 #29
0
            $cm->visible = 1;
            $cm->course = $course->id;
            $buttontext = "";
        }
    } else {
        error('Must specify a course module or a forum ID');
    }
}
if (!$buttontext) {
    $buttontext = forum_search_form($course, $search);
}
require_course_login($course, true, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
/// Print header.
$navigation = build_navigation('', $cm);
print_header_simple(format_string($forum->name), "", $navigation, "", "", true, $buttontext, user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm));
/// Some capability checks.
if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities', $context)) {
    notice(get_string("activityiscurrentlyhidden"));
}
if (!has_capability('mod/forum:viewdiscussion', $context)) {
    notice(get_string('noviewdiscussionspermission', 'forum'));
}
/// find out current groups mode
groups_print_activity_menu($cm, 'view.php?id=' . $cm->id);
$currentgroup = groups_get_activity_group($cm);
$groupmode = groups_get_activity_groupmode($cm);
/// Okay, we can show the discussions. Log the forum view.
if ($cm->id) {
    add_to_log($course->id, "forum", "view forum", "view.php?id={$cm->id}", "{$forum->id}", $cm->id);
} else {
コード例 #30
0
ファイル: lib.php プロジェクト: BackupTheBerlios/samouk-svn
 /**
  *  Display all the submissions ready for grading
  */
 function display_submissions($message = '')
 {
     global $CFG, $db, $USER;
     require_once $CFG->libdir . '/gradelib.php';
     /* first we check to see if the form has just been submitted
      * to request user_preference updates
      */
     if (isset($_POST['updatepref'])) {
         $perpage = optional_param('perpage', 10, PARAM_INT);
         $perpage = $perpage <= 0 ? 10 : $perpage;
         set_user_preference('assignment_perpage', $perpage);
         set_user_preference('assignment_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL));
     }
     /* next we get perpage and quickgrade (allow quick grade) params
      * from database
      */
     $perpage = get_user_preferences('assignment_perpage', 10);
     $quickgrade = get_user_preferences('assignment_quickgrade', 0);
     $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id);
     if (!empty($CFG->enableoutcomes) and !empty($grading_info->outcomes)) {
         $uses_outcomes = true;
     } else {
         $uses_outcomes = false;
     }
     $teacherattempts = true;
     /// Temporary measure
     $page = optional_param('page', 0, PARAM_INT);
     $strsaveallfeedback = get_string('saveallfeedback', 'assignment');
     /// Some shortcuts to make the code read better
     $course = $this->course;
     $assignment = $this->assignment;
     $cm = $this->cm;
     $tabindex = 1;
     //tabindex for quick grading tabbing; Not working for dropdowns yet
     add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id=' . $this->assignment->id, $this->assignment->id, $this->cm->id);
     $navlinks = array();
     $navlinks[] = array('name' => $this->strassignments, 'link' => "index.php?id={$course->id}", 'type' => 'activity');
     $navlinks[] = array('name' => format_string($this->assignment->name, true), 'link' => "view.php?a={$this->assignment->id}", 'type' => 'activityinstance');
     $navlinks[] = array('name' => $this->strsubmissions, 'link' => '', 'type' => 'title');
     $navigation = build_navigation($navlinks);
     print_header_simple(format_string($this->assignment->name, true), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $this->strassignment), navmenu($course, $cm));
     if (!empty($message)) {
         echo $message;
         // display messages here if any
     }
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     /// find out current groups mode
     $groupmode = groups_get_activity_groupmode($cm);
     $currentgroup = groups_get_activity_group($cm, true);
     groups_print_activity_menu($cm, 'submissions.php?id=' . $this->cm->id);
     /// Get all ppl that are allowed to submit assignments
     $users = get_users_by_capability($context, 'mod/assignment:submit', '', '', '', '', $currentgroup, '', false);
     $users = array_keys($users);
     if (!empty($CFG->enablegroupings) && !empty($cm->groupingid)) {
         $groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id');
         $users = array_intersect($users, array_keys($groupingusers));
     }
     $tablecolumns = array('picture', 'fullname', 'grade', 'submissioncomment', 'timemodified', 'timemarked', 'status', 'finalgrade');
     if ($uses_outcomes) {
         $tablecolumns[] = 'outcome';
         // no sorting based on outcomes column
     }
     $tableheaders = array('', get_string('fullname'), get_string('grade'), get_string('comment', 'assignment'), get_string('lastmodified') . ' (' . $course->student . ')', get_string('lastmodified') . ' (' . $course->teacher . ')', get_string('status'), get_string('finalgrade', 'grades'));
     if ($uses_outcomes) {
         $tableheaders[] = get_string('outcome', 'grades');
     }
     require_once $CFG->libdir . '/tablelib.php';
     $table = new flexible_table('mod-assignment-submissions');
     $table->define_columns($tablecolumns);
     $table->define_headers($tableheaders);
     $table->define_baseurl($CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id . '&amp;currentgroup=' . $currentgroup);
     $table->sortable(true, 'lastname');
     //sorted by lastname by default
     $table->collapsible(true);
     $table->initialbars(true);
     $table->column_suppress('picture');
     $table->column_suppress('fullname');
     $table->column_class('picture', 'picture');
     $table->column_class('fullname', 'fullname');
     $table->column_class('grade', 'grade');
     $table->column_class('submissioncomment', 'comment');
     $table->column_class('timemodified', 'timemodified');
     $table->column_class('timemarked', 'timemarked');
     $table->column_class('status', 'status');
     $table->column_class('finalgrade', 'finalgrade');
     if ($uses_outcomes) {
         $table->column_class('outcome', 'outcome');
     }
     $table->set_attribute('cellspacing', '0');
     $table->set_attribute('id', 'attempts');
     $table->set_attribute('class', 'submissions');
     $table->set_attribute('width', '90%');
     //$table->set_attribute('align', 'center');
     $table->no_sorting('finalgrade');
     $table->no_sorting('outcome');
     // Start working -- this is necessary as soon as the niceties are over
     $table->setup();
     /// Check to see if groups are being used in this assignment
     if (!$teacherattempts) {
         $teachers = get_course_teachers($course->id);
         if (!empty($teachers)) {
             $keys = array_keys($teachers);
         }
         foreach ($keys as $key) {
             unset($users[$key]);
         }
     }
     if (empty($users)) {
         print_heading(get_string('noattempts', 'assignment'));
         return true;
     }
     /// Construct the SQL
     if ($where = $table->get_sql_where()) {
         $where .= ' AND ';
     }
     if ($sort = $table->get_sql_sort()) {
         $sort = ' ORDER BY ' . $sort;
     }
     $select = 'SELECT u.id, u.firstname, u.lastname, u.picture,
                       s.id AS submissionid, s.grade, s.submissioncomment,
                       s.timemodified, s.timemarked,
                       COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status ';
     $sql = 'FROM ' . $CFG->prefix . 'user u ' . 'LEFT JOIN ' . $CFG->prefix . 'assignment_submissions s ON u.id = s.userid
                                                               AND s.assignment = ' . $this->assignment->id . ' ' . 'WHERE ' . $where . 'u.id IN (' . implode(',', $users) . ') ';
     $table->pagesize($perpage, count($users));
     ///offset used to calculate index of student in that particular query, needed for the pop up to know who's next
     $offset = $page * $perpage;
     $strupdate = get_string('update');
     $strgrade = get_string('grade');
     $grademenu = make_grades_menu($this->assignment->grade);
     if (($ausers = get_records_sql($select . $sql . $sort, $table->get_page_start(), $table->get_page_size())) !== false) {
         $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, array_keys($ausers));
         foreach ($ausers as $auser) {
             $final_grade = $grading_info->items[0]->grades[$auser->id];
             /// Calculate user status
             $auser->status = $auser->timemarked > 0 && $auser->timemarked >= $auser->timemodified;
             $picture = print_user_picture($auser->id, $course->id, $auser->picture, false, true);
             if (empty($auser->submissionid)) {
                 $auser->grade = -1;
                 //no submission yet
             }
             if (!empty($auser->submissionid)) {
                 ///Prints student answer and student modified date
                 ///attach file or print link to student answer, depending on the type of the assignment.
                 ///Refer to print_student_answer in inherited classes.
                 if ($auser->timemodified > 0) {
                     $studentmodified = '<div id="ts' . $auser->id . '">' . $this->print_student_answer($auser->id) . userdate($auser->timemodified) . '</div>';
                 } else {
                     $studentmodified = '<div id="ts' . $auser->id . '">&nbsp;</div>';
                 }
                 ///Print grade, dropdown or text
                 if ($auser->timemarked > 0) {
                     $teachermodified = '<div id="tt' . $auser->id . '">' . userdate($auser->timemarked) . '</div>';
                     if ($final_grade->locked or $final_grade->overridden) {
                         $grade = '<div id="g' . $auser->id . '">' . $final_grade->str_grade . '</div>';
                     } else {
                         if ($quickgrade) {
                             $menu = choose_from_menu(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++);
                             $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>';
                         } else {
                             $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>';
                         }
                     }
                 } else {
                     $teachermodified = '<div id="tt' . $auser->id . '">&nbsp;</div>';
                     if ($final_grade->locked or $final_grade->overridden) {
                         $grade = '<div id="g' . $auser->id . '">' . $final_grade->str_grade . '</div>';
                     } else {
                         if ($quickgrade) {
                             $menu = choose_from_menu(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++);
                             $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>';
                         } else {
                             $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>';
                         }
                     }
                 }
                 ///Print Comment
                 if ($final_grade->locked or $final_grade->overridden) {
                     $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($final_grade->str_feedback), 15) . '</div>';
                 } else {
                     if ($quickgrade) {
                         $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>';
                     } else {
                         $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($auser->submissioncomment), 15) . '</div>';
                     }
                 }
             } else {
                 $studentmodified = '<div id="ts' . $auser->id . '">&nbsp;</div>';
                 $teachermodified = '<div id="tt' . $auser->id . '">&nbsp;</div>';
                 $status = '<div id="st' . $auser->id . '">&nbsp;</div>';
                 if ($final_grade->locked or $final_grade->overridden) {
                     $grade = '<div id="g' . $auser->id . '">' . $final_grade->str_grade . '</div>';
                 } else {
                     if ($quickgrade) {
                         // allow editing
                         $menu = choose_from_menu(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++);
                         $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>';
                     } else {
                         $grade = '<div id="g' . $auser->id . '">-</div>';
                     }
                 }
                 if ($final_grade->locked or $final_grade->overridden) {
                     $comment = '<div id="com' . $auser->id . '">' . $final_grade->str_feedback . '</div>';
                 } else {
                     if ($quickgrade) {
                         $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>';
                     } else {
                         $comment = '<div id="com' . $auser->id . '">&nbsp;</div>';
                     }
                 }
             }
             if (empty($auser->status)) {
                 /// Confirm we have exclusively 0 or 1
                 $auser->status = 0;
             } else {
                 $auser->status = 1;
             }
             $buttontext = $auser->status == 1 ? $strupdate : $strgrade;
             ///No more buttons, we use popups ;-).
             $popup_url = '/mod/assignment/submissions.php?id=' . $this->cm->id . '&amp;userid=' . $auser->id . '&amp;mode=single' . '&amp;offset=' . $offset++;
             $button = link_to_popup_window($popup_url, 'grade' . $auser->id, $buttontext, 600, 780, $buttontext, 'none', true, 'button' . $auser->id);
             $status = '<div id="up' . $auser->id . '" class="s' . $auser->status . '">' . $button . '</div>';
             $finalgrade = '<span id="finalgrade_' . $auser->id . '">' . $final_grade->str_grade . '</span>';
             $outcomes = '';
             if ($uses_outcomes) {
                 foreach ($grading_info->outcomes as $n => $outcome) {
                     $outcomes .= '<div class="outcome"><label>' . $outcome->name . '</label>';
                     $options = make_grades_menu(-$outcome->scaleid);
                     if ($outcome->grades[$auser->id]->locked or !$quickgrade) {
                         $options[0] = get_string('nooutcome', 'grades');
                         $outcomes .= ': <span id="outcome_' . $n . '_' . $auser->id . '">' . $options[$outcome->grades[$auser->id]->grade] . '</span>';
                     } else {
                         $outcomes .= ' ';
                         $outcomes .= choose_from_menu($options, 'outcome_' . $n . '[' . $auser->id . ']', $outcome->grades[$auser->id]->grade, get_string('nooutcome', 'grades'), '', 0, true, false, 0, 'outcome_' . $n . '_' . $auser->id);
                     }
                     $outcomes .= '</div>';
                 }
             }
             $row = array($picture, fullname($auser), $grade, $comment, $studentmodified, $teachermodified, $status, $finalgrade);
             if ($uses_outcomes) {
                 $row[] = $outcomes;
             }
             $table->add_data($row);
         }
     }
     /// Print quickgrade form around the table
     if ($quickgrade) {
         echo '<form action="submissions.php" id="fastg" method="post">';
         echo '<div>';
         echo '<input type="hidden" name="id" value="' . $this->cm->id . '" />';
         echo '<input type="hidden" name="mode" value="fastgrade" />';
         echo '<input type="hidden" name="page" value="' . $page . '" />';
         echo '</div>';
         //echo '<div style="text-align:center"><input type="submit" name="fastg" value="'.get_string('saveallfeedback', 'assignment').'" /></div>';
     }
     $table->print_html();
     /// Print the whole table
     if ($quickgrade) {
         echo '<div style="text-align:center"><input type="submit" name="fastg" value="' . get_string('saveallfeedback', 'assignment') . '" /></div>';
         echo '</form>';
     }
     /// End of fast grading form
     /// Mini form for setting user preference
     echo '<br />';
     echo '<form id="options" action="submissions.php?id=' . $this->cm->id . '" method="post">';
     echo '<div>';
     echo '<input type="hidden" id="updatepref" name="updatepref" value="1" />';
     echo '<table id="optiontable" align="right">';
     echo '<tr align="right"><td>';
     echo '<label for="perpage">' . get_string('pagesize', 'assignment') . '</label>';
     echo ':</td>';
     echo '<td>';
     echo '<input type="text" id="perpage" name="perpage" size="1" value="' . $perpage . '" />';
     helpbutton('pagesize', get_string('pagesize', 'assignment'), 'assignment');
     echo '</td></tr>';
     echo '<tr align="right">';
     echo '<td>';
     print_string('quickgrade', 'assignment');
     echo ':</td>';
     echo '<td>';
     if ($quickgrade) {
         echo '<input type="checkbox" name="quickgrade" value="1" checked="checked" />';
     } else {
         echo '<input type="checkbox" name="quickgrade" value="1" />';
     }
     helpbutton('quickgrade', get_string('quickgrade', 'assignment'), 'assignment') . '</p></div>';
     echo '</td></tr>';
     echo '<tr>';
     echo '<td colspan="2" align="right">';
     echo '<input type="submit" value="' . get_string('savepreferences') . '" />';
     echo '</td></tr></table>';
     echo '</div>';
     echo '</form>';
     ///End of mini form
     print_footer($this->course);
 }