コード例 #1
0
}
$timenow = time();
if ($course->format == "weeks") {
    $table->head = array($strweek, $strname, $strassignmenttype, $strduedate, $strsubmitted, $strgrade);
    $table->align = array("center", "left", "left", "left", "right");
} else {
    if ($course->format == "topics") {
        $table->head = array($strtopic, $strname, $strassignmenttype, $strduedate, $strsubmitted, $strgrade);
        $table->align = array("center", "left", "left", "left", "right");
    } else {
        $table->head = array($strname, $strassignmenttype, $strduedate, $strsubmitted, $strgrade);
        $table->align = array("left", "left", "left", "right");
    }
}
$currentsection = "";
$types = assignment_types();
$modinfo = get_fast_modinfo($course);
foreach ($modinfo->instances['assignment'] as $cm) {
    if (!$cm->uservisible) {
        continue;
    }
    $cm->timedue = $cms[$cm->id]->timedue;
    $cm->assignmenttype = $cms[$cm->id]->assignmenttype;
    $cm->idnumber = get_field('course_modules', 'idnumber', 'id', $cm->id);
    //hack
    //Show dimmed if the mod is hidden
    $class = $cm->visible ? '' : 'class="dimmed"';
    $link = "<a {$class} href=\"view.php?id={$cm->id}\">" . format_string($cm->name) . "</a>";
    $printsection = "";
    if ($cm->sectionnum !== $currentsection) {
        if ($cm->sectionnum) {
コード例 #2
0
ファイル: help.php プロジェクト: veritech/pare-project
function include_help_for_each_assignment_type()
{
    global $CFG;
    require_once $CFG->dirroot . '/mod/assignment/lib.php';
    $typelist = assignment_types();
    foreach ($typelist as $type => $name) {
        echo '<p><b>' . $name . '</b></p>';
        echo get_string('help' . $type, 'assignment');
        echo '<hr size="1" />';
    }
}
コード例 #3
0
ファイル: lib.php プロジェクト: veritech/pare-project
/**
 * Executes upgrade scripts for assignment types when necessary
 */
function assignment_upgrade_submodules()
{
    global $CFG;
    $types = assignment_types();
    include $CFG->dirroot . '/mod/assignment/version.php';
    // defines $module with version etc
    foreach ($types as $type => $typename) {
        $fullpath = $CFG->dirroot . '/mod/assignment/type/' . $type;
        /// Check for an external version file (defines $submodule)
        if (!is_readable($fullpath . '/version.php')) {
            continue;
        }
        include_once $fullpath . '/version.php';
        /// Check whether we need to upgrade
        if (!isset($submodule->version)) {
            continue;
        }
        /// Make sure this submodule will work with this assignment version
        if (isset($submodule->requires) and $submodule->requires > $module->version) {
            notify("Assignment submodule '{$type}' is too new for your assignment");
            continue;
        }
        /// If the submodule is new, then let's install it!
        $currentversion = 'assignment_' . $type . '_version';
        if (!isset($CFG->{$currentversion})) {
            // First install!
            set_config($currentversion, $submodule->version);
            // Must keep track of version
            if (!is_readable($fullpath . '/db/' . $CFG->dbtype . '.sql')) {
                continue;
            }
            upgrade_log_start();
            $db->debug = true;
            if (!modify_database($fullpath . '/db/' . $CFG->dbtype . '.sql')) {
                notify("Error installing tables for submodule '{$type}'!");
            }
            $db->debug = false;
            continue;
        }
        /// See if we need to upgrade
        if ($submodule->version <= $CFG->{$currentversion}) {
            continue;
        }
        /// Look for the upgrade file
        if (!is_readable($fullpath . '/db/' . $CFG->dbtype . '.php')) {
            continue;
        }
        include_once $fullpath . '/db/' . $CFG->dbtype . '.php';
        // defines assignment_xxx_upgrade
        /// Perform the upgrade
        $upgrade_function = 'assignment_' . $type . '_upgrade';
        if (function_exists($upgrade_function)) {
            upgrade_log_start();
            $db->debug = true;
            if ($upgrade_function($CFG->{$currentversion})) {
                $db->debug = false;
                set_config($currentversion, $submodule->version);
            }
            $db->debug = false;
        }
    }
}