[svn r10195] third run of cleanup of the table names

http://www.dokeos.com/forum/viewtopic.php?t=7982
skala
Patrick Cool 19 years ago
parent e8ec224615
commit 1150048a4b
  1. 2
      main/admin/configure_extensions.php
  2. 12
      main/admin/course_information.php
  3. 8
      main/announcements/announcements.php
  4. 22
      main/calendar/agenda.inc.php
  5. 8
      main/calendar/agenda.php
  6. 16
      main/calendar/myagenda.php
  7. 6
      main/calendar/print.php
  8. 4
      main/course_description/index.php
  9. 6
      main/course_home/2column.php
  10. 2
      main/course_home/3column.php
  11. 6
      main/course_home/activity.php
  12. 8
      main/course_home/btf_functions.php
  13. 4
      main/course_home/course_home.php
  14. 20
      main/course_info/infocours.php
  15. 32
      main/coursecopy/classes/CourseBuilder.class.php
  16. 20
      main/coursecopy/classes/CourseRecycler.class.php
  17. 22
      main/coursecopy/classes/CourseRestorer.class.php
  18. 4
      main/document/create_document.php
  19. 4
      main/document/document.inc.php
  20. 4
      main/document/document.php
  21. 6
      main/document/downloadfolder.inc.php
  22. 4
      main/document/edit_document.php
  23. 4
      main/document/slideshow.php
  24. 4
      main/document/upload.php
  25. 4
      main/exercice/adminhp.php
  26. 4
      main/exercice/exercice.php
  27. 6
      main/exercice/exercise.class.php
  28. 2
      main/exercice/hotpotatoes.lib.php
  29. 2
      main/exercice/hotpotatoes.php
  30. 2
      main/external_module/external_module.php
  31. 2
      main/forum/forumconfig.inc.php
  32. 2
      main/group/group.php
  33. 2
      main/inc/introductionSection.inc.php
  34. 2
      main/inc/lib/add_course.lib.inc.php
  35. 8
      main/inc/lib/blog.lib.php
  36. 2
      main/inc/lib/course.lib.php
  37. 32
      main/inc/lib/database.lib.php
  38. 17
      main/inc/lib/document.lib.php
  39. 2
      main/inc/lib/fckeditor/editor/plugins/Attachment/fck_Attachment.php
  40. 4
      main/inc/lib/fileDisplay.lib.php
  41. 10
      main/inc/lib/fileUpload.lib.php
  42. 30
      main/inc/lib/groupmanager.lib.php
  43. 2
      main/inc/lib/main_api.lib.php
  44. 2
      main/inc/local.inc.php
  45. 4
      main/inc/tool_navigation_menu.inc.php
  46. 4
      main/link/link.php
  47. 28
      main/link/linkfunctions.php
  48. 6
      main/metadata/importlinks.php
  49. 2
      main/metadata/importmanifest.php
  50. 4
      main/metadata/md_document.php
  51. 6
      main/metadata/md_link.php
  52. 6
      main/metadata/md_mix.php
  53. 2
      main/metadata/md_scorm.php
  54. 2
      main/mySpace/myStudents.php
  55. 2
      main/newscorm/document.php
  56. 12712
      main/newscorm/learnpath.class.php
  57. 200
      main/newscorm/learnpathList.class.php
  58. 10
      main/newscorm/learnpath_functions.inc.php
  59. 4126
      main/newscorm/resourcelinker.inc.php
  60. 24
      main/newscorm/resourcelinker.php
  61. 12
      main/newscorm/scorm_migrate_db.php
  62. 8
      main/newscorm/scorm_migrate_db_one_course.php
  63. 2
      main/newscorm/scorm_migrate_hometools.php
  64. 2
      main/newscorm/scorm_migrate_hometools_reverse.php
  65. 2
      main/permissions/blog_permissions.inc.php
  66. 8
      main/resourcelinker/resourcelinker.inc.php
  67. 18
      main/resourcelinker/resourcelinker.php
  68. 2
      main/tracking/courseLog.php
  69. 6
      main/tracking/userLog.php
  70. 466
      main/upload/upload.document.php
  71. 4
      main/user/user.php
  72. 6
      main/work/work.lib.php
  73. 4
      main/work/work.php
  74. 2
      myStudents.php
  75. 14
      user_portal.php

@ -63,7 +63,7 @@ if(isset($_POST['activeExtension'])){
$rs = api_sql_query($sql);
while($row = mysql_fetch_array($rs)){
$sql = 'INSERT INTO '.$row['db_name'].'.'.TOOL_LIST_TABLE.' SET
$sql = 'INSERT INTO '.$row['db_name'].'.'.TABLE_TOOL_LIST.' SET
name="visio",
link="conf/",
image="visio.gif",

@ -1,5 +1,5 @@
<?php
// $Id: course_information.php 10191 2006-11-24 08:09:14Z pcool $
// $Id: course_information.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -59,19 +59,19 @@ function get_course_usage($course_code)
$table = Database :: get_course_table(QUIZ_TEST_TABLE, $course->db_name);
$usage[] = array (get_lang(TOOL_QUIZ), Database::count_rows($table));
// Documents
$table = Database :: get_course_table(DOCUMENT_TABLE, $course->db_name);
$table = Database :: get_course_table(TABLE_DOCUMENT, $course->db_name);
$usage[] = array (get_lang(TOOL_DOCUMENT), Database::count_rows($table));
// Groups
$table = Database :: get_course_table(GROUP_TABLE, $course->db_name);
$table = Database :: get_course_table(TABLE_GROUP, $course->db_name);
$usage[] = array (get_lang(TOOL_GROUP), Database::count_rows($table));
// Calendar
$table = Database :: get_course_table(AGENDA_TABLE, $course->db_name);
$table = Database :: get_course_table(TABLE_AGENDA, $course->db_name);
$usage[] = array (get_lang(TOOL_CALENDAR_EVENT), Database::count_rows($table));
// Link
$table = Database::get_course_table(LINK_TABLE, $course->db_name);
$table = Database::get_course_table(TABLE_LINK, $course->db_name);
$usage[] = array(get_lang(TOOL_LINK), Database::count_rows($table));
// Announcements
$table = Database::get_course_table(ANNOUNCEMENT_TABLE, $course->db_name);
$table = Database::get_course_table(TABLE_ANNOUNCEMENT, $course->db_name);
$usage[] = array(get_lang(TOOL_ANNOUNCEMENT), Database::count_rows($table));
return $usage;
}

@ -1,4 +1,4 @@
<?php //$Id: announcements.php 10191 2006-11-24 08:09:14Z pcool $
<?php //$Id: announcements.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -82,10 +82,10 @@ $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_courses = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_sessions = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course_user= Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_group = Database::get_course_table(GROUP_TABLE);
$tbl_group = Database::get_course_table(TABLE_GROUP);
$tbl_groupUser = Database::get_course_table(GROUP_USER_TABLE);
$tbl_announcement = Database::get_course_table(ANNOUNCEMENT_TABLE);
$tbl_item_property = Database::get_course_table(ITEM_PROPERTY_TABLE);
$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
$tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
/*
-----------------------------------------------------------

@ -1,4 +1,4 @@
<?php //$Id: agenda.inc.php 10082 2006-11-21 19:08:15Z pcool $
<?php //$Id: agenda.inc.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -66,8 +66,8 @@ function get_kalender_items($month, $year)
global $is_allowedToEdit;
// database variables
$TABLEAGENDA=Database::get_course_table(AGENDA_TABLE);
$TABLE_ITEM_PROPERTY=Database::get_course_table(LAST_TOOL_EDIT_TABLE);
$TABLEAGENDA=Database::get_course_table(TABLE_AGENDA);
$TABLE_ITEM_PROPERTY=Database::get_course_table(TABLE_ITEM_PROPERTY);
$group_memberships=GroupManager::get_group_ids($_course['dbName'], $_user['user_id']);
@ -661,8 +661,8 @@ return $last_id;
* @return integer New announcement item's ID
*/
function store_agenda_item_as_announcement($item_id){
$table_agenda = Database::get_course_table(AGENDA_TABLE);
$table_ann = Database::get_course_table(ANNOUNCEMENT_TABLE);
$table_agenda = Database::get_course_table(TABLE_AGENDA);
$table_ann = Database::get_course_table(TABLE_ANNOUNCEMENT);
//check params
if(empty($item_id) or $item_id != strval(intval($item_id))){return -1;}
//get the agenda item
@ -688,7 +688,7 @@ function store_agenda_item_as_announcement($item_id){
$ann_id = Database::get_last_insert_id();
//Now also get the list of item_properties rows for this agenda_item (calendar_event)
//and copy them into announcement item_properties
$table_props = Database::get_course_table(ITEM_PROPERTY_TABLE);
$table_props = Database::get_course_table(TABLE_ITEM_PROPERTY);
$sql_props = "SELECT * FROM $table_props WHERE tool = 'calendar_event' AND ref='$item_id'";
$res_props = api_sql_query($sql_props,__FILE__,__LINE__);
if(Database::num_rows($res_props)>0)
@ -761,7 +761,7 @@ return $send_to;
function sent_to($tool, $id)
{
global $_course;
$TABLE_ITEM_PROPERTY = Database::get_course_table(LAST_TOOL_EDIT_TABLE);
$TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$sql="SELECT * FROM $TABLE_ITEM_PROPERTY WHERE tool='".$tool."' AND ref='".$id."'";
$result=api_sql_query($sql,__FILE__,__LINE__);
@ -967,7 +967,7 @@ function show_user_group_filter_form()
function load_edit_users($tool, $id)
{
global $_course;
$TABLE_ITEM_PROPERTY = Database::get_course_table(LAST_TOOL_EDIT_TABLE);
$TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$sql="SELECT * FROM $TABLE_ITEM_PROPERTY WHERE tool='$tool' AND ref='$id'";
$result=api_sql_query($sql,__FILE__,__LINE__) or die (mysql_error());
@ -1001,7 +1001,7 @@ return $to;
function change_visibility($tool,$id)
{
global $_course;
$TABLE_ITEM_PROPERTY = Database::get_course_table(LAST_TOOL_EDIT_TABLE);
$TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$sql="SELECT * FROM $TABLE_ITEM_PROPERTY WHERE tool='".TOOL_CALENDAR_EVENT."' AND ref='$id'";
$result=api_sql_query($sql,__FILE__,__LINE__) or die (mysql_error());
@ -1111,7 +1111,7 @@ function store_edited_agenda_item()
global $_user;
// database definitions
$TABLE_ITEM_PROPERTY = Database::get_course_table(LAST_TOOL_EDIT_TABLE);
$TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
// STEP 1: editing the calendar_event table
// 1.a. some filtering of the input data
@ -1173,7 +1173,7 @@ function store_edited_agenda_item()
*/
function save_edit_agenda_item($id,$title,$content,$start_date,$end_date)
{
$TABLEAGENDA = Database::get_course_table(AGENDA_TABLE);
$TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
// store the modifications in the table calendar_event
$sql = "UPDATE ".$TABLEAGENDA."

@ -1,4 +1,4 @@
<?php //$Id: agenda.php 10191 2006-11-24 08:09:14Z pcool $
<?php //$Id: agenda.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -201,11 +201,11 @@ $DaysLong = array (get_lang("SundayLong"), get_lang("MondayLong"), get_lang("Tue
$MonthsLong = array (get_lang("JanuaryLong"), get_lang("FebruaryLong"), get_lang("MarchLong"), get_lang("AprilLong"), get_lang("MayLong"), get_lang("JuneLong"), get_lang("JulyLong"), get_lang("AugustLong"), get_lang("SeptemberLong"), get_lang("OctoberLong"), get_lang("NovemberLong"), get_lang("DecemberLong"));
// Database table definitions
$TABLEAGENDA = Database::get_course_table(AGENDA_TABLE);
$TABLE_ITEM_PROPERTY = Database::get_course_table(LAST_TOOL_EDIT_TABLE);
$TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
$TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_courseUser = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_group = Database::get_course_table(GROUP_TABLE);
$tbl_group = Database::get_course_table(TABLE_GROUP);
$tbl_groupUser = Database::get_course_table(GROUP_USER_TABLE);
$tbl_session_course_user= Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);

@ -88,8 +88,8 @@ Display::display_header(get_lang('MyAgenda'));
// setting the database variables
$TABLECOURS = Database :: get_main_table(TABLE_MAIN_COURSE);
$TABLECOURSUSER = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$TABLEAGENDA = Database :: get_course_table(AGENDA_TABLE);
$TABLE_ITEMPROPERTY = Database :: get_course_table(LAST_TOOL_EDIT_TABLE);
$TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA);
$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$TABLE_PERSONAL_AGENDA = Database :: get_user_personal_table(PERSONAL_AGENDA);
// the variables for the days and the months
@ -327,8 +327,8 @@ function get_agendaitems($courses_dbs, $month, $year)
foreach ($courses_dbs as $key => $array_course_info)
{
//databases of the courses
$TABLEAGENDA = Database :: get_course_table(AGENDA_TABLE, $array_course_info["db"]);
$TABLE_ITEMPROPERTY = Database :: get_course_table(LAST_TOOL_EDIT_TABLE, $array_course_info["db"]);
$TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA, $array_course_info["db"]);
$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY, $array_course_info["db"]);
$group_memberships = GroupManager :: get_group_ids($array_course_info["db"], $_user['user_id']);
// if the user is administrator of that course we show all the agenda items
@ -709,8 +709,8 @@ function get_day_agendaitems($courses_dbs, $month, $year, $day)
foreach ($courses_dbs as $key => $array_course_info)
{
//databases of the courses
$TABLEAGENDA = Database :: get_course_table(AGENDA_TABLE, $array_course_info["db"]);
$TABLE_ITEMPROPERTY = Database :: get_course_table(LAST_TOOL_EDIT_TABLE, $array_course_info["db"]);
$TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA, $array_course_info["db"]);
$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY, $array_course_info["db"]);
// getting all the groups of the user for the current course
$group_memberships = GroupManager :: get_group_ids($array_course_info["db"], $_user['user_id']);
@ -857,8 +857,8 @@ function get_week_agendaitems($courses_dbs, $month, $year, $week = '')
foreach ($courses_dbs as $key => $array_course_info)
{
//databases of the courses
$TABLEAGENDA = Database :: get_course_table(AGENDA_TABLE, $array_course_info["db"]);
$TABLE_ITEMPROPERTY = Database :: get_course_table(LAST_TOOL_EDIT_TABLE, $array_course_info["db"]);
$TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA, $array_course_info["db"]);
$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY, $array_course_info["db"]);
// getting all the groups of the user for the current course
$group_memberships = GroupManager :: get_group_ids($array_course_info["db"], $_user['user_id']);

@ -20,7 +20,7 @@ include('../inc/global.inc.php');
$TABLEAGENDA = Database::get_course_table(AGENDA_TABLE);
$TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
$sql = "SELECT * FROM $TABLEAGENDA WHERE id IN($id) ORDER BY start_date DESC";
$result = api_sql_query($sql,__FILE__,__LINE__);
@ -38,7 +38,7 @@ $result = api_sql_query($sql,__FILE__,__LINE__);
<body style="margin: 15px; padding: 0px;">
<center>
<input type="button" value="<?php echo htmlentities(get_lang('Print')); ?>" onclick="javascript:window.print();" />
<input type="button" value="<?php echo htmlentities(get_lang('Print')); ?>" onClick="javascript:window.print();" />
</center>
<br /><br />
@ -75,7 +75,7 @@ while($row=mysql_fetch_array($result))
<br /><br />
<center>
<input type="button" value="<?php echo htmlentities(get_lang('Print')); ?>" onclick="javascript:window.print();" />
<input type="button" value="<?php echo htmlentities(get_lang('Print')); ?>" onClick="javascript:window.print();" />
</center>
</body>

@ -1,4 +1,4 @@
<?php // $Id: index.php 9387 2006-10-09 08:14:31Z bmol $
<?php // $Id: index.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -68,7 +68,7 @@ $nameTools = get_lang(TOOL_COURSE_DESCRIPTION);
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('CourseProgram'));
$tbl_course_description = Database::get_course_table(COURSE_DESCRIPTION_TABLE);
$tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
$show_description_list = true;
$show_peda_suggest = true;
define('ADD_BLOCK', 0);

@ -53,7 +53,7 @@
function show_tools($course_tool_category)
{
$web_code_path = api_get_path(WEB_CODE_PATH);
$course_tool_table = Database::get_course_table(TOOL_LIST_TABLE);
$course_tool_table = Database::get_course_table(TABLE_TOOL_LIST);
switch ($course_tool_category)
{
@ -94,8 +94,8 @@ function show_tools($course_tool_category)
}
// grabbing all the links that have the property on_homepage set to 1
$course_link_table = Database::get_course_table(LINK_TABLE);
$course_item_property_table = Database::get_course_table(ITEM_PROPERTY_TABLE);
$course_link_table = Database::get_course_table(TABLE_LINK);
$course_item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
switch ($course_tool_category)
{
case TOOL_PUBLIC:

@ -47,7 +47,7 @@ $is_AllowedToEdit = is_allowed_to_edit(); // RH: Allowed is not allowed...
$TABLE_TOOLS = Database::get_main_table(TABLE_MAIN_COURSE_MODULE);
$TBL_ACCUEIL = Database::get_course_table(TOOL_LIST_TABLE);
$TBL_ACCUEIL = Database::get_course_table(TABLE_TOOL_LIST);
// WORK with data post askable by admin of course
if (is_allowed_to_edit())

@ -55,7 +55,7 @@
function show_tools_category($course_tool_category)
{
$web_code_path = api_get_path(WEB_CODE_PATH);
$course_tool_table = Database::get_course_table(TOOL_LIST_TABLE);
$course_tool_table = Database::get_course_table(TABLE_TOOL_LIST);
switch ($course_tool_category)
{
@ -100,8 +100,8 @@ function show_tools_category($course_tool_category)
$i=0;
// grabbing all the links that have the property on_homepage set to 1
$course_link_table = Database::get_course_table(LINK_TABLE);
$course_item_property_table = Database::get_course_table(ITEM_PROPERTY_TABLE);
$course_link_table = Database::get_course_table(TABLE_LINK);
$course_item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);

@ -1,5 +1,5 @@
<?php
// $Id: btf_functions.php 10191 2006-11-24 08:09:14Z pcool $
// $Id: btf_functions.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -43,7 +43,7 @@ function showtools2($cat)
{
GLOBAL $_user;
$TBL_ACCUEIL = Database :: get_course_tool_list_table();
$TBL_ACCUEIL = Database :: get_course_table(TABLE_TOOL_LIST);
$TABLE_TOOLS = Database :: get_main_table(TABLE_MAIN_COURSE_MODULE);
$numcols = 3;
@ -91,8 +91,8 @@ function showtools2($cat)
// grabbing all the links that have the property on_homepage set to 1
if ($cat == "External")
{
$tbl_link = Database :: get_course_table(LINK_TABLE);
$tbl_item_property = Database :: get_course_table(ITEM_PROPERTY_TABLE);
$tbl_link = Database :: get_course_table(TABLE_LINK);
$tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
if (api_is_allowed_to_edit())
{
$sql_links = "SELECT tl.*, tip.visibility

@ -1,4 +1,4 @@
<?php // $Id: course_home.php 10191 2006-11-24 08:09:14Z pcool $
<?php // $Id: course_home.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -180,7 +180,7 @@ if(!isset($coursesAlreadyVisited[$_cid]) )
api_session_register('coursesAlreadyVisited');
}
$tool_table = Database::get_course_table(TOOL_LIST_TABLE);
$tool_table = Database::get_course_table(TABLE_TOOL_LIST);
$temps=time();
$reqdate="&reqdate=$temps";

@ -1,5 +1,5 @@
<?php
// $Id: infocours.php 10191 2006-11-24 08:09:14Z pcool $
// $Id: infocours.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -64,15 +64,15 @@ require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'
*/
define("MODULE_HELP_NAME", "Settings");
define("COURSE_CHANGE_PROPERTIES", "COURSE_CHANGE_PROPERTIES");
$TABLECOURSE = Database :: get_main_table(TABLE_MAIN_COURSE);
$TABLEFACULTY = Database :: get_main_table(TABLE_MAIN_CATEGORY);
$TABLECOURSEHOME = Database :: get_course_table(TOOL_LIST_TABLE);
$TABLELANGUAGES = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
$TABLEBBCONFIG = Database :: get_course_table(TOOL_FORUM_CONFIG_TABLE);
$currentCourseID = $_course['sysCode'];
$currentCourseRepository = $_course["path"];
$is_allowedToEdit = $is_courseAdmin;
$course_setting_table = Database::get_course_table(COURSE_SETTING_TABLE);
$TABLECOURSE = Database :: get_main_table(TABLE_MAIN_COURSE);
$TABLEFACULTY = Database :: get_main_table(TABLE_MAIN_CATEGORY);
$TABLECOURSEHOME = Database :: get_course_table(TABLE_TOOL_LIST);
$TABLELANGUAGES = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
$TABLEBBCONFIG = Database :: get_course_table(TOOL_FORUM_CONFIG_TABLE);
$currentCourseID = $_course['sysCode'];
$currentCourseRepository = $_course["path"];
$is_allowedToEdit = $is_courseAdmin;
$course_setting_table = Database::get_course_table(COURSE_SETTING_TABLE);
/*
==============================================================================
LOGIC FUNCTIONS

@ -1,4 +1,4 @@
<?php // $Id: CourseBuilder.class.php 10190 2006-11-24 00:23:20Z pcool $
<?php // $Id: CourseBuilder.class.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -95,7 +95,7 @@ class CourseBuilder
}
}
}
$table = Database :: get_course_table(ITEM_PROPERTY_TABLE);
$table = Database :: get_course_table(TABLE_ITEM_PROPERTY);
foreach ($this->course->resources as $type => $resources)
{
foreach ($resources as $id => $resource)
@ -121,8 +121,8 @@ class CourseBuilder
*/
function build_documents()
{
$table_doc = Database :: get_course_table(DOCUMENT_TABLE);
$table_prop = Database :: get_course_table(ITEM_PROPERTY_TABLE);
$table_doc = Database :: get_course_table(TABLE_DOCUMENT);
$table_prop = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$sql = 'SELECT * FROM '.$table_doc.' d, '.$table_prop.' p WHERE tool = \''.TOOL_DOCUMENT.'\' AND p.ref = d.id AND p.visibility != 2 ORDER BY path';
$db_result = api_sql_query($sql, __FILE__, __LINE__);
while ($obj = mysql_fetch_object($db_result))
@ -196,8 +196,8 @@ class CourseBuilder
*/
function build_links()
{
$table = Database :: get_course_table(LINK_TABLE);
$table_prop = Database :: get_course_table(ITEM_PROPERTY_TABLE);
$table = Database :: get_course_table(TABLE_LINK);
$table_prop = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$sql = "SELECT * FROM $table l, $table_prop p WHERE p.ref=l.id AND p.tool = '".TOOL_LINK."' AND p.visibility != 2 ORDER BY l.display_order";
$db_result = api_sql_query($sql, __FILE__, __LINE__);
while ($obj = mysql_fetch_object($db_result))
@ -212,7 +212,7 @@ class CourseBuilder
*/
function build_tool_intro()
{
$table = Database :: get_course_table(TOOL_INTRO_TABLE);
$table = Database :: get_course_table(TABLE_TOOL_INTRO);
$sql = 'SELECT * FROM '.$table;
$db_result = api_sql_query($sql, __FILE__, __LINE__);
while ($obj = mysql_fetch_object($db_result))
@ -226,7 +226,7 @@ class CourseBuilder
*/
function build_link_category($id)
{
$link_cat_table = Database :: get_course_table(LINK_CATEGORY_TABLE);
$link_cat_table = Database :: get_course_table(TABLE_LINK_CATEGORY);
$sql = 'SELECT * FROM '.$link_cat_table.' WHERE id = '.$id;
$db_result = api_sql_query($sql, __FILE__, __LINE__);
while ($obj = mysql_fetch_object($db_result))
@ -242,7 +242,7 @@ class CourseBuilder
{
$table_qui = Database :: get_course_table(QUIZ_TEST_TABLE);
$table_rel = Database :: get_course_table(QUIZ_TEST_QUESTION_TABLE);
$table_doc = Database :: get_course_table(DOCUMENT_TABLE);
$table_doc = Database :: get_course_table(TABLE_DOCUMENT);
$sql = 'SELECT * FROM '.$table_qui;
$db_result = api_sql_query($sql, __FILE__, __LINE__);
while ($obj = mysql_fetch_object($db_result))
@ -289,7 +289,7 @@ class CourseBuilder
*/
function build_announcements()
{
$table = Database :: get_course_table(ANNOUNCEMENT_TABLE);
$table = Database :: get_course_table(TABLE_ANNOUNCEMENT);
$sql = 'SELECT * FROM '.$table;
$db_result = api_sql_query($sql, __FILE__, __LINE__);
while ($obj = mysql_fetch_object($db_result))
@ -303,7 +303,7 @@ class CourseBuilder
*/
function build_events()
{
$table = Database :: get_course_table(AGENDA_TABLE);
$table = Database :: get_course_table(TABLE_AGENDA);
$sql = 'SELECT * FROM '.$table;
$db_result = api_sql_query($sql, __FILE__, __LINE__);
while ($obj = mysql_fetch_object($db_result))
@ -317,7 +317,7 @@ class CourseBuilder
*/
function build_course_descriptions()
{
$table = Database :: get_course_table(COURSE_DESCRIPTION_TABLE);
$table = Database :: get_course_table(TABLE_COURSE_DESCRIPTION);
$sql = 'SELECT * FROM '.$table;
$db_result = api_sql_query($sql, __FILE__, __LINE__);
while ($obj = mysql_fetch_object($db_result))
@ -331,10 +331,10 @@ class CourseBuilder
*/
function build_learnpaths()
{
$table_main = Database :: get_course_table(LEARNPATH_MAIN_TABLE);
$table_chapter = Database :: get_course_table(LEARNPATH_CHAPTER_TABLE);
$table_item = Database :: get_course_table(LEARNPATH_ITEM_TABLE);
$table_tool = Database::get_course_table(TOOL_LIST_TABLE);
$table_main = Database :: get_course_table(LEARNPATH_MAIN_TABLE);
$table_chapter = Database :: get_course_table(LEARNPATH_CHAPTER_TABLE);
$table_item = Database :: get_course_table(LEARNPATH_ITEM_TABLE);
$table_tool = Database::get_course_table(TABLE_TOOL_LIST);
$sql = 'SELECT * FROM '.$table_main;
$db_result = api_sql_query($sql, __FILE__, __LINE__);

@ -1,5 +1,5 @@
<?php
// $Id: CourseRecycler.class.php 10190 2006-11-24 00:23:20Z pcool $
// $Id: CourseRecycler.class.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -53,7 +53,7 @@ class CourseRecycler
function recycle()
{
$table_linked_resources = Database :: get_course_table(LINKED_RESOURCES_TABLE, $this->course->destination_db);
$table_item_properties = Database::get_course_table(ITEM_PROPERTY_TABLE);
$table_item_properties = Database::get_course_table(TABLE_ITEM_PROPERTY);
foreach ($this->course->resources as $type => $resources)
{
foreach ($resources as $id => $resource)
@ -82,7 +82,7 @@ class CourseRecycler
{
if ($this->course->has_resources(RESOURCE_DOCUMENT))
{
$table = Database :: get_course_table(DOCUMENT_TABLE);
$table = Database :: get_course_table(TABLE_DOCUMENT);
foreach ($this->course->resources[RESOURCE_DOCUMENT] as $id => $document)
{
rmdirr($this->course->backup_path.'/'.$document->path);
@ -99,7 +99,7 @@ class CourseRecycler
{
if ($this->course->has_resources(RESOURCE_LINK))
{
$table = Database :: get_course_table(LINK_TABLE);
$table = Database :: get_course_table(TABLE_LINK);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_LINK])));
$sql = "DELETE FROM ".$table." WHERE id IN(".$ids.")";
api_sql_query($sql,__FILE__,__LINE__);
@ -157,8 +157,8 @@ class CourseRecycler
*/
function recycle_link_categories()
{
$link_cat_table = Database :: get_course_table(LINK_CATEGORY_TABLE);
$link_table = Database :: get_course_table(LINK_TABLE);
$link_cat_table = Database :: get_course_table(TABLE_LINK_CATEGORY);
$link_table = Database :: get_course_table(TABLE_LINK);
$sql = "SELECT lc.id FROM ".$link_cat_table." lc LEFT JOIN ".$link_table." l ON lc.id=l.category_id WHERE l.id IS NULL";
$res = api_sql_query($sql,__FILE__,__LINE__);
while ($obj = mysql_fetch_object($res))
@ -174,7 +174,7 @@ class CourseRecycler
{
if ($this->course->has_resources(RESOURCE_EVENT))
{
$table = Database :: get_course_table(AGENDA_TABLE);
$table = Database :: get_course_table(TABLE_AGENDA);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_EVENT])));
$sql = "DELETE FROM ".$table." WHERE id IN(".$ids.")";
api_sql_query($sql,__FILE__,__LINE__);
@ -187,7 +187,7 @@ class CourseRecycler
{
if ($this->course->has_resources(RESOURCE_ANNOUNCEMENT))
{
$table = Database :: get_course_table(ANNOUNCEMENT_TABLE);
$table = Database :: get_course_table(TABLE_ANNOUNCEMENT);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_ANNOUNCEMENT])));
$sql = "DELETE FROM ".$table." WHERE id IN(".$ids.")";
api_sql_query($sql,__FILE__,__LINE__);
@ -219,7 +219,7 @@ class CourseRecycler
$table_main = Database :: get_course_table(LEARNPATH_MAIN_TABLE);
$table_chapter = Database :: get_course_table(LEARNPATH_CHAPTER_TABLE);
$table_item = Database :: get_course_table(LEARNPATH_ITEM_TABLE);
$table_tool = Database::get_course_table(TOOL_LIST_TABLE);
$table_tool = Database::get_course_table(TABLE_TOOL_LIST);
foreach($this->course->resources[RESOURCE_LEARNPATH] as $id => $learnpath)
{
$sql = "DELETE FROM $table_tool WHERE link='".mysql_real_escape_string('learnpath/learnpath_handler.php?learnpath_id='.$id)."'";
@ -252,7 +252,7 @@ class CourseRecycler
{
if ($this->course->has_resources(RESOURCE_COURSEDESCRIPTION))
{
$table = Database :: get_course_table(COURSE_DESCRIPTION_TABLE);
$table = Database :: get_course_table(TABLE_COURSE_DESCRIPTION);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_COURSEDESCRIPTION])));
$sql = "DELETE FROM ".$table." WHERE id IN(".$ids.")";
api_sql_query($sql,__FILE__,__LINE__);

@ -1,7 +1,7 @@
<?php
// $Id: CourseRestorer.class.php 10190 2006-11-24 00:23:20Z pcool $
// $Id: CourseRestorer.class.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -104,7 +104,7 @@ class CourseRestorer
$this->restore_quizzes(); // after restore_documents! (for correct import of sound/video)
$this->restore_learnpaths();
// Restore the item properties
$table = Database :: get_course_table(ITEM_PROPERTY_TABLE, $this->course->destination_db);
$table = Database :: get_course_table(TABLE_ITEM_PROPERTY, $this->course->destination_db);
foreach ($this->course->resources as $type => $resources)
{
foreach ($resources as $id => $resource)
@ -161,7 +161,7 @@ class CourseRestorer
{
if ($this->course->has_resources(RESOURCE_DOCUMENT))
{
$table = Database :: get_course_table(DOCUMENT_TABLE, $this->course->destination_db);
$table = Database :: get_course_table(TABLE_DOCUMENT, $this->course->destination_db);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_DOCUMENT] as $id => $document)
{
@ -427,7 +427,7 @@ class CourseRestorer
{
if ($this->course->has_resources(RESOURCE_LINK))
{
$link_table = Database :: get_course_table(LINK_TABLE, $this->course->destination_db);
$link_table = Database :: get_course_table(TABLE_LINK, $this->course->destination_db);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_LINK] as $id => $link)
{
@ -448,7 +448,7 @@ class CourseRestorer
{
if ($this->course->has_resources(RESOURCE_TOOL_INTRO))
{
$tool_intro_table = Database :: get_course_table(TOOL_INTRO_TABLE, $this->course->destination_db);
$tool_intro_table = Database :: get_course_table(TABLE_TOOL_INTRO, $this->course->destination_db);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_TOOL_INTRO] as $id => $tool_intro)
{
@ -469,7 +469,7 @@ class CourseRestorer
{
if ($id == 0)
return 0;
$link_cat_table = Database :: get_course_table(LINK_CATEGORY_TABLE, $this->course->destination_db);
$link_cat_table = Database :: get_course_table(TABLE_LINK_CATEGORY, $this->course->destination_db);
$resources = $this->course->resources;
$link_cat = $resources[RESOURCE_LINKCATEGORY][$id];
if (!$link_cat->is_restored())
@ -493,7 +493,7 @@ class CourseRestorer
{
if ($this->course->has_resources(RESOURCE_EVENT))
{
$table = Database :: get_course_table(AGENDA_TABLE, $this->course->destination_db);
$table = Database :: get_course_table(TABLE_AGENDA, $this->course->destination_db);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_EVENT] as $id => $event)
{
@ -510,7 +510,7 @@ class CourseRestorer
{
if ($this->course->has_resources(RESOURCE_COURSEDESCRIPTION))
{
$table = Database :: get_course_table(COURSE_DESCRIPTION_TABLE, $this->course->destination_db);
$table = Database :: get_course_table(TABLE_COURSE_DESCRIPTION, $this->course->destination_db);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_COURSEDESCRIPTION] as $id => $cd)
{
@ -527,7 +527,7 @@ class CourseRestorer
{
if ($this->course->has_resources(RESOURCE_ANNOUNCEMENT))
{
$table = Database :: get_course_table(ANNOUNCEMENT_TABLE, $this->course->destination_db);
$table = Database :: get_course_table(TABLE_ANNOUNCEMENT, $this->course->destination_db);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_ANNOUNCEMENT] as $id => $announcement)
{
@ -546,7 +546,7 @@ class CourseRestorer
{
$table_qui = Database :: get_course_table(QUIZ_TEST_TABLE, $this->course->destination_db);
$table_rel = Database :: get_course_table(QUIZ_TEST_QUESTION_TABLE, $this->course->destination_db);
$table_doc = Database :: get_course_table(DOCUMENT_TABLE, $this->course->destination_db);
$table_doc = Database :: get_course_table(TABLE_DOCUMENT, $this->course->destination_db);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_QUIZ] as $id => $quiz)
{
@ -615,7 +615,7 @@ class CourseRestorer
$table_main = Database :: get_course_table(LEARNPATH_MAIN_TABLE, $this->course->destination_db);
$table_chapter = Database :: get_course_table(LEARNPATH_CHAPTER_TABLE, $this->course->destination_db);
$table_item = Database :: get_course_table(LEARNPATH_ITEM_TABLE, $this->course->destination_db);
$table_tool = Database::get_course_table(TOOL_LIST_TABLE, $this->course->destination_db);
$table_tool = Database::get_course_table(TABLE_TOOL_LIST, $this->course->destination_db);
$resources = $this->course->resources;
$prereq_old = array ();

@ -1,5 +1,5 @@
<?php
// $Id: create_document.php 9985 2006-11-15 00:43:47Z pcool $
// $Id: create_document.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -228,7 +228,7 @@ if ($form->validate())
$new_title = isset ($_POST['title']) ? trim($_POST['title']) : '';
if ($new_comment || $new_title)
{
$TABLE_DOCUMENT = Database::get_course_table(DOCUMENT_TABLE);
$TABLE_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$ct = '';
if ($new_comment)
$ct .= ", comment='$new_comment'";

@ -1,4 +1,4 @@
<?php // $Id: document.inc.php 10126 2006-11-22 17:32:11Z elixir_inter $
<?php // $Id: document.inc.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
@ -27,7 +27,7 @@ function build_directory_selector($folders,$curdirpath,$group_dir='')
$escaped_folders = $folders;
array_walk($escaped_folders, 'mysql_real_escape_string');
$folder_sql = implode("','",$escaped_folders);
$doc_table = Database::get_course_table(DOCUMENT_TABLE);
$doc_table = Database::get_course_table(TABLE_DOCUMENT);
$sql = "SELECT * FROM $doc_table WHERE filetype='folder' AND path IN ('".$folder_sql."')";
$res = api_sql_query($sql,__FILE__,__LINE__);
$folder_titles = array();

@ -1,4 +1,4 @@
<?php // $Id: document.php 10147 2006-11-23 07:56:16Z elixir_inter $
<?php // $Id: document.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -317,7 +317,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY
include_once(api_get_path(LIBRARY_PATH) . 'fileManage.lib.php');
//this is needed for the update_db_info function
//$dbTable = $_course['dbNameGlu']."document";
$dbTable = Database::get_course_table(DOCUMENT_TABLE);
$dbTable = Database::get_course_table(TABLE_DOCUMENT);
//security fix: make sure they can't move files that are not in the document table
if(DocumentManager::get_document_id($_course,$_POST['move_file'])) {

@ -1,4 +1,4 @@
<?php // $Id: downloadfolder.inc.php 9388 2006-10-09 09:03:34Z bmol $
<?php // $Id: downloadfolder.inc.php 10195 2006-11-25 15:26:00Z pcool $
/**
==============================================================================
* Functions and main code for the download folder feature
@ -57,8 +57,8 @@ else
//create zipfile of given directory
$temp_zip_file = $temp_zip_dir."/".md5(time()).".zip";
$zip_folder=new PclZip($temp_zip_file);
$doc_table = Database::get_course_table(DOCUMENT_TABLE);
$prop_table = Database::get_course_table(ITEM_PROPERTY_TABLE);
$doc_table = Database::get_course_table(TABLE_DOCUMENT);
$prop_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
//Put the files in the zip
//2 possibilities: admins get all files and folders in the selected folder (except for the deleted ones)
//normal users get only visible files that are in visible folders

@ -1,4 +1,4 @@
<?php // $Id: edit_document.php 10085 2006-11-21 20:42:52Z pcool $
<?php // $Id: edit_document.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -136,7 +136,7 @@ if(!is_dir($filepath))
$nameTools = get_lang('EditDocument');
$dbTable = Database::get_course_table(DOCUMENT_TABLE);
$dbTable = Database::get_course_table(TABLE_DOCUMENT);
if(isset($_SESSION['_gid']) && $_SESSION['_gid']!='')
{

@ -1,5 +1,5 @@
<?php
// $Id: slideshow.php 9972 2006-11-14 14:44:37Z pcool $
// $Id: slideshow.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -298,7 +298,7 @@ if ($slide_id !== "all")
// showing the comment of the image, Patrick Cool, 8 april 2005
// this is done really quickly and should be cleaned up a little bit using the API functions
$tbl_documents = Database::get_course_table(DOCUMENT_TABLE);
$tbl_documents = Database::get_course_table(TABLE_DOCUMENT);
if ($path=='/')
{
$pathpart='/';

@ -1,4 +1,4 @@
<?php // $Id: upload.php 10124 2006-11-22 17:19:37Z elixir_inter $
<?php // $Id: upload.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -222,7 +222,7 @@ if(isset($_FILES['user_upload']))
if ($new_path && ($new_comment || $new_title))
if (($docid = DocumentManager::get_document_id($_course, $new_path)))
{
$table_document = Database::get_course_table(DOCUMENT_TABLE);
$table_document = Database::get_course_table(TABLE_DOCUMENT);
$ct = '';
if ($new_comment) $ct .= ", comment='$new_comment'";
if ($new_title) $ct .= ", title='$new_title'";

@ -1,4 +1,4 @@
<?php // $Id: adminhp.php 9665 2006-10-24 10:43:48Z elixir_inter $
<?php // $Id: adminhp.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -84,7 +84,7 @@ $TBL_EXERCICE_QUESTION = Database::get_course_table(QUIZ_TEST_QUESTION_TABLE);
$TBL_EXERCICES = Database::get_course_table(QUIZ_TEST_TABLE);
$TBL_QUESTIONS = Database::get_course_table(QUIZ_QUESTION_TABLE);
$TBL_REPONSES = Database::get_course_table(QUIZ_ANSWER_TABLE);
$TBL_DOCUMENT = Database::get_course_table(DOCUMENT_TABLE);
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
//$dbTable = $_course['dbNameGlu']."document";
$dbTable = $TBL_DOCUMENT;

@ -63,8 +63,8 @@ require_once('hotpotatoes.lib.php');
$is_allowedToEdit = is_allowed_to_edit();
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_DOCUMENT = Database::get_course_table(DOCUMENT_TABLE);
$TBL_ITEM_PROPERTY = Database::get_course_table(ITEM_PROPERTY_TABLE);
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$TBL_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$TBL_EXERCICE_QUESTION = Database::get_course_table(QUIZ_TEST_QUESTION_TABLE);
$TBL_EXERCICES = Database::get_course_table(QUIZ_TEST_TABLE);
$TBL_QUESTIONS = Database::get_course_table(QUIZ_QUESTION_TABLE);

@ -1,4 +1,4 @@
<?php // $Id: exercise.class.php 9986 2006-11-15 01:14:12Z pcool $
<?php // $Id: exercise.class.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -323,8 +323,8 @@ class Exercise
function updateSound($sound,$delete)
{
global $audioPath, $documentPath,$_course, $_user;
$TBL_DOCUMENT = Database::get_course_table(DOCUMENT_TABLE);
$TBL_ITEM_PROPERTY = Database::get_course_table(ITEM_PROPERTY_TABLE);
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$TBL_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
if($sound['size'] && (strstr($sound['type'],'audio') || strstr($sound['type'],'video')))
{

@ -30,7 +30,7 @@
==============================================================================
*/
$dbTable = Database::get_course_table(DOCUMENT_TABLE);
$dbTable = Database::get_course_table(TABLE_DOCUMENT);
/**
* Creates a hotpotato directory

@ -44,7 +44,7 @@ $interbreadcrumb[]= array ("url"=>"./exercice.php", "name"=> get_lang('Exercices
$is_allowedToEdit=(!empty($is_courseAdmin)?$is_courseAdmin:false);
//$dbTable = '`'.$_course['dbNameGlu']."document`";
$dbTable = Database::get_course_table(DOCUMENT_TABLE);
$dbTable = Database::get_course_table(TABLE_DOCUMENT);
$baseServDir = $_configuration['root_sys'];
$baseServUrl = $_configuration['url_append']."/";
$document_sys_path = api_get_path(SYS_COURSE_PATH).$_course['path']."/document";

@ -43,7 +43,7 @@ $iconForInactiveImportedTools='external_inactive.gif';
include('../inc/global.inc.php');
$tbl_courseHome = Database::get_course_table(TOOL_LIST_TABLE);
$tbl_courseHome = Database::get_course_table(TABLE_TOOL_LIST);
$toolid = $_GET['id']; // RH: all lines with $toolid added/changed by me
if($toolid)

@ -20,7 +20,7 @@ $table_threads = "`".$_course["dbNameGlu"]."forum_thread"."`";
$table_posts = "`".$_course["dbNameGlu"]."forum_post"."`";
$table_mailcue = "`".$_course["dbNameGlu"]."forum_mailcue"."`";
$table_item_property = Database :: get_course_table(LAST_TOOL_EDIT_TABLE);
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$table_users = Database :: get_main_table(TABLE_MAIN_USER);
/*

@ -194,7 +194,7 @@ if (api_is_allowed_to_edit())
{
echo '<li><a href="group_category.php?id=2">'.get_lang('PropModify').'</a></li>';
}
if( Database::count_rows(Database::get_course_table(GROUP_TABLE)) > 0)
if( Database::count_rows(Database::get_course_table(TABLE_GROUP)) > 0)
{
echo '<li><a href="group_overview.php">'.get_lang('GroupOverview').'</a></li>';
}

@ -53,7 +53,7 @@ include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php')
Constants and variables
-----------------------------------------------------------
*/
$TBL_INTRODUCTION = Database::get_course_table(TOOL_INTRO_TABLE);
$TBL_INTRODUCTION = Database::get_course_table(TABLE_TOOL_INTRO);
$intro_editAllowed = $is_allowed_to_edit;
$intro_cmdEdit = $_GET['intro_cmdEdit'];

@ -1629,7 +1629,7 @@ function register_course($courseSysCode, $courseScreenCode, $courseRepository, $
$TABLECOURSUSER = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
#$TABLEANNOUNCEMENTS=$_configuration['table_prefix'].$courseDbName.$_configuration['db_glue'].$TABLEANNOUNCEMENTS;
$TABLEANNOUNCEMENTS = Database :: get_course_table(ANNOUNCEMENT_TABLE,$courseDbName);
$TABLEANNOUNCEMENTS = Database :: get_course_table(TABLE_ANNOUNCEMENT,$courseDbName);
$okForRegisterCourse = true;

@ -139,7 +139,7 @@ class Blog
// Tabel definitions
$tbl_blogs = Database::get_course_table(BLOGS_TABLE);
$tbl_tool = Database::get_course_table(TOOL_LIST_TABLE);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
$tbl_blogs_posts = Database::get_course_table(BLOGS_POSTS_TABLE);
$tbl_blogs_tasks = Database::get_course_table(BLOGS_TASKS);
@ -178,7 +178,7 @@ class Blog
// Table definitions
$tbl_blogs = Database::get_course_table(BLOGS_TABLE);
$tbl_tool = Database::get_course_table(TOOL_LIST_TABLE);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
// Update the blog
$sql = "UPDATE $tbl_blogs SET blog_name = '$title', blog_subtitle = '$subtitle' WHERE blog_id =$blog_id LIMIT 1";
@ -206,7 +206,7 @@ class Blog
$tbl_blogs = Database::get_course_table(BLOGS_TABLE);
$tbl_blogs_posts = Database::get_course_table(BLOGS_POSTS_TABLE);
$tbl_blogs_tasks = Database::get_course_table(BLOGS_TASKS);
$tbl_tool = Database::get_course_table(TOOL_LIST_TABLE);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
$tbl_blogs_rating = Database::get_course_table(BLOGS_RATING);
// Delete posts
@ -626,7 +626,7 @@ class Blog
{
// Init
$tbl_blogs = Database::get_course_table(BLOGS_TABLE);
$tbl_tool = Database::get_course_table(TOOL_LIST_TABLE);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
// Get blog properties
$sql = "SELECT blog_name, visibility FROM $tbl_blogs WHERE blog_id=$blog_id";

@ -1083,7 +1083,7 @@ class CourseManager
{
$course_info = Database :: get_course_info($course_code);
$database_name = $course_info['db_name'];
$group_table = Database :: get_course_table(GROUP_TABLE, $database_name);
$group_table = Database :: get_course_table(TABLE_GROUP, $database_name);
$group_user_table = Database :: get_course_table(GROUP_USER_TABLE, $database_name);
$sql = "SELECT g.id, g.name, COUNT(gu.id) userNb

@ -73,25 +73,25 @@ define('STATISTIC_TRACK_E_COURSE_ACCESS_TABLE', 'track_e_course_access');
define('SCORM_MAIN_TABLE', 'scorm_main');
define('SCORM_SCO_DATA_TABLE', 'scorm_sco_data');
//course tables
define('AGENDA_TABLE', 'calendar_event');
define('ANNOUNCEMENT_TABLE', 'announcement');
define('CHAT_CONNECTED_TABLE', 'chat_connected');
define('COURSE_DESCRIPTION_TABLE', 'course_description');
define('DOCUMENT_TABLE', 'document');
define('LAST_TOOL_EDIT_TABLE', 'item_property');
define('LINK_TABLE', 'link');
define('LINK_CATEGORY_TABLE', 'link_category');
define('TOOL_LIST_TABLE', 'tool');
define('TOOL_INTRO_TABLE', 'tool_intro');
define('SCORMDOC_TABLE', 'scormdocument');
define('STUDENT_PUBLICATION_TABLE', 'student_publication');
define('TABLE_AGENDA', 'calendar_event');
define('TABLE_ANNOUNCEMENT', 'announcement');
define('TABLE_CHAT_CONNECTED', 'chat_connected'); // @todo: probably no longer in use !!!
define('TABLE_COURSE_DESCRIPTION', 'course_description');
define('TABLE_DOCUMENT', 'document');
define('TABLE_ITEM_PROPERTY', 'item_property');
define('TABLE_LINK', 'link');
define('TABLE_LINK_CATEGORY', 'link_category');
define('TABLE_TOOL_LIST', 'tool');
define('TABLE_TOOL_INTRO', 'tool_intro');
define('TABLE_SCORMDOC', 'scormdocument');
define('TABLE_STUDENT_PUBLICATION', 'student_publication');
//course forum tables
define('TABLE_FORUM_CATEGORY','forum_category');
define('TABLE_FORUM','forum_forum');
define('TABLE_FORUM_THREAD','forum_thread');
define('TABLE_FORUM_POST','forum_post');
//course group tables
define('GROUP_TABLE', 'group_info');
define('TABLE_GROUP', 'group_info');
define('GROUP_USER_TABLE', 'group_rel_user');
define('GROUP_TUTOR_TABLE', 'group_rel_tutor');
define('GROUP_CATEGORY_TABLE', 'group_category');
@ -130,8 +130,6 @@ define('BLOGS_TASKS_PERMISSIONS', 'permission_task');
// user information tables
define('USER_INFO_TABLE', 'userinfo_def');
define('USER_INFO_CONTENT_TABLE', 'userinfo_content');
// item property table
define('ITEM_PROPERTY_TABLE', 'item_property');
// course settings table
define('COURSE_SETTING_TABLE', 'course_setting');
// course online tables
@ -254,7 +252,7 @@ class Database
so the queries can look cleaner.
Example:
$table = Database::get_course_document_table();
$table = Database::get_course_table(TABLE_DOCUMENT);
$sql_query = "SELECT * FROM $table WHERE $condition";
$sql_result = api_sql_query($sql_query,__FILE__,__LINE__);
$result = mysql_fetch_array($sql_result);
@ -603,7 +601,7 @@ class Database
{
$database_name_with_glue = Database::fix_database_parameter($database_name);
return Database::format_glued_course_table_name($database_name_with_glue, TOOL_LIST_TABLE);
return Database::format_glued_course_table_name($database_name_with_glue, TABLE_TOOL_LIST);
}
}
//end class Database

@ -314,8 +314,7 @@ class DocumentManager
}
else
{
//$document_table = Database::get_course_document_table();
$tbl_document = $this_course.'document';
$tbl_document = Database::get_course_table(TABLE_DOCUMENT);
$tbl_item_property = $this_course.'item_property';
//$doc_url = addslashes($doc_url);
$query = "SELECT 1 FROM `$tbl_document` AS docs,`$tbl_item_property` AS props WHERE props.tool = 'document' AND docs.id=props.ref AND props.visibility <> '1' AND docs.path = '$doc_url'";
@ -408,8 +407,8 @@ class DocumentManager
*/
function get_all_document_data($_course, $path = '/', $to_group_id = 0, $to_user_id = NULL, $can_see_invisible = false)
{
$TABLE_ITEMPROPERTY = Database :: get_course_table(ITEM_PROPERTY_TABLE, $_course['dbName']);
$TABLE_DOCUMENT = Database :: get_course_table(DOCUMENT_TABLE, $_course['dbName']);
$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY, $_course['dbName']);
$TABLE_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT, $_course['dbName']);
//if to_user_id = NULL -> change query (IS NULL)
//$to_user_id = (is_null($to_user_id))?'IS NULL':'= '.$to_user_id;
@ -479,8 +478,8 @@ class DocumentManager
*/
function get_all_document_folders($_course, $to_group_id = '0', $can_see_invisible = false)
{
$TABLE_ITEMPROPERTY = Database :: get_course_table(ITEM_PROPERTY_TABLE, $_course['dbName']);
$TABLE_DOCUMENT = Database :: get_course_table(DOCUMENT_TABLE, $_course['dbName']);
$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY, $_course['dbName']);
$TABLE_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT, $_course['dbName']);
if(empty($to_group_id)){$to_group_id = '0';} //avoid empty strings in $to_group_id
if ($can_see_invisible)
{
@ -587,8 +586,8 @@ class DocumentManager
*/
function delete_document($_course, $path, $base_work_dir)
{
$TABLE_DOCUMENT = Database :: get_course_table(DOCUMENT_TABLE);
$TABLE_ITEMPROPERTY = Database :: get_course_table(LAST_TOOL_EDIT_TABLE);
$TABLE_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY);
//first, delete the actual document...
$document_id = DocumentManager :: get_document_id($_course, $path);
@ -688,7 +687,7 @@ class DocumentManager
*/
function get_document_id($_course, $path)
{
$TABLE_DOCUMENT = Database :: get_course_table(DOCUMENT_TABLE, $_course['dbName']);
$TABLE_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT, $_course['dbName']);
$sql = "SELECT id FROM $TABLE_DOCUMENT WHERE path = '$path'";

@ -80,7 +80,7 @@ if($_POST['fileupload']=="Attach File"){
if ($new_path && ($new_comment || $new_title))
if (($docid = DocumentManager::get_document_id($_course, $new_path)))
{
$table_document = Database::get_course_table(DOCUMENT_TABLE);
$table_document = Database::get_course_table(TABLE_DOCUMENT);
$ct = '';
if ($new_comment) $ct .= ", comment='$new_comment'";
if ($new_title) $ct .= ", title='$new_title'";

@ -260,8 +260,8 @@ function folder_size($dir_name)
*/
function get_total_folder_size($path, $can_see_invisible = false)
{
$table_itemproperty = Database::get_course_table(LAST_TOOL_EDIT_TABLE);
$table_document = Database::get_course_table(DOCUMENT_TABLE);
$table_itemproperty = Database::get_course_table(TABLE_ITEM_PROPERTY);
$table_document = Database::get_course_table(TABLE_DOCUMENT);
$tool_document = TOOL_DOCUMENT;
$visibility_rule = 'props.visibility ' . ($can_see_invisible ? '<> 2' : '= 1');

@ -572,8 +572,8 @@ function dir_total_space($dirPath)
function documents_total_space($to_group_id='0')
{
$TABLE_ITEMPROPERTY = Database::get_course_table(LAST_TOOL_EDIT_TABLE);
$TABLE_DOCUMENT = Database::get_course_table(DOCUMENT_TABLE);
$TABLE_ITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$TABLE_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$sql = "SELECT SUM(size)
FROM ".$TABLE_ITEMPROPERTY." AS props, ".$TABLE_DOCUMENT." AS docs
@ -1075,7 +1075,7 @@ function clean_up_path(&$path)
*/
function add_document($_course,$path,$filetype,$filesize,$title,$comment=NULL)
{
$table_document = Database::get_course_table(DOCUMENT_TABLE,$_course['dbName']);
$table_document = Database::get_course_table(TABLE_DOCUMENT,$_course['dbName']);
$sql="INSERT INTO $table_document
(`path`,`filetype`,`size`,`title`, `comment`)
VALUES ('$path','$filetype','$filesize','$title', '$comment')";
@ -1110,7 +1110,7 @@ function get_document_id() moved to document.lib.php
*/
function update_existing_document($_course,$document_id,$filesize)
{
$document_table = Database::get_course_table(DOCUMENT_TABLE,$_course['dbName']);
$document_table = Database::get_course_table(TABLE_DOCUMENT,$_course['dbName']);
$sql="UPDATE $document_table SET `size`='$filesize' WHERE id='$document_id'";
if(api_sql_query($sql,__FILE__,__LINE__))
{
@ -1141,7 +1141,7 @@ function item_property_update_on_folder($_course,$path,$user_id)
$endchar=substr($path,strlen($path)-1,1);
if($endchar=='/')
$path=substr($path,0,strlen($path)-1);
$TABLE_ITEMPROPERTY = Database::get_course_table(ITEM_PROPERTY_TABLE,$_course['dbName']);
$TABLE_ITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY,$_course['dbName']);
//get the time
$time = date("Y-m-d H:i:s", time());

@ -100,7 +100,7 @@ class GroupManager
$course_info = Database :: get_course_info($course_code);
$course_db = $course_info['database'];
}
$table_group = Database :: get_course_table(GROUP_TABLE, $course_db);
$table_group = Database :: get_course_table(TABLE_GROUP, $course_db);
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$table_group_user = Database :: get_course_table(GROUP_USER_TABLE, $course_db);
@ -147,7 +147,7 @@ class GroupManager
global $_course,$_user;
$currentCourseRepository = $_course['path'];
$table_group = Database :: get_course_table(GROUP_TABLE);
$table_group = Database :: get_course_table(TABLE_GROUP);
$table_forum = Database :: get_course_table(TABLE_FORUM);
$category = GroupManager :: get_category($category_id);
if( strlen($places) == 0)
@ -181,7 +181,7 @@ class GroupManager
*/
function create_subgroups($group_id, $number_of_groups)
{
$table_group = Database :: get_course_table(GROUP_TABLE);
$table_group = Database :: get_course_table(TABLE_GROUP);
$category_id = GroupManager :: create_category('Subgroups', '', TOOL_PRIVATE, TOOL_PRIVATE, 0, 0, 1, 1);
$users = GroupManager :: get_users($group_id);
$group_ids = array ();
@ -285,7 +285,7 @@ class GroupManager
}
// Database table definitions
$group_table = Database :: get_course_table(GROUP_TABLE, $course_db);
$group_table = Database :: get_course_table(TABLE_GROUP, $course_db);
$group_user_table = Database :: get_course_table(GROUP_USER_TABLE, $course_db);
$forum_table = Database :: get_course_table(TABLE_FORUM, $course_db);
$forum_post_table = Database :: get_course_table(TABLE_FORUM_POST, $course_db);
@ -329,7 +329,7 @@ class GroupManager
if (empty($group_id) or !is_integer(intval($group_id)) ) {
return null;
}
$table_group = Database :: get_course_table(GROUP_TABLE);
$table_group = Database :: get_course_table(TABLE_GROUP);
$sql = 'SELECT * FROM '.$table_group.' WHERE id = '.$group_id;
$db_result = api_sql_query($sql,__FILE__,__LINE__);
$db_object = mysql_fetch_object($db_result);
@ -361,7 +361,7 @@ class GroupManager
*/
function set_group_properties($group_id, $name, $description, $maximum_number_of_students, $doc_state, $work_state, $calendar_state, $announcements_state, $self_registration_allowed, $self_unregistration_allowed)
{
$table_group = Database :: get_course_table(GROUP_TABLE);
$table_group = Database :: get_course_table(TABLE_GROUP);
//$table_forum = Database :: get_course_table(TABLE_FORUM);
$sql = "UPDATE ".$table_group."
SET name='".trim($name)."',
@ -385,7 +385,7 @@ class GroupManager
*/
function get_number_of_groups()
{
$table_group = Database :: get_course_table(GROUP_TABLE);
$table_group = Database :: get_course_table(TABLE_GROUP);
$res = api_sql_query('SELECT COUNT(id) AS number_of_groups FROM '.$table_group);
$obj = mysql_fetch_object($res);
return $obj->number_of_groups;
@ -450,7 +450,7 @@ class GroupManager
$course_info = Database :: get_course_info($course_code);
$course_db = $course_info['database'];
}
$table_group = Database :: get_course_table(GROUP_TABLE, $course_db);
$table_group = Database :: get_course_table(TABLE_GROUP, $course_db);
$table_group_cat = Database :: get_course_table(GROUP_CATEGORY_TABLE, $course_db);
$sql = "SELECT gc.* FROM $table_group_cat gc, $table_group g WHERE gc.id = g.category_id AND g.id=$group_id";
$res = api_sql_query($sql,__FILE__,__LINE__);
@ -471,7 +471,7 @@ class GroupManager
$course_info = Database :: get_course_info($course_code);
$course_db = $course_info['database'];
}
$table_group = Database :: get_course_table(GROUP_TABLE, $course_db);
$table_group = Database :: get_course_table(TABLE_GROUP, $course_db);
$table_group_cat = Database :: get_course_table(GROUP_CATEGORY_TABLE, $course_db);
$sql = "SELECT id FROM $table_group WHERE category_id='".$cat_id."'";
$res = api_sql_query($sql,__FILE__,__LINE__);
@ -560,7 +560,7 @@ class GroupManager
$course_info = Database :: get_course_info($course_code);
$course_db = $course_info['database'];
}
$group_table = Database :: get_course_table(GROUP_TABLE, $course_db);
$group_table = Database :: get_course_table(TABLE_GROUP, $course_db);
$group_user_table = Database :: get_course_table(GROUP_USER_TABLE, $course_db);
$sql = 'SELECT COUNT(gu.group_id) AS current_max FROM '.$group_user_table.' gu, '.$group_table.' g WHERE gu.group_id = g.id ';
if ($category_id != null)
@ -642,7 +642,7 @@ class GroupManager
$category = GroupManager :: get_category_from_group($group_ids[0]);
$groups_per_user = $category['groups_per_user'];
$course_user_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$group_table = Database :: get_course_table(GROUP_TABLE);
$group_table = Database :: get_course_table(TABLE_GROUP);
$group_user_table = Database :: get_course_table(GROUP_USER_TABLE);
$complete_user_list = CourseManager :: get_real_and_linked_user_list($_course['sysCode']);
$number_groups_per_user = ($groups_per_user == GROUP_PER_MEMBER_NO_LIMIT ? INFINITE : $groups_per_user);
@ -747,7 +747,7 @@ class GroupManager
*/
function maximum_number_of_students($group_id)
{
$table_group = Database :: get_course_table(GROUP_TABLE);
$table_group = Database :: get_course_table(TABLE_GROUP);
$db_result = api_sql_query('SELECT max_student FROM '.$table_group.' WHERE id = '.$group_id);
$db_object = mysql_fetch_object($db_result);
if ($db_object->max_student == 0)
@ -764,7 +764,7 @@ class GroupManager
function user_in_number_of_groups($user_id, $cat_id)
{
$table_group_user = Database :: get_course_table(GROUP_USER_TABLE);
$table_group = Database :: get_course_table(GROUP_TABLE);
$table_group = Database :: get_course_table(TABLE_GROUP);
$sql = 'SELECT COUNT(*) AS number_of_groups FROM '.$table_group_user.' gu, '.$table_group.' g WHERE gu.user_id = \''.$user_id.'\' AND g.id = gu.group_id AND g.category_id= \''.$cat_id.'\'';
$db_result = api_sql_query($sql,__FILE__,__LINE__);
$db_object = mysql_fetch_object($db_result);
@ -780,7 +780,7 @@ class GroupManager
{
if (!$user_id > 0)
return false;
$table_group = Database :: get_course_table(GROUP_TABLE);
$table_group = Database :: get_course_table(TABLE_GROUP);
$sql = 'SELECT self_registration_allowed FROM '.$table_group.' WHERE id = '.$group_id;
$db_result = api_sql_query($sql,__FILE__,__LINE__);
$db_object = mysql_fetch_object($db_result);
@ -796,7 +796,7 @@ class GroupManager
{
if (!$user_id > 0)
return false;
$table_group = Database :: get_course_table(GROUP_TABLE);
$table_group = Database :: get_course_table(TABLE_GROUP);
$db_result = api_sql_query('SELECT self_unregistration_allowed FROM '.$table_group.' WHERE id = '.$group_id);
$db_object = mysql_fetch_object($db_result);
return $db_object->self_unregistration_allowed == 1 && GroupManager :: can_user_unsubscribe($user_id, $group_id);

@ -1380,7 +1380,7 @@ function api_item_property_update($_course, $tool, $item_id, $lastedit_type, $us
{
$time = time();
$time = date("Y-m-d H:i:s", $time);
$TABLE_ITEMPROPERTY = Database :: get_course_table(ITEM_PROPERTY_TABLE);
$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY);
if ($to_user_id <= 0)
$to_user_id = NULL; //no to_user_id set
$start_visible = ($start_visible == 0) ? "0000-00-00 00:00:00" : $start_visible;

@ -745,7 +745,7 @@ if ((isset($gidReset) && $gidReset) || (isset($cidReset) && $cidReset)) // sessi
{
if ($gidReq && $_cid ) // have keys to search data
{
$group_table = Database::get_course_table(GROUP_TABLE);
$group_table = Database::get_course_table(TABLE_GROUP);
$sql = "SELECT * FROM $group_table WHERE `id` = '$gidReq'";
$result = api_sql_query($sql,__FILE__,__LINE__);
if (mysql_num_rows($result) > 0) // This group has recorded status related to this course

@ -1,5 +1,5 @@
<?php
// $Id: tool_navigation_menu.inc.php 9319 2006-10-04 12:31:07Z bmol $
// $Id: tool_navigation_menu.inc.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -48,7 +48,7 @@ function get_navigation_items($include_admin_tools = false)
{
$user_id = api_get_user_id();
$course_tools_table = Database :: get_course_table(TOOL_LIST_TABLE);
$course_tools_table = Database :: get_course_table(TABLE_TOOL_LIST);
/*
--------------------------------------------------------------

@ -51,8 +51,8 @@ $this_section=SECTION_COURSES;
api_protect_course_script();
$tbl_link = Database::get_course_table(LINK_TABLE);
$tbl_categories = Database::get_course_table(LINK_CATEGORY_TABLE);
$tbl_link = Database::get_course_table(TABLE_LINK);
$tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
$nameTools = get_lang("Links");

@ -60,7 +60,7 @@ function addlinkcategory($type)
if ($type == "link")
{
$tbl_link = Database :: get_course_table(LINK_TABLE);
$tbl_link = Database :: get_course_table(TABLE_LINK);
$title = $_POST['title'];
$urllink = $_POST['urllink'];
@ -108,7 +108,7 @@ function addlinkcategory($type)
}
elseif ($type == "category")
{
$tbl_categories = Database :: get_course_table(LINK_CATEGORY_TABLE);
$tbl_categories = Database :: get_course_table(TABLE_LINK_CATEGORY);
$category_title = trim($_POST['category_title']);
$description = trim($_POST['description']);
@ -160,9 +160,9 @@ function deletelinkcategory($type)
global $catlinkstatus;
global $_course;
global $_user;
$tbl_link = Database :: get_course_table(LINK_TABLE);
$tbl_categories = Database :: get_course_table(LINK_CATEGORY_TABLE);
$TABLE_ITEM_PROPERTY = Database :: get_course_table(LAST_TOOL_EDIT_TABLE);
$tbl_link = Database :: get_course_table(TABLE_LINK);
$tbl_categories = Database :: get_course_table(TABLE_LINK_CATEGORY);
$TABLE_ITEM_PROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY);
if ($type == "link")
{
@ -201,8 +201,8 @@ function editlinkcategory($type)
global $id;
global $submitLink;
global $submitCategory;
$tbl_link = Database :: get_course_table(LINK_TABLE);
$tbl_categories = Database :: get_course_table(LINK_CATEGORY_TABLE);
$tbl_link = Database :: get_course_table(TABLE_LINK);
$tbl_categories = Database :: get_course_table(TABLE_LINK_CATEGORY);
if ($type == "link")
{
@ -314,7 +314,7 @@ function change_visibility($id, $scope)
{
global $_course;
global $_user;
$TABLE_ITEM_PROPERTY = Database :: get_course_table(LAST_TOOL_EDIT_TABLE);
$TABLE_ITEM_PROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY);
if ($scope == "link")
{
@ -335,9 +335,9 @@ function showlinksofcategory($catid)
global $urlview;
global $up;
global $down;
$tbl_link = Database :: get_course_table(LINK_TABLE);
$tbl_link = Database :: get_course_table(TABLE_LINK);
$TABLE_ITEM_PROPERTY = Database :: get_course_table(LAST_TOOL_EDIT_TABLE);
$TABLE_ITEM_PROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$sqlLinks = "SELECT * FROM ".$tbl_link." link, ".$TABLE_ITEM_PROPERTY." itemproperties WHERE itemproperties.tool='".TOOL_LINK."' AND link.id=itemproperties.ref AND link.category_id='".$catid."' AND (itemproperties.visibility='0' OR itemproperties.visibility='1')ORDER BY link.display_order DESC";
$result = api_sql_query($sqlLinks);
@ -421,8 +421,8 @@ function movecatlink($catlinkid)
global $catmove;
global $up;
global $down;
$tbl_link = Database :: get_course_table(LINK_TABLE);
$tbl_categories = Database :: get_course_table(LINK_CATEGORY_TABLE);
$tbl_link = Database :: get_course_table(TABLE_LINK);
$tbl_categories = Database :: get_course_table(TABLE_LINK_CATEGORY);
if ($_GET['down'])
{
@ -500,7 +500,7 @@ function movecatlink($catlinkid)
*/
function get_cat($catname) // get category id (existing or make new)
{
$tbl_categories = Database :: get_course_table(LINK_CATEGORY_TABLE);
$tbl_categories = Database :: get_course_table(TABLE_LINK_CATEGORY);
$result = api_sql_query("SELECT `id` FROM ".$tbl_categories." WHERE `category_title`='".addslashes($catname)."'", __FILE__, __LINE__);
@ -520,7 +520,7 @@ function get_cat($catname) // get category id (existing or make new)
*/
function put_link($url, $cat, $title, $description, $on_homepage, $hidden)
{
$tbl_link = Database :: get_course_table(LINK_TABLE);
$tbl_link = Database :: get_course_table(TABLE_LINK);
$urleq = "url='".addslashes($url)."'";
$cateq = "category_id=".$cat;

@ -84,7 +84,7 @@ function get_cat($catname)
{
global $_course; $cateq = "category_title='". addslashes($catname) . "'";
$linkcat_table = Database::get_course_table(LINK_CATEGORY_TABLE);
$linkcat_table = Database::get_course_table(TABLE_LINK_CATEGORY);
$result = api_sql_query("SELECT id FROM $linkcat_table WHERE " . $cateq, __FILE__, __LINE__);
if (mysql_num_rows($result) >= 1 && ($row = mysql_fetch_array($result)))
@ -111,7 +111,7 @@ if (isset($lcn)) // category_title
if (($lci = get_cat($lcn)) !== FALSE)
{
$link_table = Database::get_course_table(LINK_TABLE);
$link_table = Database::get_course_table(TABLE_LINK);
$result = api_sql_query("SELECT id FROM $link_table WHERE category_id=" . $lci, __FILE__, __LINE__);
while ($row = mysql_fetch_array($result))
@ -304,7 +304,7 @@ echo '</form>', "\n";
if (count($perCat)) foreach ($perCat as $cat => $number)
$perCat[$cat] = '(' . htmlspecialchars($cat) . ')';
$linkcat_table = Database::get_course_table(LINK_CATEGORY_TABLE);
$linkcat_table = Database::get_course_table(TABLE_LINK_CATEGORY);
$result = api_sql_query("SELECT category_title FROM $linkcat_table", __FILE__, __LINE__);
while ($row = mysql_fetch_array($result))

@ -60,7 +60,7 @@ require('md_phpdig.php');
if (isset($workWith)) // explicit in URL, or selected at bottom of screen
{
$scormdocument = Database::get_course_table(SCORMDOC_TABLE);
$scormdocument = Database::get_course_table(TABLE_SCORMDOC);
$result = api_sql_query("SELECT id FROM $scormdocument WHERE path='" .
addslashes($workWith) . "'", __FILE__, __LINE__);

@ -163,7 +163,7 @@ function mdobject($_course, $id)
$this->mdo_dcmap_e = $ieee_dcmap_e; $this->mdo_dcmap_v = $ieee_dcmap_v;
$document_table = Database::get_course_table(DOCUMENT_TABLE);
$document_table = Database::get_course_table(TABLE_DOCUMENT);
if (($docinfo = @mysql_fetch_array(api_sql_query(
"SELECT path,title,comment,filetype FROM $document_table WHERE id='" .
addslashes($id) . "'", __FILE__, __LINE__))))
@ -174,7 +174,7 @@ function mdobject($_course, $id)
$this->mdo_filetype = $docinfo['filetype'];
$this->mdo_group = ''; // 2005-05-30: find group_id, if any
$group_info = Database::get_course_table(GROUP_TABLE);
$group_info = Database::get_course_table(TABLE_GROUP);
if (($result = api_sql_query(
"SELECT id,secret_directory FROM $group_info", __FILE__, __LINE__)))
while (($row = mysql_fetch_array($result)))

@ -169,7 +169,7 @@ function mdo_storeback(&$xmlDoc) // by ref!
// do not store back a modified coverage as category...
$link_table = Database::get_course_table(LINK_TABLE);
$link_table = Database::get_course_table(TABLE_LINK);
if ($u) api_sql_query("UPDATE $link_table SET " . substr($u, 2) .
" WHERE id='" . addslashes($this->mdo_id) . "'", __FILE__, __LINE__);
}
@ -198,7 +198,7 @@ function mdobject($_course, $id)
$this->mdo_dcmap_e = $ieee_dcmap_e; $this->mdo_dcmap_v = $ieee_dcmap_v;
$link_table = Database::get_course_table(LINK_TABLE);
$link_table = Database::get_course_table(TABLE_LINK);
if (($linkinfo = @mysql_fetch_array(api_sql_query(
"SELECT url,title,description,category_id FROM $link_table WHERE id='" .
addslashes($id) . "'", __FILE__, __LINE__))))
@ -208,7 +208,7 @@ function mdobject($_course, $id)
$this->mdo_description = $linkinfo['description'];
$this->mdo_category = ($lci = $linkinfo['category_id']);
$linkcat_table = Database::get_course_table(LINK_CATEGORY_TABLE);
$linkcat_table = Database::get_course_table(TABLE_LINK_CATEGORY);
if (($catinfo = @mysql_fetch_array(api_sql_query(
"SELECT category_title FROM $linkcat_table WHERE id='" .
addslashes($lci) . "'", __FILE__, __LINE__))))

@ -40,8 +40,8 @@ function mdobject($_course, $eid)
if ($type == 'Document' || $type == 'Scorm')
{
$table = $type == 'Scorm' ?
Database::get_course_table(SCORMDOC_TABLE) :
Database::get_course_table(DOCUMENT_TABLE);
Database::get_course_table(TABLE_SCORMDOC) :
Database::get_course_table(TABLE_DOCUMENT);
if (($dotpos = strpos($id, '.')))
{
@ -75,7 +75,7 @@ function mdobject($_course, $eid)
}
elseif ($type == 'Link')
{
$link_table = Database::get_course_table(LINK_TABLE);
$link_table = Database::get_course_table(TABLE_LINK);
if (($linkinfo = @mysql_fetch_array(api_sql_query(
"SELECT url,title,description,category_id FROM
$link_table WHERE id='" . addslashes($id) .

@ -78,7 +78,7 @@ function mdobject($_course, $id)
{
global $ieee_dcmap_e, $ieee_dcmap_v; // md_funcs
$scormdocument = Database::get_course_table(SCORMDOC_TABLE);
$scormdocument = Database::get_course_table(TABLE_SCORMDOC);
$this->mdo_course = $_course; $this->mdo_type = 'Scorm';
$this->mdo_id = $id; $this->mdo_eid = $this->mdo_type . '.' . $id;

@ -165,7 +165,7 @@ $tbl_course_quiz = 'quiz';
$course_quiz_question = 'quiz_question';
$course_quiz_rel_question = 'quiz_rel_question';
$course_quiz_answer = 'quiz_answer';
$course_student_publication = Database::get_course_table(STUDENT_PUBLICATION_TABLE);
$course_student_publication = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
api_display_tool_title($nameTools);

@ -49,7 +49,7 @@ require_once('learnpath.class.php');
require_once('learnpathItem.class.php');
// storing the tables names in variables.
$tbl_document = Database::get_course_table(SCORMDOC_TABLE);
$tbl_document = Database::get_course_table(TABLE_SCORMDOC);
$tbl_learnpath_main = Database::get_course_learnpath_main_table();
$tbl_tool = Database::get_course_tool_list_table();

File diff suppressed because it is too large Load Diff

@ -1,100 +1,100 @@
<?php //$id:$
/**
* File containing the declaration of the learnpathList class.
* @package dokeos.learningpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* This class is only a learning path list container with several practical methods for sorting the list and
* provide links to specific paths
* @uses Database.lib.php to use the database
* @uses learnpath.class.php to generate learnpath objects to get in the list
*/
class learnpathList {
var $list = array(); //holds a flat list of learnpaths data from the database
var $ref_list = array(); //holds a list of references to the learnpaths objects (only filled by get_refs())
var $alpha_list = array(); //holds a flat list of learnpaths sorted by alphabetical name order
var $course_code;
var $user_id;
var $refs_active = false;
/**
* This method is the constructor for the learnpathList. It gets a list of available learning paths from
* the database and creates the learnpath objects. This list depends on the user that is connected
* (only displays) items if he has enough permissions to view them.
* @param integer User ID
* @param string Optional course code (otherwise we use api_get_course_id())
* @return void
*/
function learnpathList($user_id,$course_code='') {
if(!empty($course_code)){
//proceed with course code given
}else{
$course_code = api_get_course_id();
$lp_table = Database::get_course_table('lp');
}
$this->course_code = $course_code;
$this->user_id = $user_id;
$sql = "SELECT * FROM $lp_table ORDER BY name ASC";
$res = api_sql_query($sql);
$names = array();
while ($row = Database::fetch_array($res))
{
$tbl_tool = Database::get_course_table(TOOL_LIST_TABLE);
//use domesticate here instead of mysql_real_escape_string because
//it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
//is done using domesticate()
$myname = domesticate($row['name']);
$mylink = 'newscorm/lp_controller.php?mode=view&lp_id='.$row['id'];
$sql2="SELECT * FROM $tbl_tool where (name='$myname' and image='scormbuilder.gif' and link LIKE '$mylink%')";
//error_log('New LP - learnpathList::learnpathList - getting visibility - '.$sql2,0);
$res2 = api_sql_query($sql2,__FILE__,__LINE__);
if(Database::num_rows($res2)>0){
$row2 = Database::fetch_array($res2);
$vis = $row2['visibility'];
}else{
$vis = 'i';
}
$this->list[$row['id']] = array(
'lp_type' => $row['lp_type'],
'lp_name' => stripslashes($row['name']),
'lp_desc' => stripslashes($row['description']),
'lp_path' => $row['path'],
'lp_view_mode' => $row['default_view_mod'],
'lp_force_commit' => $row['force_commit'],
'lp_maker' => stripslashes($row['content_maker']),
'lp_proximity' => $row['content_local'],
'lp_encoding' => $row['default_encoding'],
'lp_progress' => $row['progress'],
'lp_visibility' => $vis,
'lp_prevent_reinit' => $row['prevent_reinit'],
'lp_scorm_debug' => $row['debug'],
);
$names[$row['name']]=$row['id'];
}
$this->alpha_list = asort($names);
}
/**
* Gets references to learnpaths for all learnpaths IDs kept in the local list.
* This applies a transformation internally on list and ref_list and returns a copy of the refs list
* @return array List of references to learnpath objects
*/
function get_refs(){
foreach($this->list as $id => $dummy)
{
$this->ref_list[$id] = new learnpath($this->course_code,$id,$this->user_id);
}
$this->refs_active = true;
return $this->ref_list;
}
/**
* Gets a table of the different learnpaths we have at the moment
* @return array Learnpath info as [lp_id] => ([lp_type]=> ..., [lp_name]=>...,[lp_desc]=>...,[lp_path]=>...)
*/
function get_flat_list()
{
return $this->list;
}
}
?>
<?php //$id:$
/**
* File containing the declaration of the learnpathList class.
* @package dokeos.learningpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* This class is only a learning path list container with several practical methods for sorting the list and
* provide links to specific paths
* @uses Database.lib.php to use the database
* @uses learnpath.class.php to generate learnpath objects to get in the list
*/
class learnpathList {
var $list = array(); //holds a flat list of learnpaths data from the database
var $ref_list = array(); //holds a list of references to the learnpaths objects (only filled by get_refs())
var $alpha_list = array(); //holds a flat list of learnpaths sorted by alphabetical name order
var $course_code;
var $user_id;
var $refs_active = false;
/**
* This method is the constructor for the learnpathList. It gets a list of available learning paths from
* the database and creates the learnpath objects. This list depends on the user that is connected
* (only displays) items if he has enough permissions to view them.
* @param integer User ID
* @param string Optional course code (otherwise we use api_get_course_id())
* @return void
*/
function learnpathList($user_id,$course_code='') {
if(!empty($course_code)){
//proceed with course code given
}else{
$course_code = api_get_course_id();
$lp_table = Database::get_course_table('lp');
}
$this->course_code = $course_code;
$this->user_id = $user_id;
$sql = "SELECT * FROM $lp_table ORDER BY name ASC";
$res = api_sql_query($sql);
$names = array();
while ($row = Database::fetch_array($res))
{
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
//use domesticate here instead of mysql_real_escape_string because
//it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
//is done using domesticate()
$myname = domesticate($row['name']);
$mylink = 'newscorm/lp_controller.php?mode=view&lp_id='.$row['id'];
$sql2="SELECT * FROM $tbl_tool where (name='$myname' and image='scormbuilder.gif' and link LIKE '$mylink%')";
//error_log('New LP - learnpathList::learnpathList - getting visibility - '.$sql2,0);
$res2 = api_sql_query($sql2,__FILE__,__LINE__);
if(Database::num_rows($res2)>0){
$row2 = Database::fetch_array($res2);
$vis = $row2['visibility'];
}else{
$vis = 'i';
}
$this->list[$row['id']] = array(
'lp_type' => $row['lp_type'],
'lp_name' => stripslashes($row['name']),
'lp_desc' => stripslashes($row['description']),
'lp_path' => $row['path'],
'lp_view_mode' => $row['default_view_mod'],
'lp_force_commit' => $row['force_commit'],
'lp_maker' => stripslashes($row['content_maker']),
'lp_proximity' => $row['content_local'],
'lp_encoding' => $row['default_encoding'],
'lp_progress' => $row['progress'],
'lp_visibility' => $vis,
'lp_prevent_reinit' => $row['prevent_reinit'],
'lp_scorm_debug' => $row['debug'],
);
$names[$row['name']]=$row['id'];
}
$this->alpha_list = asort($names);
}
/**
* Gets references to learnpaths for all learnpaths IDs kept in the local list.
* This applies a transformation internally on list and ref_list and returns a copy of the refs list
* @return array List of references to learnpath objects
*/
function get_refs(){
foreach($this->list as $id => $dummy)
{
$this->ref_list[$id] = new learnpath($this->course_code,$id,$this->user_id);
}
$this->refs_active = true;
return $this->ref_list;
}
/**
* Gets a table of the different learnpaths we have at the moment
* @return array Learnpath info as [lp_id] => ([lp_type]=> ..., [lp_name]=>...,[lp_desc]=>...,[lp_path]=>...)
*/
function get_flat_list()
{
return $this->list;
}
}
?>

@ -1713,7 +1713,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
//------------------------AGENDA BEGIN-------------------
case "Agenda" :
//1 Get agenda event data from the database table
$TABLEAGENDA = Database :: get_course_table(AGENDA_TABLE);
$TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA);
$sql = "SELECT * FROM ".$TABLEAGENDA." where (id=$item_id)";
$result = api_sql_query($sql, __FILE__, __LINE__);
@ -1788,7 +1788,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
//------------------------ANNOUNCEMENT BEGIN-------------------
case "Ad_Valvas" :
//1 Get the announcement data from the database
$tbl_announcement = Database :: get_course_announcement_table();
$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
$sql = "SELECT * FROM $tbl_announcement where id='$item_id'";
$result = api_sql_query($sql, __FILE__, __LINE__);
@ -1834,7 +1834,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
//------------------------Course_description BEGIN-------------------
case "Course_description" :
//1 Get course description data from database
$tbl_course_description = Database :: get_course_description_table();
$tbl_course_description = Database :: get_course_table(TABLE_COURSE_DESCRIPTION);
$result = api_sql_query("SELECT id, title, content FROM ".$tbl_course_description." ORDER BY id", __FILE__, __LINE__);
//2 Check this element
@ -1864,7 +1864,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
//------------------------DOCUMENT BEGIN-------------------
case "Document" :
//1 Get the document data from the database
$tbl_document = Database :: get_course_document_table();
$tbl_document = Database::get_course_table(TABLE_DOCUMENT);
$sql_query = "SELECT * FROM $tbl_document WHERE id=$item_id";
$sql_result = api_sql_query($sql_query, __FILE__, __LINE__);
$myrow = mysql_fetch_array($sql_result);
@ -1989,7 +1989,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
//------------------------HotPotatoes BEGIN-------------------
case "HotPotatoes" :
//1 Get HotPotatoes data from the document table
$tbl_document = Database :: get_course_document_table();
$tbl_document = Database::get_course_table(TABLE_DOCUMENT);
$result = api_sql_query("SELECT * FROM $tbl_document WHERE id=$item_id", __FILE__, __LINE__);
$myrow = mysql_fetch_array($result);
//2 Get the document path

File diff suppressed because it is too large Load Diff

@ -57,8 +57,8 @@ include ('resourcelinker.inc.php');
-----------------------------------------------------------
*/
$link_table = Database :: get_course_table(LINK_TABLE);
$item_property_table = Database :: get_course_table(ITEM_PROPERTY_TABLE);
$link_table = Database :: get_course_table(TABLE_LINK);
$item_property_table = Database :: get_course_table(TABLE_ITEM_PROPERTY);
//$tbl_learnpath_main = Database :: get_course_table(LEARNPATH_MAIN_TABLE);
//$tbl_learnpath_chapter = Database :: get_course_table(LEARNPATH_CHAPTER_TABLE);
@ -305,7 +305,7 @@ if ($add)
case 'Document':
$addedresource_item = TOOL_DOCUMENT;
//get title from tool-type table
$tooltable = Database::get_course_table(DOCUMENT_TABLE);
$tooltable = Database::get_course_table(TABLE_DOCUMENT);
$result = api_sql_query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i],__FILE__,__LINE__);
$myrow=mysql_fetch_array($result);
$title = $myrow['title'];
@ -325,7 +325,7 @@ if ($add)
case 'Agenda':
$addedresource_item = TOOL_CALENDAR_EVENT;
//get title from tool-type table
$tooltable = Database::get_course_table(AGENDA_TABLE);
$tooltable = Database::get_course_table(TABLE_AGENDA);
$result = api_sql_query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i],__FILE__,__LINE__);
$myrow=mysql_fetch_array($result);
$title = $myrow['title'];
@ -333,7 +333,7 @@ if ($add)
case 'Ad_Valvas':
$addedresource_item = TOOL_ANNOUNCEMENT;
//get title from tool-type table
$tooltable = Database::get_course_table(ANNOUNCEMENT_TABLE);
$tooltable = Database::get_course_table(TABLE_ANNOUNCEMENT);
$result = api_sql_query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i],__FILE__,__LINE__);
$myrow=mysql_fetch_array($result);
$title = $myrow['title'];
@ -518,7 +518,7 @@ echo "</h3>";
// We use this to check which resources a student may add (only the modules that are active)
// see http://www.dokeos.com/forum/viewtopic.php?t=4858
$active_modules=array();
$tool_table = Database::get_course_table(TOOL_LIST_TABLE);
$tool_table = Database::get_course_table(TABLE_TOOL_LIST);
$sql_select_active="SELECT * FROM $tool_table WHERE visibility='1'";
$result_select_active=api_sql_query($sql_select_active);
while ($row=mysql_fetch_array($result_select_active))
@ -724,8 +724,8 @@ if ($from_learnpath != 'yes')
if ($content == "Agenda")
{
include (api_get_path(LIBRARY_PATH)."text.lib.php");
$TABLEAGENDA = Database::get_course_table(AGENDA_TABLE);
$TABLE_ITEM_PROPERTY = Database::get_course_table(LAST_TOOL_EDIT_TABLE);
$TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
$TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$sql="SELECT agenda.*, toolitemproperties.*
FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." toolitemproperties
@ -803,7 +803,7 @@ if ($content == "Document" OR (empty($content) AND (is_allowed_to_edit() OR in_a
if ($content == "Ad_Valvas")
{
include (api_get_path(LIBRARY_PATH)."text.lib.php");
$tbl_announcement = Database :: get_course_table(ANNOUNCEMENT_TABLE);
$tbl_announcement = Database :: get_course_table(TABLE_ANNOUNCEMENT);
$sql = "SELECT * FROM ".$tbl_announcement." a, ".$item_property_table." i WHERE i.tool = '".TOOL_ANNOUNCEMENT."' AND a.id=i.ref AND i.visibility='1' AND i.to_group_id = 0 AND i.to_user_id IS NULL ORDER BY a.display_order ASC";
//error_log($sql,0);
$result = api_sql_query($sql,__FILE__,__LINE__);
@ -910,7 +910,7 @@ if ($content == "Link")
// including the links functions file
include ("../link/linkfunctions.php");
$tbl_categories = Database::get_course_table(LINK_CATEGORY_TABLE);
$tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
if (($learnpath_id != '') and ($content == 'Link'))
{
echo "<form name='learnpath_link'><table>";
@ -979,7 +979,7 @@ if (($content == "Exercise") or ($content == "HotPotatoes"))
if ($from_learnpath == 'yes')
{
$uploadPath = "/HotPotatoes_files";
$TBL_DOCUMENT = Database::get_course_table(DOCUMENT_TABLE);
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$documentPath = api_get_path('SYS_COURSE_PATH').$_course['path'].'/document';
$sql = "SELECT * FROM ".$TBL_DOCUMENT." WHERE (path LIKE '%htm%' OR path LIKE '%html%') AND path LIKE '".$uploadPath."/%/%' ORDER BY `id` ASC";
$result = api_sql_query($sql, __FILE__, __LINE__);
@ -1024,7 +1024,7 @@ if ($content == "Externallink")
<option value="0"><?php echo get_lang('MainCategory'); ?></option>
<?php
$tbl_categories = Database::get_course_table(LINK_CATEGORY_TABLE);
$tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
$sql = "SELECT * FROM `$tbl_categories` ORDER BY display_order ASC";
echo $sql;
$result = api_sql_query($sql, __FILE__, __LINE__);

@ -446,12 +446,12 @@ foreach($courses_list as $db)
$msg = "(found $incoherences incoherences between views and items - ignored)";
}
/**
* Migrate links on the homepage as well now (look into the TOOL_LIST_TABLE table and
* Migrate links on the homepage as well now (look into the TABLE_TOOL_LIST table and
* update the links to newscorm/lp_controller.php?action=view&lp_id=x)
* Only normal learnpaths were visible from the homepage so we only need to update here
*/
//MIGRATING LEARNPATH LINKS ON COURSES HOMEPAGES
$tbl_tool = Database::get_course_table(TOOL_LIST_TABLE,$db);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST,$db);
$sql_tool = "SELECT * FROM $tbl_tool WHERE image='scormbuilder.gif' AND link LIKE '%learnpath_handler%'";
$res_tool = api_sql_query($sql_tool,__FILE__,__LINE__);
while($row_tool = Database::fetch_array($res_tool)){
@ -476,7 +476,7 @@ foreach($courses_list as $db)
/**
* Update course description (intro page) to use new links instead of learnpath/learnpath_handler.php
*/
$tbl_intro = Database::get_course_table(TOOL_INTRO_TABLE,$db);
$tbl_intro = Database::get_course_table(TABLE_TOOL_INTRO,$db);
$sql_i = "SELECT * FROM $tbl_intro WHERE id='course_homepage'";
$res_i = api_sql_query($sql_i,__FILE__,__LINE__);
//$link_to_course1 = 'scorm/scormdocument.php';
@ -557,7 +557,7 @@ while($course_row = Database::fetch_array($res_crs)){
//reinit the scormdocuments list
//$scormdocuments_lps = array();
$db_name = $courses_id_list[$my_course_code];
$tblscodoc = Database::get_course_table(SCORMDOC_TABLE,$db_name);
$tblscodoc = Database::get_course_table(TABLE_SCORMDOC,$db_name);
$sql_scodoc = "SELECT path FROM $tblscodoc WHERE path IS NOT NULL AND path != ''";
echo "$sql_scodoc<br/>";
$res_scodoc = api_sql_query($sql_scodoc,__FILE__,__LINE__);
@ -1083,7 +1083,7 @@ foreach($scorms as $my_course_code => $paths_list )
}
}
/**
* Migrate links on the homepage as well now (look into the TOOL_LIST_TABLE table and
* Migrate links on the homepage as well now (look into the TABLE_TOOL_LIST table and
* update the links to newscorm/lp_controller.php?action=view&lp_id=x)
* See scorm_migrate_hometools.php
*/
@ -1095,7 +1095,7 @@ foreach($scorms as $my_course_code => $paths_list )
/**
* Update course description (intro page) to use new links instead of learnpath/learnpath_handler.php
*/
$tbl_intro = $db_name.TOOL_INTRO_TABLE;
$tbl_intro = $db_name.TABLE_TOOL_INTRO;
$sql_i = "SELECT * FROM $tbl_intro WHERE id='course_homepage'";
$res_i = api_sql_query($sql_i,__FILE__,__LINE__);
//$link_to_course1 = 'scorm/scormdocument.php';

@ -417,11 +417,11 @@ foreach($courses_list as $db)
$msg = "(found $incoherences incoherences between views and items - ignored)";
}
/**
* Migrate links on the homepage as well now (look into the TOOL_LIST_TABLE table and
* Migrate links on the homepage as well now (look into the TABLE_TOOL_LIST table and
* update the links to newscorm/lp_controller.php?action=view&lp_id=x)
* Only normal learnpaths were visible from the homepage so we only need to update here
*/
$tbl_tool = Database::get_course_table(TOOL_LIST_TABLE,$db);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST,$db);
$sql_tool = "SELECT * FROM $tbl_tool WHERE image='scormbuilder.gif' AND link LIKE '%learnpath_handler%'";
$res_tool = api_sql_query($sql_tool,__FILE__,__LINE__);
while($row_tool = Database::fetch_array($res_tool)){
@ -491,7 +491,7 @@ while($course_row = Database::fetch_array($res_crs)){
//reinit the scormdocuments list
//$scormdocuments_lps = array();
$db_name = $courses_id_list[$my_course_code];
$tblscodoc = Database::get_course_table(SCORMDOC_TABLE,$db_name);
$tblscodoc = Database::get_course_table(TABLE_SCORMDOC,$db_name);
$sql_scodoc = "SELECT path FROM $tblscodoc WHERE path IS NOT NULL AND path != ''";
echo "$sql_scodoc<br/>";
$res_scodoc = api_sql_query($sql_scodoc,__FILE__,__LINE__);
@ -894,7 +894,7 @@ foreach($scorms as $my_course_code => $paths_list )
}
}
/**
* Migrate links on the homepage as well now (look into the TOOL_LIST_TABLE table and
* Migrate links on the homepage as well now (look into the TABLE_TOOL_LIST table and
* update the links to newscorm/lp_controller.php?action=view&lp_id=x)
* See scorm_migrate_hometools.php
*/

@ -20,7 +20,7 @@ while ($row = Database::fetch_array($res))
$courses_list[] = $row['db_name'];
//TODO add check for learnpath element. If not exist, create one.
$tbl_tool = Database::get_course_table(TOOL_LIST_TABLE,$row['db_name']);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST,$row['db_name']);
$sql_t = "UPDATE $tbl_tool SET link = 'newscorm/lp_controller.php' WHERE name='learnpath'";
$res_t = api_sql_query($sql_t,__FILE__,__LINE__);
if(!$res_t){

@ -20,7 +20,7 @@ while ($row = Database::fetch_array($res))
$courses_list[] = $row['db_name'];
//TODO add check for learnpath element. If not exist, create one.
$tbl_tool = Database::get_course_table(TOOL_LIST_TABLE,$row['db_name']);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST,$row['db_name']);
$sql_t = "UPDATE $tbl_tool SET link = 'scorm/scormdocument.php' WHERE name='learnpath'";
$res_t = @mysql_query($sql_t);
if(!$res_t){

@ -10,7 +10,7 @@
$rights_full=array("article_add","article_delete","article_edit","article_rate","article_comments_add","article_comments_delete","article_comments_rate","task_management","member_management","role_management");
$rights_limited=array("Add","Edit","Delete");
$rights_blog=array("article_add","article_delete","article_edit","article_rate","article_comments_add","article_comments_delete","article_comments_rate","task_management","member_management","role_management");
$course_tool_table = Database::get_course_table(TOOL_LIST_TABLE);
$course_tool_table = Database::get_course_table(TABLE_TOOL_LIST);
// Get all user
$blog_users = Blog::get_blog_users(mysql_escape_string($_GET['blog_id']));

@ -1,4 +1,4 @@
<?php // $Id: resourcelinker.inc.php 10190 2006-11-24 00:23:20Z pcool $
<?php // $Id: resourcelinker.inc.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -105,8 +105,8 @@ function show_documents($folder)
$visibility="visibility='1'";
}
$item_property_table = Database::get_course_table(ITEM_PROPERTY_TABLE);
$document_table = Database::get_course_table(DOCUMENT_TABLE);
$item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$document_table = Database::get_course_table(TABLE_DOCUMENT);
$sql="SELECT * from $document_table, $item_property_table WHERE id=ref AND tool = '".TOOL_DOCUMENT."' AND $visibility AND to_group_id = 0 AND to_user_id IS NULL ORDER BY path ASC";
$result=api_sql_query($sql,__FILE__,__LINE__);
while ($row=mysql_fetch_array($result))
@ -1170,7 +1170,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
break;
case "Ad_Valvas":
$tbl_announcement = Database::get_course_announcement_table();
$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
$result = api_sql_query("SELECT * FROM $tbl_announcement WHERE id=$id",__FILE__,__LINE__);
$myrow=mysql_fetch_array($result);

@ -58,8 +58,8 @@ include ('resourcelinker.inc.php');
-----------------------------------------------------------
*/
$link_table = Database :: get_course_table(LINK_TABLE);
$item_property_table = Database :: get_course_table(ITEM_PROPERTY_TABLE);
$link_table = Database :: get_course_table(TABLE_LINK);
$item_property_table = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$tbl_learnpath_main = Database :: get_course_table(LEARNPATH_MAIN_TABLE);
$tbl_learnpath_chapter = Database :: get_course_table(LEARNPATH_CHAPTER_TABLE);
@ -439,7 +439,7 @@ echo "</h3>";
// We use this to check which resources a student may add (only the modules that are active)
// see http://www.dokeos.com/forum/viewtopic.php?t=4858
$active_modules=array();
$tool_table = Database::get_course_table(TOOL_LIST_TABLE);
$tool_table = Database::get_course_table(TABLE_TOOL_LIST);
$sql_select_active="SELECT * FROM $tool_table WHERE visibility='1'";
$result_select_active=api_sql_query($sql_select_active);
while ($row=mysql_fetch_array($result_select_active))
@ -640,8 +640,8 @@ if ($from_learnpath != 'yes')
// Agenda items -->
if ($content == "Agenda")
{
$TABLEAGENDA = Database::get_course_table(AGENDA_TABLE);
$TABLE_ITEM_PROPERTY = Database::get_course_table(LAST_TOOL_EDIT_TABLE);
$TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
$TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$sql="SELECT agenda.*, toolitemproperties.*
FROM ".$TABLEAGENDA." agenda, ".$TABLE_ITEM_PROPERTY." toolitemproperties
@ -718,7 +718,7 @@ if ($content == "Document" OR (empty($content) AND (is_allowed_to_edit() OR in_a
*/
if ($content == "Ad_Valvas")
{
$tbl_announcement = Database :: get_course_table(ANNOUNCEMENT_TABLE);
$tbl_announcement = Database :: get_course_table(TABLE_ANNOUNCEMENT);
$sql = "SELECT * FROM ".$tbl_announcement." a, ".$item_property_table." i WHERE i.tool = '".TOOL_ANNOUNCEMENT."' AND a.id=i.ref AND i.visibility='1' AND i.to_group_id = 0 AND i.to_user_id IS NULL ORDER BY a.display_order ASC";
$result = api_sql_query($sql,__FILE__,__LINE__);
@ -825,7 +825,7 @@ if ($content == "Link")
// including the links functions file
include ("../link/linkfunctions.php");
$tbl_categories = Database::get_course_table(LINK_CATEGORY_TABLE);
$tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
if (($learnpath_id != '') and ($content == 'Link'))
{
echo "<form name='learnpath_link'><table>";
@ -894,7 +894,7 @@ if (($content == "Exercise") or ($content == "HotPotatoes"))
if ($from_learnpath == 'yes')
{
$uploadPath = "/HotPotatoes_files";
$TBL_DOCUMENT = Database::get_course_table(DOCUMENT_TABLE);
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$documentPath = api_get_path('SYS_COURSE_PATH').$_course['path'].'/document';
$sql = "SELECT * FROM ".$TBL_DOCUMENT." WHERE (path LIKE '%htm%' OR path LIKE '%html%') AND path LIKE '".$uploadPath."/%/%' ORDER BY `id` ASC";
$result = api_sql_query($sql, __FILE__, __LINE__);
@ -939,7 +939,7 @@ if ($content == "Externallink")
<option value="0"><?php echo get_lang('MainCategory'); ?></option>
<?php
$tbl_categories = Database::get_course_table(LINK_CATEGORY_TABLE);
$tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
$sql = "SELECT * FROM `$tbl_categories` ORDER BY display_order ASC";
echo $sql;
$result = api_sql_query($sql, __FILE__, __LINE__);

@ -83,7 +83,7 @@ $TABLETRACK_DOWNLOADS = Database::get_statistic_table(STATISTIC_TRACK_E_DOWNLO
$TABLETRACK_ACCESS_2 = Database::get_statistic_table("track_e_access");
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE);
$TABLECOURSE_LINKS = Database::get_course_table(LINK_TABLE);
$TABLECOURSE_LINKS = Database::get_course_table(TABLE_LINK);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
//$table_scormdata = Database::get_scorm_table(SCORM_SCO_DATA_TABLE);

@ -1,4 +1,4 @@
<?php // $Id: userLog.php 10191 2006-11-24 08:09:14Z pcool $
<?php // $Id: userLog.php 10195 2006-11-25 15:26:00Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -131,8 +131,8 @@ $TABLETRACK_DOWNLOADS = $_configuration['statistics_database']."`.`track_e_do
$TABLETRACK_UPLOADS = $_configuration['statistics_database']."`.`track_e_uploads";
$TABLETRACK_EXERCICES = $_configuration['statistics_database']."`.`track_e_exercices";
$TABLECOURSE_LINKS = Database::get_course_table(LINK_TABLE);
$TABLECOURSE_WORK = Database::get_course_table(STUDENT_PUBLICATION_TABLE);
$TABLECOURSE_LINKS = Database::get_course_table(TABLE_LINK);
$TABLECOURSE_WORK = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$TABLECOURSE_GROUPSUSER = Database::get_course_table(GROUP_USER_TABLE);
$TABLECOURSE_EXERCICES = Database::get_course_table(QUIZ_TEST_TABLE);
$TBL_TRACK_HOTPOTATOES = Database::get_statistic_table(STATISTIC_TRACK_E_HOTPOTATOES_TABLE);

@ -1,234 +1,234 @@
<?php //$id: $
/**
* Process part of the document sub-process for upload. This script MUST BE included by upload/index.php
* as it prepares most of the variables needed here.
* @package dokeos.upload
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Process the document and return to the document tool
*/
/*
-----------------------------------------------------------
Libraries
-----------------------------------------------------------
*/
//many useful functions in main_api.lib.php, by default included
require_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php');
require_once(api_get_path(LIBRARY_PATH) . 'events.lib.inc.php');
require_once(api_get_path(LIBRARY_PATH) . 'document.lib.php');
require_once('../document/document.inc.php');
//REMOVE
// If we want to unzip a file, we need the library
if (isset($_POST['unzip']) && $_POST['unzip'] == 1)
{
require_once(api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php');
}
/*
-----------------------------------------------------------
Variables
- some need defining before inclusion of libraries
-----------------------------------------------------------
*/
$courseDir = $_course['path']."/document";
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path.$courseDir;
$noPHP_SELF=true;
$max_filled_space = DocumentManager::get_course_quota();
//what's the current path?
if(isset($_POST['curdirpath'])) {
$path = $_POST['curdirpath'];
}else{
$path = '/';
}
// Check the path
// If the path is not found (no document id), set the path to /
if(!DocumentManager::get_document_id($_course,$path)) { $path = '/'; }
/**
* Header
*/
$nameTools = get_lang('UplUploadDocument');
$interbreadcrumb[]=array("url"=>"./document.php?curdirpath=".urlencode($path).$req_gid, "name"=> $langDocuments);
Display::display_header($nameTools,"Doc");
//show the title
api_display_tool_title($nameTools.$add_group_to_title);
/**
* Process
*/
//user has submitted a file
if(isset($_FILES['user_upload']))
{
//echo("<pre>");
//print_r($_FILES['user_upload']);
//echo("</pre>");
$upload_ok = process_uploaded_file($_FILES['user_upload']);
if($upload_ok)
{
//file got on the server without problems, now process it
$new_path = handle_uploaded_document($_course, $_FILES['user_upload'],$base_work_dir,$_POST['curdirpath'],$_user['user_id'],$to_group_id,$to_user_id,$max_filled_space,$_POST['unzip'],$_POST['if_exists']);
$new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
$new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
if ($new_path && ($new_comment || $new_title))
if (($docid = DocumentManager::get_document_id($_course, $new_path)))
{
$table_document = Database::get_course_table(DOCUMENT_TABLE);
$ct = '';
if ($new_comment) $ct .= ", comment='$new_comment'";
if ($new_title) $ct .= ", title='$new_title'";
api_sql_query("UPDATE $table_document SET" . substr($ct, 1) .
" WHERE id = '$docid'", __FILE__, __LINE__);
}
//check for missing images in html files
$missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path);
if($missing_files)
{
//show a form to upload the missing files
Display::display_normal_message(build_missing_files_form($missing_files,$_POST['curdirpath'],$_FILES['user_upload']['name']));
}
}
}
//missing images are submitted
if(isset($_POST['submit_image']))
{
$number_of_uploaded_images = count($_FILES['img_file']['name']);
//if images are uploaded
if ($number_of_uploaded_images > 0)
{
//we could also create a function for this, I'm not sure...
//create a directory for the missing files
$img_directory = str_replace('.','_',$_POST['related_file']."_files");
$missing_files_dir = create_unexisting_directory($_course,$_user['user_id'],$to_group_id,$to_user_id,$base_work_dir,$img_directory);
//put the uploaded files in the new directory and get the paths
$paths_to_replace_in_file = move_uploaded_file_collection_into_directory($_course, $_FILES['img_file'],$base_work_dir,$missing_files_dir,$_user['user_id'],$to_group_id,$to_user_id,$max_filled_space);
//open the html file and replace the paths
replace_img_path_in_html_file($_POST['img_file_path'],$paths_to_replace_in_file,$base_work_dir.$_POST['related_file']);
//update parent folders
item_property_update_on_folder($_course,$_POST['curdirpath'],$_user['user_id']);
}
}
//they want to create a directory
if(isset($_POST['create_dir']) && $_POST['dirname']!='')
{
$added_slash = ($path=='/')?'':'/';
$dir_name = $path.$added_slash.replace_dangerous_char($_POST['dirname']);
$created_dir = create_unexisting_directory($_course,$_user['user_id'],$to_group_id,$to_user_id,$base_work_dir,$dir_name,$_POST['dirname']);
if($created_dir)
{
//Display::display_normal_message("<strong>".$created_dir."</strong> was created!");
Display::display_normal_message(get_lang('DirCr'));
$path = $created_dir;
}
else
{
display_error(get_lang('CannotCreateDir'));
}
}
//tracking not needed here?
//event_access_tool(TOOL_DOCUMENT);
/*============================================================================*/
?>
<?php
//=======================================//
//they want to create a new directory//
//=======================================//
if(isset($_GET['createdir']))
{
//create the form that asks for the directory name
$new_folder_text = '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
$new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>';
$new_folder_text .= get_lang('NewDir') .' ';
$new_folder_text .= '<input type="text" name="dirname"/>';
$new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>';
$new_folder_text .= '</form>';
//show the form
Display::display_normal_message($new_folder_text);
}
else { //give them a link to create a directory
?>
<p><a href="<?php echo $_SERVER['PHP_SELF']; ?>?path=<?php echo $path; ?>&amp;createdir=1"><img src="../img/new_folder.gif" border="0" align="absmiddle" alt ="" /> <?php echo(get_lang('CreateDir'));?></a></p>
<?php
}
?>
<div id="folderselector">
<?php
//form to select directory
//$folders = DocumentManager::get_all_document_folders($_course,$to_group_id,$is_allowed_to_edit);
//echo(build_directory_selector($folders,$path,$group_properties['directory']));
?>
</div>
<!-- start upload form -->
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" name="upload" enctype="multipart/form-data">
<!-- <input type="hidden" name="MAX_FILE_SIZE" value="5400"> -->
<input type="hidden" name="curdirpath" value="<?php echo $path; ?>">
<table>
<tr>
<td valign="top">
<?php echo get_lang('File'); ?>
</td>
<td>
<input type="file" name="user_upload"/>
</td>
</tr>
<?php
if(get_setting('use_document_title')=='true')
{
?>
<tr>
<td><?php echo get_lang('Title');?></td>
<td><input type="text" size="20" name="title" style="width:300px;"></td>
</tr>
<?php
}
?>
<tr>
<td valign="top"><?php echo get_lang('Comment');?></td>
<td><textarea rows="3" cols="20" name="comment" wrap="virtual" style="width:300px;"></textarea></td>
</tr>
<tr>
<td valign="top">
<?php echo get_lang('Options'); ?>
</td>
<td>
- <input type="checkbox" name="unzip" value="1" onclick="check_unzip()"/> <?php echo(get_lang('Uncompress'));?><br/>
- <?php echo (get_lang('UplWhatIfFileExists'));?><br/>
&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="nothing" title="<?php echo (get_lang('UplDoNothingLong'));?>" checked="checked"/> <?php echo (get_lang('UplDoNothing'));?><br/>
&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="overwrite" title="<?php echo (get_lang('UplOverwriteLong'));?>"/> <?php echo (get_lang('UplOverwrite'));?><br/>
&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="rename" title="<?php echo (get_lang('UplRenameLong'));?>"/> <?php echo (get_lang('UplRename'));?>
</td>
</tr>
</table>
<input type="submit" value="<?php echo(get_lang('Ok'));?>">
</form>
<!-- end upload form -->
<!-- so they can get back to the documents -->
<p><?php echo (get_lang('Back'));?> <?php echo (get_lang('To'));?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview'));?></a></p>
<?php
/*
==============================================================================
FOOTER
==============================================================================
*/
Display::display_footer();
<?php //$id: $
/**
* Process part of the document sub-process for upload. This script MUST BE included by upload/index.php
* as it prepares most of the variables needed here.
* @package dokeos.upload
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
/**
* Process the document and return to the document tool
*/
/*
-----------------------------------------------------------
Libraries
-----------------------------------------------------------
*/
//many useful functions in main_api.lib.php, by default included
require_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php');
require_once(api_get_path(LIBRARY_PATH) . 'events.lib.inc.php');
require_once(api_get_path(LIBRARY_PATH) . 'document.lib.php');
require_once('../document/document.inc.php');
//REMOVE
// If we want to unzip a file, we need the library
if (isset($_POST['unzip']) && $_POST['unzip'] == 1)
{
require_once(api_get_path(LIBRARY_PATH).'pclzip/pclzip.lib.php');
}
/*
-----------------------------------------------------------
Variables
- some need defining before inclusion of libraries
-----------------------------------------------------------
*/
$courseDir = $_course['path']."/document";
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path.$courseDir;
$noPHP_SELF=true;
$max_filled_space = DocumentManager::get_course_quota();
//what's the current path?
if(isset($_POST['curdirpath'])) {
$path = $_POST['curdirpath'];
}else{
$path = '/';
}
// Check the path
// If the path is not found (no document id), set the path to /
if(!DocumentManager::get_document_id($_course,$path)) { $path = '/'; }
/**
* Header
*/
$nameTools = get_lang('UplUploadDocument');
$interbreadcrumb[]=array("url"=>"./document.php?curdirpath=".urlencode($path).$req_gid, "name"=> $langDocuments);
Display::display_header($nameTools,"Doc");
//show the title
api_display_tool_title($nameTools.$add_group_to_title);
/**
* Process
*/
//user has submitted a file
if(isset($_FILES['user_upload']))
{
//echo("<pre>");
//print_r($_FILES['user_upload']);
//echo("</pre>");
$upload_ok = process_uploaded_file($_FILES['user_upload']);
if($upload_ok)
{
//file got on the server without problems, now process it
$new_path = handle_uploaded_document($_course, $_FILES['user_upload'],$base_work_dir,$_POST['curdirpath'],$_user['user_id'],$to_group_id,$to_user_id,$max_filled_space,$_POST['unzip'],$_POST['if_exists']);
$new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
$new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
if ($new_path && ($new_comment || $new_title))
if (($docid = DocumentManager::get_document_id($_course, $new_path)))
{
$table_document = Database::get_course_table(TABLE_DOCUMENT);
$ct = '';
if ($new_comment) $ct .= ", comment='$new_comment'";
if ($new_title) $ct .= ", title='$new_title'";
api_sql_query("UPDATE $table_document SET" . substr($ct, 1) .
" WHERE id = '$docid'", __FILE__, __LINE__);
}
//check for missing images in html files
$missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path);
if($missing_files)
{
//show a form to upload the missing files
Display::display_normal_message(build_missing_files_form($missing_files,$_POST['curdirpath'],$_FILES['user_upload']['name']));
}
}
}
//missing images are submitted
if(isset($_POST['submit_image']))
{
$number_of_uploaded_images = count($_FILES['img_file']['name']);
//if images are uploaded
if ($number_of_uploaded_images > 0)
{
//we could also create a function for this, I'm not sure...
//create a directory for the missing files
$img_directory = str_replace('.','_',$_POST['related_file']."_files");
$missing_files_dir = create_unexisting_directory($_course,$_user['user_id'],$to_group_id,$to_user_id,$base_work_dir,$img_directory);
//put the uploaded files in the new directory and get the paths
$paths_to_replace_in_file = move_uploaded_file_collection_into_directory($_course, $_FILES['img_file'],$base_work_dir,$missing_files_dir,$_user['user_id'],$to_group_id,$to_user_id,$max_filled_space);
//open the html file and replace the paths
replace_img_path_in_html_file($_POST['img_file_path'],$paths_to_replace_in_file,$base_work_dir.$_POST['related_file']);
//update parent folders
item_property_update_on_folder($_course,$_POST['curdirpath'],$_user['user_id']);
}
}
//they want to create a directory
if(isset($_POST['create_dir']) && $_POST['dirname']!='')
{
$added_slash = ($path=='/')?'':'/';
$dir_name = $path.$added_slash.replace_dangerous_char($_POST['dirname']);
$created_dir = create_unexisting_directory($_course,$_user['user_id'],$to_group_id,$to_user_id,$base_work_dir,$dir_name,$_POST['dirname']);
if($created_dir)
{
//Display::display_normal_message("<strong>".$created_dir."</strong> was created!");
Display::display_normal_message(get_lang('DirCr'));
$path = $created_dir;
}
else
{
display_error(get_lang('CannotCreateDir'));
}
}
//tracking not needed here?
//event_access_tool(TOOL_DOCUMENT);
/*============================================================================*/
?>
<?php
//=======================================//
//they want to create a new directory//
//=======================================//
if(isset($_GET['createdir']))
{
//create the form that asks for the directory name
$new_folder_text = '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
$new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>';
$new_folder_text .= get_lang('NewDir') .' ';
$new_folder_text .= '<input type="text" name="dirname"/>';
$new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>';
$new_folder_text .= '</form>';
//show the form
Display::display_normal_message($new_folder_text);
}
else { //give them a link to create a directory
?>
<p><a href="<?php echo $_SERVER['PHP_SELF']; ?>?path=<?php echo $path; ?>&amp;createdir=1"><img src="../img/new_folder.gif" border="0" align="absmiddle" alt ="" /> <?php echo(get_lang('CreateDir'));?></a></p>
<?php
}
?>
<div id="folderselector">
<?php
//form to select directory
//$folders = DocumentManager::get_all_document_folders($_course,$to_group_id,$is_allowed_to_edit);
//echo(build_directory_selector($folders,$path,$group_properties['directory']));
?>
</div>
<!-- start upload form -->
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" name="upload" enctype="multipart/form-data">
<!-- <input type="hidden" name="MAX_FILE_SIZE" value="5400"> -->
<input type="hidden" name="curdirpath" value="<?php echo $path; ?>">
<table>
<tr>
<td valign="top">
<?php echo get_lang('File'); ?>
</td>
<td>
<input type="file" name="user_upload"/>
</td>
</tr>
<?php
if(get_setting('use_document_title')=='true')
{
?>
<tr>
<td><?php echo get_lang('Title');?></td>
<td><input type="text" size="20" name="title" style="width:300px;"></td>
</tr>
<?php
}
?>
<tr>
<td valign="top"><?php echo get_lang('Comment');?></td>
<td><textarea rows="3" cols="20" name="comment" wrap="virtual" style="width:300px;"></textarea></td>
</tr>
<tr>
<td valign="top">
<?php echo get_lang('Options'); ?>
</td>
<td>
- <input type="checkbox" name="unzip" value="1" onclick="check_unzip()"/> <?php echo(get_lang('Uncompress'));?><br/>
- <?php echo (get_lang('UplWhatIfFileExists'));?><br/>
&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="nothing" title="<?php echo (get_lang('UplDoNothingLong'));?>" checked="checked"/> <?php echo (get_lang('UplDoNothing'));?><br/>
&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="overwrite" title="<?php echo (get_lang('UplOverwriteLong'));?>"/> <?php echo (get_lang('UplOverwrite'));?><br/>
&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="rename" title="<?php echo (get_lang('UplRenameLong'));?>"/> <?php echo (get_lang('UplRename'));?>
</td>
</tr>
</table>
<input type="submit" value="<?php echo(get_lang('Ok'));?>">
</form>
<!-- end upload form -->
<!-- so they can get back to the documents -->
<p><?php echo (get_lang('Back'));?> <?php echo (get_lang('To'));?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview'));?></a></p>
<?php
/*
==============================================================================
FOOTER
==============================================================================
*/
Display::display_footer();
?>

@ -411,7 +411,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
ug.group_id group_id,
sg.name
FROM " . Database::get_course_table(GROUP_USER_TABLE) . " ug
LEFT JOIN " . Database::get_course_table(GROUP_TABLE) . " sg ON ug.group_id = sg.id
LEFT JOIN " . Database::get_course_table(TABLE_GROUP) . " sg ON ug.group_id = sg.id
WHERE ug.user_id IN ('".implode("','", $user_ids)."')";
$res = api_sql_query($sql,__FILE__,__LINE__);
@ -481,7 +481,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
$sql = "SELECT ug.user_id, ug.group_id group_id, sg.name
FROM ".Database::get_course_table(GROUP_USER_TABLE)." ug
LEFT JOIN ".Database::get_course_table(GROUP_TABLE)." sg
LEFT JOIN ".Database::get_course_table(TABLE_GROUP)." sg
ON ug.group_id = sg.id
WHERE ug.user_id IN ('".implode("','", $user_ids)."')";
$res = api_sql_query($sql,__FILE__,__LINE__);

@ -41,7 +41,7 @@ function display_action_links($always_show_tool_options, $always_show_upload_for
function display_tool_options($uploadvisibledisabled, $origin)
{
$is_allowed_to_edit = api_is_allowed_to_edit();
$work_table = Database::get_course_table(STUDENT_PUBLICATION_TABLE);
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
if (! $is_allowed_to_edit) return;
@ -126,8 +126,8 @@ function display_default_visibility_form($uploadvisibledisabled, $origin)
function display_student_publications_list($currentCourseRepositoryWeb, $link_target_parameter, $dateFormatLong, $origin)
{
//init
$work_table = Database::get_course_table(STUDENT_PUBLICATION_TABLE);
$iprop_table = Database::get_course_table(ITEM_PROPERTY_TABLE);
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$iprop_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$is_allowed_to_edit = api_is_allowed_to_edit();
$user_id = api_get_user_id();
$publications_list = array();

@ -113,8 +113,8 @@ $user_id = api_get_user_id();
$course_code = $_course['sysCode'];
$is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_code, $_SESSION['id_session']);
$work_table = Database::get_course_table(STUDENT_PUBLICATION_TABLE);
$iprop_table = Database::get_course_table(ITEM_PROPERTY_TABLE);
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$iprop_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$currentCourseRepositorySys = api_get_path(SYS_COURSE_PATH) . $_course["path"]."/";
$currentCourseRepositoryWeb = api_get_path(WEB_COURSE_PATH) . $_course["path"]."/";
$currentUserFirstName = $_user['firstName'];

@ -133,7 +133,7 @@ function exportCsv($a_infosUser,$tableTitle,$a_header,$a_dataLearnpath,$a_dataEx
$tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$tbl_stats_exercices = Database :: get_statistic_table(STATISTIC_TRACK_E_EXERCICES_TABLE);
$course_student_publication = Database :: get_course_table(STUDENT_PUBLICATION_TABLE);
$course_student_publication = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
$statistics_database = Database :: get_statistic_database();
/**

@ -547,8 +547,8 @@ function get_logged_user_course_html($my_course)
// Table definitions
//$statistic_database = Database::get_statistic_database();
$course_tool_table = Database :: get_course_table(TOOL_LIST_TABLE, $course_database);
$tool_edit_table = Database :: get_course_table(LAST_TOOL_EDIT_TABLE, $course_database);
$course_tool_table = Database :: get_course_table(TABLE_TOOL_LIST, $course_database);
$tool_edit_table = Database :: get_course_table(TABLE_ITEM_PROPERTY, $course_database);
$course_group_user_table = Database :: get_course_table(TOOL_USER, $course_database);
$user_id = api_get_user_id();
@ -777,8 +777,8 @@ function show_notification($my_course)
$statistic_database = Database :: get_statistic_database();
$user_id = api_get_user_id();
$course_database = $my_course['db'];
$course_tool_table = Database::get_course_table(TOOL_LIST_TABLE, $course_database);
$tool_edit_table = Database::get_course_table(LAST_TOOL_EDIT_TABLE, $course_database);
$course_tool_table = Database::get_course_table(TABLE_TOOL_LIST, $course_database);
$tool_edit_table = Database::get_course_table(TABLE_ITEM_PROPERTY, $course_database);
$course_group_user_table = Database :: get_course_table(GROUP_USER_TABLE, $course_database);
// get the user's last access dates to all tools of this course
$sqlLastTrackInCourse = "SELECT * FROM $statistic_database.track_e_lastaccess
@ -968,7 +968,7 @@ else
-----------------------------------------------------------
*/
$course_database = $my_course['db'];
$course_tool_table = Database::get_course_table(TOOL_LIST_TABLE, $course_database);
$course_tool_table = Database::get_course_table(TABLE_TOOL_LIST, $course_database);
$query = "SELECT visibility FROM $course_tool_table WHERE link = 'announcements/announcements.php' AND visibility = 1";
$result = api_sql_query($query);
// collect from announcements, but only if tool is visible for the course
@ -976,7 +976,7 @@ else
{
//Search announcements table
//Take the entries listed at the top of advalvas/announcements tool
$course_announcement_table = Database :: get_course_announcement_table($thisCourseDbName);
$course_announcement_table = Database::get_course_table(TABLE_ANNOUNCEMENT);
$sqlGetLastAnnouncements = "SELECT end_date publicationDate, content
FROM ".$course_announcement_table;
switch (CONFVAL_limitPreviewTo)
@ -1011,7 +1011,7 @@ else
-----------------------------------------------------------
*/
$course_database = $my_course['db'];
$course_tool_table = Database :: get_course_table(TOOL_LIST_TABLE,$course_database);
$course_tool_table = Database :: get_course_table(TABLE_TOOL_LIST,$course_database);
$query = "SELECT visibility FROM $course_tool_table WHERE link = 'calendar/agenda.php' AND visibility = 1";
$result = api_sql_query($query);
$thisAgenda = $maxCourse - $nbDigestEntries; // new max entries for agenda

Loading…
Cancel
Save