Teacher can create sessions BT#4296

1.10.x
Julio Montoya 10 years ago
parent 1720efd5b7
commit d26d3817f9
  1. 10
      main/admin/index.php
  2. 18
      main/inc/lib/userportal.lib.php
  3. 10
      main/install/data.sql
  4. 62
      main/session/add_courses_to_session.php
  5. 2
      main/session/add_many_session_to_category.php
  6. 2
      main/session/add_students_to_session.php
  7. 2
      main/session/add_teachers_to_session.php
  8. 2
      main/session/add_users_to_session.php
  9. 2
      main/session/resume_session.php
  10. 35
      main/session/session_add.php
  11. 5
      main/session/session_category_add.php
  12. 11
      main/session/session_category_list.php
  13. 2
      main/session/session_course_edit.php
  14. 6
      main/session/session_course_list.php
  15. 2
      main/session/session_course_user.php
  16. 2
      main/session/session_course_user_list.php
  17. 2
      main/session/session_edit.php
  18. 3
      main/session/session_export.php
  19. 2
      main/session/session_import.php
  20. 3
      main/session/session_import_drh.php
  21. 2
      main/session/session_user_edit.php
  22. 2
      main/session/session_user_import.php

@ -294,7 +294,7 @@ $sessionPath = api_get_path(WEB_CODE_PATH).'session/';
$items[] = array('url' => $sessionPath.'session_list.php', 'label' => get_lang('ListSession'));
$items[] = array('url' => $sessionPath.'session_add.php', 'label' => get_lang('AddSession'));
$items[] = array('url' => 'session_category_list.php', 'label' => get_lang('ListSessionCategory'));
$items[] = array('url' => $sessionPath.'session_category_list.php', 'label' => get_lang('ListSessionCategory'));
$items[] = array('url' => $sessionPath.'session_import.php', 'label' => get_lang('ImportSessionListXMLCSV'));
$items[] = array('url' => $sessionPath.'session_import_drh.php', 'label' => get_lang('ImportSessionDrhList'));
if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
@ -303,7 +303,10 @@ if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSour
'label' => get_lang('ImportLDAPUsersIntoSession')
);
}
$items[] = array('url' => 'session_export.php', 'label' => get_lang('ExportSessionListXMLCSV'));
$items[] = array(
'url' => $sessionPath.'session_export.php',
'label' => get_lang('ExportSessionListXMLCSV'),
);
$items[] = array(
'url' => '../coursecopy/copy_course_session.php',
'label' => get_lang('CopyFromCourseInSessionToAnotherSession')
@ -367,7 +370,6 @@ if (api_is_platform_admin()) {
$blocks['settings']['items'] = $items;
$blocks['settings']['extra'] = null;
$blocks['settings']['search_form'] = null;
// Skills
@ -427,7 +429,7 @@ if (api_is_platform_admin()) {
$blocks['chamilo']['extra'] = null;
$blocks['chamilo']['search_form'] = null;
//Version check
// Version check
$blocks['version_check']['icon'] = Display::return_icon('logo.png', 'Chamilo.org', array(), ICON_SIZE_SMALL, false);
$blocks['version_check']['label'] = get_lang('VersionCheck');
$blocks['version_check']['extra'] = '<div class="admin-block-version"></div>';

@ -992,18 +992,23 @@ class IndexManager
return $html;
}
function return_course_block() {
/**
* @return null|string
*/
public function return_course_block()
{
$html = '';
$show_create_link = false;
$show_course_link = false;
if ((api_get_setting('allow_users_to_create_courses') == 'false' && !api_is_platform_admin()) || api_is_student()) {
if ((api_get_setting('allow_users_to_create_courses') == 'false' &&
!api_is_platform_admin()) || api_is_student()
) {
$display_add_course_link = false;
} else {
$display_add_course_link = true;
}
//$display_add_course_link = api_is_allowed_to_create_course() && ($_SESSION['studentview'] != 'studentenview');
if ($display_add_course_link) {
$show_create_link = true;
@ -1030,6 +1035,13 @@ class IndexManager
$my_account_content .= get_lang('CourseCreate');
}
$my_account_content .= '</a></li>';
if (SessionManager::allowToManageSessions()) {
$my_account_content .= '<li class="add-course"><a href="main/session/session_add.php">';
$my_account_content .= Display::return_icon('session.png',get_lang('AddSession'),null,ICON_SIZE_SMALL);
$my_account_content .= get_lang('AddSession');
$my_account_content .= '</a></li>';
}
}
//Sort courses

@ -308,7 +308,8 @@ VALUES
('meta_title', NULL, 'textfield', 'Tracking', '', 'MetaTitleTitle', 'MetaTitleComment', NULL, NULL, 1),
('meta_description', NULL, 'textfield', 'Tracking', '', 'MetaDescriptionTitle', 'MetaDescriptionComment', NULL, NULL, 1),
('meta_image_path', NULL, 'textfield', 'Tracking', '', 'MetaImagePathTitle', 'MetaImagePathComment', NULL, NULL, 1),
('chamilo_database_version', NULL, 'textfield',NULL, '0', 'DatabaseVersion','', NULL, NULL, 0);
('allow_teachers_to_create_sessions', NULL, 'radio', 'Session', 'false', 'AllowTeachersToCreateSessionsTitle', 'AllowTeachersToCreateSessionsComment', NULL, NULL, 0),
('chamilo_database_version', NULL, 'textfield', NULL, '0', 'DatabaseVersion', '', NULL, NULL, 0);
INSERT INTO settings_options (variable, value, display_text)
VALUES
@ -619,7 +620,7 @@ VALUES
('platform_unsubscribe_allowed', 'false', 'No'),
('activate_email_template', 'true', 'Yes'),
('activate_email_template', 'false', 'No'),
('enable_iframe_inclusion', 'true', 'Yes'),
('enable_iframe_inclusion', 'true', 'Yes'),
('enable_iframe_inclusion', 'false', 'No'),
('show_hot_courses', 'true', 'Yes'),
('show_hot_courses', 'false', 'No'),
@ -630,8 +631,9 @@ VALUES
('documents_default_visibility_defined_in_course', 'true', 'Yes'),
('documents_default_visibility_defined_in_course', 'false', 'No'),
('enabled_mathjax','true','Yes'),
('enabled_mathjax','false','No');
('enabled_mathjax','false','No'),
('allow_teachers_to_create_sessions', 'true', 'Yes'),
('allow_teachers_to_create_sessions', 'false', 'No');
INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES
('&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;','arabic','ar','arabic',0),

@ -22,7 +22,7 @@ $xajax->registerFunction(array('search_courses', 'AddCourseToSession', 'search_c
$this_section = SECTION_PLATFORM_ADMIN;
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
//$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$sessionId, "name" => get_lang('SessionOverview'));
@ -118,23 +118,24 @@ if ($ajax_search) {
$sql="SELECT course.id, code, title, visual_code, session_id
FROM $tbl_course course
INNER JOIN $tbl_session_rel_course session_rel_course
ON
course.id = session_rel_course.c_id AND
session_rel_course.session_id = ".intval($sessionId)."
ORDER BY ".(sizeof($courses)?"(code IN(".implode(',',$courses).")) DESC,":"")." title";
ON
course.id = session_rel_course.c_id AND
session_rel_course.session_id = ".intval($sessionId)."
ORDER BY ".(sizeof($courses)?"(code IN(".implode(',', $courses).")) DESC,":"")." title";
if (api_is_multiple_url_enabled()) {
$tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1){
$sql="SELECT course.id, code, title, visual_code, session_id
FROM $tbl_course course
INNER JOIN $tbl_session_rel_course session_rel_course
ON course.id = session_rel_course.c_id
AND session_rel_course.session_id = ".intval($sessionId)."
INNER JOIN $tbl_course_rel_access_url url_course ON (url_course.c_id = course.id)
WHERE access_url_id = $access_url_id
ORDER BY ".(sizeof($courses)?"(code IN(".implode(',',$courses).")) DESC,":"")." title";
$sql = "SELECT course.id, code, title, visual_code, session_id
FROM $tbl_course course
INNER JOIN $tbl_session_rel_course session_rel_course
ON course.id = session_rel_course.c_id
AND session_rel_course.session_id = ".intval($sessionId)."
INNER JOIN $tbl_course_rel_access_url url_course
ON (url_course.c_id = course.id)
WHERE access_url_id = $access_url_id
ORDER BY ".(sizeof($courses)?"(code IN(".implode(',',$courses).")) DESC,":"")." title";
}
}
@ -157,16 +158,16 @@ if ($ajax_search) {
$tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1){
$sql="SELECT course.id, code, title, visual_code, session_id
FROM $tbl_course course
LEFT JOIN $tbl_session_rel_course session_rel_course
ON
course.id = session_rel_course.c_id AND
session_rel_course.session_id = ".intval($sessionId)."
INNER JOIN $tbl_course_rel_access_url url_course
ON (url_course.c_id = course.id)
WHERE access_url_id = $access_url_id
ORDER BY ".(sizeof($courses)?"(code IN(".implode(',',$courses).")) DESC,":"")." title";
$sql = "SELECT course.id, code, title, visual_code, session_id
FROM $tbl_course course
LEFT JOIN $tbl_session_rel_course session_rel_course
ON
course.id = session_rel_course.c_id AND
session_rel_course.session_id = ".intval($sessionId)."
INNER JOIN $tbl_course_rel_access_url url_course
ON (url_course.c_id = course.id)
WHERE access_url_id = $access_url_id
ORDER BY ".(sizeof($courses)?"(code IN(".implode(',',$courses).")) DESC,":"")." title";
}
}
$result = Database::query($sql);
@ -180,6 +181,21 @@ if ($ajax_search) {
}
}
if (!api_is_platform_admin() && api_is_teacher()) {
$coursesFromTeacher = CourseManager::getCoursesFollowedByUser(
api_get_user_id(),
COURSEMANAGER
);
foreach ($nosessionCourses as &$course) {
if (in_array($course['code'], array_keys($coursesFromTeacher))) {
continue;
} else {
unset($nosessionCourses[$course['id']]);
}
}
}
unset($Courses);
?>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $sessionId; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>

@ -16,7 +16,7 @@ $xajax->registerFunction('search_courses');
$this_section = SECTION_PLATFORM_ADMIN;
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
//$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
// Database Table Definitions

@ -13,7 +13,7 @@ require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
//$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
// Setting the name of the tool

@ -13,7 +13,7 @@ require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
//$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
// Setting the name of the tool

@ -23,7 +23,7 @@ $addProcess = isset($_GET['add']) ? Security::remove_XSS($_GET['add']) : null;
SessionManager::protectSession($id_session);
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
//$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id_session,"name" => get_lang('SessionOverview'));

@ -22,7 +22,7 @@ SessionManager::protectSession($sessionId);
$tool_name = get_lang('SessionOverview');
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
//$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
$orig_param = '&origin=resume_session';

@ -23,17 +23,17 @@ api_protect_limit_for_session_admin();
$formSent=0;
$errorMsg='';
$interbreadcrumb[] = array(
/*$interbreadcrumb[] = array(
'url' => 'index.php',
'name' => get_lang('PlatformAdmin'),
);
);*/
$interbreadcrumb[] = array(
'url' => 'session_list.php',
'name' => get_lang('SessionList'),
);
// Database Table Definitions
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
function search_coachs($needle) {
global $tbl_user;
@ -152,28 +152,6 @@ $nb_days_acess_after = $defaultAfterDays;
$thisYear = date('Y');
$thisMonth = date('m');
$thisDay = date('d');
$dayList = array();
for ($i = 1; $i <= 31; $i++) {
$day = sprintf("%02d", $i);
$dayList[$day] = $day;
}
$monthList = array();
for ($i = 1; $i <= 12; $i++) {
$month = sprintf("%02d", $i);
$monthList[$month] = $month;
}
$yearList = array();
for ($i = $thisYear - 5; $i <= ($thisYear + 5); $i++) {
$yearList[$i] = $i;
}
$tool_name = get_lang('AddSession');
$urlAction = api_get_self();
@ -257,12 +235,9 @@ if (!api_is_platform_admin() && api_is_teacher()) {
$coachesList = Database::store_result($result);
$coachesOptions = array();
foreach ($coachesList as $coachItem) {
$coachesOptions[$coachItem['username']] = api_get_person_name(
$coachItem['firstname'],
$coachItem['lastname']
).' ('.$coachItem['username'].')';
$coachesOptions[$coachItem['user_id']] =
api_get_person_name($coachItem['firstname'], $coachItem['lastname']).' ('.$coachItem['username'].')';
}
$form->addElement(

@ -20,8 +20,9 @@ api_protect_admin_script(true);
$formSent=0;
$errorMsg='';
$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
$interbreadcrumb[]=array('url' => "session_category_list.php","name" => get_lang('ListSessionCategory'));
//$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => "session_category_list.php","name" => get_lang('ListSessionCategory'));
// Database Table Definitions
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);

@ -44,7 +44,8 @@ if ($action == 'delete_on_session' || $action == 'delete_off_session') {
exit();
}
$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('PlatformAdmin'));
//$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
if (isset($_GET['search']) && $_GET['search'] == 'advanced') {
$interbreadcrumb[] = array("url" => 'session_category_list.php', "name" => get_lang('ListSessionCategory'));
@ -79,8 +80,12 @@ if (isset($_GET['search']) && $_GET['search'] == 'advanced') {
$table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$query = "SELECT sc.*, (
SELECT count(id) FROM $tbl_session s INNER JOIN $table_access_url_rel_session us ON (s.id = us.session_id)
WHERE s.session_category_id = sc.id and access_url_id = ".api_get_current_access_url_id()."
SELECT count(id) FROM $tbl_session s
INNER JOIN $table_access_url_rel_session us
ON (s.id = us.session_id)
WHERE
s.session_category_id = sc.id AND
access_url_id = ".api_get_current_access_url_id()."
) as nbr_session
FROM $tbl_session_category sc
$where

@ -41,7 +41,7 @@ if (!list($session_name,$course_title) = Database::fetch_row($result)) {
exit();
}
$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
//$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
$interbreadcrumb[]=array('url' => "session_list.php","name" => get_lang("SessionList"));
$interbreadcrumb[]=array('url' => "resume_session.php?id_session=".$id_session,"name" => get_lang('SessionOverview'));
$interbreadcrumb[]=array('url' => "session_course_list.php?id_session=$id_session","name" =>api_htmlentities($session_name,ENT_QUOTES,$charset));

@ -64,9 +64,9 @@ $result=Database::query($sql);
$Courses=Database::store_result($result);
$tool_name = api_htmlentities($session_name,ENT_QUOTES,$charset).' : '.get_lang('CourseListInSession');
$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
$interbreadcrumb[]=array('url' => "session_list.php","name" => get_lang('SessionList'));
$interbreadcrumb[]=array('url' => "resume_session.php?id_session=".Security::remove_XSS($_REQUEST['id_session']),"name" => get_lang('SessionOverview'));
//$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => "session_list.php","name" => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".Security::remove_XSS($_REQUEST['id_session']),"name" => get_lang('SessionOverview'));
Display::display_header($tool_name);
echo Display::page_header($tool_name);

@ -16,7 +16,7 @@ $id_session = intval($_GET['id_session']);
SessionManager::protectSession($id_session);
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
//$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => 'resume_session.php?id_session='.Security::remove_XSS($_GET['id_session']),'name' => get_lang('SessionOverview'));

@ -106,7 +106,7 @@ $nbr_results = sizeof($users);
$tool_name = get_lang('Session').': '.$session_name.' - '.get_lang('Course').': '.$course_title;
$interbreadcrumb[] = array("url" => "index.php","name" => get_lang('PlatformAdmin'));
//$interbreadcrumb[] = array("url" => "index.php","name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array("url" => "session_list.php","name" => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id_session,"name" => get_lang('SessionOverview'));

@ -27,7 +27,7 @@ $infos = SessionManager::fetch($id);
$id_coach = $infos['id_coach'];
$tool_name = get_lang('EditSession');
$interbreadcrumb[] = array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
//$interbreadcrumb[] = array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => "session_list.php","name" => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id,"name" => get_lang('SessionOverview'));

@ -34,7 +34,8 @@ $tool_name = get_lang('ExportSessionListXMLCSV');
global $_configuration;
$interbreadcrumb[] = array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
//$interbreadcrumb[] = array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
set_time_limit(0);

@ -28,7 +28,7 @@ $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE
$tool_name = get_lang('ImportSessionListXMLCSV');
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
//$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
set_time_limit(0);

@ -13,10 +13,9 @@ api_protect_admin_script(true);
api_protect_limit_for_session_admin();
$form_sent = 0;
$tool_name = get_lang('ImportSessionDrhList');
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
//$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[]=array('url' => 'session_list.php','name' => get_lang('SessionList'));
set_time_limit(0);

@ -25,7 +25,7 @@ if (empty($sessionId) || empty($userId)) {
api_not_allowed(true);
}
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
//$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$sessionId, "name" => get_lang('SessionOverview'));

@ -25,7 +25,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'show_message') {
$tool_name = get_lang('ImportUsers');
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
//$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => "session_list.php", "name" => get_lang('SessionList'));
$interbreadcrumb[] = array(
'url' => "resume_session.php?id_session=".$session_id,

Loading…
Cancel
Save