Source for file class.php
Documentation is available at class.php
// $Id: class.php 9119 2006-08-18 07:10:23Z bmol $
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2005 Dokeos S.A.
Copyright (c) Bart Mollet, Hogeschool Gent
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
==============================================================================
==============================================================================
* This script allows teachers to manage subscribed
*classes in their course.
==============================================================================
==============================================================================
==============================================================================
// name of the language file that needs to be included
$language_file = array('registration','admin');
include ('../inc/global.inc.php');
require_once (api_get_path(LIBRARY_PATH). 'course.lib.php');
require_once (api_get_path(LIBRARY_PATH). 'sortabletable.class.php');
require_once (api_get_path(LIBRARY_PATH). 'classmanager.lib.php');
require_once (api_get_path(LIBRARY_PATH). 'formvalidator/FormValidator.class.php');
==============================================================================
==============================================================================
-----------------------------------------------------------
-----------------------------------------------------------
//extra entries in breadcrumb
$interbreadcrumb[] = array ("url" => "user.php", "name" => get_lang("Users"));
echo '<a href="subscribe_class.php?'. api_get_cidreq(). '">'. get_lang("AddClassesToACourse"). '</a><br /><br />';
==============================================================================
==============================================================================
if (isset ($_GET['unsubscribe']))
if (isset ($_POST['action']))
switch ($_POST['action'])
foreach ($_POST['class'] as $index => $class_id)
-----------------------------------------------------------
-----------------------------------------------------------
* * Get the number of classes to display on the current page.
$sql = "SELECT c.id FROM $class_table c, $course_class_table cc WHERE cc.class_id = c.id AND cc.course_code ='". $_SESSION['_course']['id']. "'";
if (isset ($_GET['keyword']))
$sql .= " AND (c.name LIKE '%". $keyword. "%')";
* Get the classes to display on the current page.
COUNT(cu.user_id) AS col2";
$sql .= " ,c.id AS col3";
// '(' and ')' in next query is necessary (see http://bugs.mysql.com/bug.php?id=19053)
$sql .= " FROM ($class_table c, $course_class_table cc)";
$sql .= " LEFT JOIN $class_user_table cu ON cu.class_id = c.id";
$sql .= " WHERE c.id = cc.class_id AND cc.course_code = '". $_SESSION['_course']['id']. "'";
if (isset ($_GET['keyword']))
$sql .= " AND (c.name LIKE '%". $keyword. "%')";
$sql .= " GROUP BY c.id, c.name ";
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
* Build the reg-column of the table
* @param int $class_id The class id
* @return string Some HTML-code
$form = new FormValidator('search_class', 'get','','',null,false);
$renderer = & $form->defaultRenderer();
$renderer->setElementTemplate('<span>{element}</span> ');
$form->add_textfield('keyword', '', false);
$form->addElement('submit', 'submit', get_lang('SearchButton'));
$table = new SortableTable('users', 'get_number_of_classes', 'get_class_data', 1);
$parameters['keyword'] = $_GET['keyword'];
$table->set_additional_parameters($parameters);
$table->set_header($col ++ , '', false);
$table->set_header($col ++ , get_lang('ClassName'));
$table->set_header($col ++ , get_lang('NumberOfUsers'));
$table->set_header($col ++ , '', false);
$table->set_column_filter($col - 1, 'reg_filter');
$table->set_form_actions(array ('unsubscribe' => get_lang('Unreg')), 'class');
==============================================================================
==============================================================================
|