skala
Juan Carlos Raña 14 years ago
commit 1b89d25fc0
  1. 438
      main/admin/course_list.php
  2. 31
      main/admin/course_request_accepted.php
  3. 64
      main/admin/course_request_rejected.php
  4. 73
      main/admin/course_request_review.php
  5. 20
      main/inc/lib/course_request.lib.php
  6. 16
      main/lang/bulgarian/create_course.inc.php
  7. 18
      main/lang/english/create_course.inc.php
  8. 4
      main/lang/spanish/create_course.inc.php

@ -1,14 +1,16 @@
<?php // $Id: course_list.php 21855 2009-07-07 18:26:10Z juliomontoya $
<?php
/* For licensing terms, see /license.txt */
/**
* This script shows a list of courses and allows searching for courses codes
* and names
* @package chamilo.admin
*/
/* INIT SECTION */
// name of the language file that needs to be included
$language_file = array('admin','courses');
// Language files that need to be included.
$language_file = array('admin', 'courses');
$cidReset = true;
require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
@ -19,204 +21,191 @@ require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php';
require_once '../gradebook/lib/be/gradebookitem.class.php';
require_once '../gradebook/lib/be/category.class.php';
/**
* Get the number of courses which will be displayed
*/
function get_number_of_courses() {
$course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
$sql = "SELECT COUNT(code) AS total_number_of_items FROM $course_table";
$course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
$sql = "SELECT COUNT(code) AS total_number_of_items FROM $course_table";
global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql.= " INNER JOIN $access_url_rel_course_table url_rel_course ON (code=url_rel_course.course_code)";
global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id() != -1) {
$access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql.= " INNER JOIN $access_url_rel_course_table url_rel_course ON (code=url_rel_course.course_code)";
}
if (isset ($_GET['keyword']))
{
$keyword = Database::escape_string($_GET['keyword']);
$sql .= " WHERE (title LIKE '%".$keyword."%' OR code LIKE '%".$keyword."%' OR visual_code LIKE '%".$keyword."%')";
}
elseif (isset ($_GET['keyword_code']))
{
$keyword_code = Database::escape_string($_GET['keyword_code']);
$keyword_title = Database::escape_string($_GET['keyword_title']);
$keyword_category = Database::escape_string($_GET['keyword_category']);
$keyword_language = Database::escape_string($_GET['keyword_language']);
$keyword_visibility = Database::escape_string($_GET['keyword_visibility']);
$keyword_subscribe = Database::escape_string($_GET['keyword_subscribe']);
$keyword_unsubscribe = Database::escape_string($_GET['keyword_unsubscribe']);
$sql .= " WHERE (code LIKE '%".$keyword_code."%' OR visual_code LIKE '%".$keyword_code."%') AND title LIKE '%".$keyword_title."%' AND category_code LIKE '%".$keyword_category."%' AND course_language LIKE '%".$keyword_language."%' AND visibility LIKE '%".$keyword_visibility."%' AND subscribe LIKE '".$keyword_subscribe."'AND unsubscribe LIKE '".$keyword_unsubscribe."'";
}
if (isset ($_GET['keyword'])) {
$keyword = Database::escape_string($_GET['keyword']);
$sql .= " WHERE (title LIKE '%".$keyword."%' OR code LIKE '%".$keyword."%' OR visual_code LIKE '%".$keyword."%')";
}
elseif (isset ($_GET['keyword_code'])) {
$keyword_code = Database::escape_string($_GET['keyword_code']);
$keyword_title = Database::escape_string($_GET['keyword_title']);
$keyword_category = Database::escape_string($_GET['keyword_category']);
$keyword_language = Database::escape_string($_GET['keyword_language']);
$keyword_visibility = Database::escape_string($_GET['keyword_visibility']);
$keyword_subscribe = Database::escape_string($_GET['keyword_subscribe']);
$keyword_unsubscribe = Database::escape_string($_GET['keyword_unsubscribe']);
$sql .= " WHERE (code LIKE '%".$keyword_code."%' OR visual_code LIKE '%".$keyword_code."%') AND title LIKE '%".$keyword_title."%' AND category_code LIKE '%".$keyword_category."%' AND course_language LIKE '%".$keyword_language."%' AND visibility LIKE '%".$keyword_visibility."%' AND subscribe LIKE '".$keyword_subscribe."'AND unsubscribe LIKE '".$keyword_unsubscribe."'";
}
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_course.access_url_id=".api_get_current_access_url_id();
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id() != -1) {
$sql.= " AND url_rel_course.access_url_id=".api_get_current_access_url_id();
}
$res = Database::query($sql);
$obj = Database::fetch_object($res);
return $obj->total_number_of_items;
$res = Database::query($sql);
$obj = Database::fetch_object($res);
return $obj->total_number_of_items;
}
/**
* Get course data to display
*/
function get_course_data($from, $number_of_items, $column, $direction)
{
$course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
$users_table = Database :: get_main_table(TABLE_MAIN_USER);
$course_users_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$sql = "SELECT code AS col0, visual_code AS col1, title AS col2, course_language AS col3, category_code AS col4, subscribe AS col5, unsubscribe AS col6, tutor_name as col7, code AS col8, visibility AS col9,directory as col10 FROM $course_table";
//$sql = "SELECT code AS col0, visual_code AS col1, title AS col2, course_language AS col3, category_code AS col4, subscribe AS col5, unsubscribe AS col6, code AS col7, tutor_name as col8, code AS col9, visibility AS col10,directory as col11 FROM $course_table";
global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql.= " INNER JOIN $access_url_rel_course_table url_rel_course ON (code=url_rel_course.course_code)";
function get_course_data($from, $number_of_items, $column, $direction) {
$course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
$users_table = Database :: get_main_table(TABLE_MAIN_USER);
$course_users_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$sql = "SELECT code AS col0, visual_code AS col1, title AS col2, course_language AS col3, category_code AS col4, subscribe AS col5, unsubscribe AS col6, tutor_name as col7, code AS col8, visibility AS col9,directory as col10 FROM $course_table";
//$sql = "SELECT code AS col0, visual_code AS col1, title AS col2, course_language AS col3, category_code AS col4, subscribe AS col5, unsubscribe AS col6, code AS col7, tutor_name as col8, code AS col9, visibility AS col10,directory as col11 FROM $course_table";
global $_configuration;
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id() != -1) {
$access_url_rel_course_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql.= " INNER JOIN $access_url_rel_course_table url_rel_course ON (code=url_rel_course.course_code)";
}
if (isset ($_GET['keyword']))
{
$keyword = Database::escape_string(trim($_GET['keyword']));
$sql .= " WHERE title LIKE '%".$keyword."%' OR code LIKE '%".$keyword."%' OR visual_code LIKE '%".$keyword."%'";
}
elseif (isset ($_GET['keyword_code']))
{
$keyword_code = Database::escape_string($_GET['keyword_code']);
$keyword_title = Database::escape_string($_GET['keyword_title']);
$keyword_category = Database::escape_string($_GET['keyword_category']);
$keyword_language = Database::escape_string($_GET['keyword_language']);
$keyword_visibility = Database::escape_string($_GET['keyword_visibility']);
$keyword_subscribe = Database::escape_string($_GET['keyword_subscribe']);
$keyword_unsubscribe = Database::escape_string($_GET['keyword_unsubscribe']);
$sql .= " WHERE (code LIKE '%".$keyword_code."%' OR visual_code LIKE '%".$keyword_code."%') AND title LIKE '%".$keyword_title."%' AND category_code LIKE '%".$keyword_category."%' AND course_language LIKE '%".$keyword_language."%' AND visibility LIKE '%".$keyword_visibility."%' AND subscribe LIKE '".$keyword_subscribe."'AND unsubscribe LIKE '".$keyword_unsubscribe."'";
}
if (isset ($_GET['keyword'])) {
$keyword = Database::escape_string(trim($_GET['keyword']));
$sql .= " WHERE title LIKE '%".$keyword."%' OR code LIKE '%".$keyword."%' OR visual_code LIKE '%".$keyword."%'";
}
elseif (isset ($_GET['keyword_code'])) {
$keyword_code = Database::escape_string($_GET['keyword_code']);
$keyword_title = Database::escape_string($_GET['keyword_title']);
$keyword_category = Database::escape_string($_GET['keyword_category']);
$keyword_language = Database::escape_string($_GET['keyword_language']);
$keyword_visibility = Database::escape_string($_GET['keyword_visibility']);
$keyword_subscribe = Database::escape_string($_GET['keyword_subscribe']);
$keyword_unsubscribe = Database::escape_string($_GET['keyword_unsubscribe']);
$sql .= " WHERE (code LIKE '%".$keyword_code."%' OR visual_code LIKE '%".$keyword_code."%') AND title LIKE '%".$keyword_title."%' AND category_code LIKE '%".$keyword_category."%' AND course_language LIKE '%".$keyword_language."%' AND visibility LIKE '%".$keyword_visibility."%' AND subscribe LIKE '".$keyword_subscribe."'AND unsubscribe LIKE '".$keyword_unsubscribe."'";
}
// adding the filter to see the user's only of the current access_url
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id()!=-1) {
$sql.= " AND url_rel_course.access_url_id=".api_get_current_access_url_id();
// Adding the filter to see the user's only of the current access_url.
if ((api_is_platform_admin() || api_is_session_admin()) && $_configuration['multiple_access_urls'] && api_get_current_access_url_id() != -1) {
$sql.= " AND url_rel_course.access_url_id=".api_get_current_access_url_id();
}
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
$res = Database::query($sql);
$courses = array ();
while ($course = Database::fetch_row($res))
{
//place colour icons in front of courses
//$course[1] = '<nobr>'.get_course_visibility_icon($course[9]).'<a href="'.api_get_path(WEB_COURSE_PATH).$course[9].'/index.php">'.$course[1].'</a></nobr>';
$course[1] = '<nobr>'.get_course_visibility_icon($course[9]).'<a href="'.api_get_path(WEB_COURSE_PATH).$course[8].'/index.php">'.$course[1].'</a></nobr>';
$course[5] = $course[5] == SUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
$course[6] = $course[6] == UNSUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
//$course[7] = CourseManager :: is_virtual_course_from_system_code($course[7]) ? get_lang('Yes') : get_lang('No');
//$course_rem = array($course[0],$course[1],$course[2],$course[3],$course[4],$course[5],$course[6],$course[7],$course[8],$course[9]);
$course_rem = array($course[0],$course[1],$course[2],$course[3],$course[4],$course[5],$course[6],$course[7],$course[8]);
$courses[] = $course_rem;
}
return $courses;
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";
$res = Database::query($sql);
$courses = array ();
while ($course = Database::fetch_row($res)) {
// Place colour icons in front of courses.
//$course[1] = '<nobr>'.get_course_visibility_icon($course[9]).'<a href="'.api_get_path(WEB_COURSE_PATH).$course[9].'/index.php">'.$course[1].'</a></nobr>';
$course[1] = '<nobr>'.get_course_visibility_icon($course[9]).'<a href="'.api_get_path(WEB_COURSE_PATH).$course[8].'/index.php">'.$course[1].'</a></nobr>';
$course[5] = $course[5] == SUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
$course[6] = $course[6] == UNSUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
//$course[7] = CourseManager :: is_virtual_course_from_system_code($course[7]) ? get_lang('Yes') : get_lang('No');
//$course_rem = array($course[0], $course[1], $course[2], $course[3], $course[4], $course[5], $course[6], $course[7], $course[8], $course[9]);
$course_rem = array($course[0], $course[1], $course[2], $course[3], $course[4], $course[5], $course[6], $course[7], $course[8]);
$courses[] = $course_rem;
}
return $courses;
}
/**
* Filter to display the edit-buttons
*/
function modify_filter($code)
{
global $charset;
return
'<a href="course_information.php?code='.$code.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a>&nbsp;'.
//'<a href="../course_home/course_home.php?cidReq='.$code.'">'.Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>&nbsp;'. // This is not the preferable way to go to the homepage.
'<a href="'.api_get_path(WEB_COURSE_PATH).$code.'/index.php">'.Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>&nbsp;'.
'<a href="../tracking/courseLog.php?cidReq='.$code.'">'.Display::return_icon('statistics.gif', get_lang('Tracking')).'</a>&nbsp;'.
'<a href="course_edit.php?course_code='.$code.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>&nbsp;'.
'<a href="course_list.php?delete_course='.$code.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>'.
'<a href="../coursecopy/backup.php?cidReq='.$code.'">'.Display::return_icon('backup.gif', get_lang('CreateBackup')).'</a>&nbsp;';
function modify_filter($code) {
return
'<a href="course_information.php?code='.$code.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a>&nbsp;'.
//'<a href="../course_home/course_home.php?cidReq='.$code.'">'.Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>&nbsp;'. // This is not the preferable way to go to the homepage.
'<a href="'.api_get_path(WEB_COURSE_PATH).$code.'/index.php">'.Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>&nbsp;'.
'<a href="../tracking/courseLog.php?cidReq='.$code.'">'.Display::return_icon('statistics.gif', get_lang('Tracking')).'</a>&nbsp;'.
'<a href="course_edit.php?course_code='.$code.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>&nbsp;'.
'<a href="course_list.php?delete_course='.$code.'" onclick="javascript: if (!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>'.
'<a href="../coursecopy/backup.php?cidReq='.$code.'">'.Display::return_icon('backup.gif', get_lang('CreateBackup')).'</a>&nbsp;';
}
/**
* Return an icon representing the visibility of the course
*/
function get_course_visibility_icon($v)
{
$path = api_get_path(REL_CODE_PATH);
$style = 'margin-bottom:-5px;margin-right:5px;';
switch($v)
{
case 0:
return Display::return_icon('bullet_red.gif', get_lang('CourseVisibilityClosed'), array('style'=>$style));
break;
case 1:
return Display::return_icon('bullet_orange.gif', get_lang('Private'), array('style'=>$style));
break;
case 2:
return Display::return_icon('bullet_green.gif', get_lang('OpenToThePlatform'), array('style'=>$style));
break;
case 3:
return Display::return_icon('bullet_blue.gif', get_lang('OpenToTheWorld'), array('style'=>$style));
break;
default:
return '';
}
function get_course_visibility_icon($v) {
$path = api_get_path(REL_CODE_PATH);
$style = 'margin-bottom:-5px;margin-right:5px;';
switch($v) {
case 0:
return Display::return_icon('bullet_red.gif', get_lang('CourseVisibilityClosed'), array('style' => $style));
break;
case 1:
return Display::return_icon('bullet_orange.gif', get_lang('Private'), array('style' => $style));
break;
case 2:
return Display::return_icon('bullet_green.gif', get_lang('OpenToThePlatform'), array('style' => $style));
break;
case 3:
return Display::return_icon('bullet_blue.gif', get_lang('OpenToTheWorld'), array('style' => $style));
break;
default:
return '';
}
}
if (isset ($_POST['action']))
{
switch ($_POST['action'])
{
// Delete selected courses
case 'delete_courses' :
$course_codes = $_POST['course'];
if (count($course_codes) > 0)
{
foreach ($course_codes as $index => $course_code)
{
CourseManager :: delete_course($course_code);
$obj_cat=new Category();
$obj_cat->update_category_delete($course_code);
}
}
break;
}
if (isset ($_POST['action'])) {
switch ($_POST['action']) {
// Delete selected courses
case 'delete_courses' :
$course_codes = $_POST['course'];
if (count($course_codes) > 0) {
foreach ($course_codes as $index => $course_code) {
CourseManager :: delete_course($course_code);
$obj_cat=new Category();
$obj_cat->update_category_delete($course_code);
}
}
break;
}
}
if (isset ($_GET['search']) && $_GET['search'] == 'advanced') {
// Get all course categories
$table_course_category = Database :: get_main_table(TABLE_MAIN_CATEGORY);
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array ("url" => 'course_list.php', "name" => get_lang('CourseList'));
$tool_name = get_lang('SearchACourse');
Display :: display_header($tool_name);
//api_display_tool_title($tool_name);
$form = new FormValidator('advanced_course_search', 'get');
$form->addElement('header', '', $tool_name);
$form->add_textfield('keyword_code', get_lang('CourseCode'), false);
$form->add_textfield('keyword_title', get_lang('Title'), false);
$categories = array();
$categories_select = $form->addElement('select', 'keyword_category', get_lang('CourseFaculty'), $categories);
CourseManager::select_and_sort_categories($categories_select);
$el = & $form->addElement('select_language', 'keyword_language', get_lang('CourseLanguage'));
$el->addOption(get_lang('All'), '%');
$form->addElement('radio', 'keyword_visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
$form->addElement('radio', 'keyword_visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
$form->addElement('radio', 'keyword_visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
$form->addElement('radio', 'keyword_visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED);
$form->addElement('radio', 'keyword_visibility', null, get_lang('All'), '%');
$form->addElement('radio', 'keyword_subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
$form->addElement('radio', 'keyword_subscribe', null, get_lang('Denied'), 0);
$form->addElement('radio', 'keyword_subscribe', null, get_lang('All'), '%');
$form->addElement('radio', 'keyword_unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
$form->addElement('radio', 'keyword_unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
$form->addElement('radio', 'keyword_unsubscribe', null, get_lang('All'), '%');
$form->addElement('style_submit_button', 'submit', get_lang('SearchCourse'),'class="search"');
$defaults['keyword_language'] = '%';
$defaults['keyword_visibility'] = '%';
$defaults['keyword_subscribe'] = '%';
$defaults['keyword_unsubscribe'] = '%';
$form->setDefaults($defaults);
$form->display();
}
else
{
$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$tool_name = get_lang('CourseList');
Display :: display_header($tool_name);
// Get all course categories
$table_course_category = Database :: get_main_table(TABLE_MAIN_CATEGORY);
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));
$tool_name = get_lang('SearchACourse');
Display :: display_header($tool_name);
//api_display_tool_title($tool_name);
$form = new FormValidator('advanced_course_search', 'get');
$form->addElement('header', '', $tool_name);
$form->add_textfield('keyword_code', get_lang('CourseCode'), false);
$form->add_textfield('keyword_title', get_lang('Title'), false);
$categories = array();
$categories_select = $form->addElement('select', 'keyword_category', get_lang('CourseFaculty'), $categories);
CourseManager::select_and_sort_categories($categories_select);
$el = & $form->addElement('select_language', 'keyword_language', get_lang('CourseLanguage'));
$el->addOption(get_lang('All'), '%');
$form->addElement('radio', 'keyword_visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
$form->addElement('radio', 'keyword_visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
$form->addElement('radio', 'keyword_visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
$form->addElement('radio', 'keyword_visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED);
$form->addElement('radio', 'keyword_visibility', null, get_lang('All'), '%');
$form->addElement('radio', 'keyword_subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
$form->addElement('radio', 'keyword_subscribe', null, get_lang('Denied'), 0);
$form->addElement('radio', 'keyword_subscribe', null, get_lang('All'), '%');
$form->addElement('radio', 'keyword_unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
$form->addElement('radio', 'keyword_unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
$form->addElement('radio', 'keyword_unsubscribe', null, get_lang('All'), '%');
$form->addElement('style_submit_button', 'submit', get_lang('SearchCourse'),'class="search"');
$defaults['keyword_language'] = '%';
$defaults['keyword_visibility'] = '%';
$defaults['keyword_subscribe'] = '%';
$defaults['keyword_unsubscribe'] = '%';
$form->setDefaults($defaults);
$form->display();
} else {
$interbreadcrumb[] = array ('url' => 'index.php', "name" => get_lang('PlatformAdmin'));
$tool_name = get_lang('CourseList');
Display :: display_header($tool_name);
if (isset($_GET['action'])) {
switch ($_GET['action']) {
case 'show_msg':
@ -224,73 +213,72 @@ else
Display::display_warning_message(urldecode($_GET['warn']));
}
if (!empty($_GET['msg'])) {
Display::display_normal_message(urldecode($_GET['msg']));
Display::display_normal_message(urldecode($_GET['msg']));
}
break;
default:
break;
}
}
//api_display_tool_title($tool_name);
if (isset ($_GET['delete_course']))
{
CourseManager :: delete_course($_GET['delete_course']);
//api_display_tool_title($tool_name);
if (isset ($_GET['delete_course'])) {
$obj_cat=new Category();
$obj_cat->update_category_delete($_GET['delete_course']);
CourseManager :: delete_course($_GET['delete_course']);
$obj_cat = new Category();
$obj_cat->update_category_delete($_GET['delete_course']);
}
// Create a search-box
$form = new FormValidator('search_simple','get','','','width=200px',false);
$renderer =& $form->defaultRenderer();
$renderer->setElementTemplate('<span>{element}</span> ');
$form->addElement('text','keyword',get_lang('keyword'));
$form->addElement('style_submit_button', 'submit', get_lang('SearchCourse'),'class="search"');
$form->addElement('static','search_advanced_link',null,'<a href="course_list.php?search=advanced">'.get_lang('AdvancedSearch').'</a>');
echo '<div style="float:right;margin-top:5px;margin-right:5px;">
<a href="'.api_get_path(WEB_CODE_PATH).'admin/course_add.php">'.Display::return_icon('course_add.gif',get_lang('AddCourse')).get_lang('AddCourse').'</a>
</div>';
}
// Create a search-box
$form = new FormValidator('search_simple', 'get', '', '', 'width=200px', false);
$renderer =& $form->defaultRenderer();
$renderer->setElementTemplate('<span>{element}</span> ');
$form->addElement('text', 'keyword', get_lang('keyword'));
$form->addElement('style_submit_button', 'submit', get_lang('SearchCourse'), 'class="search"');
$form->addElement('static', 'search_advanced_link', null, '<a href="course_list.php?search=advanced">'.get_lang('AdvancedSearch').'</a>');
echo '<div style="float: right; margin-top: 5px; margin-right: 5px;">';
if (api_get_setting('course_validation') != 'true') {
echo '<a href="course_add.php">'.Display::return_icon('course_add.gif', get_lang('AddCourse')).get_lang('AddCourse').'</a>';
} else {
echo '<a href="course_request_review.php">'.Display::return_icon('course_request_pending.png', get_lang('ReviewCourseRequests')).'&nbsp;'.get_lang('ReviewCourseRequests').'</a>';
}
echo '</div>';
echo '<div class="actions">';
$form->display();
echo '</div>';
// Create a sortable table with the course data
$table = new SortableTable('courses', 'get_number_of_courses', 'get_course_data',2);
$parameters=array();
echo '<div class="actions">';
$form->display();
echo '</div>';
// Create a sortable table with the course data
$table = new SortableTable('courses', 'get_number_of_courses', 'get_course_data', 2);
$parameters=array();
if (isset ($_GET['keyword'])) {
$parameters = array ('keyword' => Security::remove_XSS($_GET['keyword']));
} elseif (isset ($_GET['keyword_code'])) {
$parameters['keyword_code'] = Security::remove_XSS($_GET['keyword_code']);
$parameters['keyword_title'] = Security::remove_XSS($_GET['keyword_title']);
$parameters['keyword_category'] = Security::remove_XSS($_GET['keyword_category']);
$parameters['keyword_language'] = Security::remove_XSS($_GET['keyword_language']);
$parameters['keyword_visibility'] = Security::remove_XSS($_GET['keyword_visibility']);
$parameters['keyword_subscribe'] = Security::remove_XSS($_GET['keyword_subscribe']);
$parameters['keyword_unsubscribe'] = Security::remove_XSS($_GET['keyword_unsubscribe']);
}
if (isset ($_GET['keyword'])) {
$parameters = array ('keyword' => Security::remove_XSS($_GET['keyword']));
} elseif (isset ($_GET['keyword_code'])) {
$parameters['keyword_code'] = Security::remove_XSS($_GET['keyword_code']);
$parameters['keyword_title'] = Security::remove_XSS($_GET['keyword_title']);
$parameters['keyword_category'] = Security::remove_XSS($_GET['keyword_category']);
$parameters['keyword_language'] = Security::remove_XSS($_GET['keyword_language']);
$parameters['keyword_visibility'] = Security::remove_XSS($_GET['keyword_visibility']);
$parameters['keyword_subscribe'] = Security::remove_XSS($_GET['keyword_subscribe']);
$parameters['keyword_unsubscribe'] = Security::remove_XSS($_GET['keyword_unsubscribe']);
}
$table->set_additional_parameters($parameters);
$table->set_additional_parameters($parameters);
$table->set_header(0, '', false, 'width="8px"');
$table->set_header(1, get_lang('Code'));
$table->set_header(2, get_lang('Title'));
$table->set_header(3, get_lang('Language'), true, 'width="70px"');
$table->set_header(4, get_lang('Category'));
$table->set_header(5, get_lang('SubscriptionAllowed'), true,'width="60px"');
$table->set_header(6, get_lang('UnsubscriptionAllowed'),false,'width="50px"');
//$table->set_header(7, get_lang('IsVirtualCourse'));
$table->set_header(7, get_lang('Teacher'));
$table->set_header(8, get_lang('Action'), false,'width="145px"');
$table->set_column_filter(8,'modify_filter');
$table->set_form_actions(array ('delete_courses' => get_lang('DeleteCourse')),'course');
$table->display();
$table->set_header(0, '', false, 'width="8px"');
$table->set_header(1, get_lang('Code'));
$table->set_header(2, get_lang('Title'));
$table->set_header(3, get_lang('Language'), true, 'width="70px"');
$table->set_header(4, get_lang('Category'));
$table->set_header(5, get_lang('SubscriptionAllowed'), true, 'width="60px"');
$table->set_header(6, get_lang('UnsubscriptionAllowed'), false, 'width="50px"');
//$table->set_header(7, get_lang('IsVirtualCourse'));
$table->set_header(7, get_lang('Teacher'));
$table->set_header(8, get_lang('Action'), false, 'width="145px"');
$table->set_column_filter(8, 'modify_filter');
$table->set_form_actions(array('delete_courses' => get_lang('DeleteCourse')), 'course');
$table->display();
}
/*
==============================================================================
FOOTER
==============================================================================
*/
/* FOOTER */
Display :: display_footer();
?>

@ -39,25 +39,35 @@ require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
// Filltering passed to this page parameters.
$delete_course_request = intval($_GET['delete_course_request']);
$message = trim(Security::remove_XSS(stripslashes(urldecode($_GET['message']))));
$is_error_message = !empty($_GET['is_error_message']);
/**
* Deletion of a course request.
*/
if (!empty($delete_course_request)) {
CourseRequestManager::delete_course_request($delete_course_request);
$course_request_code = CourseRequestManager::get_course_request_code($delete_course_request);
$result = CourseRequestManager::delete_course_request($delete_course_request);
if ($result) {
$message = sprintf(get_lang('CourseRequestDeleted'), $course_request_code);
$is_error_message = false;
} else {
$message = sprintf(get_lang('CourseRequestDeletionFailed'), $course_request_code);
$is_error_message = true;
}
}
/**
* Get the number of courses which will be displayed.
*/
function get_number_of_courses() {
function get_number_of_requests() {
return CourseRequestManager::count_course_requests(COURSE_REQUEST_ACCEPTED);
}
/**
* Get course data to display
*/
function get_course_data($from, $number_of_items, $column, $direction) {
function get_request_data($from, $number_of_items, $column, $direction) {
$course_table = Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST);
$users_table = Database :: get_main_table(TABLE_MAIN_USER);
$course_users_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
@ -87,8 +97,9 @@ function get_course_data($from, $number_of_items, $column, $direction) {
* Actions in the list: edit, accept, delete.
*/
function modify_filter($id) {
$code = CourseRequestManager::get_course_request_code($id);
$result = '<a href="editar_curso.php?id='.$id.'">'.Display::return_icon('edit.gif', get_lang('Edit'), array('style' => 'vertical-align: middle;')).'</a>'.
'&nbsp;<a href="?delete_course_request='.$id.'">'.Display::return_icon('delete.gif', get_lang('Delete'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;')).'</a>';
'&nbsp;<a href="?delete_course_request='.$id.'">'.Display::return_icon('delete.gif', get_lang('DeleteThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeDeleted'), $code), ENT_QUOTES)).'\')) return false;')).'</a>';
return $result;
}
@ -96,14 +107,24 @@ $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdm
$tool_name = get_lang('AcceptedCourseRequests');
Display :: display_header($tool_name);
// Display confirmation or error message.
if (!empty($message)) {
if ($is_error_message) {
Display::display_error_message($message);
} else {
Display::display_normal_message($message);
}
}
// The action bar.
echo '<div class="actions">';
echo '<a href="course_list.php">'.Display::return_icon('courses.gif', get_lang('CourseList')).get_lang('CourseList').'</a>';
echo '<a href="course_request_review.php">'.Display::return_icon('course_request_pending.png', get_lang('ReviewCourseRequests')).get_lang('ReviewCourseRequests').'</a>';
echo '<a href="course_request_rejected.php">'.Display::return_icon('course_request_rejected.gif', get_lang('RejectedCourseRequests')).get_lang('RejectedCourseRequests').'</a>';
echo '</div>';
// Create a sortable table with the course data
$table = new SortableTable('courses', 'get_number_of_courses', 'get_course_data', 2);
$table = new SortableTable('course_requests', 'get_number_of_requests', 'get_request_data', 2);
$table->set_additional_parameters($parameters);
//$table->set_header(0, '', false);
$table->set_header(0, get_lang('Code'));

@ -42,48 +42,67 @@ require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
$accept_course_request = intval($_GET['accept_course_request']);
$delete_course_request = intval($_GET['delete_course_request']);
$request_info = intval($_GET['request_info']);
$message = trim(Security::remove_XSS(stripslashes(urldecode($_GET['message']))));
$is_error_message = !empty($_GET['is_error_message']);
/**
* Acceptance and creation of the requested course.
*/
if (!empty($accept_course_request)) {
$course_request_code = CourseRequestManager::get_course_request_code($accept_course_request);
$course_id = CourseRequestManager::accept_course_request($accept_course_request);
if ($course_id) {
// TODO: Prepare a confirmation message.
$course_code = CourseManager::get_course_code_from_course_id($course_id);
$message = sprintf(get_lang('CourseRequestAccepted'), $course_request_code, $course_code);
$is_error_message = false;
} else {
// Prepare an error message.
$message = sprintf(get_lang('CourseRequestAcceptanceFailed'), $course_request_code);
$is_error_message = true;
}
}
/**
* Deletion of a course request.
* Sending to the teacher a request for additional information about the proposed course.
*/
if (!empty($delete_course_request)) {
CourseRequestManager::delete_course_request($delete_course_request);
elseif (!empty($request_info)) {
$course_request_code = CourseRequestManager::get_course_request_code($request_info);
$result = CourseRequestManager::ask_for_additional_info($request_info);
if ($result) {
$message = sprintf(get_lang('CourseRequestInfoAsked'), $course_request_code);
$is_error_message = false;
} else {
$message = sprintf(get_lang('CourseRequestInfoFailed'), $course_request_code);
$is_error_message = true;
}
}
/**
* Sending to the teacher a request for additional information about the proposed course.
* Deletion of a course request.
*/
if (!empty($request_info)) {
CourseRequestManager::ask_for_additional_info($request_info);
elseif (!empty($delete_course_request)) {
$course_request_code = CourseRequestManager::get_course_request_code($delete_course_request);
$result = CourseRequestManager::delete_course_request($delete_course_request);
if ($result) {
$message = sprintf(get_lang('CourseRequestDeleted'), $course_request_code);
$is_error_message = false;
} else {
$message = sprintf(get_lang('CourseRequestDeletionFailed'), $course_request_code);
$is_error_message = true;
}
}
/**
* Get the number of courses which will be displayed.
*/
function get_number_of_courses() {
function get_number_of_requests() {
return CourseRequestManager::count_course_requests(COURSE_REQUEST_REJECTED);
}
/**
* Get course data to display
*/
function get_course_data($from, $number_of_items, $column, $direction) {
function get_request_data($from, $number_of_items, $column, $direction) {
$course_table = Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST);
$users_table = Database :: get_main_table(TABLE_MAIN_USER);
$course_users_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
@ -113,11 +132,12 @@ function get_course_data($from, $number_of_items, $column, $direction) {
* Actions in the list: edit, accept, delete, request additional information.
*/
function modify_filter($id) {
$code = CourseRequestManager::get_course_request_code($id);
$result = '<a href="editar_curso.php?id='.$id.'">'.Display::return_icon('edit.gif', get_lang('Edit'), array('style' => 'vertical-align: middle;')).'</a>'.
'&nbsp;<a href="?accept_course_request='.$id.'">'.Display::return_icon('action_accept.gif', get_lang('AcceptThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(get_lang('ANewCourseWillBeCreated'), ENT_QUOTES)).'\')) return false;')).'</a>'.
'&nbsp;<a href="?delete_course_request='.$id.'">'.Display::return_icon('delete.gif', get_lang('Delete'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;')).'</a>';
'&nbsp;<a href="?accept_course_request='.$id.'">'.Display::return_icon('action_accept.gif', get_lang('AcceptThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ANewCourseWillBeCreated'), $code), ENT_QUOTES)).'\')) return false;')).'</a>'.
'&nbsp;<a href="?delete_course_request='.$id.'">'.Display::return_icon('delete.gif', get_lang('DeleteThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeDeleted'), $code), ENT_QUOTES)).'\')) return false;')).'</a>';
if (!CourseRequestManager::additional_info_asked($id)) {
$result .= '&nbsp;<a href="?request_info='.$id.'">'.Display::return_icon('request_info.gif', get_lang('AskAdditionalInfo'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(get_lang('AdditionalInfoWillBeAsked'), ENT_QUOTES)).'\')) return false;')).'</a>';
$result .= '&nbsp;<a href="?request_info='.$id.'">'.Display::return_icon('request_info.gif', get_lang('AskAdditionalInfo'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('AdditionalInfoWillBeAsked'), $code), ENT_QUOTES)).'\')) return false;')).'</a>';
}
return $result;
}
@ -126,14 +146,24 @@ $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdm
$tool_name = get_lang('RejectedCourseRequests');
Display :: display_header($tool_name);
// Display confirmation or error message.
if (!empty($message)) {
if ($is_error_message) {
Display::display_error_message($message);
} else {
Display::display_normal_message($message);
}
}
// The action bar.
echo '<div class="actions">';
echo '<a href="course_list.php">'.Display::return_icon('courses.gif', get_lang('CourseList')).get_lang('CourseList').'</a>';
echo '<a href="course_request_review.php">'.Display::return_icon('course_request_pending.png', get_lang('ReviewCourseRequests')).get_lang('ReviewCourseRequests').'</a>';
echo '<a href="course_request_accepted.php">'.Display::return_icon('course_request_accepted.gif', get_lang('AcceptedCourseRequests')).get_lang('AcceptedCourseRequests').'</a>';
echo '</div>';
// Create a sortable table with the course data
$table = new SortableTable('courses', 'get_number_of_courses', 'get_course_data', 2);
$table = new SortableTable('course_requests', 'get_number_of_requests', 'get_request_data', 2);
$table->set_additional_parameters($parameters);
//$table->set_header(0, '', false);
$table->set_header(0, get_lang('Code'));

@ -42,62 +42,82 @@ $accept_course_request = intval($_GET['accept_course_request']);
$reject_course_request = intval($_GET['reject_course_request']);
$request_info = intval($_GET['request_info']);
$delete_course_request = intval($_GET['delete_course_request']);
$message = trim(Security::remove_XSS(stripslashes(urldecode($_GET['message']))));
$is_error_message = !empty($_GET['is_error_message']);
/**
* Course acceptance and creation.
*/
if (!empty($accept_course_request)) {
$course_request_code = CourseRequestManager::get_course_request_code($accept_course_request);
$course_id = CourseRequestManager::accept_course_request($accept_course_request);
if ($course_id) {
// TODO: Prepare a confirmation message.
$course_code = CourseManager::get_course_code_from_course_id($course_id);
$message = sprintf(get_lang('CourseRequestAccepted'), $course_request_code, $course_code);
$is_error_message = false;
} else {
// Prepare an error message.
$message = sprintf(get_lang('CourseRequestAcceptanceFailed'), $course_request_code);
$is_error_message = true;
}
}
/**
* Course rejection
*/
if (isset($_GET['reject_course_request']) && $_GET['reject_course_request'] != '') {
elseif (!empty($reject_course_request)) {
$course_request_code = CourseRequestManager::get_course_request_code($reject_course_request);
$result = CourseRequestManager::reject_course_request($reject_course_request);
if ($result) {
// TODO: Prepare a confirmation message.
$message = sprintf(get_lang('CourseRequestRejected'), $course_request_code);
$is_error_message = false;
} else {
// Prepare an error message.
$message = sprintf(get_lang('CourseRequestRejectionFailed'), $course_request_code);
$is_error_message = true;
}
}
/**
* Sending to the teacher a request for additional information about the proposed course.
*/
if (!empty($request_info)) {
CourseRequestManager::ask_for_additional_info($request_info);
elseif (!empty($request_info)) {
$course_request_code = CourseRequestManager::get_course_request_code($request_info);
$result = CourseRequestManager::ask_for_additional_info($request_info);
if ($result) {
$message = sprintf(get_lang('CourseRequestInfoAsked'), $course_request_code);
$is_error_message = false;
} else {
$message = sprintf(get_lang('CourseRequestInfoFailed'), $course_request_code);
$is_error_message = true;
}
}
/**
* Deletion of a course request.
*/
if (!empty($delete_course_request)) {
CourseRequestManager::delete_course_request($delete_course_request);
elseif (!empty($delete_course_request)) {
$course_request_code = CourseRequestManager::get_course_request_code($delete_course_request);
$result = CourseRequestManager::delete_course_request($delete_course_request);
if ($result) {
$message = sprintf(get_lang('CourseRequestDeleted'), $course_request_code);
$is_error_message = false;
} else {
$message = sprintf(get_lang('CourseRequestDeletionFailed'), $course_request_code);
$is_error_message = true;
}
}
/**
* Get the number of courses which will be displayed.
*/
function get_number_of_courses() {
function get_number_of_requests() {
return CourseRequestManager::count_course_requests(COURSE_REQUEST_PENDING);
}
/**
* Get course data to display
*/
function get_course_data($from, $number_of_items, $column, $direction) {
function get_request_data($from, $number_of_items, $column, $direction) {
$course_table = Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST);
$users_table = Database :: get_main_table(TABLE_MAIN_USER);
$course_users_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
@ -137,15 +157,16 @@ function email_filter($teacher) {
* Actions in the list: edit, accept, reject, request additional information.
*/
function modify_filter($id) {
$code = CourseRequestManager::get_course_request_code($id);
$result = '<a href="editar_curso.php?id='.$id.'">'.Display::return_icon('edit.gif', get_lang('Edit'), array('style' => 'vertical-align: middle;')).'</a>'.
'&nbsp;<a href="?accept_course_request='.$id.'">'.Display::return_icon('action_accept.gif', get_lang('AcceptThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(get_lang('ANewCourseWillBeCreated'), ENT_QUOTES)).'\')) return false;')).'</a>'.
'&nbsp;<a href="?reject_course_request='.$id.'">'.Display::return_icon('action_reject.gif', get_lang('Delete'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;')).'</a>';
'&nbsp;<a href="?accept_course_request='.$id.'">'.Display::return_icon('action_accept.gif', get_lang('AcceptThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ANewCourseWillBeCreated'), $code), ENT_QUOTES)).'\')) return false;')).'</a>'.
'&nbsp;<a href="?reject_course_request='.$id.'">'.Display::return_icon('action_reject.gif', get_lang('RejectThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeRejected'), $code), ENT_QUOTES)).'\')) return false;')).'</a>';
if (!CourseRequestManager::additional_info_asked($id)) {
$result .= '&nbsp;<a href="?request_info='.$id.'">'.Display::return_icon('request_info.gif', get_lang('AskAdditionalInfo'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(get_lang('AdditionalInfoWillBeAsked'), ENT_QUOTES)).'\')) return false;')).'</a>';
$result .= '&nbsp;<a href="?request_info='.$id.'">'.Display::return_icon('request_info.gif', get_lang('AskAdditionalInfo'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('AdditionalInfoWillBeAsked'), $code), ENT_QUOTES)).'\')) return false;')).'</a>';
}
// The delete action has been deactivated here. Better reject the target request, after that you can delete it.
//$result .= '&nbsp;<a href="?delete_course_request='.$id.'">'.Display::return_icon('delete.gif', get_lang('Delete'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;')).'</a>';
//$result .= '&nbsp;<a href="?delete_course_request='.$id.'">'.Display::return_icon('delete.gif', get_lang('DeleteThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeDeleted'), $code), ENT_QUOTES)).'\')) return false;')).'</a>';
return $result;
}
@ -171,14 +192,24 @@ $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdm
$tool_name = get_lang('ReviewCourseRequests');
Display :: display_header($tool_name);
// Display confirmation or error message.
if (!empty($message)) {
if ($is_error_message) {
Display::display_error_message($message);
} else {
Display::display_normal_message($message);
}
}
// The action bar.
echo '<div class="actions">';
echo '<a href="course_list.php">'.Display::return_icon('courses.gif', get_lang('CourseList')).get_lang('CourseList').'</a>';
echo '<a href="course_request_accepted.php">'.Display::return_icon('course_request_accepted.gif', get_lang('AcceptedCourseRequests')).get_lang('AcceptedCourseRequests').'</a>';
echo '<a href="course_request_rejected.php">'.Display::return_icon('course_request_rejected.gif', get_lang('RejectedCourseRequests')).get_lang('RejectedCourseRequests').'</a>';
echo '</div>';
// Create a sortable table with the course data
$table = new SortableTable('courses', 'get_number_of_courses', 'get_course_data', 2);
$table = new SortableTable('course_requests', 'get_number_of_requests', 'get_request_data', 2);
$table->set_additional_parameters($parameters);
$table->set_header(0, '', false);
$table->set_header(1, get_lang('Code'));

@ -137,7 +137,7 @@ class CourseRequestManager {
}
/**
* Gets all the information about a course request using its database id as access key.
* Gets all the information about a course request using its database id as an access key.
* @param int/string $id The id (an integer number) of the corresponding database record.
* @return array/bool Returns the requested data as an array or FALSE on failure.
*/
@ -151,6 +151,24 @@ class CourseRequestManager {
return false;
}
/**
* Gets the code of a given course request using its database id as an access key.
* @param int/string $id The id (an integer number) of the corresponding database record.
* @return string/bool Returns the requested requested code or FALSE on failure.
*/
public static function get_course_request_code($id) {
$id = (int)$id;
$sql = "SELECT code FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." WHERE id = ".$id;
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
$result_array = Database::fetch_array($result, 'NUM');
if (is_array($result_array)) {
return $result_array[0];
}
}
return false;
}
/**
* Accepts a given by its id course request. The requested course gets created immediately after the request acceptance.
* @param int/string $id The id (an integer number) of the corresponding database record.

@ -113,7 +113,19 @@ $CourseRequestCreated = "Вашата заявка за нов курс е из
$CreateThisCourseRequest = "Създаване на заявката";
$CourseRequestDate = "Дата на заявката";
$AcceptThisCourseRequest = "Одобряване и създаване на курса";
$ANewCourseWillBeCreated = "Ще се създаде нов курс. Да се направи ли това?";
$AdditionalInfoWillBeAsked = "Ще се изпрати e-mail с искане за допълнителна информация относно заявката. Да се направи ли това?";
$ANewCourseWillBeCreated = "Ще се създаде нов курс %s. Да се изпълни ли това действие?";
$AdditionalInfoWillBeAsked = "Ще се изпрати e-mail с искане за допълнителна информация относно заявката %s. Да се изпълни ли това действие?";
$AskAdditionalInfo = "Искане на допълнителна информация";
$DeleteThisCourseRequest = "Изтриване на заявката";
$ACourseRequestWillBeDeleted = "Заявката %s ще бъде изтрита. Да се изпълни ли това действие?";
$RejectThisCourseRequest = "Отхвърляне на заявката";
$ACourseRequestWillBeRejected = "Заявката %s ще бъде отхвърлена. Да се изпълни ли това действие?";
$CourseRequestAccepted = "Заявката %s е одобрена. Създаден е нов курс %s.";
$CourseRequestAcceptanceFailed = "Заявката %s не можа да бъде одобрена поради появила се грешка.";
$CourseRequestRejected = "Заявката %s е отхвърлена.";
$CourseRequestRejectionFailed = "Заявката %s не можа да бъде отхвърлена поради появила се грешка.";
$CourseRequestInfoAsked = "Изпратено е искане за допълнителна информация по заявката %s.";
$CourseRequestInfoFailed = "Искане за допълнителна информация по заявката %s не беше изпратено поради появила се грешка.";
$CourseRequestDeleted = "Заявката %s е изтрита.";
$CourseRequestDeletionFailed = "Заявката %s не можа да бъде изтрита поради появила се грешка.";
?>

@ -110,10 +110,22 @@ $Objectives = "Objectives";
$TargetAudience = "Target audience";
$YouHaveToAcceptTermsAndConditions = "You have to accept our Terms and Conditions in order to request a new training.";
$CourseRequestCreated = "Your request for a new training has been sent successfully. You may receive a reply soon, within one or two days.";
$CreateThisCourseRequest = "Create this course request";
$CreateThisCourseRequest = "Create this training request";
$CourseRequestDate = "Request date";
$AcceptThisCourseRequest = "Accept this training";
$ANewCourseWillBeCreated = "A new training is going to be created. Is it OK to proceed?";
$AdditionalInfoWillBeAsked = "Additional information about this training request is going to be asked through an e-mail message. Is it OK to proceed?";
$ANewCourseWillBeCreated = "A new training %s is going to be created. Is it OK to proceed?";
$AdditionalInfoWillBeAsked = "Additional information about %s training request is going to be asked through an e-mail message. Is it OK to proceed?";
$AskAdditionalInfo = "Ask for additional information";
$DeleteThisCourseRequest = "Delete this training request";
$ACourseRequestWillBeDeleted = "The training request %s is going to be deleted. Is it OK to proceed?";
$RejectThisCourseRequest = "Reject this training request";
$ACourseRequestWillBeRejected = "The training request %s is going to be rejected. Is it OK to proceed?";
$CourseRequestAccepted = "The course request %s has been accepted. A new training %s has been created.";
$CourseRequestAcceptanceFailed = "The course request %s has not been accepted due to internal error.";
$CourseRequestRejected = "The training request %s has been rejected.";
$CourseRequestRejectionFailed = "The training request %s has not been rejected due to internal error.";
$CourseRequestInfoAsked = "Additional information about the training request %s has been asked.";
$CourseRequestInfoFailed = "Additional information about the training request %s has not been asked due to internal error.";
$CourseRequestDeleted = "The training request %s has been deleted.";
$CourseRequestDeletionFailed = "The training request %s has not been deleted due to internal error.";
?>

@ -113,7 +113,7 @@ $CourseRequestCreated = "Se recibió correctamente su solicitud de curso. En bre
$CreateThisCourseRequest = "Solicitud de nuevo curso";
$CourseRequestDate = "Fecha Solicitud";
$AcceptThisCourseRequest = "Validar este curso";
$ANewCourseWillBeCreated = "Se creará un curso indicado.";
$AdditionalInfoWillBeAsked = "Enviar un e-mail solicitando información adicional.";
$ANewCourseWillBeCreated = "Se creará un curso indicado (%s).";
$AdditionalInfoWillBeAsked = "Enviar un e-mail solicitando información adicional (%s).";
$AskAdditionalInfo = "Pedir más información";
?>
Loading…
Cancel
Save