Location: PHPKode > projects > WebConference Plugin for Moodle > webconference/index.php
<?php // $Id: index.php,v 1.0 2008/12/22 17:13:28 mlazar Exp $

/////////////////////////////////////////////////////////////////////////////////
///  WebConference Module
///  Index file enumerates conferences
/////////////////////////////////////////////////////////////////////////////////

    require_once('../../config.php');
    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, 'webconference', 'view all', "index.php?id=$course->id", '');

    $strwcnameplural = get_string('modulenameplural', "webconference");
    $strwcname       = get_string('modulename', 'webconference');

/// Print the header

    print_header_simple($strwcnameplural, '', $strwcnameplural, '', '', true, '', navmenu($course));

/// Get all the conferences for this course

    if (! $webconferencemtgs = get_all_instances_in_course('webconference', $course)) {
        notice('There are no WebConference Meetings', "../../course/view.php?id=$course->id");
        die();
    }

/// Print the list of conferences

    $timenow  = time();
    $strname  = get_string('name');
    $strweek  = get_string('week');
    $strtopic = get_string('topic');

    if ($course->format == 'weeks') {
        $table->head  = array ($strweek, $strname);
        $table->align = array ('center', 'left');
    } else if ($course->format == 'topics') {
        $table->head  = array ($strtopic, $strname);
        $table->align = array ('center', 'left', 'left', 'left');
    } else {
        $table->head  = array ($strname);
        $table->align = array ('left', 'left', 'left');
    }

    $currentsection = '';
    foreach ($webconferencemtgs as $wcmtg) {
        if (!$wcmtg->visible) {
            //Show dimmed if the mod is hidden
            $link = "<a class=\"dimmed\" href=\"view.php?id=$wcmtg->coursemodule\">".format_string($wcmtg->name,true)."</a>";
        } else {
            //Show normal if the mod is visible
            $link = "<a href=\"view.php?id=$wcmtg->coursemodule\">".format_string($wcmtg->name,true)."</a>";
        }
        $printsection = '';
        if ($wcmtg->section !== $currentsection) {
            if ($wcmtg->section) {
                $printsection = $wcmtg->section;
            }
            if ($currentsection !== '') {
                $table->data[] = 'hr';
            }
            $currentsection = $wcmtg->section;
        }
        if ($course->format == 'weeks' or $course->format == 'topics') {
            $table->data[] = array ($printsection, $link);
        } else {
            $table->data[] = array ($link);
        }
    }

    echo '<br />';

    print_table($table);

/// Finish the page

    print_footer($course);

?>
Return current item: WebConference Plugin for Moodle