Completed
Push — 1.10.x ( fe0e5a...3a6f9c )
by Yannick
134:15 queued 86:39
created
main/course_info/download.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
 $this_section = SECTION_COURSES;
11 11
 
12 12
 if (isset($_GET['session']) && $_GET['session']) {
13
-	$archive_path = api_get_path(SYS_ARCHIVE_PATH).'temp/';
14
-	$_cid = true;
15
-	$is_courseAdmin = true;
13
+    $archive_path = api_get_path(SYS_ARCHIVE_PATH).'temp/';
14
+    $_cid = true;
15
+    $is_courseAdmin = true;
16 16
 } else {
17
-	$archive_path = api_get_path(SYS_ARCHIVE_PATH);
17
+    $archive_path = api_get_path(SYS_ARCHIVE_PATH);
18 18
 }
19 19
 
20 20
 $archive_file = isset($_GET['archive']) ? $_GET['archive'] : null;
@@ -23,20 +23,20 @@  discard block
 block discarded – undo
23 23
 list($extension) = getextension($archive_file);
24 24
 
25 25
 if (empty($extension) || !file_exists($archive_path.$archive_file)) {
26
-	exit;
26
+    exit;
27 27
 }
28 28
 
29 29
 $extension = strtolower($extension);
30 30
 $content_type = '';
31 31
 
32 32
 if (in_array($extension, array('xml', 'csv')) && (api_is_platform_admin(true) || api_is_drh())) {
33
-	$content_type = 'application/force-download';
33
+    $content_type = 'application/force-download';
34 34
 } elseif ($extension == 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) {
35
-	$content_type = 'application/force-download';
35
+    $content_type = 'application/force-download';
36 36
 }
37 37
 
38 38
 if (empty($content_type)) {
39
-	api_not_allowed(true);
39
+    api_not_allowed(true);
40 40
 }
41 41
 
42 42
 if (Security::check_abs_path($archive_path.$archive_file, $archive_path)) {
Please login to merge, or discard this patch.
main/course_info/delete_course.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 $current_course_name = $_course['name'];
22 22
 
23 23
 if (!api_is_allowed_to_edit()) {
24
-	api_not_allowed(true);
24
+    api_not_allowed(true);
25 25
 }
26 26
 
27 27
 $tool_name = get_lang('DelCourse');
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     $message .= '<p><a class="btn btn-primary" href="'.api_get_path(WEB_CODE_PATH).'course_info/maintenance.php?'.api_get_cidreq().'">'.
46 46
         get_lang('No').'</a>&nbsp;<a class="btn btn-danger" href="'.api_get_self().'?delete=yes&'.api_get_cidreq().'">'.
47 47
         get_lang('Yes').'</a></p>';
48
-	$interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance'));
48
+    $interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance'));
49 49
 }
50 50
 Display :: display_header($tool_name, 'Settings');
51 51
 echo Display::page_header($tool_name);
Please login to merge, or discard this patch.
main/work/downloadfolder.inc.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 
63 63
 if (api_is_allowed_to_edit() || api_is_coach()) {
64 64
     //Search for all files that are not deleted => visibility != 2
65
-   $sql = "SELECT DISTINCT
65
+    $sql = "SELECT DISTINCT
66 66
                 url,
67 67
                 title,
68 68
                 description,
Please login to merge, or discard this patch.
main/coursecopy/classes/wiki.class.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -9,43 +9,43 @@  discard block
 block discarded – undo
9 9
  */
10 10
 class Wiki extends Coursecopy\Resource
11 11
 {
12
-	public $id;
13
-	public $page_id;
14
-	public $reflink;
15
-	public $title;
16
-	public $content;
17
-	public $user_id;
18
-	public $group_id;
19
-	public $timestamp;
20
-	public $progress;
21
-	public $version;
12
+    public $id;
13
+    public $page_id;
14
+    public $reflink;
15
+    public $title;
16
+    public $content;
17
+    public $user_id;
18
+    public $group_id;
19
+    public $timestamp;
20
+    public $progress;
21
+    public $version;
22 22
 
23
-	/**
24
-	 * Wiki constructor.
25
-	 * @param int $id
26
-	 * @param int $page_id
27
-	 * @param $reflink
28
-	 * @param $title
29
-	 * @param $content
30
-	 * @param $user_id
31
-	 * @param $group_id
32
-	 * @param $timestamp
33
-	 * @param $progress
34
-	 * @param $version
35
-	 */
36
-	public function __construct(
37
-		$id,
38
-		$page_id,
39
-		$reflink,
40
-		$title,
41
-		$content,
42
-		$user_id,
43
-		$group_id,
44
-		$timestamp,
45
-		$progress,
46
-		$version
47
-	) {
48
-		parent::__construct($id,RESOURCE_WIKI);
23
+    /**
24
+     * Wiki constructor.
25
+     * @param int $id
26
+     * @param int $page_id
27
+     * @param $reflink
28
+     * @param $title
29
+     * @param $content
30
+     * @param $user_id
31
+     * @param $group_id
32
+     * @param $timestamp
33
+     * @param $progress
34
+     * @param $version
35
+     */
36
+    public function __construct(
37
+        $id,
38
+        $page_id,
39
+        $reflink,
40
+        $title,
41
+        $content,
42
+        $user_id,
43
+        $group_id,
44
+        $timestamp,
45
+        $progress,
46
+        $version
47
+    ) {
48
+        parent::__construct($id,RESOURCE_WIKI);
49 49
         $this->id = $id;
50 50
         $this->page_id = $page_id;
51 51
         $this->reflink = $reflink;
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
         $this->dtime = $timestamp;
57 57
         $this->progress = $progress;
58 58
         $this->version = $version;
59
-	}
59
+    }
60 60
 
61
-	public function show()
62
-	{
63
-		parent::show();
64
-		echo $this->reflink.' ('. (empty($this->group_id) ? get_lang('Everyone') : get_lang('Group') . ' ' .  $this->group_id) .') ' . '<i>(' . $this->dtime . ')</i>';
65
-	}
61
+    public function show()
62
+    {
63
+        parent::show();
64
+        echo $this->reflink.' ('. (empty($this->group_id) ? get_lang('Everyone') : get_lang('Group') . ' ' .  $this->group_id) .') ' . '<i>(' . $this->dtime . ')</i>';
65
+    }
66 66
 }
Please login to merge, or discard this patch.
main/coursecopy/classes/Announcement.class.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -10,25 +10,25 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class Announcement extends Coursecopy\Resource
12 12
 {
13
-	/**
14
-	 * The title of the announcement
15
-	 */
13
+    /**
14
+     * The title of the announcement
15
+     */
16 16
     public $title;
17
-	/**
18
-	 * The content of the announcement
19
-	 */
17
+    /**
18
+     * The content of the announcement
19
+     */
20 20
     public $content;
21
-	/**
22
-	 * The date on which this announcement was made
23
-	 */
21
+    /**
22
+     * The date on which this announcement was made
23
+     */
24 24
     public $date;
25
-	/**
26
-	 * The display order of this announcement
27
-	 */
25
+    /**
26
+     * The display order of this announcement
27
+     */
28 28
     public $display_order;
29
-	/**
30
-	 * Has the e-mail been sent?
31
-	 */
29
+    /**
30
+     * Has the e-mail been sent?
31
+     */
32 32
     public $email_sent;
33 33
 
34 34
     public $attachment_path;
@@ -39,36 +39,36 @@  discard block
 block discarded – undo
39 39
 
40 40
     public $attachment_comment;
41 41
 
42
-	/**
43
-	 * Create a new announcement
44
-	 * @param int $id
45
-	 * @param string $title
46
-	 * @param string $content
47
-	 * @param string $date
48
-	 * @param int display_order
49
-	 */
42
+    /**
43
+     * Create a new announcement
44
+     * @param int $id
45
+     * @param string $title
46
+     * @param string $content
47
+     * @param string $date
48
+     * @param int display_order
49
+     */
50 50
     function __construct($id, $title, $content, $date, $display_order, $email_sent, $path, $filename, $size, $comment)
51 51
     {
52
-		parent::__construct($id,RESOURCE_ANNOUNCEMENT);
52
+        parent::__construct($id,RESOURCE_ANNOUNCEMENT);
53 53
 
54
-		$this->content	= $content;
55
-		$this->title 	= $title;
56
-		$this->date 	= $date;
57
-		$this->display_order	= $display_order;
58
-		$this->email_sent	 	= $email_sent;
54
+        $this->content	= $content;
55
+        $this->title 	= $title;
56
+        $this->date 	= $date;
57
+        $this->display_order	= $display_order;
58
+        $this->email_sent	 	= $email_sent;
59 59
 
60
-		$this->attachment_path 	= $path;
61
-		$this->attachment_filename = $filename;
62
-		$this->attachment_size 	= $size;
63
-		$this->attachment_comment 	= $comment;
64
-	}
60
+        $this->attachment_path 	= $path;
61
+        $this->attachment_filename = $filename;
62
+        $this->attachment_size 	= $size;
63
+        $this->attachment_comment 	= $comment;
64
+    }
65 65
 
66
-	/**
67
-	 * Show this announcement
68
-	 */
69
-	function show()
70
-	{
71
-		parent::show();
72
-		echo $this->date.': '.$this->title;
73
-	}
66
+    /**
67
+     * Show this announcement
68
+     */
69
+    function show()
70
+    {
71
+        parent::show();
72
+        echo $this->date.': '.$this->title;
73
+    }
74 74
 }
Please login to merge, or discard this patch.
main/coursecopy/classes/DummyCourseCreator.class.php 1 patch
Indentation   +279 added lines, -279 removed lines patch added patch discarded remove patch
@@ -20,289 +20,289 @@
 block discarded – undo
20 20
  */
21 21
 class DummyCourseCreator
22 22
 {
23
-	/**
24
-	 * The dummy course
25
-	 */
26
-	public $course;
27
-	/**
28
-	 *
29
-	 */
30
-	public $default_property = array();
23
+    /**
24
+     * The dummy course
25
+     */
26
+    public $course;
27
+    /**
28
+     *
29
+     */
30
+    public $default_property = array();
31 31
 
32
-	/**
33
-	 * Create the dummy course
34
-	 */
35
-	public function create_dummy_course($course_code)
36
-	{
37
-		$this->default_property['insert_user_id'] = '1';
38
-		$this->default_property['insert_date'] = date('Y-m-d H:i:s');
39
-		$this->default_property['lastedit_date'] = date('Y-m-d H:i:s');
40
-		$this->default_property['lastedit_user_id'] = '1';
41
-		$this->default_property['to_group_id'] = '0';
42
-		$this->default_property['to_user_id'] = null;
43
-		$this->default_property['visibility'] = '1';
44
-		$this->default_property['start_visible'] = '0000-00-00 00:00:00';
45
-		$this->default_property['end_visible'] =  '0000-00-00 00:00:00';
32
+    /**
33
+     * Create the dummy course
34
+     */
35
+    public function create_dummy_course($course_code)
36
+    {
37
+        $this->default_property['insert_user_id'] = '1';
38
+        $this->default_property['insert_date'] = date('Y-m-d H:i:s');
39
+        $this->default_property['lastedit_date'] = date('Y-m-d H:i:s');
40
+        $this->default_property['lastedit_user_id'] = '1';
41
+        $this->default_property['to_group_id'] = '0';
42
+        $this->default_property['to_user_id'] = null;
43
+        $this->default_property['visibility'] = '1';
44
+        $this->default_property['start_visible'] = '0000-00-00 00:00:00';
45
+        $this->default_property['end_visible'] =  '0000-00-00 00:00:00';
46 46
 
47
-		$course = api_get_course_info($course_code);
48
-		$this->course = new Course();
49
-		$tmp_path = api_get_path(SYS_COURSE_PATH).$course['directory'].'/document/tmp_'.uniqid('');
50
-		@mkdir($tmp_path, api_get_permissions_for_new_directories(), true);
51
-		$this->course->backup_path = $tmp_path;
52
-		$this->create_dummy_links();
53
-		$this->create_dummy_events();
54
-		$this->create_dummy_forums();
55
-		$this->create_dummy_announcements();
56
-		$this->create_dummy_documents();
57
-		$this->create_dummy_learnpaths();
58
-		$cr = new CourseRestorer($this->course);
59
-		$cr->set_file_option(FILE_OVERWRITE);
60
-		$cr->restore($course_code);
61
-		rmdirr($tmp_path);
62
-	}
63
-	/**
64
-	 * Create dummy documents
65
-	 */
66
-	function create_dummy_documents()
67
-	{
68
-		$course = api_get_course_info();
69
-		$course_doc_path = $this->course->backup_path.'/document/';
70
-		$number_of_documents = rand(10, 30);
71
-		$extensions = array ('html', 'doc');
72
-		$directories = array();
73
-		$property = $this->default_property;
74
-		$property['lastedit_type'] = 'DocumentAdded';
75
-		$property['tool'] = TOOL_DOCUMENT;
76
-		$doc_id = 0;
77
-		for ($doc_id = 1; $doc_id < $number_of_documents; $doc_id ++)
78
-		{
79
-			$path = '';
80
-			$doc_type = rand(0, count($extensions) - 1);
81
-			$extension = $extensions[$doc_type];
82
-			$filename = $this->get_dummy_content('title').'_'.$doc_id.'.'.$extension;
83
-			$content = $this->get_dummy_content('text');
84
-			$dirs = rand(0, 3);
85
-			for ($i = 0; $i < $dirs; $i ++)
86
-			{
87
-				$path .= 'directory/';
88
-				$directories[$path] = 1;
89
-			}
90
-			$dir_to_make = $course_doc_path.$path;
91
-			if (!is_dir($dir_to_make))
92
-			{
93
-				@mkdir($dir_to_make, api_get_permissions_for_new_directories(), true);
94
-			}
95
-			$file = $course_doc_path.$path.$filename;
96
-			$fp = fopen($file, 'w');
97
-			fwrite($fp, $content);
98
-			fclose($fp);
99
-			$size = filesize($file);
100
-			$document = new Document($doc_id, '/'.$path.$filename,$this->get_dummy_content('description'),$this->get_dummy_content('title'), 'file', $size);
101
-			$document->item_properties[] = $property;
102
-			$this->course->add_resource($document);
103
-		}
104
-		foreach($directories as $path => $flag)
105
-		{
106
-			$path = substr($path,0,strlen($path)-1);
107
-			$document = new Document($doc_id++,'/'.$path, $this->get_dummy_content('description'),$this->get_dummy_content('title'),'folder',0);
108
-			$property['lastedit_type'] = 'FolderCreated';
109
-			$document->item_properties[] = $property;
110
-			$this->course->add_resource($document);
111
-		}
112
-	}
113
-	/**
114
-	 * Create dummy announcements
115
-	 */
116
-	function create_dummy_announcements()
117
-	{
118
-		$property = $this->default_property;
119
-		$property['lastedit_type'] = 'AnnouncementAdded';
120
-		$property['tool'] = TOOL_ANNOUNCEMENT;
121
-		$number_of_announcements = rand(10, 30);
122
-		for ($i = 0; $i < $number_of_announcements; $i ++)
123
-		{
124
-			$time = mktime(rand(1, 24), rand(1, 60), 0, rand(1, 12), rand(1, 28), intval(date('Y')));
125
-			$date = date('Y-m-d', $time);
126
-			$announcement = new Announcement($i,$this->get_dummy_content('title'),$this->get_dummy_content('text'), $date,0);
127
-			$announcement->item_properties[] = $property;
128
-			$this->course->add_resource($announcement);
129
-		}
130
-	}
131
-	/**
132
-	 * Create dummy events
133
-	 */
134
-	function create_dummy_events()
135
-	{
136
-		$number_of_events = rand(10, 30);
137
-		$property = $this->default_property;
138
-		$property['lastedit_type'] = 'AgendaAdded';
139
-		$property['tool'] = TOOL_CALENDAR_EVENT;
140
-		for ($i = 0; $i < $number_of_events; $i ++)
141
-		{
142
-			$hour = rand(1,24);
143
-			$minute = rand(1,60);
144
-			$second = rand(1,60);
145
-			$day = rand(1,28);
146
-			$month = rand(1,12);
147
-			$year = intval(date('Y'));
148
-			$time = mktime($hour,$minute,$second,$month,$day,$year);
149
-			$start_date = date('Y-m-d H:m:s', $time);
150
-			$hour = rand($hour,24);
151
-			$minute = rand($minute,60);
152
-			$second = rand($second,60);
153
-			$day = rand($day,28);
154
-			$month = rand($month,12);
155
-			$year = intval(date('Y'));
156
-			$time = mktime($hour,$minute,$second,$month,$day,$year);
157
-			$end_date = date('Y-m-d H:m:s', $time);
158
-			$event = new CalendarEvent(
159
-				$i,
160
-				$this->get_dummy_content('title'),
161
-				$this->get_dummy_content('text'),
162
-				$start_date,
163
-				$end_date
164
-			);
165
-			$event->item_properties[] = $property;
166
-			$this->course->add_resource($event);
167
-		}
168
-	}
169
-	/**
170
-	 * Create dummy links
171
-	 */
172
-	function create_dummy_links()
173
-	{
174
-		// create categorys
175
-		$number_of_categories = rand(5, 10);
176
-		for ($i = 0; $i < $number_of_categories; $i ++)
177
-		{
178
-			$linkcat = new LinkCategory($i, $this->get_dummy_content('title'), $this->get_dummy_content('description'),$i);
179
-			$this->course->add_resource($linkcat);
180
-		}
181
-		// create links
182
-		$number_of_links = rand(5, 50);
183
-		$on_homepage = rand(0,20) == 0 ? 1 : 0;
184
-		$property = $this->default_property;
185
-		$property['lastedit_type'] = 'LinkAdded';
186
-		$property['tool'] = TOOL_LINK;
187
-		for ($i = 0; $i < $number_of_links; $i ++)
188
-		{
189
-			$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);
190
-			$link->item_properties[] = $property;
191
-			$this->course->add_resource($link);
192
-		}
193
-	}
194
-	/**
195
-	 * Create dummy forums
196
-	 */
197
-	function create_dummy_forums()
198
-	{
199
-		$number_of_categories = rand(2, 6);
200
-		$number_of_forums = rand(5, 50);
201
-		$number_of_topics = rand(30, 100);
202
-		$number_of_posts = rand(100, 1000);
203
-		$last_forum_post = array ();
204
-		$last_topic_post = array ();
205
-		// create categorys
206
-		$order = 1;
207
-		for ($i = 1; $i <= $number_of_categories; $i ++)
208
-		{
209
-			$forumcat = new ForumCategory($i, $this->get_dummy_content('title'), $this->get_dummy_content('description'), $order, 0, 0);
210
-			$this->course->add_resource($forumcat);
211
-			$order++;
212
-		}
213
-		// create posts
214
-		for ($post_id = 1; $post_id <= $number_of_posts; $post_id ++)
215
-		{
216
-			$topic_id = rand(1, $number_of_topics);
217
-			$last_topic_post[$topic_id] = $post_id;
218
-			$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);
219
-			$this->course->add_resource($post);
220
-		}
221
-		// create topics
222
-		for ($topic_id = 1; $topic_id <= $number_of_topics; $topic_id ++)
223
-		{
224
-			$forum_id = rand(1, $number_of_forums);
225
-			$last_forum_post[$forum_id] = $last_topic_post[$topic_id];
226
-			$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]);
227
-			$this->course->add_resource($topic);
228
-		}
229
-		// create forums
230
-		for ($forum_id = 1; $forum_id <= $number_of_forums; $forum_id ++)
231
-		{
232
-			$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]);
233
-			$this->course->add_resource($forum);
234
-		}
235
-	}
236
-	/**
237
-	 * Create dummy learnpaths
238
-	 */
239
-	function create_dummy_learnpaths()
240
-	{
241
-		$number_of_learnpaths = rand(3,5);
242
-		$global_item_id = 1;
243
-		for($i=1; $i<=$number_of_learnpaths;$i++)
244
-		{
245
-		$chapters = array();
246
-		$number_of_chapters = rand(1,6);
247
-		for($chapter_id = 1; $chapter_id <= $number_of_chapters; $chapter_id++)
248
-		{
249
-			$chapter['name'] = $this->get_dummy_content('title');
250
-			$chapter['description'] = $this->get_dummy_content('description');
251
-			$chapter['display_order'] = $chapter_id;
252
-			$chapter['items'] = array();
253
-			$number_of_items = rand(5,20);
254
-			for( $item_id = 1; $item_id<$number_of_items; $item_id++)
255
-			{
256
-				$types = array(RESOURCE_ANNOUNCEMENT, RESOURCE_EVENT, RESOURCE_DOCUMENT,RESOURCE_LINK,RESOURCE_FORUM,RESOURCE_FORUMPOST,RESOURCE_FORUMTOPIC);
257
-				$type = $types[rand(0,count($types)-1)];
258
-				$resources = $this->course->resources[$type];
259
-				$resource = $resources[rand(0,count($resources)-1)];
260
-				$item = array();
261
-				$item['type'] = $resource->type;
262
-				$item['id'] = $resource->source_id;
263
-				$item['display_order'] = $item_id;
264
-				$item['title'] = $this->get_dummy_content('title');
265
-				$item['description'] = $this->get_dummy_content('description');
266
-				$item['ref_id'] = $global_item_id;
267
-				if( rand(0,5) == 1 && $item_id > 1)
268
-				{
269
-					$item['prereq_type'] = 'i';
270
-					$item['prereq'] = rand($global_item_id - $item_id,$global_item_id-1);
271
-				}
272
-				$chapter['items'][] = $item;
273
-				$global_item_id++;
274
-			}
275
-			$chapters[] = $chapter;
276
-		}
277
-		$lp = new CourseCopyLearnpath($i,$this->get_dummy_content('title'),$this->get_dummy_content('description'),1,$chapters);
278
-		$this->course->add_resource($lp);
279
-		}
280
-	}
281
-	/**
282
-	 * Get dummy titles, descriptions and texts
283
-	 */
284
-	function get_dummy_content($type)
285
-	{
286
-		$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.
47
+        $course = api_get_course_info($course_code);
48
+        $this->course = new Course();
49
+        $tmp_path = api_get_path(SYS_COURSE_PATH).$course['directory'].'/document/tmp_'.uniqid('');
50
+        @mkdir($tmp_path, api_get_permissions_for_new_directories(), true);
51
+        $this->course->backup_path = $tmp_path;
52
+        $this->create_dummy_links();
53
+        $this->create_dummy_events();
54
+        $this->create_dummy_forums();
55
+        $this->create_dummy_announcements();
56
+        $this->create_dummy_documents();
57
+        $this->create_dummy_learnpaths();
58
+        $cr = new CourseRestorer($this->course);
59
+        $cr->set_file_option(FILE_OVERWRITE);
60
+        $cr->restore($course_code);
61
+        rmdirr($tmp_path);
62
+    }
63
+    /**
64
+     * Create dummy documents
65
+     */
66
+    function create_dummy_documents()
67
+    {
68
+        $course = api_get_course_info();
69
+        $course_doc_path = $this->course->backup_path.'/document/';
70
+        $number_of_documents = rand(10, 30);
71
+        $extensions = array ('html', 'doc');
72
+        $directories = array();
73
+        $property = $this->default_property;
74
+        $property['lastedit_type'] = 'DocumentAdded';
75
+        $property['tool'] = TOOL_DOCUMENT;
76
+        $doc_id = 0;
77
+        for ($doc_id = 1; $doc_id < $number_of_documents; $doc_id ++)
78
+        {
79
+            $path = '';
80
+            $doc_type = rand(0, count($extensions) - 1);
81
+            $extension = $extensions[$doc_type];
82
+            $filename = $this->get_dummy_content('title').'_'.$doc_id.'.'.$extension;
83
+            $content = $this->get_dummy_content('text');
84
+            $dirs = rand(0, 3);
85
+            for ($i = 0; $i < $dirs; $i ++)
86
+            {
87
+                $path .= 'directory/';
88
+                $directories[$path] = 1;
89
+            }
90
+            $dir_to_make = $course_doc_path.$path;
91
+            if (!is_dir($dir_to_make))
92
+            {
93
+                @mkdir($dir_to_make, api_get_permissions_for_new_directories(), true);
94
+            }
95
+            $file = $course_doc_path.$path.$filename;
96
+            $fp = fopen($file, 'w');
97
+            fwrite($fp, $content);
98
+            fclose($fp);
99
+            $size = filesize($file);
100
+            $document = new Document($doc_id, '/'.$path.$filename,$this->get_dummy_content('description'),$this->get_dummy_content('title'), 'file', $size);
101
+            $document->item_properties[] = $property;
102
+            $this->course->add_resource($document);
103
+        }
104
+        foreach($directories as $path => $flag)
105
+        {
106
+            $path = substr($path,0,strlen($path)-1);
107
+            $document = new Document($doc_id++,'/'.$path, $this->get_dummy_content('description'),$this->get_dummy_content('title'),'folder',0);
108
+            $property['lastedit_type'] = 'FolderCreated';
109
+            $document->item_properties[] = $property;
110
+            $this->course->add_resource($document);
111
+        }
112
+    }
113
+    /**
114
+     * Create dummy announcements
115
+     */
116
+    function create_dummy_announcements()
117
+    {
118
+        $property = $this->default_property;
119
+        $property['lastedit_type'] = 'AnnouncementAdded';
120
+        $property['tool'] = TOOL_ANNOUNCEMENT;
121
+        $number_of_announcements = rand(10, 30);
122
+        for ($i = 0; $i < $number_of_announcements; $i ++)
123
+        {
124
+            $time = mktime(rand(1, 24), rand(1, 60), 0, rand(1, 12), rand(1, 28), intval(date('Y')));
125
+            $date = date('Y-m-d', $time);
126
+            $announcement = new Announcement($i,$this->get_dummy_content('title'),$this->get_dummy_content('text'), $date,0);
127
+            $announcement->item_properties[] = $property;
128
+            $this->course->add_resource($announcement);
129
+        }
130
+    }
131
+    /**
132
+     * Create dummy events
133
+     */
134
+    function create_dummy_events()
135
+    {
136
+        $number_of_events = rand(10, 30);
137
+        $property = $this->default_property;
138
+        $property['lastedit_type'] = 'AgendaAdded';
139
+        $property['tool'] = TOOL_CALENDAR_EVENT;
140
+        for ($i = 0; $i < $number_of_events; $i ++)
141
+        {
142
+            $hour = rand(1,24);
143
+            $minute = rand(1,60);
144
+            $second = rand(1,60);
145
+            $day = rand(1,28);
146
+            $month = rand(1,12);
147
+            $year = intval(date('Y'));
148
+            $time = mktime($hour,$minute,$second,$month,$day,$year);
149
+            $start_date = date('Y-m-d H:m:s', $time);
150
+            $hour = rand($hour,24);
151
+            $minute = rand($minute,60);
152
+            $second = rand($second,60);
153
+            $day = rand($day,28);
154
+            $month = rand($month,12);
155
+            $year = intval(date('Y'));
156
+            $time = mktime($hour,$minute,$second,$month,$day,$year);
157
+            $end_date = date('Y-m-d H:m:s', $time);
158
+            $event = new CalendarEvent(
159
+                $i,
160
+                $this->get_dummy_content('title'),
161
+                $this->get_dummy_content('text'),
162
+                $start_date,
163
+                $end_date
164
+            );
165
+            $event->item_properties[] = $property;
166
+            $this->course->add_resource($event);
167
+        }
168
+    }
169
+    /**
170
+     * Create dummy links
171
+     */
172
+    function create_dummy_links()
173
+    {
174
+        // create categorys
175
+        $number_of_categories = rand(5, 10);
176
+        for ($i = 0; $i < $number_of_categories; $i ++)
177
+        {
178
+            $linkcat = new LinkCategory($i, $this->get_dummy_content('title'), $this->get_dummy_content('description'),$i);
179
+            $this->course->add_resource($linkcat);
180
+        }
181
+        // create links
182
+        $number_of_links = rand(5, 50);
183
+        $on_homepage = rand(0,20) == 0 ? 1 : 0;
184
+        $property = $this->default_property;
185
+        $property['lastedit_type'] = 'LinkAdded';
186
+        $property['tool'] = TOOL_LINK;
187
+        for ($i = 0; $i < $number_of_links; $i ++)
188
+        {
189
+            $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);
190
+            $link->item_properties[] = $property;
191
+            $this->course->add_resource($link);
192
+        }
193
+    }
194
+    /**
195
+     * Create dummy forums
196
+     */
197
+    function create_dummy_forums()
198
+    {
199
+        $number_of_categories = rand(2, 6);
200
+        $number_of_forums = rand(5, 50);
201
+        $number_of_topics = rand(30, 100);
202
+        $number_of_posts = rand(100, 1000);
203
+        $last_forum_post = array ();
204
+        $last_topic_post = array ();
205
+        // create categorys
206
+        $order = 1;
207
+        for ($i = 1; $i <= $number_of_categories; $i ++)
208
+        {
209
+            $forumcat = new ForumCategory($i, $this->get_dummy_content('title'), $this->get_dummy_content('description'), $order, 0, 0);
210
+            $this->course->add_resource($forumcat);
211
+            $order++;
212
+        }
213
+        // create posts
214
+        for ($post_id = 1; $post_id <= $number_of_posts; $post_id ++)
215
+        {
216
+            $topic_id = rand(1, $number_of_topics);
217
+            $last_topic_post[$topic_id] = $post_id;
218
+            $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);
219
+            $this->course->add_resource($post);
220
+        }
221
+        // create topics
222
+        for ($topic_id = 1; $topic_id <= $number_of_topics; $topic_id ++)
223
+        {
224
+            $forum_id = rand(1, $number_of_forums);
225
+            $last_forum_post[$forum_id] = $last_topic_post[$topic_id];
226
+            $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]);
227
+            $this->course->add_resource($topic);
228
+        }
229
+        // create forums
230
+        for ($forum_id = 1; $forum_id <= $number_of_forums; $forum_id ++)
231
+        {
232
+            $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]);
233
+            $this->course->add_resource($forum);
234
+        }
235
+    }
236
+    /**
237
+     * Create dummy learnpaths
238
+     */
239
+    function create_dummy_learnpaths()
240
+    {
241
+        $number_of_learnpaths = rand(3,5);
242
+        $global_item_id = 1;
243
+        for($i=1; $i<=$number_of_learnpaths;$i++)
244
+        {
245
+        $chapters = array();
246
+        $number_of_chapters = rand(1,6);
247
+        for($chapter_id = 1; $chapter_id <= $number_of_chapters; $chapter_id++)
248
+        {
249
+            $chapter['name'] = $this->get_dummy_content('title');
250
+            $chapter['description'] = $this->get_dummy_content('description');
251
+            $chapter['display_order'] = $chapter_id;
252
+            $chapter['items'] = array();
253
+            $number_of_items = rand(5,20);
254
+            for( $item_id = 1; $item_id<$number_of_items; $item_id++)
255
+            {
256
+                $types = array(RESOURCE_ANNOUNCEMENT, RESOURCE_EVENT, RESOURCE_DOCUMENT,RESOURCE_LINK,RESOURCE_FORUM,RESOURCE_FORUMPOST,RESOURCE_FORUMTOPIC);
257
+                $type = $types[rand(0,count($types)-1)];
258
+                $resources = $this->course->resources[$type];
259
+                $resource = $resources[rand(0,count($resources)-1)];
260
+                $item = array();
261
+                $item['type'] = $resource->type;
262
+                $item['id'] = $resource->source_id;
263
+                $item['display_order'] = $item_id;
264
+                $item['title'] = $this->get_dummy_content('title');
265
+                $item['description'] = $this->get_dummy_content('description');
266
+                $item['ref_id'] = $global_item_id;
267
+                if( rand(0,5) == 1 && $item_id > 1)
268
+                {
269
+                    $item['prereq_type'] = 'i';
270
+                    $item['prereq'] = rand($global_item_id - $item_id,$global_item_id-1);
271
+                }
272
+                $chapter['items'][] = $item;
273
+                $global_item_id++;
274
+            }
275
+            $chapters[] = $chapter;
276
+        }
277
+        $lp = new CourseCopyLearnpath($i,$this->get_dummy_content('title'),$this->get_dummy_content('description'),1,$chapters);
278
+        $this->course->add_resource($lp);
279
+        }
280
+    }
281
+    /**
282
+     * Get dummy titles, descriptions and texts
283
+     */
284
+    function get_dummy_content($type)
285
+    {
286
+        $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.
287 287
 		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.
288 288
 		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.
289 289
 		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.
290 290
 		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.';
291
-		switch($type)
292
-		{
293
-		 case 'description':
294
-		 	$descriptions = explode(".",$dummy_text);
295
-		 	return $descriptions[rand(0,count($descriptions)-1)];
296
-		 	break;
297
-		 case 'title':
298
-		 	$dummy_text = str_replace(array("\n",'.',',',"\t"),array(' ','','',' '),$dummy_text);
299
-		 	$titles = explode(" ",$dummy_text);
300
-		 	return trim($titles[rand(0,count($titles)-1)]);
301
-		 	break;
302
-		 case 'text':
303
-		 	$texts = explode("\n",$dummy_text);
304
-		 	return $texts[rand(0,count($texts)-1)];
305
-		 	break;
306
-		}
307
-	}
291
+        switch($type)
292
+        {
293
+            case 'description':
294
+             $descriptions = explode(".",$dummy_text);
295
+                return $descriptions[rand(0,count($descriptions)-1)];
296
+                break;
297
+            case 'title':
298
+             $dummy_text = str_replace(array("\n",'.',',',"\t"),array(' ','','',' '),$dummy_text);
299
+                $titles = explode(" ",$dummy_text);
300
+                return trim($titles[rand(0,count($titles)-1)]);
301
+                break;
302
+            case 'text':
303
+             $texts = explode("\n",$dummy_text);
304
+                return $texts[rand(0,count($texts)-1)];
305
+                break;
306
+        }
307
+    }
308 308
 }
Please login to merge, or discard this patch.
main/coursecopy/classes/CourseCopyLearnpath.class.php 1 patch
Indentation   +182 added lines, -182 removed lines patch added patch discarded remove patch
@@ -8,194 +8,194 @@
 block discarded – undo
8 8
  */
9 9
 class CourseCopyLearnpath extends Coursecopy\Resource
10 10
 {
11
-	/**
12
-	 * Type of learnpath (can be dokeos (1), scorm (2), aicc (3))
13
-	 */
14
-	public $lp_type;
15
-	/**
16
-	 * The name
17
-	 */
18
-	public $name;
19
-	/**
20
-	 * The reference
21
-	 */
22
-	public $ref;
23
-	/**
24
-	 * The description
25
-	 */
26
-	public $description;
27
-	/**
28
-	 * Path to the learning path files
29
-	 */
30
-	public $path;
31
-	/**
32
-	 * Whether additional commits should be forced or not
33
-	 */
34
-	public $force_commit;
35
-	/**
36
-	 * View mode by default ('embedded' or 'fullscreen')
37
-	 */
38
-	public $default_view_mod;
39
-	/**
40
-	 * Default character encoding
41
-	 */
42
-	public $default_encoding;
43
-	/**
44
-	 * Display order
45
-	 */
46
-	public $display_order;
47
-	/**
48
-	 * Content editor/publisher
49
-	 */
50
-	public $content_maker;
51
-	/**
52
-	 * Location of the content (local or remote)
53
-	 */
54
-	public $content_local;
55
-	/**
56
-	 * License of the content
57
-	 */
58
-	public $content_license;
59
-	/**
60
-	 * Whether to prevent reinitialisation or not
61
-	 */
62
-	public $prevent_reinit;
63
-	/**
64
-	 * JavaScript library used
65
-	 */
66
-	public $js_lib;
67
-	/**
68
-	 * Debug level for this lp
69
-	 */
70
-	public $debug;
71
-	/**
72
-	 * The items
73
-	 */
74
-	public $items;
75
-	/**
76
-	 * The learnpath visibility on the homepage
77
-	 */
78
-	public $visibility;
11
+    /**
12
+     * Type of learnpath (can be dokeos (1), scorm (2), aicc (3))
13
+     */
14
+    public $lp_type;
15
+    /**
16
+     * The name
17
+     */
18
+    public $name;
19
+    /**
20
+     * The reference
21
+     */
22
+    public $ref;
23
+    /**
24
+     * The description
25
+     */
26
+    public $description;
27
+    /**
28
+     * Path to the learning path files
29
+     */
30
+    public $path;
31
+    /**
32
+     * Whether additional commits should be forced or not
33
+     */
34
+    public $force_commit;
35
+    /**
36
+     * View mode by default ('embedded' or 'fullscreen')
37
+     */
38
+    public $default_view_mod;
39
+    /**
40
+     * Default character encoding
41
+     */
42
+    public $default_encoding;
43
+    /**
44
+     * Display order
45
+     */
46
+    public $display_order;
47
+    /**
48
+     * Content editor/publisher
49
+     */
50
+    public $content_maker;
51
+    /**
52
+     * Location of the content (local or remote)
53
+     */
54
+    public $content_local;
55
+    /**
56
+     * License of the content
57
+     */
58
+    public $content_license;
59
+    /**
60
+     * Whether to prevent reinitialisation or not
61
+     */
62
+    public $prevent_reinit;
63
+    /**
64
+     * JavaScript library used
65
+     */
66
+    public $js_lib;
67
+    /**
68
+     * Debug level for this lp
69
+     */
70
+    public $debug;
71
+    /**
72
+     * The items
73
+     */
74
+    public $items;
75
+    /**
76
+     * The learnpath visibility on the homepage
77
+     */
78
+    public $visibility;
79 79
 
80
-	/**
81
-	 * Author info
82
-	 */
83
-	public $author;
80
+    /**
81
+     * Author info
82
+     */
83
+    public $author;
84 84
 
85
-	/**
86
-	 * Author's image
87
-	 */
88
-	public $preview_image;
85
+    /**
86
+     * Author's image
87
+     */
88
+    public $preview_image;
89 89
 
90
-	/**
91
-	 * Create a new learnpath
92
-	 * @param integer ID
93
-	 * @param integer Type (1,2,3,...)
94
-	 * @param string $name
95
-	 * @param string $path
96
-	 * @param string $ref
97
-	 * @param string $description
98
-	 * @param string $content_local
99
-	 * @param string $default_encoding
100
-	 * @param string $default_view_mode
101
-	 * @param bool   $prevent_reinit
102
-	 * @param bool   $force_commit
103
-	 * @param string $content_maker
104
-	 * @param integer $display_order
105
-	 * @param string $js_lib
106
-	 * @param string $content_license
107
-	 * @param integer $debug
108
-	 * @param string $visibility
109
-	 * @param array  $items
110
-	 */
111
-	public function __construct(
112
-		$id,
113
-		$type,
114
-		$name,
115
-		$path,
116
-		$ref,
117
-		$description,
118
-		$content_local,
119
-		$default_encoding,
120
-		$default_view_mode,
121
-		$prevent_reinit,
122
-		$force_commit,
123
-		$content_maker,
124
-		$display_order,
125
-		$js_lib,
126
-		$content_license,
127
-		$debug,
128
-		$visibility,
129
-		$author,
130
-		$preview_image,
131
-		$use_max_score,
132
-		$autolaunch,
133
-		$created_on,
134
-		$modified_on,
135
-		$publicated_on,
136
-		$expired_on,
137
-		$session_id,
138
-		$items
139
-	) {
140
-		parent::__construct($id, RESOURCE_LEARNPATH);
141
-		$this->lp_type = $type;
142
-		$this->name = $name;
143
-		$this->path = $path;
144
-		$this->ref = $ref;
145
-		$this->description = $description;
146
-		$this->content_local = $content_local;
147
-		$this->default_encoding = $default_encoding;
148
-		$this->default_view_mod = $default_view_mode;
149
-		$this->prevent_reinit = $prevent_reinit;
150
-		$this->force_commit = $force_commit;
151
-		$this->content_maker = $content_maker;
152
-		$this->display_order = $display_order;
153
-		$this->js_lib = $js_lib;
154
-		$this->content_license = $content_license;
155
-		$this->debug = $debug;
156
-		$this->visibility=$visibility;
90
+    /**
91
+     * Create a new learnpath
92
+     * @param integer ID
93
+     * @param integer Type (1,2,3,...)
94
+     * @param string $name
95
+     * @param string $path
96
+     * @param string $ref
97
+     * @param string $description
98
+     * @param string $content_local
99
+     * @param string $default_encoding
100
+     * @param string $default_view_mode
101
+     * @param bool   $prevent_reinit
102
+     * @param bool   $force_commit
103
+     * @param string $content_maker
104
+     * @param integer $display_order
105
+     * @param string $js_lib
106
+     * @param string $content_license
107
+     * @param integer $debug
108
+     * @param string $visibility
109
+     * @param array  $items
110
+     */
111
+    public function __construct(
112
+        $id,
113
+        $type,
114
+        $name,
115
+        $path,
116
+        $ref,
117
+        $description,
118
+        $content_local,
119
+        $default_encoding,
120
+        $default_view_mode,
121
+        $prevent_reinit,
122
+        $force_commit,
123
+        $content_maker,
124
+        $display_order,
125
+        $js_lib,
126
+        $content_license,
127
+        $debug,
128
+        $visibility,
129
+        $author,
130
+        $preview_image,
131
+        $use_max_score,
132
+        $autolaunch,
133
+        $created_on,
134
+        $modified_on,
135
+        $publicated_on,
136
+        $expired_on,
137
+        $session_id,
138
+        $items
139
+    ) {
140
+        parent::__construct($id, RESOURCE_LEARNPATH);
141
+        $this->lp_type = $type;
142
+        $this->name = $name;
143
+        $this->path = $path;
144
+        $this->ref = $ref;
145
+        $this->description = $description;
146
+        $this->content_local = $content_local;
147
+        $this->default_encoding = $default_encoding;
148
+        $this->default_view_mod = $default_view_mode;
149
+        $this->prevent_reinit = $prevent_reinit;
150
+        $this->force_commit = $force_commit;
151
+        $this->content_maker = $content_maker;
152
+        $this->display_order = $display_order;
153
+        $this->js_lib = $js_lib;
154
+        $this->content_license = $content_license;
155
+        $this->debug = $debug;
156
+        $this->visibility=$visibility;
157 157
 
158
-		$this->use_max_score=$use_max_score;
159
-		$this->autolaunch=$autolaunch;
160
-		$this->created_on=$created_on;
161
-		$this->modified_on=$modified_on;
162
-		$this->publicated_on=$publicated_on;
163
-		$this->expired_on=$expired_on;
164
-		$this->session_id=$session_id;
158
+        $this->use_max_score=$use_max_score;
159
+        $this->autolaunch=$autolaunch;
160
+        $this->created_on=$created_on;
161
+        $this->modified_on=$modified_on;
162
+        $this->publicated_on=$publicated_on;
163
+        $this->expired_on=$expired_on;
164
+        $this->session_id=$session_id;
165 165
 
166
-		$this->author= $author;
167
-		$this->preview_image= $preview_image;
166
+        $this->author= $author;
167
+        $this->preview_image= $preview_image;
168 168
 
169
-		$this->items = $items;
170
-	}
171
-	/**
172
-	 * Get the items
173
-	 */
174
-	function get_items()
175
-	{
176
-		return $this->items;
177
-	}
169
+        $this->items = $items;
170
+    }
171
+    /**
172
+     * Get the items
173
+     */
174
+    function get_items()
175
+    {
176
+        return $this->items;
177
+    }
178 178
 
179
-	/**
180
-	 * Check if a given resource is used as an item in this chapter
181
-	 */
182
-	function has_item($resource)
183
-	{
184
-		foreach ($this->items as $item) {
185
-			if ($item['id'] == $resource->get_id() &&
186
-				isset($item['type']) && $item['type'] == $resource->get_type()
187
-			) {
188
-				return true;
189
-			}
190
-		}
191
-		return false;
192
-	}
179
+    /**
180
+     * Check if a given resource is used as an item in this chapter
181
+     */
182
+    function has_item($resource)
183
+    {
184
+        foreach ($this->items as $item) {
185
+            if ($item['id'] == $resource->get_id() &&
186
+                isset($item['type']) && $item['type'] == $resource->get_type()
187
+            ) {
188
+                return true;
189
+            }
190
+        }
191
+        return false;
192
+    }
193 193
 
194
-	/**
195
-	 * Show this learnpath
196
-	 */
197
-	function show() {
198
-		parent::show();
199
-		echo $this->name;
200
-	}
194
+    /**
195
+     * Show this learnpath
196
+     */
197
+    function show() {
198
+        parent::show();
199
+        echo $this->name;
200
+    }
201 201
 }
Please login to merge, or discard this patch.
main/coursecopy/classes/Attendance.class.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -13,28 +13,28 @@
 block discarded – undo
13 13
     public $params = array();
14 14
     public $attendance_calendar = array();
15 15
 
16
-	/**
17
-	 * Create a new Thematic
18
-	 *
19
-	 * @param array parameters
20
-	 */
16
+    /**
17
+     * Create a new Thematic
18
+     *
19
+     * @param array parameters
20
+     */
21 21
     public function __construct($params)
22 22
     {
23
-		parent::__construct($params['id'], RESOURCE_ATTENDANCE);
24
-		$this->params = $params;
25
-	}
23
+        parent::__construct($params['id'], RESOURCE_ATTENDANCE);
24
+        $this->params = $params;
25
+    }
26 26
 
27 27
     /**
28 28
      * @inheritdoc
29 29
      */
30 30
     public function show()
31 31
     {
32
-		parent::show();
33
-		echo $this->params['name'];
34
-	}
32
+        parent::show();
33
+        echo $this->params['name'];
34
+    }
35 35
 
36 36
     public function add_attendance_calendar($data)
37 37
     {
38
-		$this->attendance_calendar[] = $data;
39
-	}
38
+        $this->attendance_calendar[] = $data;
39
+    }
40 40
 }
Please login to merge, or discard this patch.
main/coursecopy/classes/SurveyQuestion.class.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -10,93 +10,93 @@
 block discarded – undo
10 10
  */
11 11
 class SurveyQuestion extends Coursecopy\Resource
12 12
 {
13
-	/**
14
-	 * Survey ID
15
-	 */
16
-	public $survey_id;
17
-	/**
18
-	 * Question and question comment
19
-	 */
20
-	public $survey_question;
21
-	public $survey_question_comment;
22
-	/**
23
-	 * Question type
24
-	 */
25
-	public $survey_question_type;
26
-	/**
27
-	 * Display ?
28
-	 */
29
-	public $display;
30
-	/**
31
-	 * Sorting order
32
-	 */
33
-	public $sort;
34
-	/**
35
-	 * Shared question ID
36
-	 */
37
-	public $shared_question_id;
38
-	/**
39
-	 * Maximum value for the vote
40
-	 */
41
-	public $max_value;
13
+    /**
14
+     * Survey ID
15
+     */
16
+    public $survey_id;
17
+    /**
18
+     * Question and question comment
19
+     */
20
+    public $survey_question;
21
+    public $survey_question_comment;
22
+    /**
23
+     * Question type
24
+     */
25
+    public $survey_question_type;
26
+    /**
27
+     * Display ?
28
+     */
29
+    public $display;
30
+    /**
31
+     * Sorting order
32
+     */
33
+    public $sort;
34
+    /**
35
+     * Shared question ID
36
+     */
37
+    public $shared_question_id;
38
+    /**
39
+     * Maximum value for the vote
40
+     */
41
+    public $max_value;
42 42
 
43
-	/**
44
-	 * Question's options
45
-	 */
46
-	public $options;
43
+    /**
44
+     * Question's options
45
+     */
46
+    public $options;
47 47
 
48
-	/**
49
-	 * Create a new SurveyQuestion
50
-	 * @param int	 $id
51
-	 * @param int 	 $survey_id
52
-	 * @param string $survey_question
53
-	 * @param string $survey_question_comment
54
-	 * @param string $type
55
-	 * @param string $display
56
-	 * @param int	 $sort
57
-	 * @param int	 $shared_question_id
58
-	 * @param int	 $max_value
59
-	 */
60
-	function __construct(
61
-		$id,
62
-		$survey_id,
63
-		$survey_question,
64
-		$survey_question_comment,
65
-		$type,
66
-		$display,
67
-		$sort,
68
-		$shared_question_id,
69
-		$max_value
70
-	) {
71
-		parent::__construct($id,RESOURCE_SURVEYQUESTION);
72
-		$this->survey_id = $survey_id;
73
-		$this->survey_question = $survey_question;
74
-		$this->survey_question_comment = $survey_question_comment;
75
-		$this->survey_question_type = $type;
76
-		$this->display = $display;
77
-		$this->sort = $sort;
78
-		$this->shared_question_id = $shared_question_id;
79
-		$this->max_value = $max_value;
80
-		$this->answers = array();
81
-	}
82
-	/**
83
-	 * Add an answer option to this SurveyQuestion
84
-	 * @param string $option_text
85
-	 * @param int	 $sort
86
-	 */
87
-	function add_answer($option_text,$sort)
88
-	{
89
-		$answer = array();
90
-		$answer['option_text'] = $option_text;
91
-		$answer['sort'] = $sort;
92
-		$this->answers[] = $answer;
93
-	}
94
-	/**
95
-	 * Show this question
96
-	 */
97
-	function show()
98
-	{
99
-		parent::show();
100
-		echo $this->survey_question;
101
-	}
48
+    /**
49
+     * Create a new SurveyQuestion
50
+     * @param int	 $id
51
+     * @param int 	 $survey_id
52
+     * @param string $survey_question
53
+     * @param string $survey_question_comment
54
+     * @param string $type
55
+     * @param string $display
56
+     * @param int	 $sort
57
+     * @param int	 $shared_question_id
58
+     * @param int	 $max_value
59
+     */
60
+    function __construct(
61
+        $id,
62
+        $survey_id,
63
+        $survey_question,
64
+        $survey_question_comment,
65
+        $type,
66
+        $display,
67
+        $sort,
68
+        $shared_question_id,
69
+        $max_value
70
+    ) {
71
+        parent::__construct($id,RESOURCE_SURVEYQUESTION);
72
+        $this->survey_id = $survey_id;
73
+        $this->survey_question = $survey_question;
74
+        $this->survey_question_comment = $survey_question_comment;
75
+        $this->survey_question_type = $type;
76
+        $this->display = $display;
77
+        $this->sort = $sort;
78
+        $this->shared_question_id = $shared_question_id;
79
+        $this->max_value = $max_value;
80
+        $this->answers = array();
81
+    }
82
+    /**
83
+     * Add an answer option to this SurveyQuestion
84
+     * @param string $option_text
85
+     * @param int	 $sort
86
+     */
87
+    function add_answer($option_text,$sort)
88
+    {
89
+        $answer = array();
90
+        $answer['option_text'] = $option_text;
91
+        $answer['sort'] = $sort;
92
+        $this->answers[] = $answer;
93
+    }
94
+    /**
95
+     * Show this question
96
+     */
97
+    function show()
98
+    {
99
+        parent::show();
100
+        echo $this->survey_question;
101
+    }
102 102
 }
Please login to merge, or discard this patch.