Merge branch '1.10.x' into bootstrap

1.10.x
aragonc 9 years ago
commit ec3be40cc4
  1. 19
      app/Migrations/Schema/V110/Version20150522222222.php
  2. 5
      main/admin/index.php
  3. 21
      main/attendance/attendance_controller.php
  4. 2
      main/attendance/attendance_list.php
  5. 39
      main/coursecopy/classes/CourseBuilder.class.php
  6. 235
      main/coursecopy/classes/CourseRecycler.class.php
  7. 221
      main/coursecopy/classes/CourseRestorer.class.php
  8. 62
      main/coursecopy/classes/CourseSelectForm.class.php
  9. 111
      main/coursecopy/classes/Event.class.php
  10. 7
      main/coursecopy/import_backup.php
  11. 1
      main/coursecopy/recycle_course.php
  12. 66
      main/dropbox/dropbox_download.php
  13. 30
      main/dropbox/dropbox_functions.inc.php
  14. 41
      main/dropbox/index.php
  15. 2
      main/exercice/export/scorm/scorm_classes.php
  16. 64
      main/exercice/live_stats.php
  17. 2
      main/exercice/question.class.php
  18. 5
      main/exercice/question_pool.php
  19. 7
      main/exercice/result.php
  20. 1
      main/exercice/stats.php
  21. 5
      main/forum/newthread.php
  22. 40
      main/inc/latex.php
  23. 13
      main/inc/lib/SmsPluginLibraryInterface.php
  24. 13
      main/inc/lib/agenda.lib.php
  25. 6
      main/inc/lib/attendance.lib.php
  26. 31
      main/inc/lib/course.lib.php
  27. 43
      main/inc/lib/display.lib.php
  28. 22
      main/inc/lib/formvalidator/Element/DateRangePicker.php
  29. 2
      main/inc/lib/link.lib.php
  30. 10
      main/inc/lib/nanogong.lib.php
  31. 12
      main/inc/lib/sub_language.class.php
  32. 132
      main/inc/lib/text.lib.php
  33. 3
      main/install/data.sql
  34. 1
      main/lang/english/trad4all.inc.php
  35. 1
      main/lang/spanish/trad4all.inc.php
  36. 27
      main/messages/new_message.php
  37. 5
      main/messages/view_message.php
  38. 8
      main/mySpace/access_details.php
  39. 16
      main/newscorm/blank.php
  40. 102
      main/newscorm/learnpath.class.php
  41. 2
      main/newscorm/lp_content.php
  42. 33
      main/newscorm/lp_view.php
  43. 1
      main/session/resume_session.php
  44. 4
      main/survey/survey_list.php
  45. 4
      main/template/default/session/resume_session.tpl
  46. 4
      src/Chamilo/CoreBundle/Composer/ScriptHandler.php
  47. 157
      tests/main/inc/lib/text.lib.test.php

@ -707,7 +707,7 @@ class Version20150522222222 extends AbstractMigrationChamilo
'',
'radio',
'Tools',
($value?$value:'false'),
($value ? $value : 'false'),
'DropboxHideCourseCoachTitle',
'DropboxHideCourseCoachComment',
null,
@ -718,6 +718,23 @@ class Version20150522222222 extends AbstractMigrationChamilo
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
$value = api_get_configuration_value('dropbox_hide_general_coach');
$this->addSettingCurrent(
'dropbox_hide_general_coach',
'',
'radio',
'Tools',
($value ? $value : 'false'),
'DropboxHideGeneralCoachTitle',
'DropboxHideGeneralCoachComment',
null,
'',
1,
true,
false,
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']]
);
// If SSO is used, the redirection to the master server is forced.
//$_configuration['force_sso_redirect'] = false;
$value = api_get_configuration_value('force_sso_redirect');

@ -36,7 +36,9 @@ if (api_is_multiple_url_enabled()) {
$message = '';
if (api_is_platform_admin()) {
if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) {
if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) &&
!is_writable(api_get_path(SYS_ARCHIVE_PATH))
) {
$message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'), 'warning');
}
@ -76,7 +78,6 @@ if (!empty($hook)) {
}
/* Users */
$blocks['users']['icon'] = Display::return_icon('members.gif', get_lang('Users'), array(), ICON_SIZE_MEDIUM, false);
$blocks['users']['label'] = api_ucfirst(get_lang('Users'));
$blocks['users']['class'] = 'block-admin-users';

@ -112,7 +112,9 @@ class AttendanceController
$attendance->category_id = $_POST['category_id'];
$link_to_gradebook = false;
if ( isset($_POST['attendance_qualify_gradebook']) && $_POST['attendance_qualify_gradebook'] == 1 ) {
if (isset($_POST['attendance_qualify_gradebook']) &&
$_POST['attendance_qualify_gradebook'] == 1
) {
$link_to_gradebook = true;
}
$last_id = $attendance->attendance_edit($attendance_id,$link_to_gradebook);
@ -135,10 +137,12 @@ class AttendanceController
}
} else {
// default values
$attendance_data = $attendance->get_attendance_by_id($attendance_id);
$data['attendance_id'] = $attendance_data['id'];
$data['title'] = $attendance_data['name'];
$data['description'] = $attendance_data['description'];
$attendance_data = $attendance->get_attendance_by_id(
$attendance_id
);
$data['attendance_id'] = $attendance_data['id'];
$data['title'] = $attendance_data['name'];
$data['description'] = $attendance_data['description'];
$data['attendance_qualify_title'] = $attendance_data['attendance_qualify_title'];
$data['attendance_weight'] = $attendance_data['attendance_weight'];
@ -159,12 +163,15 @@ class AttendanceController
$allowDeleteAttendance = api_get_setting('allow_delete_attendance');
if ($allowDeleteAttendance !== 'true') {
$this->attendance_list();
return false;
}
$attendance = new Attendance();
if (!empty($attendance_id)) {
$affected_rows = $attendance->attendance_delete($attendance_id);
}
if ($affected_rows) {
$message['message_attendance_delete'] = true;
}
@ -256,8 +263,8 @@ class AttendanceController
* It's used for controlling attendance sheet (list, add),
* render to attendance_sheet view
* @param string $action
* @param int $attendance_id
* @param int $student_id
* @param int $attendance_id
* @param int $student_id
* @param bool $edit
*/
public function attendance_sheet($action, $attendance_id, $student_id = 0, $edit = true)

@ -17,7 +17,7 @@ if (api_is_allowed_to_edit(null, true)) {
}
echo '<div class="actions">';
echo '<a href="index.php?'.api_get_cidreq().$param_gradebook.'&action=attendance_add">'.
Display::return_icon('new_attendance_list.png',get_lang('CreateANewAttendance'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('new_attendance_list.png', get_lang('CreateANewAttendance'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
}
$attendance = new Attendance();

@ -163,6 +163,7 @@ class CourseBuilder
}
}
}
// Once we've built the resources array a bit more, try to get items
// from the item_property table and order them in the "resources" array
foreach ($this->course->resources as $type => $resources) {
@ -173,7 +174,7 @@ class CourseBuilder
WHERE
c_id = $courseId AND
tool = '".$tool."' AND
ref='".$resource->get_id()."'";
ref = '".$resource->get_id()."'";
$res = Database::query($sql);
$all_properties = array();
while ($item_property = Database::fetch_array($res)) {
@ -276,7 +277,7 @@ class CourseBuilder
p.visibility != 2 AND
path NOT LIKE '/images/gallery%' AND
$avoid_paths AND
d.session_id = 0
(d.session_id = 0 OR d.session_id IS NULL)
ORDER BY path";
} else {
$sql = "SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size
@ -288,7 +289,7 @@ class CourseBuilder
tool = '".TOOL_DOCUMENT."' AND
p.visibility != 2 AND
$avoid_paths AND
d.session_id = 0
(d.session_id = 0 OR d.session_id IS NULL)
ORDER BY path";
}
@ -484,7 +485,7 @@ class CourseBuilder
p.ref=l.id AND
p.tool = '".TOOL_LINK."' AND
p.visibility != 2 AND
l.session_id = 0
(l.session_id = 0 OR l.session_id IS NULL)
ORDER BY l.display_order";
}
@ -536,7 +537,8 @@ class CourseBuilder
$with_base_content
);
$sql = "SELECT * FROM $table WHERE c_id = $courseId $sessionCondition";
$sql = "SELECT * FROM $table
WHERE c_id = $courseId $sessionCondition";
$db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result)) {
@ -609,7 +611,7 @@ class CourseBuilder
//select only quizzes with active = 0 or 1 (not -1 which is for deleted quizzes)
} else {
$sql = "SELECT * FROM $table_qui
WHERE c_id = $courseId AND active >=0 AND session_id = 0";
WHERE c_id = $courseId AND active >=0 AND (session_id = 0 OR session_id IS NULL)";
//select only quizzes with active = 0 or 1 (not -1 which is for deleted quizzes)
}
@ -933,7 +935,8 @@ class CourseBuilder
$with_base_content
);
$sql = 'SELECT * FROM '.$table_survey.' WHERE c_id = '.$courseId.' '.$sessionCondition;
$sql = 'SELECT * FROM '.$table_survey.'
WHERE c_id = '.$courseId.' '.$sessionCondition;
$db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result)) {
$survey = new Survey(
@ -1189,7 +1192,7 @@ class CourseBuilder
WHERE c_id = '.$courseId.' '.$session_condition;
} else {
$sql = 'SELECT * FROM '.$table_main.'
WHERE c_id = '.$courseId.' AND session_id = 0';
WHERE c_id = '.$courseId.' AND (session_id = 0 OR session_id IS NULL)';
}
if (!empty($id_list)) {
@ -1201,7 +1204,8 @@ class CourseBuilder
if ($db_result) {
while ($obj = Database::fetch_object($db_result)) {
$items = array();
$sql_items = "SELECT * FROM ".$table_item." WHERE c_id = '$courseId' AND lp_id = ".$obj->id;
$sql_items = "SELECT * FROM ".$table_item."
WHERE c_id = '$courseId' AND lp_id = ".$obj->id;
$db_items = Database::query($sql_items);
while ($obj_item = Database::fetch_object($db_items)) {
$item['id'] = $obj_item->id;
@ -1316,19 +1320,21 @@ class CourseBuilder
}
//@todo check this queries are the same ...
if (!empty($this->course->type) && $this->course->type == 'partial') {
$sql = 'SELECT * FROM '.$table_glossary.' g WHERE g.c_id = '.$courseId.' '.$session_condition;
$sql = 'SELECT * FROM '.$table_glossary.' g
WHERE g.c_id = '.$courseId.' '.$session_condition;
} else {
$sql = 'SELECT * FROM '.$table_glossary.' g WHERE g.c_id = '.$courseId.' '.$session_condition;
$sql = 'SELECT * FROM '.$table_glossary.' g
WHERE g.c_id = '.$courseId.' '.$session_condition;
}
} else {
$table_glossary = Database:: get_course_table(TABLE_GLOSSARY);
//@todo check this queries are the same ... ayayay
if (!empty($this->course->type) && $this->course->type == 'partial') {
$sql = 'SELECT * FROM '.$table_glossary.' g
WHERE g.c_id = '.$courseId.' AND session_id = 0';
WHERE g.c_id = '.$courseId.' AND (session_id = 0 OR session_id IS NULL)';
} else {
$sql = 'SELECT * FROM '.$table_glossary.' g
WHERE g.c_id = '.$courseId.' AND session_id = 0';
WHERE g.c_id = '.$courseId.' AND (session_id = 0 OR session_id IS NULL)';
}
}
$db_result = Database::query($sql);
@ -1415,7 +1421,7 @@ class CourseBuilder
} else {
$tbl_wiki = Database::get_course_table(TABLE_WIKI);
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$courseId.' AND session_id = 0';
WHERE c_id = '.$courseId.' AND (session_id = 0 OR session_id IS NULL)';
}
$db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result)) {
@ -1497,10 +1503,7 @@ class CourseBuilder
t.c_id = $courseId AND
tp.c_id = $courseId AND
thematic_id = {$row['id']} AND
tp.id IN (".implode(
', ',
$thematic_plan_id_list
).") ";
tp.id IN (".implode(', ', $thematic_plan_id_list).") ";
$result = Database::query($sql);
while ($sub_row = Database::fetch_array($result, 'ASSOC')) {

@ -46,9 +46,9 @@ class CourseRecycler
$this->type = $type;
$table_tool_intro = Database::get_course_table(TABLE_TOOL_INTRO);
$table_tool_intro = Database::get_course_table(TABLE_TOOL_INTRO);
$table_linked_resources = Database::get_course_table(TABLE_LINKED_RESOURCES);
$table_item_properties = Database::get_course_table(TABLE_ITEM_PROPERTY);
$table_item_properties = Database::get_course_table(TABLE_ITEM_PROPERTY);
$this->recycle_links();
$this->recycle_link_categories();
@ -116,9 +116,12 @@ class CourseRecycler
rmdirr($this->course->backup_path.'/'.$document->path);
}
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_DOCUMENT])));
$sql = "DELETE FROM $table WHERE c_id = ".$this->course_id." AND id IN(".$ids.")";
Database::query($sql);
$ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_DOCUMENT])));
if (!empty($ids)) {
$sql = "DELETE FROM $table
WHERE c_id = ".$this->course_id." AND id IN(".$ids.")";
Database::query($sql);
}
}
}
}
@ -129,19 +132,25 @@ class CourseRecycler
public function recycle_wiki()
{
if ($this->course->has_resources(RESOURCE_WIKI)) {
$table_wiki = Database::get_course_table(TABLE_WIKI);
$table_wiki_conf = Database::get_course_table(TABLE_WIKI_CONF);
$table_wiki = Database::get_course_table(TABLE_WIKI);
$table_wiki_conf = Database::get_course_table(TABLE_WIKI_CONF);
$pages = array();
foreach ($this->course->resources[RESOURCE_WIKI] as $resource) {
$pages[] = $resource->page_id;
}
$wiki_ids = implode(',', (array_keys($this->course->resources[RESOURCE_WIKI])));
$page_ids = implode(',', $pages);
$sql = "DELETE FROM ".$table_wiki." WHERE c_id = ".$this->course_id." AND id IN(".$wiki_ids.")";
Database::query($sql);
$sql = "DELETE FROM ".$table_wiki_conf." WHERE c_id = ".$this->course_id." AND page_id IN(".$page_ids.")";
Database::query($sql);
$wiki_ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_WIKI])));
if (!empty($wiki_ids)) {
$page_ids = implode(',', $pages);
$sql = "DELETE FROM ".$table_wiki."
WHERE c_id = ".$this->course_id." AND id IN(".$wiki_ids.")";
Database::query($sql);
$sql = "DELETE FROM ".$table_wiki_conf."
WHERE c_id = ".$this->course_id." AND page_id IN(".$page_ids.")";
Database::query($sql);
}
}
}
@ -152,9 +161,12 @@ class CourseRecycler
{
if ($this->course->has_resources(RESOURCE_GLOSSARY)) {
$table_glossary = Database::get_course_table(TABLE_GLOSSARY);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_GLOSSARY])));
$sql = "DELETE FROM ".$table_glossary." WHERE c_id = ".$this->course_id." AND glossary_id IN(".$ids.")";
Database::query($sql);
$ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_GLOSSARY])));
if (!empty($ids)) {
$sql = "DELETE FROM ".$table_glossary."
WHERE c_id = ".$this->course_id." AND glossary_id IN(".$ids.")";
Database::query($sql);
}
}
}
@ -165,9 +177,12 @@ class CourseRecycler
{
if ($this->course->has_resources(RESOURCE_LINK)) {
$table = Database :: get_course_table(TABLE_LINK);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_LINK])));
$sql = "DELETE FROM ".$table." WHERE c_id = ".$this->course_id." AND id IN(".$ids.")";
Database::query($sql);
$ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_LINK])));
if (!empty($ids)) {
$sql = "DELETE FROM $table
WHERE c_id = ".$this->course_id." AND id IN(".$ids.")";
Database::query($sql);
}
}
}
@ -210,14 +225,21 @@ class CourseRecycler
}
if ($this->course->has_resources(RESOURCE_FORUMCATEGORY)) {
$forum_ids = implode(',', (array_keys($this->course->resources[RESOURCE_FORUMCATEGORY])));
$sql = "DELETE FROM ".$table_category." WHERE c_id = ".$this->course_id." AND cat_id IN(".$forum_ids.");";
Database::query($sql);
$forum_ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_FORUMCATEGORY])));
if (!empty($forum_ids)) {
$sql = "DELETE FROM ".$table_category."
WHERE c_id = ".$this->course_id." AND cat_id IN(".$forum_ids.");";
Database::query($sql);
}
}
if ($this->course->has_resources(RESOURCE_FORUM)) {
$forum_ids = implode(',', (array_keys($this->course->resources[RESOURCE_FORUM])));
$forum_ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_FORUM])));
if (empty($forum_ids)) {
return false;
}
$sql = "DELETE FROM $table_attachment USING $table_attachment
INNER JOIN $table_post
@ -279,7 +301,6 @@ class CourseRecycler
WHERE c_id = ".$this->course_id." AND forum_id IN(".$forum_ids.")";
Database::query($sql);
}
}
/**
@ -331,19 +352,22 @@ class CourseRecycler
/**
* Delete events
*/
public function recycle_events() {
public function recycle_events()
{
if ($this->course->has_resources(RESOURCE_EVENT)) {
$table = Database :: get_course_table(TABLE_AGENDA);
$table_attachment = Database :: get_course_table(TABLE_AGENDA_ATTACHMENT);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_EVENT])));
$sql = "DELETE FROM ".$table."
WHERE c_id = ".$this->course_id." AND id IN(".$ids.")";
Database::query($sql);
$ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_EVENT])));
if (!empty($ids)) {
$sql = "DELETE FROM ".$table."
WHERE c_id = ".$this->course_id." AND id IN(".$ids.")";
Database::query($sql);
$sql = "DELETE FROM ".$table_attachment."
WHERE c_id = ".$this->course_id." AND agenda_id IN(".$ids.")";
Database::query($sql);
$sql = "DELETE FROM ".$table_attachment."
WHERE c_id = ".$this->course_id." AND agenda_id IN(".$ids.")";
Database::query($sql);
}
}
}
@ -356,14 +380,16 @@ class CourseRecycler
$table = Database :: get_course_table(TABLE_ANNOUNCEMENT);
$table_attachment = Database :: get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_ANNOUNCEMENT])));
$sql = "DELETE FROM ".$table."
WHERE c_id = ".$this->course_id." AND id IN(".$ids.")";
Database::query($sql);
$ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_ANNOUNCEMENT])));
if (!empty($ids)) {
$sql = "DELETE FROM ".$table."
WHERE c_id = ".$this->course_id." AND id IN(".$ids.")";
Database::query($sql);
$sql = "DELETE FROM ".$table_attachment."
WHERE c_id = ".$this->course_id." AND announcement_id IN(".$ids.")";
Database::query($sql);
$sql = "DELETE FROM ".$table_attachment."
WHERE c_id = ".$this->course_id." AND announcement_id IN(".$ids.")";
Database::query($sql);
}
}
}
@ -374,10 +400,11 @@ class CourseRecycler
public function recycle_quizzes()
{
if ($this->course->has_resources(RESOURCE_QUIZ)) {
$table_qui_que = Database :: get_course_table(TABLE_QUIZ_QUESTION);
$table_qui_ans = Database :: get_course_table(TABLE_QUIZ_ANSWER);
$table_qui = Database :: get_course_table(TABLE_QUIZ_TEST);
$table_rel = Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION);
$table_qui = Database :: get_course_table(TABLE_QUIZ_TEST);
$table_rel = Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION);
$table_qui_que_opt = Database :: get_course_table(TABLE_QUIZ_QUESTION_OPTION);
$table_qui_que_cat = Database :: get_course_table(TABLE_QUIZ_QUESTION_CATEGORY);
$table_qui_que_rel_cat = Database :: get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY);
@ -392,9 +419,11 @@ class CourseRecycler
if (!empty($ids)) {
// Deletion of the tests first. Questions in these tests are
// not deleted and become orphan at this point
$sql = "DELETE FROM ".$table_qui." WHERE c_id = ".$this->course_id." AND id IN(".$ids.")";
$sql = "DELETE FROM ".$table_qui."
WHERE c_id = ".$this->course_id." AND id IN(".$ids.")";
Database::query($sql);
$sql = "DELETE FROM ".$table_rel." WHERE c_id = ".$this->course_id." AND exercice_id IN(".$ids.")";
$sql = "DELETE FROM ".$table_rel."
WHERE c_id = ".$this->course_id." AND exercice_id IN(".$ids.")";
Database::query($sql);
}
@ -430,11 +459,14 @@ class CourseRecycler
$orphan_ids[] = $obj->id;
}
$orphan_ids = implode(',', $orphan_ids);
$sql = "DELETE FROM ".$table_rel." WHERE c_id = ".$this->course_id." AND question_id IN(".$orphan_ids.")";
$sql = "DELETE FROM ".$table_rel."
WHERE c_id = ".$this->course_id." AND question_id IN(".$orphan_ids.")";
Database::query($sql);
$sql = "DELETE FROM ".$table_qui_ans." WHERE c_id = ".$this->course_id." AND question_id IN(".$orphan_ids.")";
$sql = "DELETE FROM ".$table_qui_ans."
WHERE c_id = ".$this->course_id." AND question_id IN(".$orphan_ids.")";
Database::query($sql);
$sql = "DELETE FROM ".$table_qui_que." WHERE c_id = ".$this->course_id." AND id IN(".$orphan_ids.")";
$sql = "DELETE FROM ".$table_qui_que."
WHERE c_id = ".$this->course_id." AND id IN(".$orphan_ids.")";
Database::query($sql);
}
// Also delete questions categories and options
@ -445,6 +477,7 @@ class CourseRecycler
$sql = "DELETE FROM $table_qui_que_opt WHERE c_id = ".$this->course_id;
Database::query($sql);
}
// Quizzes previously deleted are, in fact, kept with a status
// (active field) of "-1". Delete those, now.
$sql = "DELETE FROM ".$table_qui." WHERE c_id = ".$this->course_id." AND active = -1";
@ -476,17 +509,29 @@ class CourseRecycler
$table_survey_q_o = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_survey_a = Database :: get_course_Table(TABLE_SURVEY_ANSWER);
$table_survey_i = Database :: get_course_table(TABLE_SURVEY_INVITATION);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_SURVEY])));
$sql = "DELETE FROM ".$table_survey_i." WHERE c_id = ".$this->course_id." ";
Database::query($sql);
$sql = "DELETE FROM ".$table_survey_a." WHERE c_id = ".$this->course_id." AND survey_id IN(".$ids.")";
Database::query($sql);
$sql = "DELETE FROM ".$table_survey_q_o." WHERE c_id = ".$this->course_id." AND survey_id IN(".$ids.")";
Database::query($sql);
$sql = "DELETE FROM ".$table_survey_q." WHERE c_id = ".$this->course_id." AND survey_id IN(".$ids.")";
Database::query($sql);
$sql = "DELETE FROM ".$table_survey." WHERE c_id = ".$this->course_id." AND survey_id IN(".$ids.")";
$sql = "DELETE FROM $table_survey_i
WHERE c_id = ".$this->course_id;
Database::query($sql);
$ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_SURVEY])));
if (!empty($ids)) {
$sql = "DELETE FROM $table_survey_a
WHERE c_id = ".$this->course_id." AND survey_id IN(".$ids.")";
Database::query($sql);
$sql = "DELETE FROM $table_survey_q_o
WHERE c_id = ".$this->course_id." AND survey_id IN(".$ids.")";
Database::query($sql);
$sql = "DELETE FROM $table_survey_q
WHERE c_id = ".$this->course_id." AND survey_id IN(".$ids.")";
Database::query($sql);
$sql = "DELETE FROM $table_survey
WHERE c_id = ".$this->course_id." AND survey_id IN(".$ids.")";
Database::query($sql);
}
}
}
@ -503,7 +548,7 @@ class CourseRecycler
$table_iv_int = Database::get_course_table(TABLE_LP_IV_INTERACTION);
$table_tool = Database::get_course_table(TABLE_TOOL_LIST);
foreach($this->course->resources[RESOURCE_LEARNPATH] as $id => $learnpath) {
foreach ($this->course->resources[RESOURCE_LEARNPATH] as $id => $learnpath) {
// See task #875.
if ($learnpath->lp_type == 2) {
// This is a learning path of SCORM type.
@ -518,9 +563,13 @@ class CourseRecycler
//remove links from course homepage
$sql = "DELETE FROM $table_tool
WHERE c_id = ".$this->course_id." AND link LIKE '%lp_controller.php%lp_id=$id%' AND image='scormbuilder.gif'";
WHERE
c_id = ".$this->course_id." AND
link LIKE '%lp_controller.php%lp_id=$id%' AND
image='scormbuilder.gif'";
Database::query($sql);
//remove elements from lp_* tables (from bottom-up) by removing interactions, then item_view, then views and items, then paths
//remove elements from lp_* tables (from bottom-up)
// by removing interactions, then item_view, then views and items, then paths
$sql_items = "SELECT id FROM $table_item
WHERE c_id = ".$this->course_id." AND lp_id=$id";
$res_items = Database::query($sql_items);
@ -560,9 +609,12 @@ class CourseRecycler
{
if ($this->course->has_resources(RESOURCE_COURSEDESCRIPTION)) {
$table = Database :: get_course_table(TABLE_COURSE_DESCRIPTION);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_COURSEDESCRIPTION])));
$sql = "DELETE FROM ".$table." WHERE c_id = ".$this->course_id." AND id IN(".$ids.")";
Database::query($sql);
$ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_COURSEDESCRIPTION])));
if (!empty($ids)) {
$sql = "DELETE FROM $table
WHERE c_id = ".$this->course_id." AND id IN(".$ids.")";
Database::query($sql);
}
}
}
@ -572,27 +624,60 @@ class CourseRecycler
public function recycle_thematic($session_id = 0)
{
if ($this->course->has_resources(RESOURCE_THEMATIC)) {
$table_thematic = Database :: get_course_table(TABLE_THEMATIC);
$table_thematic = Database :: get_course_table(TABLE_THEMATIC);
$table_thematic_advance = Database :: get_course_table(TABLE_THEMATIC_ADVANCE);
$table_thematic_plan = Database :: get_course_table(TABLE_THEMATIC_PLAN);
$table_thematic_plan = Database :: get_course_table(TABLE_THEMATIC_PLAN);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_THEMATIC] as $last_id => $thematic) {
if (is_numeric($last_id)) {
foreach($thematic->thematic_advance_list as $thematic_advance) {
$cond = array('id = ? AND c_id = ?'=>array($thematic_advance['id'], $this->course_id));
api_item_property_update($this->course_info, 'thematic_advance', $thematic_advance['id'],'ThematicAdvanceDeleted', api_get_user_id());
$cond = array(
'id = ? AND c_id = ?' => array(
$thematic_advance['id'],
$this->course_id,
),
);
api_item_property_update(
$this->course_info,
'thematic_advance',
$thematic_advance['id'],
'ThematicAdvanceDeleted',
api_get_user_id()
);
Database::delete($table_thematic_advance, $cond);
}
foreach($thematic->thematic_plan_list as $thematic_plan) {
$cond = array('id = ? AND c_id = ?'=>array($thematic_plan['id'], $this->course_id));
api_item_property_update($this->course_info, 'thematic_plan', $thematic_advance['id'], 'ThematicPlanDeleted', api_get_user_id());
$cond = array(
'id = ? AND c_id = ?' => array(
$thematic_plan['id'],
$this->course_id,
),
);
api_item_property_update(
$this->course_info,
'thematic_plan',
$thematic_advance['id'],
'ThematicPlanDeleted',
api_get_user_id()
);
Database::delete($table_thematic_plan, $cond);
}
$cond = array('id = ? AND c_id = ?'=>array($last_id, $this->course_id));
api_item_property_update($this->course_info, 'thematic', $last_id,'ThematicDeleted', api_get_user_id());
$cond = array(
'id = ? AND c_id = ?' => array(
$last_id,
$this->course_id,
),
);
api_item_property_update(
$this->course_info,
'thematic',
$last_id,
'ThematicDeleted',
api_get_user_id()
);
Database::delete($table_thematic,$cond);
}
}
@ -605,7 +690,7 @@ class CourseRecycler
public function recycle_attendance($session_id = 0)
{
if ($this->course->has_resources(RESOURCE_ATTENDANCE)) {
$table_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
$table_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
$table_attendance_calendar = Database :: get_course_table(TABLE_ATTENDANCE_CALENDAR);
$resources = $this->course->resources;
@ -617,7 +702,13 @@ class CourseRecycler
}
$cond = array('id = ? AND c_id = ?'=>array($last_id, $this->course_id));
Database::delete($table_attendance, $cond);
api_item_property_update($this->course_info, TOOL_ATTENDANCE, $last_id,'AttendanceDeleted', api_get_user_id());
api_item_property_update(
$this->course_info,
TOOL_ATTENDANCE,
$last_id,
'AttendanceDeleted',
api_get_user_id()
);
}
}
}

@ -78,6 +78,7 @@ class CourseRestorer
*
**/
public $add_text_in_items = false;
public $destination_course_id;
/**
* Create a new CourseRestorer
@ -149,7 +150,9 @@ class CourseRestorer
$this->destination_course_id = $course_info['real_id'];
//Getting first teacher (for the forums)
$teacher_list = CourseManager::get_teacher_list_from_course_code($course_info['code']);
$teacher_list = CourseManager::get_teacher_list_from_course_code(
$course_info['code']
);
$this->first_teacher_id = api_get_user_id();
if (!empty($teacher_list)) {
@ -194,48 +197,70 @@ class CourseRestorer
}
// Restore the item properties
$table = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$table = Database::get_course_table(TABLE_ITEM_PROPERTY);
foreach ($this->course->resources as $type => $resources) {
if (is_array($resources)) {
foreach ($resources as $id => $resource) {
foreach ($resource->item_properties as $property) {
// First check if there isn't already a record for this resource
$sql = "SELECT * FROM $table
WHERE
c_id = ".$this->destination_course_id." AND
tool = '".$property['tool']."' AND
ref = '".$resource->destination_id."'";
$params = [];
if (!empty($session_id)) {
$params['session_id'] = intval($session_id);
}
if (is_array($resources)) {
foreach ($resources as $id => $resource) {
if (isset($resource->item_properties)) {
foreach ($resource->item_properties as $property) {
// First check if there isn't already a record for this resource
$sql = "SELECT * FROM $table
WHERE
c_id = ".$this->destination_course_id." AND
tool = '".$property['tool']."' AND
ref = '".$resource->destination_id."'";
$res = Database::query($sql);
if (Database::num_rows($res) == 0) {
/* The to_group_id and to_user_id are set to default
values as users/groups possibly not exist in
the target course*/
$params['c_id'] = $this->destination_course_id;
$params['tool'] = self::DBUTF8($property['tool']);
$params['insert_user_id'] = self::DBUTF8($property['insert_user_id']);
$params['insert_date'] = self::DBUTF8($property['insert_date']);
$params['lastedit_date'] = self::DBUTF8($property['lastedit_date']);
$params['ref'] = $resource->destination_id;
$params['lastedit_type'] = self::DBUTF8($property['lastedit_type']);
$params['lastedit_user_id'] = self::DBUTF8($property['lastedit_user_id']);
$params['visibility'] = self::DBUTF8($property['visibility']);
$params['start_visible'] = self::DBUTF8($property['start_visible']);
$params['end_visible'] = self::DBUTF8($property['end_visible']);
$params['to_user_id'] = self::DBUTF8($property['to_user_id']);
//$params['to_group_id'] = 'NULL';
$id = Database::insert($table, $params);
if ($id) {
$sql = "UPDATE $table SET id = iid WHERE iid = $id";
Database::query($sql);
$params = [];
if (!empty($session_id)) {
$params['session_id'] = intval($session_id);
}
$res = Database::query($sql);
if (Database::num_rows($res) == 0) {
/* The to_group_id and to_user_id are set to default
values as users/groups possibly not exist in
the target course*/
$params['c_id'] = $this->destination_course_id;
$params['tool'] = self::DBUTF8(
$property['tool']
);
$params['insert_user_id'] = self::DBUTF8(
$property['insert_user_id']
);
$params['insert_date'] = self::DBUTF8(
$property['insert_date']
);
$params['lastedit_date'] = self::DBUTF8(
$property['lastedit_date']
);
$params['ref'] = $resource->destination_id;
$params['lastedit_type'] = self::DBUTF8(
$property['lastedit_type']
);
$params['lastedit_user_id'] = self::DBUTF8(
$property['lastedit_user_id']
);
$params['visibility'] = self::DBUTF8(
$property['visibility']
);
$params['start_visible'] = self::DBUTF8(
$property['start_visible']
);
$params['end_visible'] = self::DBUTF8(
$property['end_visible']
);
$params['to_user_id'] = self::DBUTF8(
$property['to_user_id']
);
//$params['to_group_id'] = 'NULL';
$id = Database::insert($table, $params);
if ($id) {
$sql = "UPDATE $table SET id = iid WHERE iid = $id";
Database::query($sql);
}
}
}
}
@ -868,7 +893,7 @@ class CourseRestorer
$params = [
'c_id' => $this->destination_course_id,
'path' => "/".self::DBUTF8escapestring(substr($new_file_name, 9)),
'path' => "/".self::DBUTF8("/".substr($document->path, 9)),
'comment'=> self::DBUTF8($document->comment),
'title' => self::DBUTF8($document->title),
'filetype' => self::DBUTF8($document->file_type),
@ -1087,7 +1112,7 @@ class CourseRestorer
}
}
if ($forum_cat && !$forum_cat->is_restored()) {
$title = $forum_cat->obj->cat_title;
/*$title = $forum_cat->obj->cat_title;
if (!empty($title)) {
if (!preg_match('/.*\((.+)\)$/', $title, $matches)) {
// This is for avoiding repetitive adding of training code after several backup/restore cycles.
@ -1095,7 +1120,7 @@ class CourseRestorer
$title = $title.' ('.$this->course->code.')';
}
}
}
}*/
$params = (array) $forum_cat->obj;
$params['c_id'] = $this->destination_course_id;
$params['cat_comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_course(
@ -1237,9 +1262,14 @@ class CourseRestorer
if ($this->course->has_resources(RESOURCE_LINK)) {
$link_table = Database :: get_course_table(TABLE_LINK);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_LINK] as $id => $link) {
$cat_id = $this->restore_link_category($link->category_id, $session_id);
$sql = "SELECT MAX(display_order) FROM $link_table
$cat_id = $this->restore_link_category(
$link->category_id,
$session_id
);
$sql = "SELECT MAX(display_order)
FROM $link_table
WHERE
c_id = ".$this->destination_course_id." AND
category_id='" . intval($cat_id). "'";
@ -1264,9 +1294,20 @@ class CourseRestorer
if ($id) {
$sql = "UPDATE $link_table SET id = iid WHERE iid = $id";
Database::query($sql);
}
$this->course->resources[RESOURCE_LINK][$id]->destination_id = $id;
api_item_property_update(
$this->destination_course_info,
TOOL_LINK,
$id,
'LinkAdded',
api_get_user_id()
);
if (!isset($this->course->resources[RESOURCE_LINK][$id])) {
$this->course->resources[RESOURCE_LINK][$id] = new stdClass();
}
$this->course->resources[RESOURCE_LINK][$id]->destination_id = $id;
}
}
}
}
@ -1304,6 +1345,7 @@ class CourseRestorer
if ($new_id) {
$sql = "UPDATE $link_cat_table SET id = iid WHERE iid = $new_id";
Database::query($sql);
api_set_default_visibility($new_id, TOOL_LINK_CATEGORY);
}
$this->course->resources[RESOURCE_LINKCATEGORY][$id]->destination_id = $new_id;
@ -1347,9 +1389,13 @@ class CourseRestorer
if ($id) {
$sql = "UPDATE $tool_intro_table SET id = iid WHERE iid = $id";
Database::query($sql);
}
$this->course->resources[RESOURCE_TOOL_INTRO][$id]->destination_id = $id;
if (!isset($this->course->resources[RESOURCE_TOOL_INTRO][$id])) {
$this->course->resources[RESOURCE_TOOL_INTRO][$id] = new stdClass();
}
$this->course->resources[RESOURCE_TOOL_INTRO][$id]->destination_id = $id;
}
}
}
}
@ -1387,11 +1433,15 @@ class CourseRestorer
if ($new_event_id) {
$sql = "UPDATE $table SET id = iid WHERE iid = $new_event_id";
Database::query($sql);
}
$this->course->resources[RESOURCE_EVENT][$id]->destination_id = $new_event_id;
if (!isset($this->course->resources[RESOURCE_EVENT][$id])) {
$this->course->resources[RESOURCE_EVENT][$id] = new stdClass();
}
$this->course->resources[RESOURCE_EVENT][$id]->destination_id = $new_event_id;
}
//Copy event attachment
// Copy event attachment
$origin_path = $this->course->backup_path.'/upload/calendar/';
$destination_path = api_get_path(SYS_COURSE_PATH).$this->course->destination_path.'/upload/calendar/';
@ -1493,9 +1543,12 @@ class CourseRestorer
if ($id) {
$sql = "UPDATE $table SET id = iid WHERE iid = $id";
Database::query($sql);
}
$this->course->resources[RESOURCE_COURSEDESCRIPTION][$id]->destination_id = $id;
if (!isset($this->course->resources[RESOURCE_COURSEDESCRIPTION][$id])) {
$this->course->resources[RESOURCE_COURSEDESCRIPTION][$id] = new stdClass();
}
$this->course->resources[RESOURCE_COURSEDESCRIPTION][$id]->destination_id = $id;
}
}
}
}
@ -1533,23 +1586,27 @@ class CourseRestorer
$new_announcement_id = Database::insert($table, $params);
if ($new_announcement_id) {
$sql = "UPDATE $table SET id = iid WHERE iid = $id";
$sql = "UPDATE $table SET id = iid WHERE iid = $new_announcement_id";
Database::query($sql);
}
$this->course->resources[RESOURCE_ANNOUNCEMENT][$id]->destination_id = $new_announcement_id;
if (!isset($this->course->resources[RESOURCE_ANNOUNCEMENT][$id])) {
$this->course->resources[RESOURCE_ANNOUNCEMENT][$id] = new stdClass();
}
$this->course->resources[RESOURCE_ANNOUNCEMENT][$id]->destination_id = $new_announcement_id;
}
$origin_path = $this->course->backup_path.'/upload/announcements/';
$destination_path = api_get_path(SYS_COURSE_PATH).$this->course->destination_path.'/upload/announcements/';
//Copy announcement attachment file
// Copy announcement attachment file
if (!empty($this->course->orig)) {
$table_attachment = Database :: get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
$table_attachment = Database::get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
$sql = 'SELECT path, comment, size, filename
FROM '.$table_attachment.'
WHERE c_id = '.$this->destination_course_id.' AND announcement_id = '.$id;
WHERE
c_id = '.$this->destination_course_id.' AND
announcement_id = '.$id;
$attachment_event = Database::query($sql);
$attachment_event = Database::fetch_object($attachment_event);
@ -1557,7 +1614,10 @@ class CourseRestorer
!is_dir($origin_path.$attachment_event->path)
) {
$new_filename = uniqid(''); //ass seen in the add_agenda_attachment_file() function in agenda.inc.php
$copy_result = copy($origin_path.$attachment_event->path, $destination_path.$new_filename);
$copy_result = copy(
$origin_path.$attachment_event->path,
$destination_path.$new_filename
);
if ($copy_result) {
$table_attachment = Database :: get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
@ -2400,7 +2460,7 @@ class CourseRestorer
'author' => self::DBUTF8($lp->author),
'preview_image' => self::DBUTF8($lp->preview_image),
'use_max_score' => self::DBUTF8($lp->use_max_score),
'autolaunch' => self::DBUTF8($lp->autolaunch),
'autolaunch' => self::DBUTF8(isset($lp->autolaunch) ? $lp->autolaunch : ''),
'created_on' => self::DBUTF8($lp->created_on),
'modified_on' => self::DBUTF8($lp->modified_on),
'publicated_on' => empty($lp->publicated_on) ? api_get_utc_datetime() : self::DBUTF8($lp->publicated_on),
@ -2767,8 +2827,6 @@ class CourseRestorer
foreach ($resources[RESOURCE_GLOSSARY] as $id => $glossary) {
$params = [];
$condition_session = "";
if (!empty($session_id)) {
$session_id = intval($session_id);
$params['session_id'] = $session_id;
@ -2790,6 +2848,10 @@ class CourseRestorer
$my_id = Database::insert($table_glossary, $params);
if ($my_id) {
$sql = "UPDATE $table_glossary SET glossary_id = iid WHERE iid = $my_id";
Database::query($sql);
api_item_property_update(
$this->destination_course_info,
TOOL_GLOSSARY,
@ -2797,6 +2859,11 @@ class CourseRestorer
"GlossaryAdded",
api_get_user_id()
);
if (!isset($this->course->resources[RESOURCE_GLOSSARY][$id])) {
$this->course->resources[RESOURCE_GLOSSARY][$id] = new stdClass();
}
$this->course->resources[RESOURCE_GLOSSARY][$id]->destination_id = $my_id;
}
}
@ -2845,12 +2912,13 @@ class CourseRestorer
$new_id = Database::insert($table_wiki, $params);
if ($new_id) {
$this->course->resources[RESOURCE_WIKI][$id]->destination_id = $new_id;
$sql = "UPDATE $table_wiki SET page_id = '$new_id'
WHERE c_id = ".$this->destination_course_id." AND id = '$new_id'";
$sql = "UPDATE $table_wiki SET page_id = '$new_id', id = iid
WHERE c_id = ".$this->destination_course_id." AND iid = '$new_id'";
Database::query($sql);
$this->course->resources[RESOURCE_WIKI][$id]->destination_id = $new_id;
// we also add an entry in wiki_conf
$params = [
'c_id' => $this->destination_course_id,
@ -2891,8 +2959,8 @@ class CourseRestorer
foreach ($resources[RESOURCE_THEMATIC] as $id => $thematic) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$thematic->content = DocumentManager::replace_urls_inside_content_html_from_copy_course(
$thematic->content,
$thematic->params['content'] = DocumentManager::replace_urls_inside_content_html_from_copy_course(
$thematic->params['content'],
$this->course->code,
$this->course->destination_path,
$this->course->backup_path,
@ -2901,9 +2969,10 @@ class CourseRestorer
$thematic->params['c_id'] = $this->destination_course_id;
unset($thematic->params['id']);
unset($thematic->params['iid']);
$last_id = Database::insert($table_thematic, $thematic->params, false);
if (is_numeric($last_id)) {
if ($last_id) {
$sql = "UPDATE $table_thematic SET id = iid WHERE iid = $last_id";
Database::query($sql);
@ -2922,9 +2991,13 @@ class CourseRestorer
$thematic_advance['attendance_id'] = 0;
$thematic_advance['thematic_id'] = $last_id;
$thematic_advance['c_id'] = $this->destination_course_id;
$my_id = Database::insert($table_thematic_advance, $thematic_advance, false);
$my_id = Database::insert(
$table_thematic_advance,
$thematic_advance,
false
);
if (is_numeric($my_id)) {
if ($my_id) {
$sql = "UPDATE $table_thematic_advance SET id = iid WHERE iid = $my_id";
Database::query($sql);
@ -2946,7 +3019,7 @@ class CourseRestorer
$thematic_plan['c_id'] = $this->destination_course_id;
$my_id = Database::insert($table_thematic_plan, $thematic_plan, false);
if (is_numeric($my_id)) {
if ($my_id) {
$sql = "UPDATE $table_thematic_plan SET id = iid WHERE iid = $my_id";
Database::query($sql);

@ -19,24 +19,24 @@ class CourseSelectForm
static function display_form($course, $hidden_fields = null, $avoid_serialize = false)
{
global $charset;
$resource_titles[RESOURCE_EVENT] = get_lang('Events');
$resource_titles[RESOURCE_ANNOUNCEMENT] = get_lang('Announcements');
$resource_titles[RESOURCE_DOCUMENT] = get_lang('Documents');
$resource_titles[RESOURCE_LINK] = get_lang('Links');
$resource_titles[RESOURCE_COURSEDESCRIPTION] = get_lang('CourseDescription');
$resource_titles[RESOURCE_FORUM] = get_lang('Forums');
$resource_titles[RESOURCE_FORUMCATEGORY] = get_lang('ForumCategory');
$resource_titles[RESOURCE_QUIZ] = get_lang('Tests');
$resource_titles[RESOURCE_TEST_CATEGORY] = get_lang('QuestionCategory');
$resource_titles[RESOURCE_LEARNPATH] = get_lang('ToolLearnpath');
$resource_titles[RESOURCE_SCORM] = 'SCORM';
$resource_titles[RESOURCE_TOOL_INTRO] = get_lang('ToolIntro');
$resource_titles[RESOURCE_SURVEY] = get_lang('Survey');
$resource_titles[RESOURCE_GLOSSARY] = get_lang('Glossary');
$resource_titles[RESOURCE_WIKI] = get_lang('Wiki');
$resource_titles[RESOURCE_THEMATIC] = get_lang('Thematic');
$resource_titles[RESOURCE_ATTENDANCE] = get_lang('Attendance');
$resource_titles[RESOURCE_WORK] = get_lang('ToolStudentPublication');
$resource_titles[RESOURCE_EVENT] = get_lang('Events');
$resource_titles[RESOURCE_ANNOUNCEMENT] = get_lang('Announcements');
$resource_titles[RESOURCE_DOCUMENT] = get_lang('Documents');
$resource_titles[RESOURCE_LINK] = get_lang('Links');
$resource_titles[RESOURCE_COURSEDESCRIPTION] = get_lang('CourseDescription');
$resource_titles[RESOURCE_FORUM] = get_lang('Forums');
$resource_titles[RESOURCE_FORUMCATEGORY] = get_lang('ForumCategory');
$resource_titles[RESOURCE_QUIZ] = get_lang('Tests');
$resource_titles[RESOURCE_TEST_CATEGORY] = get_lang('QuestionCategory');
$resource_titles[RESOURCE_LEARNPATH] = get_lang('ToolLearnpath');
$resource_titles[RESOURCE_SCORM] = 'SCORM';
$resource_titles[RESOURCE_TOOL_INTRO] = get_lang('ToolIntro');
$resource_titles[RESOURCE_SURVEY] = get_lang('Survey');
$resource_titles[RESOURCE_GLOSSARY] = get_lang('Glossary');
$resource_titles[RESOURCE_WIKI] = get_lang('Wiki');
$resource_titles[RESOURCE_THEMATIC] = get_lang('Thematic');
$resource_titles[RESOURCE_ATTENDANCE] = get_lang('Attendance');
$resource_titles[RESOURCE_WORK] = get_lang('ToolStudentPublication');
?>
<script>
function exp(item) {
@ -394,15 +394,13 @@ class CourseSelectForm
// Loading the results from the checkboxes of ethe javascript
$resource = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null;
$course_info = api_get_course_info($course_code);
$table_doc = Database::get_course_table(TABLE_DOCUMENT);
$table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY);
$course_id = $course_info['real_id'];
$course_info = api_get_course_info($course_code);
$table_doc = Database::get_course_table(TABLE_DOCUMENT);
$table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY);
$course_id = $course_info['real_id'];
/* Searching the documents resource that have been set to null because
$avoid_serialize is true in the display_form() function*/
if ($from == 'copy_course') {
if (is_array($resource)) {
$resource = array_keys($resource);
@ -420,13 +418,20 @@ class CourseSelectForm
WHERE
d.c_id = '.$course_id.' AND
p.c_id = '.$course_id.' AND
tool = \''.TOOL_DOCUMENT.'\' AND
p.ref = d.id AND p.visibility != 2 AND
d.id = '.$resource_item.$condition_session.'
tool = \''.TOOL_DOCUMENT.'\' AND
p.ref = d.id AND p.visibility != 2 AND
d.id = '.$resource_item.$condition_session.'
ORDER BY path';
$db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result)) {
$doc = new Document($obj->id, $obj->path, $obj->comment, $obj->title, $obj->filetype, $obj->size);
$doc = new Document(
$obj->id,
$obj->path,
$obj->comment,
$obj->title,
$obj->filetype,
$obj->size
);
if ($doc) {
$course->add_resource($doc);
// adding item property
@ -449,6 +454,7 @@ class CourseSelectForm
if (is_array($course->resources)) {
foreach ($course->resources as $type => $resources) {
switch ($type) {
case RESOURCE_SURVEYQUESTION:
foreach($resources as $id => $obj) {

@ -10,53 +10,63 @@ require_once 'Resource.class.php';
*/
class CalendarEvent extends Resource
{
/**
* The title
*/
public $title;
/**
* The content
*/
public $content;
/**
* The start date
*/
public $start_date;
/**
* The end date
*/
public $end_date;
/**
* The attachment path
*/
public $attachment_path;
/**
* The title
*/
public $title;
/**
* The content
*/
public $content;
/**
* The start date
*/
public $start_date;
/**
* The end date
*/
public $end_date;
/**
* The attachment path
*/
public $attachment_path;
/**
* The attachment filename
*/
public $attachment_filename;
/**
* The attachment size
*/
public $attachment_size;
/**
* The attachment filename
*/
public $attachment_filename;
/**
* The attachment size
*/
public $attachment_size;
/**
* The attachment comment
*/
public $attachment_comment;
/**
* The attachment comment
*/
public $attachment_comment;
/**
* Create a new Event
* @param int $id
* @param string $title
* @param string $content
* @param string $date
* @param string $hour
* @param int $duration
*/
function __construct($id, $title, $content, $start_date, $end_date, $attachment_path = null, $attachment_filename= null, $attachment_size= null, $attachment_comment= null, $all_day = 0)
{
/**
* Create a new Event
* @param int $id
* @param string $title
* @param string $content
* @param string $date
* @param string $hour
* @param int $duration
*/
public function __construct(
$id,
$title,
$content,
$start_date,
$end_date,
$attachment_path = null,
$attachment_filename = null,
$attachment_size = null,
$attachment_comment = null,
$all_day = 0
) {
parent::__construct($id, RESOURCE_EVENT);
$this->title = $title;
@ -71,11 +81,12 @@ class CalendarEvent extends Resource
$this->attachment_comment = $attachment_comment;
}
/**
* Show this Event
*/
function show() {
parent::show();
echo $this->title.' ('.$this->start_date.' -> '.$this->end_date.')';
}
/**
* Show this Event
*/
function show()
{
parent::show();
echo $this->title.' ('.$this->start_date.' -> '.$this->end_date.')';
}
}

@ -7,8 +7,7 @@
* @package chamilo.backup
*/
// Including the global initialization file
require '../inc/global.inc.php';
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_COURSE_MAINTENANCE;
api_protect_course_script(true);
@ -71,7 +70,9 @@ if (Security::check_token('post') && (
$delete_file = false;
} else {
if ($_FILES['backup']['error'] == 0) {
$filename = CourseArchiver::import_uploaded_file($_FILES['backup']['tmp_name']);
$filename = CourseArchiver::import_uploaded_file(
$_FILES['backup']['tmp_name']
);
if ($filename === false) {
$error = true;
} else {

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Delete resources from a course.
*

@ -17,9 +17,9 @@ require_once 'dropbox_functions.inc.php';
$course_id = api_get_course_int_id();
$user_id = api_get_user_id();
if (isset($_GET['cat_id']) AND
is_numeric($_GET['cat_id']) AND
$_GET['action'] == 'downloadcategory' AND
if (isset($_GET['cat_id']) &&
is_numeric($_GET['cat_id']) &&
$_GET['action'] == 'downloadcategory' &&
isset($_GET['sent_received'])
) {
/** step 1: constructing the sql statement.
@ -69,9 +69,7 @@ if (isset($_GET['cat_id']) AND
// Check if the id makes sense
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
Display::display_header($nameTools, 'Dropbox');
Display :: display_error_message(get_lang('Error'));
Display::display_footer();
api_not_allowed(true);
exit;
}
@ -84,9 +82,13 @@ if (user_can_download_file($_GET['id'], api_get_user_id())) {
/* ERROR IF NOT ALLOWED TO DOWNLOAD */
if (!$allowed_to_download) {
Display::display_header($nameTools, 'Dropbox');
Display::display_error_message(get_lang('YouAreNotAllowedToDownloadThisFile'));
Display::display_footer();
api_not_allowed(
true,
Display::return_message(
get_lang('YouAreNotAllowedToDownloadThisFile'),
'error'
)
);
exit;
} else {
/* DOWNLOAD THE FILE */
@ -100,50 +102,8 @@ if (!$allowed_to_download) {
exit;
}
$file = $work->title;
$mimetype = DocumentManager::file_get_mime_type(true);
$fileinfo = pathinfo($file);
$extension = $fileinfo['extension'];
if (!empty($extension) && isset($mimetype[$extension]) && $_GET['action'] != 'download') {
// give hint to browser about filetype
header( 'Content-type: ' . $mimetype[$extension] . "\n");
} else {
//no information about filetype: force a download dialog window in browser
header( "Content-type: application/octet-stream\n");
}
header('Content-Disposition: attachment; filename='.$file);
/**
* Note that if you use these two headers from a previous example:
* header('Cache-Control: no-cache, must-revalidate');
* header('Pragma: no-cache');
* before sending a file to the browser, the "Open" option on Internet Explorer's file download dialog will not work properly. If the user clicks "Open" instead of "Save," the target application will open an empty file, because the downloaded file was not cached. The user will have to save the file to their hard drive in order to use it.
* Make sure to leave these headers out if you'd like your visitors to be able to use IE's "Open" option.
*/
header("Pragma: \n");
header("Cache-Control: \n");
header("Cache-Control: public\n"); // IE cannot download from sessions without a cache
/*if (isset($_SERVER['HTTPS'])) {
/**
* We need to set the following headers to make downloads work using IE in HTTPS mode.
*
//header('Pragma: ');
//header('Cache-Control: ');
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT\n");
header("Last-Modified: " . gmdate( "D, d M Y H:i:s") . " GMT\n");
header("Cache-Control: no-store, no-cache, must-revalidate\n"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0\n", false);
}*/
header('Content-Description: '.trim(htmlentities($file)));
header('Content-transfer-encoding: binary');
header("Content-Length: " . filesize($path)."\n" );
$fp = fopen( $path, 'rb');
fpassthru($fp);
exit();
DocumentManager::file_send_for_download($path, true, $file);
exit;
}
//@todo clean this file the code below is useless there are 2 exits in previous conditions ... maybe a bad copy/paste/merge?
exit;

@ -570,16 +570,34 @@ function display_add_form($dropbox_unid, $viewReceivedCategory, $viewSentCategor
);
}
$hideCoach = api_get_setting('dropbox_hide_course_coach');
$complete_user_list2 = CourseManager::get_coach_list_from_course_code(
$course_info['code'],
api_get_session_id()
);
if ($hideCoach !== 'true') {
$complete_user_list2 = CourseManager::get_coach_list_from_course_code(
$course_info['code'],
api_get_session_id()
$generalCoachList = array();
$courseCoachList = array();
foreach ($complete_user_list2 as $coach) {
if ($coach['type'] == 'general_coach') {
$generalCoachList[] = $coach;
} else {
$courseCoachList[] = $coach;
}
}
$hideCourseCoach = api_get_setting('dropbox_hide_course_coach');
if ($hideCourseCoach == 'false') {
$complete_user_list_for_dropbox = array_merge(
$complete_user_list_for_dropbox,
$courseCoachList
);
}
$hideGeneralCoach = api_get_setting('dropbox_hide_general_coach');
if ($hideGeneralCoach == 'false') {
$complete_user_list_for_dropbox = array_merge(
$complete_user_list_for_dropbox,
$complete_user_list2
$generalCoachList
);
}
} else {

@ -346,7 +346,7 @@ if ($action != 'add') {
}
$column_show[] = 0;
// Here we change the way how the colums are going to be sort
// Here we change the way how the columns are going to be sort
// in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate
// because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48"
@ -366,26 +366,29 @@ if ($action != 'add') {
// New icon
$new_icon = '';
if ($dropbox_file->last_upload_date > $last_access AND !in_array($dropbox_file->id, $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX])) {
if ($dropbox_file->last_upload_date > $last_access &&
!in_array($dropbox_file->id, $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX])
) {
$new_icon = '&nbsp;'.Display::return_icon('new_dropbox_message.png', get_lang('New'),'',ICON_SIZE_SMALL);
}
$link_open = '<a href="dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">';
$dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>';
$dropbox_file_data[] = '<a href="dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'.Display::return_icon('save.png', get_lang('Download'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a>'.$new_icon.'<br />'.$dropbox_file->description;
$dropbox_file_data[] = '<a href="dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'.
Display::return_icon('save.png', get_lang('Download'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a>'.$new_icon.'<br />'.$dropbox_file->description;
$file_size = $dropbox_file->filesize;
$dropbox_file_data[] = format_file_size($file_size);
$dropbox_file_data[] = $dropbox_file->author;
//$dropbox_file_data[] = $dropbox_file->description;
$last_upload_date = api_get_local_time($dropbox_file->last_upload_date);
$dropbox_file_data[] = date_to_str_ago($last_upload_date).'<br /><span class="dropbox_date">'.api_format_date($last_upload_date).'</span>';
$dropbox_file_data[] = date_to_str_ago($last_upload_date).'<br /><span class="dropbox_date">'.
api_format_date($last_upload_date).'</span>';
$action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').'
<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a>
<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movereceived&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a>
<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'.
Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a>
<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movereceived&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a>
<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'.
Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
// This is a hack to have an additional row in a sortable table
@ -433,7 +436,11 @@ if ($action != 'add') {
}
// Displaying the table
$additional_get_parameters = array('view' => $view, 'view_received_category' => $viewReceivedCategory, 'view_sent_category' => $viewSentCategory);
$additional_get_parameters = array(
'view' => $view,
'view_received_category' => $viewReceivedCategory,
'view_sent_category' => $viewSentCategory,
);
$selectlist = array(
'delete_received' => get_lang('Delete'),
'download_received' => get_lang('Download')
@ -534,7 +541,8 @@ if ($action != 'add') {
$dropbox_file_data[] = $dropbox_file->id;
$link_open = '<a href="dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">';
$dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>';
$dropbox_file_data[] = '<a href="dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'.Display::return_icon('save.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a><br />'.$dropbox_file->description;
$dropbox_file_data[] = '<a href="dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'.
Display::return_icon('save.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a><br />'.$dropbox_file->description;
$file_size = $dropbox_file->filesize;
$dropbox_file_data[] = format_file_size($file_size);
$receivers_celldata = null;
@ -551,9 +559,9 @@ if ($action != 'add') {
$receivers_celldata = '';
$action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').'
<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a>
<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movesent&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a>
<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a>
<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movesent&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a>
<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
// This is a hack to have an additional row in a sortable table
if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) {
$action_icons .= "</td></tr>\n"; // ending the normal row of the sortable table
@ -620,7 +628,8 @@ if ($action != 'add') {
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
$selectlist = array('download_received' => get_lang('Download'));
}
echo '<div class="files-table">';
echo '<div class="files-table">';
Display::display_sortable_config_table(
'dropbox',
$column_header,
@ -632,7 +641,7 @@ if ($action != 'add') {
$column_order,
$selectlist
);
echo '</div>';
echo '</div>';
}
}

@ -733,14 +733,12 @@ class ScormAnswerHotspot extends Answer
{
$s="<tr>
<td valign='top' colspan='2'>&nbsp;";
$questionName=text_filter($questionName);
$s.=$questionName;
$s.="</td>
</tr>
<tr>
<td valign='top' colspan='2'>
<i>";
$questionDescription=text_filter($questionDescription);
$s.=$questionDescription;
$s.="</i>
</td>

@ -20,8 +20,14 @@ if (!$result) {
api_not_allowed(true);
}
$interbreadcrumb[] = array ("url" => "exercise.php?gradebook=$gradebook", "name" => get_lang('Exercises'));
$interbreadcrumb[] = array ("url" => "admin.php?exerciseId=$exercise_id","name" => $objExercise->name);
$interbreadcrumb[] = array(
"url" => "exercise.php?".api_get_cidreq(),
"name" => get_lang('Exercises'),
);
$interbreadcrumb[] = array(
"url" => "admin.php?exerciseId=$exercise_id&".api_get_cidreq(),
"name" => $objExercise->name,
);
//Add the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
@ -32,32 +38,50 @@ Display::display_header(get_lang('StudentsWhoAreTakingTheExerciseRightNow'));
//jqgrid will use this URL to do the selects
$minutes = 60;
$url = api_get_path(WEB_AJAX_PATH).'exercise.ajax.php?a=get_live_stats&exercise_id='.$objExercise->id.'&minutes='.$minutes;
$url = api_get_path(WEB_AJAX_PATH).'exercise.ajax.php?a=get_live_stats&exercise_id='.$objExercise->id.'&minutes='.$minutes;
//The order is important you need to check the the $column variable in the model.ajax.php file
$columns = array(get_lang('FirstName'), get_lang('LastName'), get_lang('Time'), get_lang('QuestionsAlreadyAnswered'), get_lang('Score'));
//Column config
$column_model = array(
array('name'=>'firstname', 'index'=>'firstname', 'width'=>'100', 'align'=>'left'),
array('name'=>'lastname', 'index'=>'lastname', 'width'=>'100', 'align'=>'left'),
array('name'=>'start_date', 'index'=>'start_date', 'width'=>'100', 'align'=>'left'),
array('name'=>'question', 'index'=>'count_questions', 'width'=>'60', 'align'=>'left', 'sortable'=>'false'),
array('name'=>'score', 'index'=>'score', 'width'=>'50', 'align'=>'left','sortable'=>'false'),
);
$column_model = array(
array(
'name' => 'firstname',
'index' => 'firstname',
'width' => '100',
'align' => 'left',
),
array(
'name' => 'lastname',
'index' => 'lastname',
'width' => '100',
'align' => 'left',
),
array(
'name' => 'start_date',
'index' => 'start_date',
'width' => '100',
'align' => 'left',
),
array(
'name' => 'question',
'index' => 'count_questions',
'width' => '60',
'align' => 'left',
'sortable' => 'false',
),
array(
'name' => 'score',
'index' => 'score',
'width' => '50',
'align' => 'left',
'sortable' => 'false',
),
);
//Autowidth
$extra_params['autowidth'] = 'true';
//height auto
$extra_params['height'] = 'auto';
/*
//With this function we can add actions to the jgrid (edit, delete, etc)
$action_links = 'function action_formatter(cellvalue, options, rowObject) {
return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
'&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?action=copy&id=\'+options.rowId+\'">'.Display::return_icon('copy.png',get_lang('Copy'),'',ICON_SIZE_SMALL).'</a>'.
'&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
'\';
}';
*/
?>
<script>
@ -80,8 +104,6 @@ $actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']
Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
echo $actions = Display::div($actions, array('class'=> 'actions'));
//echo Display::page_header($objExercise->name);
//echo Display::page_header(get_lang('StudentsWhoAreTakingTheExerciseRightNow'));
echo Display::grid_html('live_stats');
Display::display_footer();

@ -204,7 +204,7 @@ abstract class Question
*/
public function selectDescription()
{
$this->description = text_filter($this->description);
$this->description = $this->description;
return $this->description;
}

@ -53,7 +53,10 @@ $nameTools = get_lang('QuestionPool');
$interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises'));
if (!empty($objExercise)) {
$interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$objExercise->id, "name" => $objExercise->name);
$interbreadcrumb[] = array(
"url" => "admin.php?exerciseId=".$objExercise->id."&".api_get_cidreq(),
"name" => $objExercise->name
);
}
// message to be displayed if actions successful

@ -54,8 +54,11 @@ if (!$is_allowedToEdit) {
}
if ($show_headers) {
$interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises'));
$interbreadcrumb[] = array("url" => "#","name" => get_lang('Result'));
$interbreadcrumb[] = array(
"url" => "exercise.php?".api_get_cidreq(),
"name" => get_lang('Exercises'),
);
$interbreadcrumb[] = array("url" => "#", "name" => get_lang('Result'));
$this_section = SECTION_COURSES;
Display::display_header();
} else {

@ -276,7 +276,6 @@ foreach ($data as $row_table) {
}
$content .= $table->toHtml();
$interbreadcrumb[] = array("url" => "exercise.php?gradebook=$gradebook&".api_get_cidreq(), "name" => get_lang('Exercises'));
$interbreadcrumb[] = array("url" => "admin.php?exerciseId=$exercise_id&".api_get_cidreq(), "name" => $objExercise->name);

@ -47,10 +47,7 @@ if (isset($_GET['origin'])) {
}
/* MAIN DISPLAY SECTION */
/* Retrieving forum and forum category information */
$current_forum = get_forum_information($_GET['forum']); // Note: This has to be validated that it is an existing forum.
$current_forum = get_forum_information($_GET['forum']);
$current_forum_category = get_forumcategory_information($current_forum['forum_category']);
/* Breadcrumbs */

@ -1,40 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>LaTeX Code</title>
</head>
<body>
<?php // $Id: latex.php,v 1.1 2006/04/05 07:18:46 pcool Exp $
/* For licensing terms, see /license.txt */
/* INIT SECTION */
include '../inc/global.inc.php';
/* FUNCTIONS */
// put your functions here
// if the list gets large, divide them into different sections:
// display functions, tool logic functions, database functions
// try to place your functions into an API library or separate functions file - it helps reuse
/* MAIN CODE */
$code = Security::remove_XSS($_GET['code']);
echo '<div id="latex_code">';
echo '<h3>'.get_lang('LatexCode').'</h3>';
echo stripslashes($code);
echo '</div>';
echo '<div id="latex_image">';
echo '<h3>'.get_lang('LatexFormula').'</h3>';
echo '<img src="'.api_get_path(WEB_COURSE_PATH).$_course['path'].'/temp/'.$code.'" alt="'.get_lang('LatexCode').'"/>';
echo '</div>';
/* FOOTER */
?>
</body>
</html>

@ -20,23 +20,26 @@ interface SmsPluginLibraryInterface
/**
* @param array $additionalParameters
*
* @return mixed
*/
public function send($additionalParameters);
/**
* @param array $additionalParameters
*
* @return mixed
*/
public function getSms($additionalParameters);
/**
* buildSms (builds an SMS from a template and data)
* @param object ClockworksmsPlugin object
* @param object Template object
* @param string Template file name
* @param string Text key from lang file
* @param array Data to fill message variables (if any)
* @param object $plugin ClockworksmsPlugin object
* @param object $tpl Template object
* @param string $templateName Template file name
* @param string $messageKey Text key from lang file
* @param array $parameters Data to fill message variables (if any)
*
* @return object Template object with message property updated
*/
public function buildSms($plugin, $tpl, $templateName, $messageKey, $parameters = null);

@ -2493,10 +2493,15 @@ class Agenda
GroupManager::user_has_access(api_get_user_id(), api_get_group_id(), GroupManager::GROUP_TOOL_CALENDAR) &&
GroupManager::is_tutor_of_group(api_get_user_id(), api_get_group_id())
) {
$actionsLeft .= "<a href='".api_get_path(WEB_CODE_PATH)."calendar/agenda.php?".api_get_cidreq()."&action=add&type=course'>".
Display::return_icon('new_event.png', get_lang('AgendaAdd'), '', ICON_SIZE_MEDIUM)."</a>";
$actionsLeft .= "<a href='".api_get_path(WEB_CODE_PATH)."calendar/agenda.php?".api_get_cidreq()."&action=importical&type=course'>".
Display::return_icon('import_calendar.png', get_lang('ICalFileImport'), '', ICON_SIZE_MEDIUM)."</a>";
$actionsLeft .= Display::url(
Display::return_icon('new_event.png', get_lang('AgendaAdd'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH)."calendar/agenda.php?".api_get_cidreq()."&action=add&type=".$this->type
);
$actionsLeft .= Display::url(
Display::return_icon('import_calendar.png', get_lang('ICalFileImport'), '', ICON_SIZE_MEDIUM),
api_get_path(WEB_CODE_PATH)."calendar/agenda.php?".api_get_cidreq()."&action=importical&type=".$this->type
);
if ($this->type == 'course') {

@ -198,7 +198,7 @@ class Attendance
Display::return_icon('invisible.png', get_lang('Show'), array(), ICON_SIZE_SMALL).'</a>';
$attendance[2] = '<span class="muted">'.$attendance[2].'</span>';
}
if ($allowDelete) {
if ($allowDelete === 'true') {
$actions .= '<a href="index.php?' . api_get_cidreq() . '&action=attendance_delete&attendance_id=' . $attendance[0] . $param_gradebook . '">' .
Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
}
@ -487,6 +487,7 @@ class Attendance
$tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
$user_id = api_get_user_id();
$course_id = $_course['real_id'];
if (is_array($attendance_id)) {
foreach ($attendance_id as $id) {
$id = intval($id);
@ -506,9 +507,10 @@ class Attendance
}
}
} else {
$attendance_id = intval($attendance_id);
$attendance_id= intval($attendance_id);
$sql = "UPDATE $tbl_attendance SET active = 2
WHERE c_id = $course_id AND id = '$attendance_id'";
$result = Database::query($sql);
$affected_rows = Database::affected_rows($result);
if (!empty($affected_rows)) {

@ -5594,7 +5594,7 @@ class CourseManager
$current_url_id = api_get_current_access_url_id();
// Get course list auto-register
$special_course_list = self::get_special_course_list();
$special_course_list = self::get_special_course_list();
$without_special_courses = '';
if (!empty($special_course_list)) {
@ -5604,13 +5604,16 @@ class CourseManager
//AND course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
$sql = "SELECT course.id, course.title, course.code, course.subscribe subscr, course.unsubscribe unsubscr, course_rel_user.status status,
course_rel_user.sort sort, course_rel_user.user_course_cat user_course_cat
FROM $TABLECOURS course,
$TABLECOURSUSER course_rel_user, ".$TABLE_ACCESS_URL_REL_COURSE." url
WHERE course.id=".intval($courseId)."
AND course.id = course_rel_user.c_id
AND url.c_id = course.id
AND course_rel_user.user_id = ".intval($user_id)."
$without_special_courses ";
FROM
$TABLECOURS course,
$TABLECOURSUSER course_rel_user, ".$TABLE_ACCESS_URL_REL_COURSE." url
WHERE
course.id=".intval($courseId)." AND
course.id = course_rel_user.c_id AND
url.c_id = course.id AND
course_rel_user.user_id = ".intval($user_id)."
$without_special_courses
";
// If multiple URL access mode is enabled, only fetch courses
// corresponding to the current URL.
@ -5622,7 +5625,8 @@ class CourseManager
$result = Database::query($sql);
// Browse through all courses. We can only have one course because of the course.id=".intval($courseId) in sql query
// Browse through all courses. We can only have one course because
// of the course.id=".intval($courseId) in sql query
$course = Database::fetch_array($result);
$course_info = api_get_course_info($course['code']);
//$course['id_session'] = null;
@ -5631,10 +5635,15 @@ class CourseManager
// For each course, get if there is any notification icon to show
// (something that would have changed since the user's last visit).
$show_notification = Display :: show_notification($course_info);
$show_notification = Display::show_notification($course_info);
// New code displaying the user's status in respect to this course.
$status_icon = Display::return_icon('blackboard.png', $course_info['title'], array(), ICON_SIZE_LARGE);
$status_icon = Display::return_icon(
'blackboard.png',
$course_info['title'],
array(),
ICON_SIZE_LARGE
);
$params = array();
$params['right_actions'] = '';

@ -1268,8 +1268,7 @@ class Display
foreach($rows as $content) {
$table->setCellContents($row, $column, $content);
$row++;
//$column++;
}
}
}
return $table->toHtml();
}
@ -1341,8 +1340,9 @@ class Display
tet.to_group_id group_id,
ctt.image image,
ctt.link link
FROM $tool_edit_table tet INNER JOIN $course_tool_table ctt
ON tet.c_id = ctt.c_id
FROM $tool_edit_table tet
INNER JOIN $course_tool_table ctt
ON tet.c_id = ctt.c_id
WHERE
tet.c_id = $course_id AND
tet.lastedit_date > '$oldestTrackDate' ".
@ -1358,7 +1358,7 @@ class Display
$group_ids[] = 0; //add group 'everyone'
$notifications = array();
// Filter all last edits of all tools of the course
while ($res && ($item_property = Database::fetch_array($res))) {
while ($res && ($item_property = Database::fetch_array($res, 'ASSOC'))) {
// First thing to check is if the user never entered the tool
// or if his last visit was earlier than the last modification.
@ -1390,6 +1390,7 @@ class Display
) {
continue;
}
// If it's a survey, make sure the user's invited. Otherwise drop it.
if ($item_property['tool'] == TOOL_SURVEY) {
$survey_info = SurveyManager::get_survey($item_property['ref'], 0, $course_code);
@ -1403,13 +1404,21 @@ class Display
}
}
}
// If it's a learning path, ensure it is currently visible to the user
if ($item_property['tool'] == TOOL_LEARNPATH) {
if (!learnpath::is_lp_visible_for_student($item_property['ref'], $user_id, $course_code)) {
continue;
}
}
if ($item_property['tool'] == 'work' && $item_property['type'] == 'DirectoryCreated') {
if ($item_property['tool'] == TOOL_DROPBOX) {
$item_property['link'] = 'dropbox/dropbox_download.php?id='.$item_property['ref'];
}
if ($item_property['tool'] == 'work' &&
$item_property['type'] == 'DirectoryCreated'
) {
$item_property['lastedit_type'] = 'WorkAdded';
}
$notifications[$item_property['tool']] = $item_property;
@ -1417,16 +1426,28 @@ class Display
}
// Show all tool icons where there is something new.
$retvalue = '&nbsp;';
while (list($key, $notification) = each($notifications)) {
$return = '&nbsp;';
foreach($notifications as $notification) {
$lastDate = date('d/m/Y H:i', convert_sql_date($notification['lastedit_date']));
$type = $notification['lastedit_type'];
$label = get_lang('TitleNotification').": ".get_lang($type)." ($lastDate)";
$retvalue .= '<a href="'.api_get_path(WEB_CODE_PATH).$notification['link'].'?cidReq='.$course_code.'&ref='.$notification['ref'].'&gidReq='.$notification['to_group_id'].'&id_session='.$sessionId.'">'.
Display::return_icon($notification['image'], $label).'</a>&nbsp;';
if (strpos($notification['link'], '?') === false) {
$notification['link'] = $notification['link'].'?notification=1';
} else {
$notification['link'] = $notification['link'].'&notification=1';
}
$return .= Display::url(
Display::return_icon($notification['image'], $label),
api_get_path(WEB_CODE_PATH).
$notification['link'].'&cidReq='.$course_code.
'&ref='.$notification['ref'].
'&gidReq='.$notification['to_group_id'].
'&id_session='.$sessionId
).'&nbsp;';
}
return $retvalue;
return $return;
}
/**

@ -62,30 +62,34 @@ class DateRangePicker extends HTML_QuickForm_text
}
$minDate = null;
if (!empty($this->getAttribute('minDate'))) {
$minDateValue = $this->getAttribute('minDate');
if (!empty($minDateValue)) {
$minDate = "
minDate: '{$this->getAttribute('minDate')}',
minDate: '{$minDateValue}',
";
}
$maxDate = null;
if (!empty($this->getAttribute('maxDate'))) {
$maxDateValue = $this->getAttribute('maxDate');
if (!empty($maxDateValue)) {
$maxDate = "
maxDate: '{$this->getAttribute('maxDate')}',
maxDate: '{$maxDateValue}',
";
}
$format = 'YYYY-MM-DD HH:mm';
if (!empty($this->getAttribute('format'))) {
$format = $this->getAttribute('format');
$formatValue = $this->getAttribute('format');
if (!empty($formatValue)) {
$format = $formatValue;
}
$timePicker = 'true';
if (!empty($this->getAttribute('timePicker'))) {
$timePicker = $this->getAttribute('timePicker');
$timePickerValue = $this->getAttribute('timePicker');
if (!empty($timePickerValue)) {
$timePicker = $timePickerValue;
}
//timeFormat: 'hh:mm'
// timeFormat: 'hh:mm'
$js .= "<script>
$(function() {
$('#$id').daterangepicker({

@ -1575,7 +1575,7 @@ class Link extends Model
// Validation when belongs to a session
$showChildren = $categoryId == $myrow['id'] || $show == 'all';
$session_img = api_get_session_image($myrow['session_id'], $_user['status']);
$myrow['description'] = text_filter($myrow['description']);
$myrow['description'] = $myrow['description'];
$strVisibility = '';
$visibilityClass = null;

@ -19,6 +19,12 @@ class Nanogong
public $store_path;
public $params;
public $can_edit = false;
public $course_id;
public $session_id;
public $exercise_id;
public $question_id;
public $user_id;
public $course_info;
/* Files allowed to upload */
public $available_extensions = array('mp3', 'wav', 'ogg');
@ -113,7 +119,7 @@ class Nanogong
$this->question_id = 0;
}
$this->can_edit = false;
$this->can_edit = false;
if (api_is_allowed_to_edit()) {
$this->can_edit = true;
@ -123,7 +129,7 @@ class Nanogong
}
}
//Settings the params array
// Settings the params array
$this->params = $params;
$this->store_path = api_get_path(SYS_COURSE_PATH).$this->course_info['path'].'/exercises/';
$this->create_user_folder();

@ -53,7 +53,9 @@ class SubLanguageManager
{
$table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
$sql = 'SELECT * FROM ' . $table . '
WHERE parent_id= ' . intval($parent_id) . ' AND id= ' . intval($sub_language_id) . '';
WHERE
parent_id= ' . intval($parent_id).' AND
id= ' . intval($sub_language_id) . '';
$rs = Database::query($sql);
$all_information = array();
while ($row = Database::fetch_array($rs, 'ASSOC')) {
@ -173,7 +175,11 @@ class SubLanguageManager
*/
public static function remove_sub_language($parent_id, $sub_language_id)
{
if (empty($parent_id) or (intval($parent_id) != $parent_id) or empty($sub_language_id) or (intval($sub_language_id) != $sub_language_id)) {
if (empty($parent_id) ||
(intval($parent_id) != $parent_id) ||
empty($sub_language_id) ||
(intval($sub_language_id) != $sub_language_id)
) {
return false;
}
$table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
@ -189,7 +195,7 @@ class SubLanguageManager
return false;
} //can't delete dir, so do not delete language record
$sql = 'DELETE FROM ' . $table . '
WHERE id= ' . intval($sub_language_id) . ' ';
WHERE id= ' . intval($sub_language_id);
$res = Database::query($sql);
return $res;

@ -622,138 +622,6 @@ function _split_str_by_whitespace( $string, $goal ) {
return $chunks;
}
/**
* @desc This function does some parsing on the text that gets inputted. This parsing can be of any kind
* LaTeX notation, Word Censoring, Glossary Terminology (extension will available soon), Musical Notations, ...
* The inspiration for this filter function came from Moodle an phpBB who both use a similar approach.
* <code>[tex]\sqrt(2)[/tex]</code>
* @param $input string. some text
* @return $output string. some text that contains the parsed elements.
* @author Patrick Cool <patrick.cool@UGent.be>
* @version March 2OO6
*/
function text_filter($input, $filter = true) {
//$input = stripslashes($input);
if ($filter) {
// *** parse [tex]...[/tex] tags *** //
// which will return techexplorer or image html depending on the capabilities of the
// browser of the user (using some javascript that checks if the browser has the TechExplorer plugin installed or not)
//$input = _text_parse_tex($input);
// *** parse [teximage]...[/teximage] tags *** //
// these force the gif rendering of LaTeX using the mimetex gif renderer
//$input=_text_parse_tex_image($input);
// *** parse [texexplorer]...[/texexplorer] tags *** //
// these force the texeplorer LaTeX notation
//$input = _text_parse_texexplorer($input);
// *** Censor Words *** //
// censor words. This function removes certain words by [censored]
// this can be usefull when the campus is open to the world.
// $input=text_censor_words($input);
// *** parse [?]...[/?] tags *** //
// for the glossary tool
//$input = _text_parse_glossary($input);
// parse [wiki]...[/wiki] tags
// this is for the coolwiki plugin.
// $input=text_parse_wiki($input);
// parse [tool]...[/tool] tags
// this parse function adds a link to a certain tool
// $input=text_parse_tool($input);
// parse [user]...[/user] tags
// parse [email]...[/email] tags
// parse [code]...[/code] tags
}
return $input;
}
/**
* Applies parsing for tex commands that are separated by [tex]
* [/tex] to make it readable for techexplorer plugin.
* This function should not be accessed directly but should be accesse through the text_filter function
* @param string $text The text to parse
* @return string The text after parsing.
* @author Patrick Cool <patrick.cool@UGent.be>
* @version June 2004
*/
function _text_parse_tex($textext) {
//$textext = str_replace(array ("[tex]", "[/tex]"), array ('[*****]', '[/*****]'), $textext);
//$textext = stripslashes($texttext);
$input_array = preg_split("/(\[tex]|\[\/tex])/", $textext, -1, PREG_SPLIT_DELIM_CAPTURE);
foreach ($input_array as $key => $value) {
if ($key > 0 && $input_array[$key - 1] == '[tex]' AND $input_array[$key + 1] == '[/tex]') {
$input_array[$key] = latex_gif_renderer($value);
unset($input_array[$key - 1]);
unset($input_array[$key + 1]);
//echo 'LaTeX: <embed type="application/x-techexplorer" texdata="'.stripslashes($value).'" autosize="true" pluginspage="http://www.integretechpub.com/techexplorer/"><br />';
}
}
$output = implode('',$input_array);
return $output;
}
/**
* This function should not be accessed directly but should be accesse through the text_filter function
* @author Patrick Cool <patrick.cool@UGent.be>
*/
function _text_parse_glossary($input) {
return $input;
}
/**
* @desc This function makes a valid link to a different tool.
* This function should not be accessed directly but should be accesse through the text_filter function
* @author Patrick Cool <patrick.cool@UGent.be>
*/
function _text_parse_tool($input) {
// An array with all the valid tools
$tools[] = array(TOOL_ANNOUNCEMENT, 'announcements/announcements.php');
$tools[] = array(TOOL_CALENDAR_EVENT, 'calendar/agenda.php');
// Check if the name between the [tool] [/tool] tags is a valid one
}
/**
* Renders LaTeX code into a gif or retrieve a cached version of the gif.
* @author Patrick Cool <patrick.cool@UGent.be> Ghent University
*/
function latex_gif_renderer($latex_code) {
$_course = api_get_course_info();
// Setting the paths and filenames
$mimetex_path = api_get_path(LIBRARY_PATH).'mimetex/';
$temp_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/temp/';
$latex_filename = md5($latex_code).'.gif';
if (!file_exists($temp_path.$latex_filename) OR isset($_GET['render'])) {
if (IS_WINDOWS_OS) {
$mimetex_command = $mimetex_path.'mimetex.exe -e "'.$temp_path.md5($latex_code).'.gif" '.escapeshellarg($latex_code).'';
} else {
$mimetex_command = $mimetex_path.'mimetex.cgi -e "'.$temp_path.md5($latex_code).'.gif" '.escapeshellarg($latex_code);
}
exec($mimetex_command);
//echo 'volgende shell commando werd uitgevoerd:<br /><pre>'.$mimetex_command.'</pre><hr>';
}
$return = "<a href=\"\" onclick=\"javascript: newWindow=window.open('".api_get_path(WEB_CODE_PATH)."inc/latex.php?code=".urlencode($latex_code)."&amp;filename=$latex_filename','latexCode','toolbar=no,location=no,scrollbars=yes,resizable=yes,status=yes,width=375,height=250,left=200,top=100');\">";
$return .= '<img src="'.api_get_path(WEB_COURSE_PATH).$_course['path'].'/temp/'.$latex_filename.'" alt="'.$latex_code.'" border="0" /></a>';
return $return;
}
/**
* This functions cuts a paragraph
* i.e cut('Merry Xmas from Lima',13) = "Merry Xmas fr..."

@ -1707,6 +1707,7 @@ VALUES
('hide_certificate_export_link_students', NULL, 'radio', 'Gradebook', 'false', 'CertificateHideExportLinkStudentTitle', 'CertificateHideExportLinkStudentComment', NULL, NULL, 1),
('hide_certificate_export_link', NULL, 'radio', 'Gradebook', 'false', 'CertificateHideExportLinkTitle', 'CertificateHideExportLinkComment', NULL, NULL, 1),
('dropbox_hide_course_coach', NULL, 'radio', 'Tools', 'false', 'DropboxHideCourseCoachTitle', 'DropboxHideCourseCoachComment', NULL, NULL, 1),
('dropbox_hide_general_coach', NULL, 'radio', 'Tools', 'false', 'DropboxHideGeneralCoachTitle', 'DropboxHideGeneralCoachComment', NULL, NULL, 1),
('sso_force_redirect', NULL, 'radio', 'Security', 'false', 'SSOForceRedirectTitle', 'SSOForceRedirectComment', NULL, NULL, 1),
('session_course_ordering', NULL, 'radio', 'Session', 'false', 'SessionCourseOrderingTitle', 'SessionCourseOrderingComment', NULL, NULL, 1),
('gamification_mode', NULL, 'radio', 'Platform', '0', 'GamificationModeTitle', 'GamificationModeComment', NULL, NULL, 1),
@ -1786,6 +1787,8 @@ VALUES
('hide_certificate_export_link', 'false', 'No'),
('dropbox_hide_course_coach', 'true', 'Yes'),
('dropbox_hide_course_coach', 'false', 'No'),
('dropbox_hide_general_coach', 'true', 'Yes'),
('dropbox_hide_general_coach', 'false', 'No'),
('sso_force_redirect', 'true', 'Yes'),
('sso_force_redirect', 'false', 'No'),
('session_course_ordering', 'true', 'Yes'),

@ -7510,4 +7510,5 @@ $SkillXDisabled = "Skill \"%s\" disabled";
$ShowFullSkillNameOnSkillWheelTitle = "Show full skill name on skill wheel";
$ShowFullSkillNameOnSkillWheelComment = "On the wheel of skills, it shows the name of the skill when it has short code.";
$DBPort = "Port";
$CreatedBy = "Created by";
?>

@ -7535,4 +7535,5 @@ $SkillXDisabled = "Competencia \"%s\" deshabilitada";
$ShowFullSkillNameOnSkillWheelTitle = "Mostrar nombre completo de la competencias en rueda de competencias";
$ShowFullSkillNameOnSkillWheelComment = "En la rueda de competencias, permite mostrar el nombre de la competencia cuando ésta tiene código corto.";
$DBPort = "Puerto";
$CreatedBy = "Creado por";
?>

@ -244,12 +244,12 @@ function manage_form($default, $select_from_user_list = null, $sent_to = null)
if ($form->validate()) {
$check = Security::check_token('post');
if ($check) {
$user_list = $default['users'];
$file_comments = $_POST['legend'];
$title = $default['title'];
$content = $default['content'];
$group_id = isset($default['group_id']) ? $default['group_id'] : null;
$parent_id = isset($default['parent_id']) ? $default['parent_id'] : null;
$user_list = $default['users'];
$file_comments = $_POST['legend'];
$title = $default['title'];
$content = $default['content'];
$group_id = isset($default['group_id']) ? $default['group_id'] : null;
$parent_id = isset($default['parent_id']) ? $default['parent_id'] : null;
if (is_array($user_list) && count($user_list)> 0) {
//all is well, send the message
foreach ($user_list as $user) {
@ -306,12 +306,16 @@ if ($group_id != 0) {
} else {
$social_right_content .= '<div class=actions>';
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'</a>';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.
Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'</a>';
}
if (api_get_setting('allow_message_tool') == 'true') {
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.Display::return_icon('message_new.png',get_lang('ComposeMessage')).'</a>';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.Display::return_icon('inbox.png',get_lang('Inbox')).'</a>';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.Display::return_icon('outbox.png',get_lang('Outbox')).'</a>';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
Display::return_icon('message_new.png',get_lang('ComposeMessage')).'</a>';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('inbox.png',get_lang('Inbox')).'</a>';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
Display::return_icon('outbox.png',get_lang('Outbox')).'</a>';
}
$social_right_content .= '</div>';
}
@ -325,7 +329,8 @@ if (api_get_setting('allow_social_tool') == 'true') {
$social_right_content .= '<div class="row">';
$social_right_content .= '<div class="col-md-12">';
$social_right_content .= '<div class="actions">';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('back.png', get_lang('Back'), array(), 32).'</a>';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.
Display::return_icon('back.png', get_lang('Back'), array(), 32).'</a>';
$social_right_content .= '</div>';
$social_right_content .= '</div>';
$social_right_content .= '<div class="col-md-12">';

@ -59,15 +59,10 @@ $message = '';
if (api_get_setting('allow_social_tool') == 'true') {
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu($show_menu);
$message .='<div class="span9">';
}
//MAIN CONTENT
$message .= MessageManager::show_message_box($id_message, $source);
if (api_get_setting('allow_social_tool') == 'true') {
$message .='</div>';
}
if (!empty($message)) {
$social_right_content .= $message;
} else {

@ -31,7 +31,13 @@ $courseId = $courseInfo['real_id'];
$connections = MySpace::get_connections_to_course($user_id, $courseId, $session_id);
$quote_simple = "'";
$form = new FormValidator('myform', 'get', api_get_self(), null, array('id' => 'myform'));
$form = new FormValidator(
'myform',
'get',
api_get_self(),
null,
array('id' => 'myform')
);
$form->addElement('text', 'from', get_lang('From'), array('id' => 'date_from'));
$form->addElement('text', 'to', get_lang('Until'), array('id' => 'date_to'));
$form->addElement(

@ -9,6 +9,11 @@
$use_anonymous = true;
require_once '../inc/global.inc.php';
Display::display_reduced_header();
$htmlHeadXtra[] = "
<style>
body { background: none;}
</style>
";
if (isset($_GET['error'])) {
switch ($_GET['error']){
@ -28,6 +33,17 @@ if (isset($_GET['error'])) {
echo '<br /><br />';
Display::display_warning_message(get_lang('ReachedOneAttempt'));
break;
case 'x_frames_options':
if (isset($_SESSION['x_frame_source'])) {
$src = $_SESSION['x_frame_source'];
echo Display::return_message(
Display::url($src, $src, ['target' => '_blank']),
'normal',
false
);
unset($_SESSION['x_frame_source']);
}
break;
default:
break;
}

@ -1046,12 +1046,14 @@ class learnpath
if ($this->type == 2 || $this->type == 3) {
// This is a scorm learning path, delete the files as well.
$sql = "SELECT path FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
$sql = "SELECT path FROM $lp
WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
$res = Database::query($sql);
if (Database :: num_rows($res) > 0) {
$row = Database :: fetch_array($res);
$path = $row['path'];
$sql = "SELECT id FROM $lp WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id;
$sql = "SELECT id FROM $lp
WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id;
$res = Database::query($sql);
if (Database :: num_rows($res) > 0) { // Another learning path uses this directory, so don't delete it.
if ($this->debug > 2) {
@ -1079,7 +1081,8 @@ class learnpath
$tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST);
$link = 'newscorm/lp_controller.php?action=view&lp_id='.$this->lp_id;
// Delete tools
$sql = "DELETE FROM $tbl_tool WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')";
$sql = "DELETE FROM $tbl_tool
WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')";
Database::query($sql);
$sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
@ -1095,20 +1098,6 @@ class learnpath
api_get_user_id()
);
// Delete link of gradebook tool
//$tbl_grade_link = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
/*$sql = 'SELECT gl.id FROM ' . $tbl_grade_link . ' gl WHERE gl.type="4" AND gl.ref_id="' . $id . '";';
$result = Database::query($sql);
$row = Database :: fetch_array($result, 'ASSOC');*/
// Fixing gradebook link deleted see #5229.
/*
if (!empty($row['id'])) {
$link = LinkFactory :: load($row['id']);
if ($link[0] != null) {
$link[0]->delete();
}
}*/
$link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4 , $id, api_get_session_id());
if ($link_info !== false) {
GradebookUtils::remove_resource_from_course_gradebook($link_info['id']);
@ -1588,12 +1577,12 @@ class learnpath
$row_parent = Database :: fetch_array($res_parent);
$parent = $row_parent['parent_item_id'];
$sql_bros = "SELECT * FROM $lp_item
WHERE
c_id = ".$course_id." AND
parent_item_id = $parent AND
id = $id AND
item_type='dokeos_chapter'
ORDER BY display_order";
WHERE
c_id = ".$course_id." AND
parent_item_id = $parent AND
id = $id AND
item_type='dokeos_chapter'
ORDER BY display_order";
$res_bros = Database::query($sql_bros);
$list = array ();
while ($row_bro = Database :: fetch_array($res_bros)) {
@ -1610,7 +1599,8 @@ class learnpath
* @param integer Item ID
* @return array A list of all the "brother items" (or an empty array on failure)
*/
public function get_brother_items($id) {
public function get_brother_items($id)
{
$course_id = api_get_course_int_id();
if ($this->debug > 0) {
error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0);
@ -1965,6 +1955,7 @@ class learnpath
<a id="scorm-next" href="" onClick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next" ><img border="0" src="../img/btn_next.png" title="' . get_lang('ScormNext') . '"></a>
</div>';
}
return $navbar;
}
@ -2125,7 +2116,7 @@ class learnpath
$index = $this->index;
if (isset ($this->ordered_items[$index -1])) {
$index--;
while (isset($this->ordered_items[$index]) AND ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter')) {
while (isset($this->ordered_items[$index]) && ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter')) {
$index--;
if ($index < 0) {
return $this->index;
@ -2588,7 +2579,6 @@ class learnpath
*/
public function get_preview_image_path($size = null, $path_type = 'web')
{
$preview_image = $this->get_preview_image();
if (isset($preview_image) && !empty($preview_image)) {
$image_sys_path = api_get_path(SYS_COURSE_PATH).$this->course_info['path'].'/upload/learning_path/images/';
@ -2618,7 +2608,7 @@ class learnpath
/**
* Gets the learnpath author
* @return string LP's author
* @return string LP's author
*/
public function get_author()
{
@ -3895,9 +3885,9 @@ class learnpath
/**
* Move a learnpath up (display_order)
* @param integer Learnpath ID
* @param integer $lp_id Learnpath ID
*/
public function move_up($lp_id)
public static function move_up($lp_id)
{
$course_id = api_get_course_int_id();
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
@ -3942,9 +3932,9 @@ class learnpath
/**
* Move a learnpath down (display_order)
* @param integer Learnpath ID
* @param integer $lp_id Learnpath ID
*/
public function move_down($lp_id)
public static function move_down($lp_id)
{
$course_id = api_get_course_int_id();
$lp_table = Database :: get_course_table(TABLE_LP_MAIN);
@ -3952,8 +3942,9 @@ class learnpath
WHERE c_id = ".$course_id."
ORDER BY display_order";
$res = Database::query($sql);
if ($res === false)
if ($res === false) {
return false;
}
$lps = array ();
$lp_order = array ();
$num = Database :: num_rows($res);
@ -3968,7 +3959,7 @@ class learnpath
$need_fix = true;
$sql_u = "UPDATE $lp_table SET display_order = $i
WHERE c_id = ".$course_id." AND id = " . $row['id'];
$res_u = Database::query($sql_u);
Database::query($sql_u);
}
$row['display_order'] = $i;
$lps[$row['id']] = $row;
@ -6039,7 +6030,6 @@ class learnpath
$file = $filepath . $row['path'];
if ($fp = @ fopen($file, 'w')) {
$content = text_filter($content);
$content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'] . '/courses/', $content);
// Change the path of mp3 to absolute.
@ -10357,6 +10347,50 @@ EOD;
return $totalExercisesResult + $totalEvaluationResult;
}
/**
* Check if URL is not allowed to be show in a iframe
* @param string $src
*
* @return string
*/
public function checkXFrameOptions($src)
{
if (strpos($src, api_get_path(WEB_CODE_PATH)) === false) {
// Check X-Frame-Options
$ch = curl_init();
$options = array(
CURLOPT_URL => $src,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_AUTOREFERER => true,
CURLOPT_CONNECTTIMEOUT => 120,
CURLOPT_TIMEOUT => 120,
CURLOPT_MAXREDIRS => 10,
);
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch);
$headers = substr($response, 0, $httpCode['header_size']);
$error = false;
if (stripos($headers, 'X-Frame-Options: DENY') > -1 ||
stripos($headers, 'X-Frame-Options: SAMEORIGIN')>-1
) {
$error = true;
}
if ($error) {
$_SESSION['x_frame_source'] = $src;
$src = 'blank.php?error=x_frames_options';
}
}
return $src;
}
}
if (!function_exists('trim_value')) {

@ -56,6 +56,8 @@ if ($dokeos_chapter) {
} else {
$src = 'blank.php?error=prerequisites';
}
$src = $_SESSION['oLP']->checkXFrameOptions($src);
break;
case 2:
$_SESSION['oLP']->stop_previous_item();

@ -150,19 +150,27 @@ if (!isset($src)) {
$htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>';
$prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
if ($prereq_check === true) {
$src = $_SESSION['oLP']->get_link('http', $lp_item_id, $get_toc_list);
$src = $_SESSION['oLP']->get_link(
'http',
$lp_item_id,
$get_toc_list
);
// Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP.
$file_info = parse_url($src);
$file_info = pathinfo($file_info['path']);
if (isset($file_info['path'])) {
$file_info = pathinfo($file_info['path']);
}
if (
isset($file_info['extension']) &&
api_strtolower(substr($file_info['extension'], 0, 3) == 'pdf')
) {
$src = api_get_path(WEB_CODE_PATH)
. 'newscorm/lp_view_item.php?lp_item_id=' . $lp_item_id
. '&' . api_get_cidreq();
$src = api_get_path(WEB_CODE_PATH).'newscorm/lp_view_item.php?lp_item_id='.$lp_item_id.'&'.api_get_cidreq();
}
$src = $_SESSION['oLP']->checkXFrameOptions($src);
$_SESSION['oLP']->start_current_item(); // starts time counter manually if asset
} else {
$src = 'blank.php?error=prerequisites';
@ -183,11 +191,14 @@ if (!isset($src)) {
case 3:
// aicc
$_SESSION['oLP']->stop_previous_item(); // save status manually if asset
$htmlHeadXtra[] = '<script src="' . $_SESSION['oLP']->get_js_lib()
. '" type="text/javascript" language="javascript"></script>';
$htmlHeadXtra[] = '<script src="' . $_SESSION['oLP']->get_js_lib().'" type="text/javascript" language="javascript"></script>';
$prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
if ($prereq_check === true) {
$src = $_SESSION['oLP']->get_link('http', $lp_item_id, $get_toc_list);
$src = $_SESSION['oLP']->get_link(
'http',
$lp_item_id,
$get_toc_list
);
$_SESSION['oLP']->start_current_item(); // starts time counter manually if asset
} else {
$src = 'blank.php';
@ -294,7 +305,8 @@ $save_setting = api_get_setting('show_navigation_menu');
global $_setting;
$_setting['show_navigation_menu'] = 'false';
$scorm_css_header = true;
$lp_theme_css = $_SESSION['oLP']->get_theme(); // Sets the css theme of the LP this call is also use at the frames (toc, nav, message).
$lp_theme_css = $_SESSION['oLP']->get_theme();
// Sets the css theme of the LP this call is also use at the frames (toc, nav, message).
if ($_SESSION['oLP']->mode == 'fullscreen') {
$htmlHeadXtra[] = "<script>window.open('$src','content_id','toolbar=0,location=0,status=0,scrollbars=1,resizable=1');</script>";
@ -391,8 +403,7 @@ if (api_get_course_setting('lp_return_link') == 1) {
$buttonHomeText = get_lang('LearningPathList');
}
$lpPreviewImagePath = 'unknown.png';
$lpPreviewImagePath = api_get_path(WEB_CODE_PATH).'img/icons/64/unknown.png';
if ($_SESSION['oLP']->get_preview_image()) {
$lpPreviewImagePath = $_SESSION['oLP']->get_preview_image_path();
}

@ -377,6 +377,7 @@ $tpl = new Template(get_lang('Session'));
$tpl->assign('session_header', $sessionHeader);
$tpl->assign('title', $sessionTitle);
$tpl->assign('general_coach', $generalCoach);
$tpl->assign('session_admin', api_get_user_info($session->getSessionAdminId()));
$tpl->assign('session', $sessionInfo);
$tpl->assign('session_category', is_null($sessionCategory) ? null : $sessionCategory->getName());
$tpl->assign('session_dates', SessionManager::parseSessionDates($sessionInfo));

@ -101,7 +101,9 @@ if ($action == 'delete' && isset($_GET['survey_id'])) {
exit;
}
// If the survey is shared => also delete the shared content
if (is_numeric($survey_data['survey_share'])) {
if (isset($survey_data['survey_share']) &&
is_numeric($survey_data['survey_share'])
) {
SurveyManager::delete_survey($survey_data['survey_share'], true);
}

@ -6,6 +6,10 @@
{{ title }}
<table id="session-properties" class="data_table">
<tr>
<td>{{ 'CreatedBy'|get_lang }}</td>
<td>{{ session_admin.complete_name }}</td>
</tr>
<tr>
<td>{{ 'GeneralCoach' | get_lang}} :</td>
<td>{{ general_coach.complete_name }}</td>

@ -67,6 +67,7 @@ class ScriptHandler
__DIR__.'/../../../../main/announcements/resources/announcements_email.class.php',
__DIR__.'/../../../../main/inc/lib/main_api.lib.php',
__DIR__.'/../../../../main/exercice/export/scorm/scorm_export.php',
__DIR__.'/../../../../main/exercice/testheaderpage.php',
//__DIR__.'/../../../../main/inc/lib/nusoap/class.soapclient.php',
__DIR__.'/../../../../main/inc/lib/nusoap/nusoap.php',
__DIR__.'/../../../../main/admin/admin_page.class.php',
@ -123,6 +124,7 @@ class ScriptHandler
__DIR__.'/../../../../main/course_description/upload_file_form.class.php',
__DIR__.'/../../../../main/auth/external_login/facebook-php-sdk/src/facebook.php',
__DIR__.'/../../../../main/auth/external_login/facebook-php-sdk/src/base_facebook.php',
__DIR__.'/../../../../main/inc/latex.php',
__DIR__.'/../../../../main/inc/lib/formvalidator/Element/calendar_popup.php',
__DIR__.'/../../../../main/inc/lib/formvalidator/Element/datepicker.php',
__DIR__.'/../../../../main/inc/lib/formvalidator/Element/datepickerdate.php',
@ -132,7 +134,7 @@ class ScriptHandler
__DIR__.'/../../../../main/inc/lib/formvalidator/Element/style_button.php',
__DIR__.'/../../../../main/inc/lib/formvalidator/Element/style_reset_button.php',
__DIR__.'/../../../../main/inc/lib/formvalidator/Element/style_submit_button.php',
__DIR__.'/../../../../main/inc/lib/formvalidator/Element/tbl_change.js.php',
__DIR__.'/../../../../main/inc/lib/formvalidator/Element/tbl_change.js.php'
];
foreach ($paths as $path) {

@ -1,108 +1,71 @@
<?php
require_once(api_get_path(LIBRARY_PATH).'text.lib.php');
class TestText extends UnitTestCase {
class TestText extends UnitTestCase
{
public function test_api_html_to_text() {
$filename = api_get_path(SYS_PATH).'documentation/installation_guide.html';
$res = @file_get_contents($filename);
if ($res !== false) {
$res = api_html_to_text($res);
$this->assertTrue(is_string($res));
} else {
$this->assertTrue(true); // The file is missing, skip this test.
}
//var_dump('<pre>'.$res.'</pre>');
}
public function test_api_html_to_text() {
$filename = api_get_path(SYS_PATH).'documentation/installation_guide.html';
$res = @file_get_contents($filename);
if ($res !== false) {
$res = api_html_to_text($res);
$this->assertTrue(is_string($res));
} else {
$this->assertTrue(true); // The file is missing, skip this test.
}
//var_dump('<pre>'.$res.'</pre>');
}
public function test_api_camel_case_to_underscore() {
$input_strings = array('myDocuments', 'MyProfile', 'CreateNewCourse', 'Create_New_course');
$expected_results = array('my_documents', 'my_profile', 'create_new_course', 'create_new_course');
$results = array_map('api_camel_case_to_underscore', $input_strings);
$this->assertTrue($results == $expected_results);
//var_dump($results);
}
public function test_api_camel_case_to_underscore() {
$input_strings = array('myDocuments', 'MyProfile', 'CreateNewCourse', 'Create_New_course');
$expected_results = array('my_documents', 'my_profile', 'create_new_course', 'create_new_course');
$results = array_map('api_camel_case_to_underscore', $input_strings);
$this->assertTrue($results == $expected_results);
//var_dump($results);
}
function test_api_underscore_to_camel_case() {
$input_strings = array('my_documents', 'My_profile', 'create_new_course');
$expected_results1 = array('MyDocuments', 'MyProfile', 'CreateNewCourse');
$expected_results2 = array('myDocuments', 'MyProfile', 'createNewCourse');
$func = create_function('$param', 'return api_underscore_to_camel_case($param, false);');
$results1 = array('MyDocuments', 'MyProfile', 'CreateNewCourse');
$results2 = array('myDocuments', 'MyProfile', 'createNewCourse');
$results1 = array_map('api_underscore_to_camel_case', $input_strings);
$results2 = array_map($func, $input_strings);
$this->assertTrue($results1 == $expected_results1 && $results2 == $expected_results2);
//var_dump($results1);
//var_dump($results2);
}
function test_api_underscore_to_camel_case() {
$input_strings = array('my_documents', 'My_profile', 'create_new_course');
$expected_results1 = array('MyDocuments', 'MyProfile', 'CreateNewCourse');
$expected_results2 = array('myDocuments', 'MyProfile', 'createNewCourse');
$func = create_function('$param', 'return api_underscore_to_camel_case($param, false);');
$results1 = array('MyDocuments', 'MyProfile', 'CreateNewCourse');
$results2 = array('myDocuments', 'MyProfile', 'createNewCourse');
$results1 = array_map('api_underscore_to_camel_case', $input_strings);
$results2 = array_map($func, $input_strings);
$this->assertTrue($results1 == $expected_results1 && $results2 == $expected_results2);
//var_dump($results1);
//var_dump($results2);
}
function test_text_parse_glossary() {
$input='';
$res=_text_parse_glossary($input);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testcut() {
$text='';
$maxchar='';
$res=cut($text,$maxchar,$embed=false);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function test_text_parse_tex() {
$textext='';
$res=_text_parse_tex($textext);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testdate_to_str_ago() {
$date='';
$res=date_to_str_ago($date);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function test_text_parse_tool() {
$input='';
$res=_text_parse_tool($input);
$this->assertTrue(is_null($res));
//var_dump($res);
}
function testfloat_format() {
$number='';
$res=float_format($number, $flag = 1);
if(!is_numeric($res) or !is_float($res)) {
$this->assertTrue(is_null($res));
}
//var_dump($res);
}
function testcut() {
$text='';
$maxchar='';
$res=cut($text,$maxchar,$embed=false);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testdate_to_str_ago() {
$date='';
$res=date_to_str_ago($date);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testfloat_format() {
$number='';
$res=float_format($number, $flag = 1);
if(!is_numeric($res) or !is_float($res)) {
$this->assertTrue(is_null($res));
}
//var_dump($res);
}
function testlatex_gif_renderer() {
ob_start();
$latex_code="";
global $_course;
$res=latex_gif_renderer($latex_code);
ob_end_clean();
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testmake_clickable() {
$string='';
$res=make_clickable($string);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testtext_filter() {
$input='';
$res=text_filter($input, $filter=true);
$this->assertTrue(is_string($res));
//var_dump($res);
}
function testmake_clickable() {
$string='';
$res=make_clickable($string);
$this->assertTrue(is_string($res));
//var_dump($res);
}
}

Loading…
Cancel
Save