Merge branch '1.10.x' of github.com:chamilo/chamilo-lms into 1.10.x

1.10.x
Yannick Warnier 10 years ago
commit f0080bb220
  1. 2
      README.md
  2. 14
      documentation/optimization.html
  3. 2
      main/admin/add_users_to_usergroup.php
  4. 98
      main/coursecopy/classes/Announcement.class.php
  5. 26
      main/coursecopy/classes/Attendance.class.php
  6. 69
      main/coursecopy/classes/CourseDescription.class.php
  7. 3
      main/coursecopy/classes/CourseSelectForm.class.php
  8. 37
      main/coursecopy/classes/CourseSession.class.php
  9. 567
      main/coursecopy/classes/DummyCourseCreator.class.php
  10. 2
      main/coursecopy/classes/Event.class.php
  11. 5
      main/coursecopy/classes/Forum.class.php
  12. 2
      main/coursecopy/classes/ForumCategory.class.php
  13. 4
      main/coursecopy/classes/ForumTopic.class.php
  14. 50
      main/coursecopy/classes/Glossary.class.php
  15. 73
      main/coursecopy/classes/Link.class.php
  16. 66
      main/coursecopy/classes/LinkCategory.class.php
  17. 4
      main/coursecopy/classes/Quiz.class.php
  18. 53
      main/coursecopy/classes/Resource.class.php
  19. 22
      main/coursecopy/classes/ScormDocument.class.php
  20. 206
      main/coursecopy/classes/Survey.class.php
  21. 92
      main/coursecopy/classes/SurveyInvitation.class.php
  22. 175
      main/coursecopy/classes/SurveyQuestion.class.php
  23. 2
      main/coursecopy/classes/Thematic.class.php
  24. 150
      main/coursecopy/classes/ToolIntro.class.php
  25. 2
      main/coursecopy/classes/Work.class.php
  26. 84
      main/coursecopy/classes/wiki.class.php
  27. 12
      main/inc/ajax/lp.ajax.php
  28. 16
      main/inc/lib/pear/PEAR.php
  29. 26
      main/inc/lib/usermanager.lib.php
  30. 26
      main/newscorm/lp_nav.php
  31. 4
      main/newscorm/scorm_api.php
  32. 16
      main/template/default/learnpath/view.tpl
  33. 18
      plugin/bbb/lib/bbb.lib.php
  34. 1
      src/Chamilo/CoreBundle/Entity/SysCalendar.php
  35. 1
      src/Chamilo/CoreBundle/Entity/SystemTemplate.php
  36. 21
      src/Chamilo/CoreBundle/Entity/Tag.php
  37. 1
      src/Chamilo/CoreBundle/Entity/Templates.php
  38. 1
      src/Chamilo/CoreBundle/Entity/TrackCourseRanking.php
  39. 1
      src/Chamilo/CoreBundle/Entity/TrackEAccess.php
  40. 1
      src/Chamilo/CoreBundle/Entity/TrackEAttempt.php
  41. 1
      src/Chamilo/CoreBundle/Entity/TrackEAttemptCoeff.php
  42. 21
      src/Chamilo/CoreBundle/Entity/TrackEAttemptRecording.php
  43. 21
      src/Chamilo/CoreBundle/Entity/TrackECourseAccess.php
  44. 1
      src/Chamilo/CoreBundle/Entity/TrackEDownloads.php
  45. 1
      src/Chamilo/CoreBundle/Entity/TrackEExercises.php
  46. 1
      src/Chamilo/CoreBundle/Entity/TrackEHotpotatoes.php
  47. 1
      src/Chamilo/CoreBundle/Entity/TrackEHotspot.php
  48. 1
      src/Chamilo/CoreBundle/Entity/TrackEItemProperty.php
  49. 1
      src/Chamilo/CoreBundle/Entity/TrackELastaccess.php
  50. 1
      src/Chamilo/CoreBundle/Entity/TrackELinks.php
  51. 1
      src/Chamilo/CoreBundle/Entity/TrackELogin.php
  52. 1
      src/Chamilo/CoreBundle/Entity/TrackEOnline.php
  53. 1
      src/Chamilo/CoreBundle/Entity/TrackEOpen.php
  54. 1
      src/Chamilo/CoreBundle/Entity/TrackEUploads.php
  55. 1
      src/Chamilo/CoreBundle/Entity/TrackStoredValues.php
  56. 23
      src/Chamilo/CoreBundle/Entity/TrackStoredValuesStack.php
  57. 21
      src/Chamilo/CoreBundle/Entity/UserApiKey.php
  58. 21
      src/Chamilo/CoreBundle/Entity/UserCourseCategory.php
  59. 1
      src/Chamilo/CoreBundle/Entity/UserFriendRelationType.php
  60. 1
      src/Chamilo/CoreBundle/Entity/UserGroupRelUserGroup.php
  61. 1
      src/Chamilo/CoreBundle/Entity/UserRelCourseVote.php
  62. 21
      src/Chamilo/CoreBundle/Entity/UserRelEventType.php
  63. 21
      src/Chamilo/CoreBundle/Entity/UserRelUser.php
  64. 2
      src/Chamilo/CoreBundle/Entity/Usergroup.php
  65. 19
      src/Chamilo/CoreBundle/Entity/UsergroupRelCourse.php
  66. 21
      src/Chamilo/CoreBundle/Entity/UsergroupRelQuestion.php
  67. 19
      src/Chamilo/CoreBundle/Entity/UsergroupRelSession.php
  68. 8
      src/Chamilo/CoreBundle/Entity/UsergroupRelUser.php

@ -168,7 +168,7 @@ php bin/doctrine.php migrations:execute 20150527120703 --up --configuration=app/
You can also print the differences between your database and what it should be by issuing the following command from the Chamilo base folder: You can also print the differences between your database and what it should be by issuing the following command from the Chamilo base folder:
``` ```
php bin/doctrine.php orm:schema:update --dump-sql php bin/doctrine.php orm:schema-tool:update --dump-sql
``` ```
## Contributing ## Contributing

@ -342,7 +342,7 @@ ALTER TABLE user_rel_tag ADD INDEX idx_user_rel_tag_user (user_id);
In Chamilo 1.10.0 (the first version of the serie), many indexes were forgotten, so you can boost your database by adding the following indexes:<br /> In Chamilo 1.10.0 (the first version of the serie), many indexes were forgotten, so you can boost your database by adding the following indexes:<br />
<pre> <pre>
alter table extra_field_values add index idx_extra_field_values (field_id, item_id); alter table extra_field_values add index idx_extra_field_values (field_id, item_id);
alter table usergroup_rel_user add index idx_usergroup_ru (group_id); alter table usergroup_rel_user add index idx_usergroup_ru (usergroup_id);
alter table usergroup_rel_user add index idx_usergroup_ru_u (user_id); alter table usergroup_rel_user add index idx_usergroup_ru_u (user_id);
alter table c_student_publication add index idxstudpub_cid (c_id); alter table c_student_publication add index idxstudpub_cid (c_id);
alter table c_student_publication add index idxstudpub_uid (user_id); alter table c_student_publication add index idxstudpub_uid (user_id);
@ -558,23 +558,23 @@ This is easy, doesn't require a server reload and you should see the results pre
you should avoid using this technique. you should avoid using this technique.
</p> </p>
<p> <p>
You can also mitigate the risk by disabling permissions check only You can also mitigate the risk by disabling permissions check only
for some static resource like css,js and fonts files. for some static resource like css,js and fonts files.
<br/> <br/>
For that is required to load header module For that is required to load header module
in apache (check with a2enmod in your favorite root terminal)<br /> in apache (check with a2enmod in your favorite root terminal)<br />
add theses line after RewriteBase /courses/: add theses line after RewriteBase /courses/:
<pre> <pre>
&lt;IfModule mod_headers.c&gt; &lt;IfModule mod_headers.c&gt;
# all file name ended with these extensions names will bypass the permission check (and also served by the browser cache at the next request) # all file name ended with these extensions names will bypass the permission check (and also served by the browser cache at the next request)
&lt;FilesMatch &quot;\.(gif|jpg|jpeg|png|js|pdf|ico|icon|css|swf|avi|mp3|ogg|wav|ttf|otf|eot|woff)$&quot;&gt; &lt;FilesMatch &quot;\.(gif|jpg|jpeg|png|js|pdf|ico|icon|css|swf|avi|mp3|ogg|wav|ttf|otf|eot|woff)$&quot;&gt;
Header unset Cache-Control Header unset Cache-Control
Header set Cache-Control &quot;public, max-age=29030400&quot; Header set Cache-Control &quot;public, max-age=29030400&quot;
RequestHeader unset Cookie RequestHeader unset Cookie
Header unset ETag Header unset ETag
&lt;/FilesMatch&gt; &lt;/FilesMatch&gt;
&lt;/IfModule&gt; &lt;/IfModule&gt;
# also adjust files here # also adjust files here
RewriteRule (\.(html|gif|jpg|jpeg|png|js|pdf|ico|icon|css|swf|avi|mp3|ogg|wav|ttf|otf|eot|woff))$ - [L] RewriteRule (\.(html|gif|jpg|jpeg|png|js|pdf|ico|icon|css|swf|avi|mp3|ogg|wav|ttf|otf|eot|woff))$ - [L]
</pre> </pre>
</p> </p>

@ -177,7 +177,7 @@ if ($use_extra_fields) {
if (count($extra_field_result)>1) { if (count($extra_field_result)>1) {
for ($i=0; $i<count($extra_field_result)-1; $i++) { for ($i=0; $i<count($extra_field_result)-1; $i++) {
if (is_array($extra_field_result[$i+1])) { if (is_array($extra_field_result[$i+1])) {
$final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i+1]); $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i+1]);
} }
} }
} else { } else {

@ -10,25 +10,25 @@ require_once 'Resource.class.php';
*/ */
class Announcement extends Coursecopy\Resource class Announcement extends Coursecopy\Resource
{ {
/** /**
* The title of the announcement * The title of the announcement
*/ */
public $title; public $title;
/** /**
* The content of the announcement * The content of the announcement
*/ */
public $content; public $content;
/** /**
* The date on which this announcement was made * The date on which this announcement was made
*/ */
public $date; public $date;
/** /**
* The display order of this announcement * The display order of this announcement
*/ */
public $display_order; public $display_order;
/** /**
* Has the e-mail been sent? * Has the e-mail been sent?
*/ */
public $email_sent; public $email_sent;
public $attachment_path; public $attachment_path;
@ -39,36 +39,46 @@ class Announcement extends Coursecopy\Resource
public $attachment_comment; public $attachment_comment;
/** /**
* Create a new announcement * Create a new announcement
* @param int $id * @param int $id
* @param string $title * @param string $title
* @param string $content * @param string $content
* @param string $date * @param string $date
* @param int display_order * @param int display_order
*/ */
function __construct($id, $title, $content, $date, $display_order, $email_sent, $path, $filename, $size, $comment) public function __construct(
{ $id,
parent::__construct($id,RESOURCE_ANNOUNCEMENT); $title,
$content,
$date,
$display_order,
$email_sent,
$path,
$filename,
$size,
$comment
) {
parent::__construct($id,RESOURCE_ANNOUNCEMENT);
$this->content = $content; $this->content = $content;
$this->title = $title; $this->title = $title;
$this->date = $date; $this->date = $date;
$this->display_order = $display_order; $this->display_order = $display_order;
$this->email_sent = $email_sent; $this->email_sent = $email_sent;
$this->attachment_path = $path; $this->attachment_path = $path;
$this->attachment_filename = $filename; $this->attachment_filename = $filename;
$this->attachment_size = $size; $this->attachment_size = $size;
$this->attachment_comment = $comment; $this->attachment_comment = $comment;
} }
/** /**
* Show this announcement * Show this announcement
*/ */
function show() function show()
{ {
parent::show(); parent::show();
echo $this->date.': '.$this->title; echo $this->date.': '.$this->title;
} }
} }

@ -13,28 +13,28 @@ class Attendance extends Coursecopy\Resource
public $params = array(); public $params = array();
public $attendance_calendar = array(); public $attendance_calendar = array();
/** /**
* Create a new Thematic * Create a new Thematic
* *
* @param array parameters * @param array parameters
*/ */
public function __construct($params) public function __construct($params)
{ {
parent::__construct($params['id'], RESOURCE_ATTENDANCE); parent::__construct($params['id'], RESOURCE_ATTENDANCE);
$this->params = $params; $this->params = $params;
} }
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function show() public function show()
{ {
parent::show(); parent::show();
echo $this->params['name']; echo $this->params['name'];
} }
public function add_attendance_calendar($data) public function add_attendance_calendar($data)
{ {
$this->attendance_calendar[] = $data; $this->attendance_calendar[] = $data;
} }
} }

@ -1,6 +1,7 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
namespace Coursecopy; namespace Coursecopy;
require_once 'Resource.class.php'; require_once 'Resource.class.php';
/** /**
@ -10,39 +11,41 @@ require_once 'Resource.class.php';
*/ */
class CourseDescription extends Resource class CourseDescription extends Resource
{ {
/** /**
* The title * The title
*/ */
public $title; public $title;
/**
* The content /**
*/ * The content
public $content; */
/** public $content;
* The description type
*/ /**
public $description_type; * The description type
*/
public $description_type;
/** /**
* Create a new course description * Create a new course description
* @param int $id * @param int $id
* @param string $title * @param string $title
* @param string $content * @param string $content
*/ */
public function __construct($id,$title,$content,$description_type) public function __construct($id, $title, $content, $description_type)
{ {
parent::__construct($id,RESOURCE_COURSEDESCRIPTION); parent::__construct($id, RESOURCE_COURSEDESCRIPTION);
$this->title = $title; $this->title = $title;
$this->content = $content; $this->content = $content;
$this->description_type = $description_type; $this->description_type = $description_type;
} }
/** /**
* Show this Event * Show this Event
*/ */
function show() public function show()
{ {
parent::show(); parent::show();
echo $this->title; echo $this->title;
} }
} }

@ -16,7 +16,7 @@ class CourseSelectForm
* @param array $hidden_fields Hidden fields to add to the form. * @param array $hidden_fields Hidden fields to add to the form.
* @param boolean the document array will be serialize. This is used in the course_copy.php file * @param boolean the document array will be serialize. This is used in the course_copy.php file
*/ */
static function display_form($course, $hidden_fields = null, $avoid_serialize = false) public static function display_form($course, $hidden_fields = null, $avoid_serialize = false)
{ {
global $charset; global $charset;
$resource_titles[RESOURCE_GRADEBOOK] = get_lang('Gradebook'); $resource_titles[RESOURCE_GRADEBOOK] = get_lang('Gradebook');
@ -224,7 +224,6 @@ class CourseSelectForm
foreach ($resources as $id => $resource) { foreach ($resources as $id => $resource) {
if ($resource) { if ($resource) {
// Event obj in 1.9.x in 1.10.x the class is CalendarEvent
Coursecopy\Resource::setClassType($resource); Coursecopy\Resource::setClassType($resource);
echo '<label class="checkbox">'; echo '<label class="checkbox">';
echo '<input type="checkbox" name="resource['.$type.']['.$id.']" id="resource['.$type.']['.$id.']" />'; echo '<input type="checkbox" name="resource['.$type.']['.$id.']" id="resource['.$type.']['.$id.']" />';

@ -11,24 +11,25 @@ require_once 'Resource.class.php';
class CourseSession extends Coursecopy\Resource class CourseSession extends Coursecopy\Resource
{ {
// The title session // The title session
public $title; public $title;
/** /**
* Create a new Session * Create a new Session
* @param int $id * @param int $id
* @param string $title * @param string $title
*/ */
public function __construct($id,$title) public function __construct($id,$title)
{ {
parent::__construct($id, RESOURCE_SESSION_COURSE); parent::__construct($id, RESOURCE_SESSION_COURSE);
$this->title = $title; $this->title = $title;
} }
/** /**
* Show this Event * Show this Event
*/ */
function show() { public function show()
parent::show(); {
echo $this->title; parent::show();
} echo $this->title;
}
} }

@ -20,289 +20,290 @@ require_once 'CourseRestorer.class.php';
*/ */
class DummyCourseCreator class DummyCourseCreator
{ {
/** /**
* The dummy course * The dummy course
*/ */
public $course; public $course;
/** /**
* *
*/ */
public $default_property = array(); public $default_property = array();
/** /**
* Create the dummy course * Create the dummy course
*/ */
public function create_dummy_course($course_code) public function create_dummy_course($course_code)
{ {
$this->default_property['insert_user_id'] = '1'; $this->default_property['insert_user_id'] = '1';
$this->default_property['insert_date'] = date('Y-m-d H:i:s'); $this->default_property['insert_date'] = date('Y-m-d H:i:s');
$this->default_property['lastedit_date'] = date('Y-m-d H:i:s'); $this->default_property['lastedit_date'] = date('Y-m-d H:i:s');
$this->default_property['lastedit_user_id'] = '1'; $this->default_property['lastedit_user_id'] = '1';
$this->default_property['to_group_id'] = '0'; $this->default_property['to_group_id'] = '0';
$this->default_property['to_user_id'] = null; $this->default_property['to_user_id'] = null;
$this->default_property['visibility'] = '1'; $this->default_property['visibility'] = '1';
$this->default_property['start_visible'] = '0000-00-00 00:00:00'; $this->default_property['start_visible'] = '0000-00-00 00:00:00';
$this->default_property['end_visible'] = '0000-00-00 00:00:00'; $this->default_property['end_visible'] = '0000-00-00 00:00:00';
$course = api_get_course_info($course_code); $course = api_get_course_info($course_code);
$this->course = new Course(); $this->course = new Course();
$tmp_path = api_get_path(SYS_COURSE_PATH).$course['directory'].'/document/tmp_'.uniqid(''); $tmp_path = api_get_path(SYS_COURSE_PATH).$course['directory'].'/document/tmp_'.uniqid('');
@mkdir($tmp_path, api_get_permissions_for_new_directories(), true); @mkdir($tmp_path, api_get_permissions_for_new_directories(), true);
$this->course->backup_path = $tmp_path; $this->course->backup_path = $tmp_path;
$this->create_dummy_links(); $this->create_dummy_links();
$this->create_dummy_events(); $this->create_dummy_events();
$this->create_dummy_forums(); $this->create_dummy_forums();
$this->create_dummy_announcements(); $this->create_dummy_announcements();
$this->create_dummy_documents(); $this->create_dummy_documents();
$this->create_dummy_learnpaths(); $this->create_dummy_learnpaths();
$cr = new CourseRestorer($this->course); $cr = new CourseRestorer($this->course);
$cr->set_file_option(FILE_OVERWRITE); $cr->set_file_option(FILE_OVERWRITE);
$cr->restore($course_code); $cr->restore($course_code);
rmdirr($tmp_path); rmdirr($tmp_path);
} }
/**
* Create dummy documents /**
*/ * Create dummy documents
function create_dummy_documents() */
{ public function create_dummy_documents()
$course = api_get_course_info(); {
$course_doc_path = $this->course->backup_path.'/document/'; $course = api_get_course_info();
$number_of_documents = rand(10, 30); $course_doc_path = $this->course->backup_path.'/document/';
$extensions = array ('html', 'doc'); $number_of_documents = rand(10, 30);
$directories = array(); $extensions = array ('html', 'doc');
$property = $this->default_property; $directories = array();
$property['lastedit_type'] = 'DocumentAdded'; $property = $this->default_property;
$property['tool'] = TOOL_DOCUMENT; $property['lastedit_type'] = 'DocumentAdded';
$doc_id = 0; $property['tool'] = TOOL_DOCUMENT;
for ($doc_id = 1; $doc_id < $number_of_documents; $doc_id ++) $doc_id = 0;
{ for ($doc_id = 1; $doc_id < $number_of_documents; $doc_id ++)
$path = ''; {
$doc_type = rand(0, count($extensions) - 1); $path = '';
$extension = $extensions[$doc_type]; $doc_type = rand(0, count($extensions) - 1);
$filename = $this->get_dummy_content('title').'_'.$doc_id.'.'.$extension; $extension = $extensions[$doc_type];
$content = $this->get_dummy_content('text'); $filename = $this->get_dummy_content('title').'_'.$doc_id.'.'.$extension;
$dirs = rand(0, 3); $content = $this->get_dummy_content('text');
for ($i = 0; $i < $dirs; $i ++) $dirs = rand(0, 3);
{ for ($i = 0; $i < $dirs; $i ++)
$path .= 'directory/'; {
$directories[$path] = 1; $path .= 'directory/';
} $directories[$path] = 1;
$dir_to_make = $course_doc_path.$path; }
if (!is_dir($dir_to_make)) $dir_to_make = $course_doc_path.$path;
{ if (!is_dir($dir_to_make))
@mkdir($dir_to_make, api_get_permissions_for_new_directories(), true); {
} @mkdir($dir_to_make, api_get_permissions_for_new_directories(), true);
$file = $course_doc_path.$path.$filename; }
$fp = fopen($file, 'w'); $file = $course_doc_path.$path.$filename;
fwrite($fp, $content); $fp = fopen($file, 'w');
fclose($fp); fwrite($fp, $content);
$size = filesize($file); fclose($fp);
$document = new Document($doc_id, '/'.$path.$filename,$this->get_dummy_content('description'),$this->get_dummy_content('title'), 'file', $size); $size = filesize($file);
$document->item_properties[] = $property; $document = new Document($doc_id, '/'.$path.$filename,$this->get_dummy_content('description'),$this->get_dummy_content('title'), 'file', $size);
$this->course->add_resource($document); $document->item_properties[] = $property;
} $this->course->add_resource($document);
foreach($directories as $path => $flag) }
{ foreach($directories as $path => $flag)
$path = substr($path,0,strlen($path)-1); {
$document = new Document($doc_id++,'/'.$path, $this->get_dummy_content('description'),$this->get_dummy_content('title'),'folder',0); $path = substr($path,0,strlen($path)-1);
$property['lastedit_type'] = 'FolderCreated'; $document = new Document($doc_id++,'/'.$path, $this->get_dummy_content('description'),$this->get_dummy_content('title'),'folder',0);
$document->item_properties[] = $property; $property['lastedit_type'] = 'FolderCreated';
$this->course->add_resource($document); $document->item_properties[] = $property;
} $this->course->add_resource($document);
} }
/** }
* Create dummy announcements /**
*/ * Create dummy announcements
function create_dummy_announcements() */
{ function create_dummy_announcements()
$property = $this->default_property; {
$property['lastedit_type'] = 'AnnouncementAdded'; $property = $this->default_property;
$property['tool'] = TOOL_ANNOUNCEMENT; $property['lastedit_type'] = 'AnnouncementAdded';
$number_of_announcements = rand(10, 30); $property['tool'] = TOOL_ANNOUNCEMENT;
for ($i = 0; $i < $number_of_announcements; $i ++) $number_of_announcements = rand(10, 30);
{ for ($i = 0; $i < $number_of_announcements; $i ++)
$time = mktime(rand(1, 24), rand(1, 60), 0, rand(1, 12), rand(1, 28), intval(date('Y'))); {
$date = date('Y-m-d', $time); $time = mktime(rand(1, 24), rand(1, 60), 0, rand(1, 12), rand(1, 28), intval(date('Y')));
$announcement = new Announcement($i,$this->get_dummy_content('title'),$this->get_dummy_content('text'), $date,0); $date = date('Y-m-d', $time);
$announcement->item_properties[] = $property; $announcement = new Announcement($i,$this->get_dummy_content('title'),$this->get_dummy_content('text'), $date,0);
$this->course->add_resource($announcement); $announcement->item_properties[] = $property;
} $this->course->add_resource($announcement);
} }
/** }
* Create dummy events /**
*/ * Create dummy events
function create_dummy_events() */
{ function create_dummy_events()
$number_of_events = rand(10, 30); {
$property = $this->default_property; $number_of_events = rand(10, 30);
$property['lastedit_type'] = 'AgendaAdded'; $property = $this->default_property;
$property['tool'] = TOOL_CALENDAR_EVENT; $property['lastedit_type'] = 'AgendaAdded';
for ($i = 0; $i < $number_of_events; $i ++) $property['tool'] = TOOL_CALENDAR_EVENT;
{ for ($i = 0; $i < $number_of_events; $i ++)
$hour = rand(1,24); {
$minute = rand(1,60); $hour = rand(1,24);
$second = rand(1,60); $minute = rand(1,60);
$day = rand(1,28); $second = rand(1,60);
$month = rand(1,12); $day = rand(1,28);
$year = intval(date('Y')); $month = rand(1,12);
$time = mktime($hour,$minute,$second,$month,$day,$year); $year = intval(date('Y'));
$start_date = date('Y-m-d H:m:s', $time); $time = mktime($hour,$minute,$second,$month,$day,$year);
$hour = rand($hour,24); $start_date = date('Y-m-d H:m:s', $time);
$minute = rand($minute,60); $hour = rand($hour,24);
$second = rand($second,60); $minute = rand($minute,60);
$day = rand($day,28); $second = rand($second,60);
$month = rand($month,12); $day = rand($day,28);
$year = intval(date('Y')); $month = rand($month,12);
$time = mktime($hour,$minute,$second,$month,$day,$year); $year = intval(date('Y'));
$end_date = date('Y-m-d H:m:s', $time); $time = mktime($hour,$minute,$second,$month,$day,$year);
$event = new CalendarEvent( $end_date = date('Y-m-d H:m:s', $time);
$i, $event = new CalendarEvent(
$this->get_dummy_content('title'), $i,
$this->get_dummy_content('text'), $this->get_dummy_content('title'),
$start_date, $this->get_dummy_content('text'),
$end_date $start_date,
); $end_date
$event->item_properties[] = $property; );
$this->course->add_resource($event); $event->item_properties[] = $property;
} $this->course->add_resource($event);
} }
/** }
* Create dummy links /**
*/ * Create dummy links
function create_dummy_links() */
{ function create_dummy_links()
// create categorys {
$number_of_categories = rand(5, 10); // create categorys
for ($i = 0; $i < $number_of_categories; $i ++) $number_of_categories = rand(5, 10);
{ for ($i = 0; $i < $number_of_categories; $i ++)
$linkcat = new LinkCategory($i, $this->get_dummy_content('title'), $this->get_dummy_content('description'),$i); {
$this->course->add_resource($linkcat); $linkcat = new LinkCategory($i, $this->get_dummy_content('title'), $this->get_dummy_content('description'),$i);
} $this->course->add_resource($linkcat);
// create links }
$number_of_links = rand(5, 50); // create links
$on_homepage = rand(0,20) == 0 ? 1 : 0; $number_of_links = rand(5, 50);
$property = $this->default_property; $on_homepage = rand(0,20) == 0 ? 1 : 0;
$property['lastedit_type'] = 'LinkAdded'; $property = $this->default_property;
$property['tool'] = TOOL_LINK; $property['lastedit_type'] = 'LinkAdded';
for ($i = 0; $i < $number_of_links; $i ++) $property['tool'] = TOOL_LINK;
{ for ($i = 0; $i < $number_of_links; $i ++)
$link = new Link($i, $this->get_dummy_content('title'), 'http://www.google.com/search?q='.$this->get_dummy_content('title'), $this->get_dummy_content('description'), rand(0, $number_of_categories -1),$on_homepage); {
$link->item_properties[] = $property; $link = new Link($i, $this->get_dummy_content('title'), 'http://www.google.com/search?q='.$this->get_dummy_content('title'), $this->get_dummy_content('description'), rand(0, $number_of_categories -1),$on_homepage);
$this->course->add_resource($link); $link->item_properties[] = $property;
} $this->course->add_resource($link);
} }
/** }
* Create dummy forums /**
*/ * Create dummy forums
function create_dummy_forums() */
{ function create_dummy_forums()
$number_of_categories = rand(2, 6); {
$number_of_forums = rand(5, 50); $number_of_categories = rand(2, 6);
$number_of_topics = rand(30, 100); $number_of_forums = rand(5, 50);
$number_of_posts = rand(100, 1000); $number_of_topics = rand(30, 100);
$last_forum_post = array (); $number_of_posts = rand(100, 1000);
$last_topic_post = array (); $last_forum_post = array ();
// create categorys $last_topic_post = array ();
$order = 1; // create categorys
for ($i = 1; $i <= $number_of_categories; $i ++) $order = 1;
{ for ($i = 1; $i <= $number_of_categories; $i ++)
$forumcat = new ForumCategory($i, $this->get_dummy_content('title'), $this->get_dummy_content('description'), $order, 0, 0); {
$this->course->add_resource($forumcat); $forumcat = new ForumCategory($i, $this->get_dummy_content('title'), $this->get_dummy_content('description'), $order, 0, 0);
$order++; $this->course->add_resource($forumcat);
} $order++;
// create posts }
for ($post_id = 1; $post_id <= $number_of_posts; $post_id ++) // create posts
{ for ($post_id = 1; $post_id <= $number_of_posts; $post_id ++)
$topic_id = rand(1, $number_of_topics); {
$last_topic_post[$topic_id] = $post_id; $topic_id = rand(1, $number_of_topics);
$post = new ForumPost($post_id, $this->get_dummy_content('title'), $this->get_dummy_content('text'), date('Y-m-d H:i:s'), 1, 'Portal Administrator', 0, 0, $topic_id, 0, 1); $last_topic_post[$topic_id] = $post_id;
$this->course->add_resource($post); $post = new ForumPost($post_id, $this->get_dummy_content('title'), $this->get_dummy_content('text'), date('Y-m-d H:i:s'), 1, 'Portal Administrator', 0, 0, $topic_id, 0, 1);
} $this->course->add_resource($post);
// create topics }
for ($topic_id = 1; $topic_id <= $number_of_topics; $topic_id ++) // create topics
{ for ($topic_id = 1; $topic_id <= $number_of_topics; $topic_id ++)
$forum_id = rand(1, $number_of_forums); {
$last_forum_post[$forum_id] = $last_topic_post[$topic_id]; $forum_id = rand(1, $number_of_forums);
$topic = new ForumTopic($topic_id, $this->get_dummy_content('title'), '2011-03-31 12:10:00', 'Chamilo', 'Administrator', 0, $forum_id, $last_topic_post[$topic_id]); $last_forum_post[$forum_id] = $last_topic_post[$topic_id];
$this->course->add_resource($topic); $topic = new ForumTopic($topic_id, $this->get_dummy_content('title'), '2011-03-31 12:10:00', 'Chamilo', 'Administrator', 0, $forum_id, $last_topic_post[$topic_id]);
} $this->course->add_resource($topic);
// create forums }
for ($forum_id = 1; $forum_id <= $number_of_forums; $forum_id ++) // create forums
{ for ($forum_id = 1; $forum_id <= $number_of_forums; $forum_id ++)
$forum = new Forum($forum_id, $this->get_dummy_content('title'),$this->get_dummy_content('description'), rand(1, $number_of_categories), $last_forum_post[$forum_id]); {
$this->course->add_resource($forum); $forum = new Forum($forum_id, $this->get_dummy_content('title'),$this->get_dummy_content('description'), rand(1, $number_of_categories), $last_forum_post[$forum_id]);
} $this->course->add_resource($forum);
} }
/** }
* Create dummy learnpaths /**
*/ * Create dummy learnpaths
function create_dummy_learnpaths() */
{ function create_dummy_learnpaths()
$number_of_learnpaths = rand(3,5); {
$global_item_id = 1; $number_of_learnpaths = rand(3,5);
for($i=1; $i<=$number_of_learnpaths;$i++) $global_item_id = 1;
{ for($i=1; $i<=$number_of_learnpaths;$i++)
$chapters = array(); {
$number_of_chapters = rand(1,6); $chapters = array();
for($chapter_id = 1; $chapter_id <= $number_of_chapters; $chapter_id++) $number_of_chapters = rand(1,6);
{ for($chapter_id = 1; $chapter_id <= $number_of_chapters; $chapter_id++)
$chapter['name'] = $this->get_dummy_content('title'); {
$chapter['description'] = $this->get_dummy_content('description'); $chapter['name'] = $this->get_dummy_content('title');
$chapter['display_order'] = $chapter_id; $chapter['description'] = $this->get_dummy_content('description');
$chapter['items'] = array(); $chapter['display_order'] = $chapter_id;
$number_of_items = rand(5,20); $chapter['items'] = array();
for( $item_id = 1; $item_id<$number_of_items; $item_id++) $number_of_items = rand(5,20);
{ for( $item_id = 1; $item_id<$number_of_items; $item_id++)
$types = array(RESOURCE_ANNOUNCEMENT, RESOURCE_EVENT, RESOURCE_DOCUMENT,RESOURCE_LINK,RESOURCE_FORUM,RESOURCE_FORUMPOST,RESOURCE_FORUMTOPIC); {
$type = $types[rand(0,count($types)-1)]; $types = array(RESOURCE_ANNOUNCEMENT, RESOURCE_EVENT, RESOURCE_DOCUMENT,RESOURCE_LINK,RESOURCE_FORUM,RESOURCE_FORUMPOST,RESOURCE_FORUMTOPIC);
$resources = $this->course->resources[$type]; $type = $types[rand(0,count($types)-1)];
$resource = $resources[rand(0,count($resources)-1)]; $resources = $this->course->resources[$type];
$item = array(); $resource = $resources[rand(0,count($resources)-1)];
$item['type'] = $resource->type; $item = array();
$item['id'] = $resource->source_id; $item['type'] = $resource->type;
$item['display_order'] = $item_id; $item['id'] = $resource->source_id;
$item['title'] = $this->get_dummy_content('title'); $item['display_order'] = $item_id;
$item['description'] = $this->get_dummy_content('description'); $item['title'] = $this->get_dummy_content('title');
$item['ref_id'] = $global_item_id; $item['description'] = $this->get_dummy_content('description');
if( rand(0,5) == 1 && $item_id > 1) $item['ref_id'] = $global_item_id;
{ if( rand(0,5) == 1 && $item_id > 1)
$item['prereq_type'] = 'i'; {
$item['prereq'] = rand($global_item_id - $item_id,$global_item_id-1); $item['prereq_type'] = 'i';
} $item['prereq'] = rand($global_item_id - $item_id,$global_item_id-1);
$chapter['items'][] = $item; }
$global_item_id++; $chapter['items'][] = $item;
} $global_item_id++;
$chapters[] = $chapter; }
} $chapters[] = $chapter;
$lp = new CourseCopyLearnpath($i,$this->get_dummy_content('title'),$this->get_dummy_content('description'),1,$chapters); }
$this->course->add_resource($lp); $lp = new CourseCopyLearnpath($i,$this->get_dummy_content('title'),$this->get_dummy_content('description'),1,$chapters);
} $this->course->add_resource($lp);
} }
/** }
* Get dummy titles, descriptions and texts /**
*/ * Get dummy titles, descriptions and texts
function get_dummy_content($type) */
{ function get_dummy_content($type)
$dummy_text = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque lectus. Duis sodales. Vivamus et nunc. Phasellus interdum est a lorem. Fusce venenatis luctus lectus. Mauris quis turpis ac erat rhoncus suscipit. Phasellus elit dui, semper at, porta ut, egestas ac, enim. Quisque pellentesque, nisl nec consequat mollis, ipsum justo pellentesque nibh, non faucibus odio ante at lorem. Donec vitae pede ut felis ultricies semper. Suspendisse velit nibh, interdum quis, gravida nec, dapibus ac, leo. Cras id sem ut tellus tincidunt scelerisque. Aenean ac magna feugiat dolor accumsan dignissim. Integer eget nisl. {
Ut sit amet nulla. Vestibulum venenatis posuere mauris. Nullam magna leo, blandit luctus, consequat quis, gravida nec, justo. Nam pede. Etiam ut nisl. In at quam scelerisque sapien faucibus commodo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Proin mattis lorem quis nunc. Praesent placerat ligula id elit. Aenean blandit, purus sit amet pharetra auctor, libero orci rutrum felis, sit amet sodales mauris ipsum ultricies sapien. Vivamus wisi. Cras elit elit, ullamcorper ac, interdum nec, pulvinar nec, lacus. In lacus. Vivamus auctor, arcu vitae tincidunt porta, eros lacus tristique justo, vitae semper risus neque eget massa. Vivamus turpis. $dummy_text = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque lectus. Duis sodales. Vivamus et nunc. Phasellus interdum est a lorem. Fusce venenatis luctus lectus. Mauris quis turpis ac erat rhoncus suscipit. Phasellus elit dui, semper at, porta ut, egestas ac, enim. Quisque pellentesque, nisl nec consequat mollis, ipsum justo pellentesque nibh, non faucibus odio ante at lorem. Donec vitae pede ut felis ultricies semper. Suspendisse velit nibh, interdum quis, gravida nec, dapibus ac, leo. Cras id sem ut tellus tincidunt scelerisque. Aenean ac magna feugiat dolor accumsan dignissim. Integer eget nisl.
Aenean ac wisi non enim aliquam scelerisque. Praesent eget mi. Vestibulum volutpat pulvinar justo. Phasellus sapien ante, pharetra id, bibendum sed, porta non, purus. Maecenas leo velit, luctus quis, porta non, feugiat sit amet, sapien. Proin vitae augue ut massa adipiscing placerat. Morbi ac risus. Proin dapibus eros egestas quam. Fusce fermentum lobortis elit. Duis lectus tellus, convallis nec, lobortis vel, accumsan ut, nunc. Nunc est. Donec ullamcorper laoreet quam. Ut sit amet nulla. Vestibulum venenatis posuere mauris. Nullam magna leo, blandit luctus, consequat quis, gravida nec, justo. Nam pede. Etiam ut nisl. In at quam scelerisque sapien faucibus commodo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Proin mattis lorem quis nunc. Praesent placerat ligula id elit. Aenean blandit, purus sit amet pharetra auctor, libero orci rutrum felis, sit amet sodales mauris ipsum ultricies sapien. Vivamus wisi. Cras elit elit, ullamcorper ac, interdum nec, pulvinar nec, lacus. In lacus. Vivamus auctor, arcu vitae tincidunt porta, eros lacus tristique justo, vitae semper risus neque eget massa. Vivamus turpis.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Suspendisse potenti. Mauris mi. Vivamus risus lacus, faucibus sit amet, sollicitudin a, blandit et, justo. In hendrerit. Sed imperdiet, eros at fringilla tempor, turpis augue semper enim, quis rhoncus nibh enim quis dui. Sed massa sapien, mattis et, laoreet sit amet, dignissim nec, urna. Integer laoreet quam quis lectus. Curabitur convallis gravida dui. Nam metus. Ut sit amet augue in nibh interdum scelerisque. Donec venenatis, lacus et pulvinar euismod, libero massa condimentum pede, commodo tristique nunc massa eu quam. Donec vulputate. Aenean in nibh. Phasellus porttitor. Donec molestie, sem ac porttitor vulputate, mauris dui egestas libero, ac lobortis dolor sem vel ligula. Nam vulputate pretium libero. Cras accumsan. Vivamus lacinia sapien sit amet elit. Aenean ac wisi non enim aliquam scelerisque. Praesent eget mi. Vestibulum volutpat pulvinar justo. Phasellus sapien ante, pharetra id, bibendum sed, porta non, purus. Maecenas leo velit, luctus quis, porta non, feugiat sit amet, sapien. Proin vitae augue ut massa adipiscing placerat. Morbi ac risus. Proin dapibus eros egestas quam. Fusce fermentum lobortis elit. Duis lectus tellus, convallis nec, lobortis vel, accumsan ut, nunc. Nunc est. Donec ullamcorper laoreet quam.
Duis bibendum elementum justo. Duis posuere. Fusce nulla odio, posuere eget, condimentum nec, venenatis eu, elit. In hac habitasse platea dictumst. Aenean ac sem in enim imperdiet feugiat. Integer tincidunt lectus at elit. Integer magna lacus, vehicula quis, eleifend eget, suscipit vitae, leo. Nunc porta augue nec enim. Curabitur vehicula volutpat enim. Aliquam consequat. Vestibulum rhoncus tellus vitae erat. Integer est. Quisque fermentum leo nec odio. Suspendisse lobortis sollicitudin augue. Nullam urna mi, suscipit eu, sagittis laoreet, ultrices ac, sem. Aliquam enim tortor, hendrerit non, cursus a, tristique sit amet, sapien. Suspendisse potenti. Aenean semper placerat neque.'; Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Suspendisse potenti. Mauris mi. Vivamus risus lacus, faucibus sit amet, sollicitudin a, blandit et, justo. In hendrerit. Sed imperdiet, eros at fringilla tempor, turpis augue semper enim, quis rhoncus nibh enim quis dui. Sed massa sapien, mattis et, laoreet sit amet, dignissim nec, urna. Integer laoreet quam quis lectus. Curabitur convallis gravida dui. Nam metus. Ut sit amet augue in nibh interdum scelerisque. Donec venenatis, lacus et pulvinar euismod, libero massa condimentum pede, commodo tristique nunc massa eu quam. Donec vulputate. Aenean in nibh. Phasellus porttitor. Donec molestie, sem ac porttitor vulputate, mauris dui egestas libero, ac lobortis dolor sem vel ligula. Nam vulputate pretium libero. Cras accumsan. Vivamus lacinia sapien sit amet elit.
switch($type) Duis bibendum elementum justo. Duis posuere. Fusce nulla odio, posuere eget, condimentum nec, venenatis eu, elit. In hac habitasse platea dictumst. Aenean ac sem in enim imperdiet feugiat. Integer tincidunt lectus at elit. Integer magna lacus, vehicula quis, eleifend eget, suscipit vitae, leo. Nunc porta augue nec enim. Curabitur vehicula volutpat enim. Aliquam consequat. Vestibulum rhoncus tellus vitae erat. Integer est. Quisque fermentum leo nec odio. Suspendisse lobortis sollicitudin augue. Nullam urna mi, suscipit eu, sagittis laoreet, ultrices ac, sem. Aliquam enim tortor, hendrerit non, cursus a, tristique sit amet, sapien. Suspendisse potenti. Aenean semper placerat neque.';
{ switch($type)
case 'description': {
$descriptions = explode(".",$dummy_text); case 'description':
return $descriptions[rand(0,count($descriptions)-1)]; $descriptions = explode(".",$dummy_text);
break; return $descriptions[rand(0,count($descriptions)-1)];
case 'title': break;
$dummy_text = str_replace(array("\n",'.',',',"\t"),array(' ','','',' '),$dummy_text); case 'title':
$titles = explode(" ",$dummy_text); $dummy_text = str_replace(array("\n",'.',',',"\t"),array(' ','','',' '),$dummy_text);
return trim($titles[rand(0,count($titles)-1)]); $titles = explode(" ",$dummy_text);
break; return trim($titles[rand(0,count($titles)-1)]);
case 'text': break;
$texts = explode("\n",$dummy_text); case 'text':
return $texts[rand(0,count($texts)-1)]; $texts = explode("\n",$dummy_text);
break; return $texts[rand(0,count($texts)-1)];
} break;
} }
}
} }

@ -80,7 +80,7 @@ class CalendarEvent extends Coursecopy\Resource
/** /**
* Show this Event * Show this Event
*/ */
function show() public function show()
{ {
parent::show(); parent::show();
echo $this->title.' ('.$this->start_date.' -> '.$this->end_date.')'; echo $this->title.' ('.$this->start_date.' -> '.$this->end_date.')';

@ -103,7 +103,7 @@ class Forum extends Coursecopy\Resource
/** /**
* Create a new Forum * Create a new Forum
*/ */
function __construct($obj) public function __construct($obj)
{ {
parent::__construct($obj->forum_id, RESOURCE_FORUM); parent::__construct($obj->forum_id, RESOURCE_FORUM);
$this->obj = $obj; $this->obj = $obj;
@ -112,7 +112,8 @@ class Forum extends Coursecopy\Resource
/** /**
* Show this resource * Show this resource
*/ */
function show() { public function show()
{
parent::show(); parent::show();
echo $this->obj->forum_title; echo $this->obj->forum_title;
} }

@ -22,7 +22,7 @@ class ForumCategory extends Coursecopy\Resource
/** /**
* Show this resource * Show this resource
*/ */
function show() public function show()
{ {
parent::show(); parent::show();
echo $this->obj->cat_title; echo $this->obj->cat_title;

@ -15,7 +15,7 @@ class ForumTopic extends Coursecopy\Resource
*/ */
/* function ForumTopic($id, $title, $time, $topic_poster_id, $topic_poster_name, $forum_id, $last_post, $replies, $views = 0, $sticky = 0, $locked = 0, /* function ForumTopic($id, $title, $time, $topic_poster_id, $topic_poster_name, $forum_id, $last_post, $replies, $views = 0, $sticky = 0, $locked = 0,
$time_closed = null, $weight = 0, $title_qualify = null, $qualify_max = 0) */ $time_closed = null, $weight = 0, $title_qualify = null, $qualify_max = 0) */
function __construct($obj) public function __construct($obj)
{ {
parent::__construct($obj->thread_id, RESOURCE_FORUMTOPIC); parent::__construct($obj->thread_id, RESOURCE_FORUMTOPIC);
$this->obj = $obj; $this->obj = $obj;
@ -39,7 +39,7 @@ class ForumTopic extends Coursecopy\Resource
/** /**
* Show this resource * Show this resource
*/ */
function show() public function show()
{ {
parent::show(); parent::show();
$extra = api_convert_and_format_date($this->obj->thread_date); $extra = api_convert_and_format_date($this->obj->thread_date);

@ -10,33 +10,33 @@ require_once 'Resource.class.php';
*/ */
class Glossary extends Coursecopy\Resource class Glossary extends Coursecopy\Resource
{ {
public $glossary_id; public $glossary_id;
public $name; public $name;
public $description; public $description;
public $display_order; public $display_order;
/** /**
* Create a new Glossary * Create a new Glossary
* @param int $id * @param int $id
* @param string $name * @param string $name
* @param string $description * @param string $description
* @param int $display_order * @param int $display_order
*/ */
public function __construct($id,$name,$description,$display_order) public function __construct($id,$name,$description,$display_order)
{ {
parent::__construct($id,RESOURCE_GLOSSARY); parent::__construct($id,RESOURCE_GLOSSARY);
$this->glossary_id = $id; $this->glossary_id = $id;
$this->name = $name; $this->name = $name;
$this->description = $description; $this->description = $description;
$this->display_order = $display_order; $this->display_order = $display_order;
} }
/** /**
* Show this glossary * Show this glossary
*/ */
public function show() public function show()
{ {
parent::show(); parent::show();
echo $this->name; echo $this->name;
} }
} }

@ -11,33 +11,33 @@ require_once 'Resource.class.php';
*/ */
class Link extends Coursecopy\Resource class Link extends Coursecopy\Resource
{ {
/** /**
* The title * The title
*/ */
public $title; public $title;
/** /**
* The URL * The URL
*/ */
public $url; public $url;
/** /**
* The description * The description
*/ */
public $description; public $description;
/** /**
* Id of this links category * Id of this links category
*/ */
public $category_id; public $category_id;
/** /**
* Display link on course homepage * Display link on course homepage
*/ */
public $on_homepage; public $on_homepage;
/** /**
* Create a new Link * Create a new Link
* @param int $id The id of this link in the Chamilo-course * @param int $id The id of this link in the Chamilo-course
* @param string $title * @param string $title
* @param string $url * @param string $url
* @param string $description * @param string $description
*/ */
public function __construct( public function __construct(
$id, $id,
$title, $title,
@ -45,22 +45,21 @@ class Link extends Coursecopy\Resource
$description, $description,
$category_id, $category_id,
$on_homepage $on_homepage
) ) {
{ parent::__construct($id,RESOURCE_LINK);
parent::__construct($id,RESOURCE_LINK); $this->title = $title;
$this->title = $title; $this->url = $url;
$this->url = $url; $this->description = $description;
$this->description = $description; $this->category_id = $category_id;
$this->category_id = $category_id; $this->on_homepage = $on_homepage;
$this->on_homepage = $on_homepage; }
}
/** /**
* Show this resource * Show this resource
*/ */
public function show() public function show()
{ {
parent::show(); parent::show();
echo $this->title.' ('.$this->url.')'; echo $this->title.' ('.$this->url.')';
} }
} }

@ -10,39 +10,39 @@ require_once 'Resource.class.php';
*/ */
class LinkCategory extends Coursecopy\Resource class LinkCategory extends Coursecopy\Resource
{ {
/** /**
* The title * The title
*/ */
public $title; public $title;
/** /**
* The description * The description
*/ */
public $description; public $description;
/** /**
* The display order * The display order
*/ */
public $display_order; public $display_order;
/** /**
* Create a new LinkCategory * Create a new LinkCategory
* @param int $id * @param int $id
* @param string $title * @param string $title
* @param string $description * @param string $description
*/ */
function __construct($id,$title,$description,$display_order) public function __construct($id,$title,$description,$display_order)
{ {
parent::__construct($id,RESOURCE_LINKCATEGORY); parent::__construct($id,RESOURCE_LINKCATEGORY);
$this->title = $title; $this->title = $title;
$this->description = $description; $this->description = $description;
$this->display_order = $display_order; $this->display_order = $display_order;
} }
/** /**
* Show this LinkCategory * Show this LinkCategory
*/ */
function show() public function show()
{ {
parent::show(); parent::show();
echo $this->title.' '.$this->description.'<br />'; echo $this->title.' '.$this->description.'<br />';
} }
} }

@ -21,6 +21,10 @@ class Quiz extends Coursecopy\Resource
*/ */
public $obj; //question public $obj; //question
/**
* Quiz constructor.
* @param int $obj
*/
public function __construct($obj) public function __construct($obj)
{ {
$this->obj = $obj; $this->obj = $obj;

@ -233,28 +233,49 @@ class Resource
} }
/** /**
* Fix objects coming from 1.9.x to 1.10.x * Fix objects coming from 1.9.x to 1.10.x
* Example class Event to CalendarEvent * Example class Event to CalendarEvent
* *
* @param Resource $resource * @param Resource $resource
*/ */
public static function setClassType(&$resource) public static function setClassType(&$resource)
{ {
if (get_class($resource) == 'Event') { $class = get_class($resource);
/** @var $resource CalendarEvent */ switch ($class) {
$newResource = new CalendarEvent( case 'Event':
$resource->source_id, /** @var $resource \CalendarEvent */
$resource->title, $newResource = new \CalendarEvent(
$resource->content, $resource->source_id,
$resource->start_date, $resource->title,
$resource->end_date, $resource->content,
$resource->attachment_path, $resource->start_date,
$resource->attachment_filename, $resource->end_date,
$resource->attachment_size, $resource->attachment_path,
$resource->attachment_comment, $resource->attachment_filename,
$resource->all_day $resource->attachment_size,
); $resource->attachment_comment,
$resource = $newResource; $resource->all_day
);
$resource = $newResource;
break;
case 'CourseDescription':
if (!method_exists($resource, 'show')) {
$resource = (array) $resource;
$newResource = new CourseDescription(
isset($resource['id']) ? $resource['id'] : '',
$resource['title'],
$resource['content'],
$resource['description_type']
);
$newResource->source_id = $resource['source_id'];
$newResource->destination_id = $resource['source_id'];
$newResource->linked_resources = $resource['source_id'];
$newResource->item_properties = $resource['source_id'];
$newResource->obj = $resource['obj'];
$resource = $newResource;
}
break;
} }
} }
} }

@ -13,18 +13,18 @@ class ScormDocument extends Coursecopy\Resource
public $path; public $path;
public $title; public $title;
/** /**
* Create a new Scorm Document * Create a new Scorm Document
* @param int $id * @param int $id
* @param string $path * @param string $path
* @param string $title * @param string $title
*/ */
public function __construct($id, $path, $title) public function __construct($id, $path, $title)
{ {
parent::__construct($id,RESOURCE_SCORM); parent::__construct($id,RESOURCE_SCORM);
$this->path = 'scorm'.$path; $this->path = 'scorm'.$path;
$this->title = $title; $this->title = $title;
} }
/** /**
* Show this document * Show this document

@ -10,86 +10,86 @@ require_once 'Resource.class.php';
*/ */
class Survey extends Coursecopy\Resource class Survey extends Coursecopy\Resource
{ {
/** /**
* The survey code * The survey code
*/ */
public $code; public $code;
/** /**
* The title and subtitle * The title and subtitle
*/ */
public $title; public $title;
public $subtitle; public $subtitle;
/** /**
* The author's name * The author's name
*/ */
public $author; public $author;
/** /**
* The survey's language * The survey's language
*/ */
public $lang; public $lang;
/** /**
* The availability period * The availability period
*/ */
public $avail_from; public $avail_from;
public $avail_till; public $avail_till;
/** /**
* Flag for shared status * Flag for shared status
*/ */
public $is_shared; public $is_shared;
/** /**
* Template used * Template used
*/ */
public $template; public $template;
/** /**
* Introduction text * Introduction text
*/ */
public $intro; public $intro;
/** /**
* Thanks text * Thanks text
*/ */
public $surveythanks; public $surveythanks;
/** /**
* Creation date * Creation date
*/ */
public $creation_date; public $creation_date;
/** /**
* Invitation status * Invitation status
*/ */
public $invited; public $invited;
/** /**
* Answer status * Answer status
*/ */
public $answered; public $answered;
/** /**
* Invitation and reminder mail contents * Invitation and reminder mail contents
*/ */
public $invite_mail; public $invite_mail;
public $reminder_mail; public $reminder_mail;
/** /**
* Questions and invitations lists * Questions and invitations lists
*/ */
public $question_ids; public $question_ids;
public $invitation_ids; public $invitation_ids;
/** /**
* Create a new Survey * Create a new Survey
* @param string $code * @param string $code
* @param string $title * @param string $title
* @param string $subtitle * @param string $subtitle
* @param string $author * @param string $author
* @param string $lang * @param string $lang
* @param string $avail_from * @param string $avail_from
* @param string $avail_till * @param string $avail_till
* @param char $is_shared * @param char $is_shared
* @param string $template * @param string $template
* @param string $intro * @param string $intro
* @param string $surveythanks * @param string $surveythanks
* @param string $creation_date * @param string $creation_date
* @param int $invited * @param int $invited
* @param int $answered * @param int $answered
* @param string $invite_mail * @param string $invite_mail
* @param string $reminder_mail * @param string $reminder_mail
*/ */
public function __construct( public function __construct(
$id, $id,
$code, $code,
@ -109,49 +109,49 @@ class Survey extends Coursecopy\Resource
$invite_mail, $invite_mail,
$reminder_mail $reminder_mail
) { ) {
parent::__construct($id,RESOURCE_SURVEY); parent::__construct($id, RESOURCE_SURVEY);
$this->code = $code; $this->code = $code;
$this->title = $title; $this->title = $title;
$this->subtitle = $subtitle; $this->subtitle = $subtitle;
$this->author = $author; $this->author = $author;
$this->lang = $lang; $this->lang = $lang;
$this->avail_from = $avail_from; $this->avail_from = $avail_from;
$this->avail_till = $avail_till; $this->avail_till = $avail_till;
$this->is_shared = $is_shared; $this->is_shared = $is_shared;
$this->template = $template; $this->template = $template;
$this->intro = $intro; $this->intro = $intro;
$this->surveythanks = $surveythanks; $this->surveythanks = $surveythanks;
$this->creation_date = $creation_date; $this->creation_date = $creation_date;
$this->invited = $invited; $this->invited = $invited;
$this->answered = $answered; $this->answered = $answered;
$this->invite_mail = $invite_mail; $this->invite_mail = $invite_mail;
$this->reminder_mail = $reminder_mail; $this->reminder_mail = $reminder_mail;
$this->question_ids = array(); $this->question_ids = array();
$this->invitation_ids = array(); $this->invitation_ids = array();
} }
/** /**
* Add a question to this survey * Add a question to this survey
*/ */
function add_question($id) public function add_question($id)
{ {
$this->question_ids[] = $id; $this->question_ids[] = $id;
} }
/** /**
* Add an invitation to this survey * Add an invitation to this survey
*/ */
function add_invitation($id) public function add_invitation($id)
{ {
$this->invitation_ids[] = $id; $this->invitation_ids[] = $id;
} }
/** /**
* Show this survey * Show this survey
*/ */
function show() public function show()
{ {
parent::show(); parent::show();
echo $this->code.' - '.$this->title; echo $this->code.' - '.$this->title;
} }
} }

@ -10,52 +10,52 @@ require_once 'Resource.class.php';
*/ */
class SurveyInvitation extends Coursecopy\Resource class SurveyInvitation extends Coursecopy\Resource
{ {
/** /**
* Survey code * Survey code
*/ */
public $code; public $code;
/** /**
* User info * User info
*/ */
public $user; public $user;
/** /**
* Invitation code * Invitation code
*/ */
public $invitation_code; public $invitation_code;
/** /**
* Invitation date * Invitation date
*/ */
public $invitation_date; public $invitation_date;
/** /**
* Reminder date * Reminder date
*/ */
public $reminder_date; public $reminder_date;
/** /**
* Create a new SurveyInvitation * Create a new SurveyInvitation
* @param int $id * @param int $id
* @param string $code * @param string $code
* @param string $user * @param string $user
* @param string $invitation_code * @param string $invitation_code
* @param string $invitation_date * @param string $invitation_date
* @param string $reminder_date * @param string $reminder_date
*/ */
public function __construct($id,$code,$user,$invitation_code,$invitation_date,$reminder_date) public function __construct($id, $code, $user, $invitation_code, $invitation_date, $reminder_date)
{ {
parent::__construct($id, RESOURCE_SURVEYINVITATION); parent::__construct($id, RESOURCE_SURVEYINVITATION);
$this->code = $code; $this->code = $code;
$this->user = $user; $this->user = $user;
$this->invitation_code = $invitation_code; $this->invitation_code = $invitation_code;
$this->invitation_date = $invitation_date; $this->invitation_date = $invitation_date;
$this->reminder_date = $reminder_date; $this->reminder_date = $reminder_date;
} }
/** /**
* Show this invitation * Show this invitation
*/ */
function show() public function show()
{ {
parent::show(); parent::show();
echo $this->invitation_code; echo $this->invitation_code;
} }
} }

@ -10,93 +10,94 @@ require_once 'Resource.class.php';
*/ */
class SurveyQuestion extends Coursecopy\Resource class SurveyQuestion extends Coursecopy\Resource
{ {
/** /**
* Survey ID * Survey ID
*/ */
public $survey_id; public $survey_id;
/** /**
* Question and question comment * Question and question comment
*/ */
public $survey_question; public $survey_question;
public $survey_question_comment; public $survey_question_comment;
/** /**
* Question type * Question type
*/ */
public $survey_question_type; public $survey_question_type;
/** /**
* Display ? * Display ?
*/ */
public $display; public $display;
/** /**
* Sorting order * Sorting order
*/ */
public $sort; public $sort;
/** /**
* Shared question ID * Shared question ID
*/ */
public $shared_question_id; public $shared_question_id;
/** /**
* Maximum value for the vote * Maximum value for the vote
*/ */
public $max_value; public $max_value;
/** /**
* Question's options * Question's options
*/ */
public $options; public $options;
/** /**
* Create a new SurveyQuestion * Create a new SurveyQuestion
* @param int $id * @param int $id
* @param int $survey_id * @param int $survey_id
* @param string $survey_question * @param string $survey_question
* @param string $survey_question_comment * @param string $survey_question_comment
* @param string $type * @param string $type
* @param string $display * @param string $display
* @param int $sort * @param int $sort
* @param int $shared_question_id * @param int $shared_question_id
* @param int $max_value * @param int $max_value
*/ */
function __construct( public function __construct(
$id, $id,
$survey_id, $survey_id,
$survey_question, $survey_question,
$survey_question_comment, $survey_question_comment,
$type, $type,
$display, $display,
$sort, $sort,
$shared_question_id, $shared_question_id,
$max_value $max_value
) { ) {
parent::__construct($id,RESOURCE_SURVEYQUESTION); parent::__construct($id, RESOURCE_SURVEYQUESTION);
$this->survey_id = $survey_id; $this->survey_id = $survey_id;
$this->survey_question = $survey_question; $this->survey_question = $survey_question;
$this->survey_question_comment = $survey_question_comment; $this->survey_question_comment = $survey_question_comment;
$this->survey_question_type = $type; $this->survey_question_type = $type;
$this->display = $display; $this->display = $display;
$this->sort = $sort; $this->sort = $sort;
$this->shared_question_id = $shared_question_id; $this->shared_question_id = $shared_question_id;
$this->max_value = $max_value; $this->max_value = $max_value;
$this->answers = array(); $this->answers = array();
} }
/**
* Add an answer option to this SurveyQuestion /**
* @param string $option_text * Add an answer option to this SurveyQuestion
* @param int $sort * @param string $option_text
*/ * @param int $sort
function add_answer($option_text,$sort) */
{ public function add_answer($option_text,$sort)
$answer = array(); {
$answer['option_text'] = $option_text; $answer = array();
$answer['sort'] = $sort; $answer['option_text'] = $option_text;
$this->answers[] = $answer; $answer['sort'] = $sort;
} $this->answers[] = $answer;
/** }
* Show this question /**
*/ * Show this question
function show() */
{ public function show()
parent::show(); {
echo $this->survey_question; parent::show();
} echo $this->survey_question;
}
} }

@ -16,7 +16,7 @@ class Thematic extends Coursecopy\Resource
/** /**
* Create a new Thematic * Create a new Thematic
* *
* @param array parameters * @param array $params
*/ */
public function __construct($params) public function __construct($params)
{ {

@ -10,82 +10,82 @@ require_once 'Resource.class.php';
*/ */
class ToolIntro extends Coursecopy\Resource class ToolIntro extends Coursecopy\Resource
{ {
public $id; public $id;
/** /**
* intro text * intro text
*/ */
public $intro_text; public $intro_text;
/** /**
* Create a new text introduction * Create a new text introduction
* @param int $id The id of this tool introduction in the Chamilo-course * @param int $id The id of this tool introduction in the Chamilo-course
* @param string $intro_text * @param string $intro_text
*/ */
public function __construct($id, $intro_text) public function __construct($id, $intro_text)
{ {
parent::__construct($id, RESOURCE_TOOL_INTRO); parent::__construct($id, RESOURCE_TOOL_INTRO);
$this->id = $id; $this->id = $id;
$this->intro_text = $intro_text; $this->intro_text = $intro_text;
} }
/** /**
* Show this resource * Show this resource
*/ */
function show() public function show()
{ {
parent::show(); parent::show();
switch ($this->id) switch ($this->id)
{ {
case TOOL_DOCUMENT: case TOOL_DOCUMENT:
$lang_id = 'Documents'; $lang_id = 'Documents';
break; break;
case TOOL_CALENDAR_EVENT: case TOOL_CALENDAR_EVENT:
$lang_id = 'Agenda'; $lang_id = 'Agenda';
break; break;
case TOOL_LINK: case TOOL_LINK:
$lang_id = 'Links'; $lang_id = 'Links';
break; break;
case TOOL_LEARNPATH: case TOOL_LEARNPATH:
$lang_id = 'LearningPath'; $lang_id = 'LearningPath';
break; break;
case TOOL_ANNOUNCEMENT: case TOOL_ANNOUNCEMENT:
$lang_id = 'Announcements'; $lang_id = 'Announcements';
break; break;
case TOOL_FORUM: case TOOL_FORUM:
$lang_id = 'Forums'; $lang_id = 'Forums';
break; break;
case TOOL_DROPBOX: case TOOL_DROPBOX:
$lang_id = 'Dropbox'; $lang_id = 'Dropbox';
break; break;
case TOOL_QUIZ: case TOOL_QUIZ:
$lang_id = 'Exercises'; $lang_id = 'Exercises';
break; break;
case TOOL_USER: case TOOL_USER:
$lang_id = 'Users'; $lang_id = 'Users';
break; break;
case TOOL_GROUP: case TOOL_GROUP:
$lang_id = 'Group'; $lang_id = 'Group';
break; break;
case TOOL_WIKI: case TOOL_WIKI:
$lang_id = 'Wiki'; $lang_id = 'Wiki';
break; break;
case TOOL_STUDENTPUBLICATION: case TOOL_STUDENTPUBLICATION:
$lang_id = 'StudentPublications'; $lang_id = 'StudentPublications';
break; break;
case TOOL_COURSE_HOMEPAGE: case TOOL_COURSE_HOMEPAGE:
$lang_id = 'CourseHomepageLink'; $lang_id = 'CourseHomepageLink';
break; break;
case TOOL_GLOSSARY: case TOOL_GLOSSARY:
$lang_id = 'Glossary'; $lang_id = 'Glossary';
break; break;
case TOOL_NOTEBOOK: case TOOL_NOTEBOOK:
$lang_id = 'Notebook'; $lang_id = 'Notebook';
break; break;
default: default:
$lang_id = ucfirst($this->id); // This is a wild guess. $lang_id = ucfirst($this->id); // This is a wild guess.
} }
echo '<strong>'.get_lang($lang_id, '').':</strong><br />'; echo '<strong>'.get_lang($lang_id, '').':</strong><br />';
echo $this->intro_text; echo $this->intro_text;
} }
} }

@ -15,7 +15,7 @@ class Work extends Coursecopy\Resource
/** /**
* Create a new Work * Create a new Work
* *
* @param array parameters * @param array $params
*/ */
public function __construct($params) public function __construct($params)
{ {

@ -9,43 +9,43 @@
*/ */
class Wiki extends Coursecopy\Resource class Wiki extends Coursecopy\Resource
{ {
public $id; public $id;
public $page_id; public $page_id;
public $reflink; public $reflink;
public $title; public $title;
public $content; public $content;
public $user_id; public $user_id;
public $group_id; public $group_id;
public $timestamp; public $timestamp;
public $progress; public $progress;
public $version; public $version;
/** /**
* Wiki constructor. * Wiki constructor.
* @param int $id * @param int $id
* @param int $page_id * @param int $page_id
* @param $reflink * @param $reflink
* @param $title * @param $title
* @param $content * @param $content
* @param $user_id * @param $user_id
* @param $group_id * @param $group_id
* @param $timestamp * @param $timestamp
* @param $progress * @param $progress
* @param $version * @param $version
*/ */
public function __construct( public function __construct(
$id, $id,
$page_id, $page_id,
$reflink, $reflink,
$title, $title,
$content, $content,
$user_id, $user_id,
$group_id, $group_id,
$timestamp, $timestamp,
$progress, $progress,
$version $version
) { ) {
parent::__construct($id,RESOURCE_WIKI); parent::__construct($id,RESOURCE_WIKI);
$this->id = $id; $this->id = $id;
$this->page_id = $page_id; $this->page_id = $page_id;
$this->reflink = $reflink; $this->reflink = $reflink;
@ -56,11 +56,11 @@ class Wiki extends Coursecopy\Resource
$this->dtime = $timestamp; $this->dtime = $timestamp;
$this->progress = $progress; $this->progress = $progress;
$this->version = $version; $this->version = $version;
} }
public function show() public function show()
{ {
parent::show(); parent::show();
echo $this->reflink.' ('. (empty($this->group_id) ? get_lang('Everyone') : get_lang('Group') . ' ' . $this->group_id) .') ' . '<i>(' . $this->dtime . ')</i>'; echo $this->reflink.' ('. (empty($this->group_id) ? get_lang('Everyone') : get_lang('Group') . ' ' . $this->group_id) .') ' . '<i>(' . $this->dtime . ')</i>';
} }
} }

@ -64,9 +64,8 @@ switch ($action) {
case 'update_lp_item_order': case 'update_lp_item_order':
if (api_is_allowed_to_edit(null, true)) { if (api_is_allowed_to_edit(null, true)) {
$new_order = $_POST['new_order']; $new_order = $_POST['new_order'];
$sections = explode('^', $new_order);
$sections = explode('^', $new_order);
$new_array = array(); $new_array = array();
// We have to update parent_item_id, previous_item_id, next_item_id, display_order in the database // We have to update parent_item_id, previous_item_id, next_item_id, display_order in the database
@ -189,12 +188,7 @@ switch ($action) {
break; break;
} }
$learningPath = new learnpath( $learningPath = learnpath::getLpFromSession(api_get_course_id(), $lpId, api_get_user_id());
api_get_course_id(),
$lpId,
api_get_user_id()
);
$lpItem = $learningPath->getItem($lpItemId); $lpItem = $learningPath->getItem($lpItemId);
if (empty($lpItem)) { if (empty($lpItem)) {

@ -19,10 +19,6 @@
* @since File available since Release 0.1 * @since File available since Release 0.1
*/ */
// Added by Chamilo team, 16-MAR-2010
if (class_exists('pear')) { return; }
//
/**#@+ /**#@+
* ERROR constants * ERROR constants
*/ */
@ -156,7 +152,7 @@ class PEAR
* @access public * @access public
* @return void * @return void
*/ */
function PEAR($error_class = null) public function __construct($error_class = null)
{ {
$classname = strtolower(get_class($this)); $classname = strtolower(get_class($this));
if ($this->_debug) { if ($this->_debug) {
@ -867,9 +863,13 @@ class PEAR_Error
* @access public * @access public
* *
*/ */
function PEAR_Error($message = 'unknown error', $code = null, public function __constructor(
$mode = null, $options = null, $userinfo = null) $message = 'unknown error',
{ $code = null,
$mode = null,
$options = null,
$userinfo = null
) {
if ($mode === null) { if ($mode === null) {
$mode = PEAR_ERROR_RETURN; $mode = PEAR_ERROR_RETURN;
} }

@ -2269,24 +2269,28 @@ class UserManager
} }
/** Get extra user data by value /** Get extra user data by value
* @param string the internal variable name of the field * @param string $field_variable the internal variable name of the field
* @param string the internal value of the field * @param string $field_value the internal value of the field
* @param bool $all_visibility
*
* @return array with extra data info of a user i.e array('field_variable'=>'value'); * @return array with extra data info of a user i.e array('field_variable'=>'value');
*/ */
public static function get_extra_user_data_by_value($field_variable, $field_value) public static function get_extra_user_data_by_value($field_variable, $field_value, $all_visibility = true)
{ {
$extraField = new ExtraFieldValue('user'); $extraField = new ExtraFieldValue('user');
$data = $extraField->get_item_id_from_field_variable_and_field_value( $data = $extraField->get_values_by_handler_and_field_variable(
$field_variable, $field_variable,
$field_value, $field_value,
true null,
true,
intval($all_visibility)
); );
$result = []; $result = [];
if (!empty($data)) { if (!empty($data)) {
foreach ($data as $data) { foreach ($data as $data) {
$result[] = $data; $result[] = $data['item_id'];
} }
} }
@ -3602,7 +3606,7 @@ class UserManager
$finalResult = array(); $finalResult = array();
if (count($extraFieldResult)>1) { if (count($extraFieldResult)>1) {
for ($i=0; $i < count($extraFieldResult) -1; $i++) { for ($i=0; $i < count($extraFieldResult) -1; $i++) {
if (is_array($extraFieldResult[$i+1])) { if (is_array($extraFieldResult[$i]) && is_array($extraFieldResult[$i+1])) {
$finalResult = array_intersect($extraFieldResult[$i], $extraFieldResult[$i+1]); $finalResult = array_intersect($extraFieldResult[$i], $extraFieldResult[$i+1]);
} }
} }
@ -3626,7 +3630,7 @@ class UserManager
* @param string $query the value of the search box * @param string $query the value of the search box
* @return string HTML form * @return string HTML form
*/ */
public static function get_search_form($query) public static function get_search_form($query, $defaultParams = [])
{ {
$searchType = isset($_GET['search_type']) ? $_GET['search_type'] : null; $searchType = isset($_GET['search_type']) ? $_GET['search_type'] : null;
$form = new FormValidator( $form = new FormValidator(
@ -3678,6 +3682,10 @@ class UserManager
$defaults['search_type'] = intval($searchType); $defaults['search_type'] = intval($searchType);
$defaults['q'] = api_htmlentities(Security::remove_XSS($query)); $defaults['q'] = api_htmlentities(Security::remove_XSS($query));
if (!empty($defaultParams)) {
$defaults = array_merge($defaults, $defaultParams);
}
$form->setDefaults($defaults); $form->setDefaults($defaults);
$form->addButtonSearch(get_lang('Search')); $form->addButtonSearch(get_lang('Search'));
@ -4815,7 +4823,7 @@ EOF;
/** /**
* Subscribe boss to students * Subscribe boss to students
* *
* @param int $bossId The boss id * @param int $bossId The boss id
* @param array $usersId The users array * @param array $usersId The users array
* @return int Affected rows * @return int Affected rows

@ -21,22 +21,18 @@ $navigation_bar = '';
$display_mode = ''; $display_mode = '';
$autostart = 'true'; $autostart = 'true';
if (isset($_SESSION['lpobject'])) { $myLP = learnpath::getLpFromSession(api_get_course_id(), '', '');
$oLP = unserialize($_SESSION['lpobject']);
if (is_object($oLP)) { if ($myLP) {
$_SESSION['oLP'] = $oLP; $display_mode = $myLP->mode;
} else {
die('Could not instanciate lp object');
}
$display_mode = $_SESSION['oLP']->mode;
$scorm_css_header = true; $scorm_css_header = true;
$lp_theme_css = $_SESSION['oLP']->get_theme(); $lp_theme_css = $myLP->get_theme();
$my_style = api_get_visual_theme(); $my_style = api_get_visual_theme();
// Setting up the CSS theme if exists // Setting up the CSS theme if exists
$mycourselptheme = null; $mycourselptheme = null;
if (api_get_setting('allow_course_theme') == 'true') { if (api_get_setting('allow_course_theme') === 'true') {
$mycourselptheme = api_get_course_setting('allow_learning_path_theme'); $mycourselptheme = api_get_course_setting('allow_learning_path_theme');
} }
@ -46,13 +42,13 @@ if (isset($_SESSION['lpobject'])) {
$lp_theme_css = $my_style; $lp_theme_css = $my_style;
} }
$progress_bar = $_SESSION['oLP']->getProgressBar(); $progress_bar = $myLP->getProgressBar();
$navigation_bar = $_SESSION['oLP']->get_navigation_bar(); $navigation_bar = $myLP->get_navigation_bar();
$mediaplayer = $_SESSION['oLP']->get_mediaplayer($autostart); $mediaplayer = $myLP->get_mediaplayer($autostart);
} }
session_write_close(); session_write_close();
?> ?>
<script type="text/javascript"> <script>
$(document).ready(function() { $(document).ready(function() {
jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer({ jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer({
success: function(player, node) { success: function(player, node) {
@ -61,5 +57,5 @@ session_write_close();
}); });
</script> </script>
<span> <span>
<?php echo (!empty($mediaplayer)) ? $mediaplayer : '&nbsp;' ?> <?php echo !empty($mediaplayer) ? $mediaplayer : '&nbsp;' ?>
</span> </span>

@ -1663,7 +1663,7 @@ function switch_item(current_item, next_item){
}); });
olms.switch_finished = 0; //only changed back once LMSInitialize() happens olms.switch_finished = 0; //only changed back once LMSInitialize() happens
loadForumThead(olms.lms_lp_id, next_item); loadForumThread(olms.lms_lp_id, next_item);
return true; return true;
} }
@ -1671,7 +1671,7 @@ function switch_item(current_item, next_item){
/** /**
* Get a forum info when the learning path item has a associated forum * Get a forum info when the learning path item has a associated forum
*/ */
var loadForumThead = function(lpId, lpItemId) { var loadForumThread = function(lpId, lpItemId) {
var loadForum = $.getJSON('<?php echo api_get_path(WEB_AJAX_PATH) ?>lp.ajax.php', { var loadForum = $.getJSON('<?php echo api_get_path(WEB_AJAX_PATH) ?>lp.ajax.php', {
a: 'get_forum_thread', a: 'get_forum_thread',
lp: lpId, lp: lpId,

@ -33,7 +33,7 @@
{% if gamification_mode == 1 %} {% if gamification_mode == 1 %}
<hr> <hr>
<!--- gamification --> <!--- gamification -->
<div id="scorm-gamification"> <div id="scorm-gamification">
<div class="row"> <div class="row">
<div class="col-xs-6"> <div class="col-xs-6">
@ -61,8 +61,8 @@
</div> </div>
</div> </div>
</div> </div>
<!--- end gamification --> <!--- end gamification -->
{% else %} {% else %}
<div id="progress_bar"> <div id="progress_bar">
{{ progress_bar }} {{ progress_bar }}
</div> </div>
@ -79,7 +79,7 @@
<em class="fa fa-home"></em> <span class="hidden-xs hidden-sm"></span> <em class="fa fa-home"></em> <span class="hidden-xs hidden-sm"></span>
</a> </a>
</div> </div>
</div> </div>
</div> </div>
@ -139,7 +139,7 @@
{% endif %} {% endif %}
</div> </div>
<div role="tabpanel" class="tab-pane" id="lp-view-forum"> <div role="tabpanel" class="tab-pane" id="lp-view-forum">
</div> </div>
</div> </div>
</div> </div>
@ -161,7 +161,7 @@
}; };
$(document).on('ready', function () { $(document).on('ready', function () {
{% if lp_mode == 'embedframe' %} {% if lp_mode == 'embedframe' %}
//$('#learning_path_main').addClass('lp-view-collapsed'); //$('#learning_path_main').addClass('lp-view-collapsed');
$('#lp-view-expand-button, #lp-view-expand-toggle').on('click', function (e) { $('#lp-view-expand-button, #lp-view-expand-toggle').on('click', function (e) {
@ -181,7 +181,7 @@
$('#lp-view-expand-toggle span.fa').toggleClass('fa-expand'); $('#lp-view-expand-toggle span.fa').toggleClass('fa-expand');
$('#lp-view-expand-toggle span.fa').toggleClass('fa-compress'); $('#lp-view-expand-toggle span.fa').toggleClass('fa-compress');
}); });
{% endif %} {% endif %}
$('.lp-view-tabs').on('click', '.disabled', function (e) { $('.lp-view-tabs').on('click', '.disabled', function (e) {
@ -214,7 +214,7 @@
$('.lp-view-tabs').fadeIn(); $('.lp-view-tabs').fadeIn();
}); });
loadForumThead({{ lp_id }}, {{ lp_current_item_id }}); loadForumThread({{ lp_id }}, {{ lp_current_item_id }});
{% if glossary_extra_tools in glossary_tool_availables %} {% if glossary_extra_tools in glossary_tool_availables %}
// Loads the glossary library. // Loads the glossary library.

@ -55,11 +55,21 @@ class bbb
$this->groupSupport = isset($columns['group_id']) ? true : false; $this->groupSupport = isset($columns['group_id']) ? true : false;
if ($this->groupSupport) { if ($this->groupSupport) {
// Plugin check
$this->groupSupport = (bool) $plugin->get('enable_conference_in_course_groups'); $this->groupSupport = (bool) $plugin->get('enable_conference_in_course_groups');
if ($this->groupSupport) { if ($this->groupSupport) {
$courseInfo = api_get_course_info();
if ($courseInfo) { // Platform check
$this->groupSupport = api_get_course_setting('bbb_enable_conference_in_groups') === '1'; $bbbSetting = api_get_setting('bbb_enable_conference_in_course_groups');
$bbbSetting = isset($bbbSetting['bbb']) ? $bbbSetting['bbb'] === 'true' : false;
if ($bbbSetting) {
// Course check
$courseInfo = api_get_course_info();
if ($courseInfo) {
$this->groupSupport = api_get_course_setting('bbb_enable_conference_in_groups') === '1';
}
} }
} }
} }
@ -152,7 +162,7 @@ class bbb
# a user joins. If after this period, a user hasn't joined, the meeting is # a user joins. If after this period, a user hasn't joined, the meeting is
# removed from memory. # removed from memory.
defaultMeetingCreateJoinDuration=5 defaultMeetingCreateJoinDuration=5
* *
* @return mixed * @return mixed
*/ */
public function createMeeting($params) public function createMeeting($params)

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -12,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class Tag class Tag
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** /**
* @var string * @var string
* *
@ -33,17 +43,6 @@ class Tag
*/ */
private $count; private $count;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set tag * Set tag
* *

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -12,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class TrackEAttemptRecording class TrackEAttemptRecording
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** /**
* @var integer * @var integer
* *
@ -61,17 +71,6 @@ class TrackEAttemptRecording
*/ */
private $sessionId; private $sessionId;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set exeId * Set exeId
* *

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -20,6 +21,15 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class TrackECourseAccess class TrackECourseAccess
{ {
/**
* @var integer
*
* @ORM\Column(name="course_access_id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $courseAccessId;
/** /**
* @var integer * @var integer
* *
@ -69,17 +79,6 @@ class TrackECourseAccess
*/ */
private $userIp; private $userIp;
/**
* @var integer
*
* @ORM\Column(name="course_access_id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $courseAccessId;
/** /**
* Set cId * Set cId
* *

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -19,7 +20,16 @@ use Doctrine\ORM\Mapping as ORM;
* @ORM\Entity * @ORM\Entity
*/ */
class TrackStoredValuesStack class TrackStoredValuesStack
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** /**
* @var integer * @var integer
* *
@ -62,17 +72,6 @@ class TrackStoredValuesStack
*/ */
private $svValue; private $svValue;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set userId * Set userId
* *

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -12,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class UserApiKey class UserApiKey
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** /**
* @var integer * @var integer
* *
@ -68,17 +78,6 @@ class UserApiKey
*/ */
private $description; private $description;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set userId * Set userId
* *

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -12,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class UserCourseCategory class UserCourseCategory
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** /**
* @var integer * @var integer
* *
@ -33,17 +43,6 @@ class UserCourseCategory
*/ */
private $sort; private $sort;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set userId * Set userId
* *

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -12,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class UserRelEventType class UserRelEventType
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** /**
* @var integer * @var integer
* *
@ -26,17 +36,6 @@ class UserRelEventType
*/ */
private $eventTypeName; private $eventTypeName;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set userId * Set userId
* *

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -12,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class UserRelUser class UserRelUser
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** /**
* @var integer * @var integer
* *
@ -40,17 +50,6 @@ class UserRelUser
*/ */
private $lastEdit; private $lastEdit;
/**
* @var integer
*
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set userId * Set userId
* *

@ -20,7 +20,7 @@ class Usergroup
* *
* @ORM\Column(name="id", type="integer", nullable=false) * @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue() * @ORM\GeneratedValue
*/ */
protected $id; protected $id;

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -15,27 +16,25 @@ class UsergroupRelCourse
/** /**
* @var integer * @var integer
* *
* @ORM\Column(name="usergroup_id", type="integer", nullable=false) * @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $usergroupId; private $id;
/** /**
* @var integer * @var integer
* *
* @ORM\Column(name="course_id", type="integer", nullable=false) * @ORM\Column(name="usergroup_id", type="integer", nullable=false)
*/ */
private $courseId; private $usergroupId;
/** /**
* @var integer * @var integer
* *
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="course_id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/ */
private $id; private $courseId;
/** /**
* Set usergroupId * Set usergroupId

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -12,6 +13,15 @@ use Doctrine\ORM\Mapping as ORM;
*/ */
class UsergroupRelQuestion class UsergroupRelQuestion
{ {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/** /**
* @var integer * @var integer
* *
@ -40,17 +50,6 @@ class UsergroupRelQuestion
*/ */
private $coefficient; private $coefficient;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/** /**
* Set cId * Set cId
* *

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity; namespace Chamilo\CoreBundle\Entity;
@ -15,27 +16,25 @@ class UsergroupRelSession
/** /**
* @var integer * @var integer
* *
* @ORM\Column(name="usergroup_id", type="integer", nullable=false) * @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/ */
private $usergroupId; private $id;
/** /**
* @var integer * @var integer
* *
* @ORM\Column(name="session_id", type="integer", nullable=false) * @ORM\Column(name="usergroup_id", type="integer", nullable=false)
*/ */
private $sessionId; private $usergroupId;
/** /**
* @var integer * @var integer
* *
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="session_id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/ */
private $id; private $sessionId;
/** /**
* Set usergroupId * Set usergroupId

@ -6,14 +6,6 @@ namespace Chamilo\CoreBundle\Entity;
use Chamilo\UserBundle\Entity\User; use Chamilo\UserBundle\Entity\User;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/**
* ,
* indexes={
// * @ORM\Index(name="IDX_739515A9A76ED395", columns={"user_id"}),
// * @ORM\Index(name="IDX_739515A9D2112630", columns={"usergroup_id"})
* }
*/
/** /**
* Class UsergroupRelUser * Class UsergroupRelUser
* *

Loading…
Cancel
Save