Completed
Push — 1.10.x ( 2524fc...6bc0e1 )
by Yannick
47:10
created
main/coursecopy/classes/SurveyInvitation.class.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -10,52 +10,52 @@
 block discarded – undo
10 10
  */
11 11
 class SurveyInvitation extends Coursecopy\Resource
12 12
 {
13
-	/**
14
-	 * Survey code
15
-	 */
16
-	public $code;
17
-	/**
18
-	 * User info
19
-	 */
20
-	public $user;
21
-	/**
22
-	 * Invitation code
23
-	 */
24
-	public $invitation_code;
25
-	/**
26
-	 * Invitation date
27
-	 */
28
-	public $invitation_date;
29
-	/**
30
-	 * Reminder date
31
-	 */
32
-	public $reminder_date;
13
+    /**
14
+     * Survey code
15
+     */
16
+    public $code;
17
+    /**
18
+     * User info
19
+     */
20
+    public $user;
21
+    /**
22
+     * Invitation code
23
+     */
24
+    public $invitation_code;
25
+    /**
26
+     * Invitation date
27
+     */
28
+    public $invitation_date;
29
+    /**
30
+     * Reminder date
31
+     */
32
+    public $reminder_date;
33 33
 
34
-	/**
35
-	 * Create a new SurveyInvitation
36
-	 * @param	int	 $id
37
-	 * @param string $code
38
-	 * @param string $user
39
-	 * @param string $invitation_code
40
-	 * @param string $invitation_date
41
-	 * @param string $reminder_date
42
-	 */
43
-	public function __construct($id,$code,$user,$invitation_code,$invitation_date,$reminder_date)
44
-	{
45
-		parent::__construct($id, RESOURCE_SURVEYINVITATION);
46
-		$this->code = $code;
47
-		$this->user = $user;
48
-		$this->invitation_code = $invitation_code;
49
-		$this->invitation_date = $invitation_date;
50
-		$this->reminder_date = $reminder_date;
51
-	}
34
+    /**
35
+     * Create a new SurveyInvitation
36
+     * @param	int	 $id
37
+     * @param string $code
38
+     * @param string $user
39
+     * @param string $invitation_code
40
+     * @param string $invitation_date
41
+     * @param string $reminder_date
42
+     */
43
+    public function __construct($id,$code,$user,$invitation_code,$invitation_date,$reminder_date)
44
+    {
45
+        parent::__construct($id, RESOURCE_SURVEYINVITATION);
46
+        $this->code = $code;
47
+        $this->user = $user;
48
+        $this->invitation_code = $invitation_code;
49
+        $this->invitation_date = $invitation_date;
50
+        $this->reminder_date = $reminder_date;
51
+    }
52 52
 
53
-	/**
54
-	 * Show this invitation
55
-	 */
56
-	function show()
57
-	{
58
-		parent::show();
59
-		echo $this->invitation_code;
60
-	}
53
+    /**
54
+     * Show this invitation
55
+     */
56
+    function show()
57
+    {
58
+        parent::show();
59
+        echo $this->invitation_code;
60
+    }
61 61
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
 	 * @param string $invitation_date
41 41
 	 * @param string $reminder_date
42 42
 	 */
43
-	public function __construct($id,$code,$user,$invitation_code,$invitation_date,$reminder_date)
43
+	public function __construct($id, $code, $user, $invitation_code, $invitation_date, $reminder_date)
44 44
 	{
45 45
 		parent::__construct($id, RESOURCE_SURVEYINVITATION);
46 46
 		$this->code = $code;
Please login to merge, or discard this patch.
main/coursecopy/classes/LinkCategory.class.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -10,39 +10,39 @@
 block discarded – undo
10 10
  */
11 11
 class LinkCategory extends Coursecopy\Resource
12 12
 {
13
-	/**
14
-	 * The title
15
-	 */
16
-	public $title;
17
-	/**
18
-	 * The description
19
-	 */
20
-	public $description;
21
-	/**
22
-	 * The display order
23
-	 */
24
-	public $display_order;
13
+    /**
14
+     * The title
15
+     */
16
+    public $title;
17
+    /**
18
+     * The description
19
+     */
20
+    public $description;
21
+    /**
22
+     * The display order
23
+     */
24
+    public $display_order;
25 25
 
26
-	/**
27
-	 * Create a new LinkCategory
28
-	 * @param int $id
29
-	 * @param string $title
30
-	 * @param string $description
31
-	 */
32
-	function __construct($id,$title,$description,$display_order)
33
-	{
34
-		parent::__construct($id,RESOURCE_LINKCATEGORY);
35
-		$this->title = $title;
36
-		$this->description = $description;
37
-		$this->display_order = $display_order;
38
-	}
26
+    /**
27
+     * Create a new LinkCategory
28
+     * @param int $id
29
+     * @param string $title
30
+     * @param string $description
31
+     */
32
+    function __construct($id,$title,$description,$display_order)
33
+    {
34
+        parent::__construct($id,RESOURCE_LINKCATEGORY);
35
+        $this->title = $title;
36
+        $this->description = $description;
37
+        $this->display_order = $display_order;
38
+    }
39 39
 
40
-	/**
41
-	 * Show this LinkCategory
42
-	 */
43
-	function show()
44
-	{
45
-		parent::show();
46
-		echo $this->title.' '.$this->description.'<br />';
47
-	}
40
+    /**
41
+     * Show this LinkCategory
42
+     */
43
+    function show()
44
+    {
45
+        parent::show();
46
+        echo $this->title.' '.$this->description.'<br />';
47
+    }
48 48
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@
 block discarded – undo
29 29
 	 * @param string $title
30 30
 	 * @param string $description
31 31
 	 */
32
-	function __construct($id,$title,$description,$display_order)
32
+	function __construct($id, $title, $description, $display_order)
33 33
 	{
34
-		parent::__construct($id,RESOURCE_LINKCATEGORY);
34
+		parent::__construct($id, RESOURCE_LINKCATEGORY);
35 35
 		$this->title = $title;
36 36
 		$this->description = $description;
37 37
 		$this->display_order = $display_order;
Please login to merge, or discard this patch.
main/coursecopy/classes/CourseDescription.class.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -10,39 +10,39 @@
 block discarded – undo
10 10
  */
11 11
 class CourseDescription extends Resource
12 12
 {
13
-	/**
14
-	 * The title
15
-	 */
16
-	public $title;
17
-	/**
18
-	 * The content
19
-	 */
20
-	public $content;
21
-	/**
22
-	 * The description type
23
-	 */
24
-	public $description_type;
13
+    /**
14
+     * The title
15
+     */
16
+    public $title;
17
+    /**
18
+     * The content
19
+     */
20
+    public $content;
21
+    /**
22
+     * The description type
23
+     */
24
+    public $description_type;
25 25
 
26
-	/**
27
-	 * Create a new course description
28
-	 * @param int $id
29
-	 * @param string $title
30
-	 * @param string $content
31
-	 */
32
-	public function __construct($id,$title,$content,$description_type)
33
-	{
34
-		parent::__construct($id,RESOURCE_COURSEDESCRIPTION);
35
-		$this->title = $title;
36
-		$this->content = $content;
37
-		$this->description_type = $description_type;
38
-	}
26
+    /**
27
+     * Create a new course description
28
+     * @param int $id
29
+     * @param string $title
30
+     * @param string $content
31
+     */
32
+    public function __construct($id,$title,$content,$description_type)
33
+    {
34
+        parent::__construct($id,RESOURCE_COURSEDESCRIPTION);
35
+        $this->title = $title;
36
+        $this->content = $content;
37
+        $this->description_type = $description_type;
38
+    }
39 39
 
40
-	/**
41
-	 * Show this Event
42
-	 */
43
-	function show()
44
-	{
45
-		parent::show();
46
-		echo $this->title;
47
-	}
40
+    /**
41
+     * Show this Event
42
+     */
43
+    function show()
44
+    {
45
+        parent::show();
46
+        echo $this->title;
47
+    }
48 48
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@
 block discarded – undo
29 29
 	 * @param string $title
30 30
 	 * @param string $content
31 31
 	 */
32
-	public function __construct($id,$title,$content,$description_type)
32
+	public function __construct($id, $title, $content, $description_type)
33 33
 	{
34
-		parent::__construct($id,RESOURCE_COURSEDESCRIPTION);
34
+		parent::__construct($id, RESOURCE_COURSEDESCRIPTION);
35 35
 		$this->title = $title;
36 36
 		$this->content = $content;
37 37
 		$this->description_type = $description_type;
Please login to merge, or discard this patch.
main/coursecopy/classes/CourseSelectForm.class.php 3 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
 
137 137
 		//get destination course title
138 138
 		if (!empty($hidden_fields['destination_course'])) {
139
-            $sessionTitle = !empty($hidden_fields['destination_session']) ? ' (' . api_get_session_name(
139
+            $sessionTitle = !empty($hidden_fields['destination_session']) ? ' ('.api_get_session_name(
140 140
                 $hidden_fields['destination_session']
141
-            ) . ')' : null;
141
+            ).')' : null;
142 142
 
143 143
             $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']);
144 144
 			echo '<h3>';
145
-			echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle;
145
+			echo get_lang('DestinationCourse').' : '.$course_infos['title'].' ('.$course_infos['code'].') '.$sessionTitle;
146 146
 			echo '</h3>';
147 147
 		}
148 148
         echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>';
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 			/*Documents are avoided due the huge amount of memory that the serialize php function "eats"
299 299
 			(when there are directories with hundred/thousand of files) */
300 300
 			// this is a known issue of serialize
301
-			$course->resources['document']= null;
301
+			$course->resources['document'] = null;
302 302
 		}
303 303
 
304 304
 		echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>';
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 		    Display::display_warning_message(get_lang('NoDataAvailable'));
316 316
 		} else {
317 317
     		if (!empty($hidden_fields['destination_session'])) {
318
-    			echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'.
318
+    			echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;" >'.
319 319
                     get_lang('Ok').'</button>';
320 320
     		} else {
321 321
                 if ($recycleOption) {
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
      */
340 340
     static function display_hidden_quiz_questions($course)
341 341
     {
342
-		if(is_array($course->resources)){
342
+		if (is_array($course->resources)) {
343 343
 			foreach ($course->resources as $type => $resources) {
344 344
 				if (count($resources) > 0) {
345 345
 					switch ($type) {
@@ -359,10 +359,10 @@  discard block
 block discarded – undo
359 359
      */
360 360
     static function display_hidden_scorm_directories($course)
361 361
     {
362
-        if (is_array($course->resources)){
362
+        if (is_array($course->resources)) {
363 363
 			foreach ($course->resources as $type => $resources) {
364 364
 				if (count($resources) > 0) {
365
-					switch($type) {
365
+					switch ($type) {
366 366
 						case RESOURCE_SCORM:
367 367
 							foreach ($resources as $id => $resource) {
368 368
 								echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />';
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 			if (is_array($resource)) {
409 409
 				$resource = array_keys($resource);
410 410
 
411
-				foreach	($resource as $resource_item) {
411
+				foreach ($resource as $resource_item) {
412 412
 
413 413
 					$condition_session = '';
414 414
 					if (!empty($session_id)) {
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
                                         tool = '".RESOURCE_DOCUMENT."' AND
445 445
                                         ref = $resource_item ";
446 446
                             $res = Database::query($sql);
447
-                            $all_properties = array ();
448
-                            while ($item_property = Database::fetch_array($res,'ASSOC')) {
447
+                            $all_properties = array();
448
+                            while ($item_property = Database::fetch_array($res, 'ASSOC')) {
449 449
                                 $all_properties[] = $item_property;
450 450
                             }
451 451
                             $course->resources[RESOURCE_DOCUMENT][$resource_item]->item_properties = $all_properties;
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 
461 461
 				switch ($type) {
462 462
 					case RESOURCE_SURVEYQUESTION:
463
-						foreach($resources as $id => $obj) {
463
+						foreach ($resources as $id => $obj) {
464 464
 						    if (isset($_POST['resource'][RESOURCE_SURVEY]) &&
465 465
                                 is_array($_POST['resource'][RESOURCE_SURVEY]) &&
466 466
                                 !in_array($obj->survey_id, array_keys($_POST['resource'][RESOURCE_SURVEY]))
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
                                 ) {
536 536
 									foreach ($documents as $id_to_check => $post_value) {
537 537
 										$obj_to_check = $resources[$id_to_check];
538
-										$shared_path_part = substr($obj_to_check->path,0,strlen($obj->path));
538
+										$shared_path_part = substr($obj_to_check->path, 0, strlen($obj->path));
539 539
 										if ($id_to_check != $id && $obj->path == $shared_path_part) {
540 540
 											$_POST['resource'][RESOURCE_DOCUMENT][$id] = 1;
541 541
 											break;
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 								$resource_is_used_elsewhere = $course->is_linked_resource($obj);
550 550
 								// check if document is in a quiz (audio/video)
551 551
 								if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) {
552
-									foreach($course->resources[RESOURCE_QUIZ] as $quiz) {
552
+									foreach ($course->resources[RESOURCE_QUIZ] as $quiz) {
553 553
                                         $quiz = $quiz->obj;
554 554
 										if (isset($quiz->media) && $quiz->media == $id) {
555 555
 											$resource_is_used_elsewhere = true;
@@ -618,15 +618,15 @@  discard block
 block discarded – undo
618 618
 		<?php
619 619
 
620 620
 		//get destination course title
621
-		if(!empty($hidden_fields['destination_course'])) {
621
+		if (!empty($hidden_fields['destination_course'])) {
622 622
              if (!empty($hidden_fields['destination_session'])) {
623
-                 $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')';
623
+                 $sessionTitle = ' ('.api_get_session_name($hidden_fields['destination_session']).')';
624 624
              } else {
625 625
                  $sessionTitle = null;
626 626
              }
627 627
             $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']);
628 628
 			echo '<h3>';
629
-				echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle;
629
+				echo get_lang('DestinationCourse').' : '.$course_infos['title'].$sessionTitle;
630 630
 			echo '</h3>';
631 631
 		}
632 632
 
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 		echo '<script type="text/javascript">var myUpload = new upload(1000);</script>';
635 635
 		echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.api_get_path(WEB_CODE_PATH).'img/progress_bar.gif\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">';
636 636
 		echo '<input type="hidden" name="action" value="course_select_form"/>';
637
-		foreach ($list_course as $course){
637
+		foreach ($list_course as $course) {
638 638
 			foreach ($course->resources as $type => $resources) {
639 639
 				if (count($resources) > 0) {
640 640
 					echo '<img id="img_'.$course->code.'" src="../img/1.gif" onclick="javascript:exp('."'$course->code'".');" />';
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 		if ($avoid_serialize) {
663 663
 			//Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files)
664 664
 			// this is a known issue of serialize
665
-			$course->resources['document']= null;
665
+			$course->resources['document'] = null;
666 666
 		}
667 667
 		echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>';
668 668
 		if (is_array($hidden_fields)) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -527,14 +527,15 @@
 block discarded – undo
527 527
 						// Mark folders to import which are not selected by the user to import,
528 528
 						// but in which a document was selected.
529 529
 						$documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null;
530
-						if (!empty($resources) && is_array($resources))
531
-							foreach ($resources as $id => $obj) {
530
+						if (!empty($resources) && is_array($resources)) {
531
+													foreach ($resources as $id => $obj) {
532 532
 								if (isset($obj->file_type) && $obj->file_type == 'folder' &&
533 533
                                     !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) &&
534 534
                                     is_array($documents)
535 535
                                 ) {
536 536
 									foreach ($documents as $id_to_check => $post_value) {
537 537
 										$obj_to_check = $resources[$id_to_check];
538
+						}
538 539
 										$shared_path_part = substr($obj_to_check->path,0,strlen($obj->path));
539 540
 										if ($id_to_check != $id && $obj->path == $shared_path_part) {
540 541
 											$_POST['resource'][RESOURCE_DOCUMENT][$id] = 1;
Please login to merge, or discard this patch.
Indentation   +252 added lines, -252 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class CourseSelectForm
13 13
 {
14
-	/**
15
-	 * Display the form
16
-	 * @param array $hidden_fields Hidden fields to add to the form.
17
-	 * @param boolean the document array will be serialize. This is used in the course_copy.php file
18
-	 */
19
-	static function display_form($course, $hidden_fields = null, $avoid_serialize = false)
14
+    /**
15
+     * Display the form
16
+     * @param array $hidden_fields Hidden fields to add to the form.
17
+     * @param boolean the document array will be serialize. This is used in the course_copy.php file
18
+     */
19
+    static function display_form($course, $hidden_fields = null, $avoid_serialize = false)
20 20
     {
21 21
         global $charset;
22 22
         $resource_titles[RESOURCE_GRADEBOOK] = get_lang('Gradebook');
@@ -134,50 +134,50 @@  discard block
 block discarded – undo
134 134
 		</script>
135 135
 		<?php
136 136
 
137
-		//get destination course title
138
-		if (!empty($hidden_fields['destination_course'])) {
137
+        //get destination course title
138
+        if (!empty($hidden_fields['destination_course'])) {
139 139
             $sessionTitle = !empty($hidden_fields['destination_session']) ? ' (' . api_get_session_name(
140 140
                 $hidden_fields['destination_session']
141 141
             ) . ')' : null;
142 142
 
143 143
             $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']);
144
-			echo '<h3>';
145
-			echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle;
146
-			echo '</h3>';
147
-		}
144
+            echo '<h3>';
145
+            echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle;
146
+            echo '</h3>';
147
+        }
148 148
         echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>';
149
-		echo '<script type="text/javascript">var myUpload = new upload(1000);</script>';
149
+        echo '<script type="text/javascript">var myUpload = new upload(1000);</script>';
150 150
         $icon = Display::returnIconPath('myprogress_bar.gif');
151
-		echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.$icon.',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">';
152
-		echo '<input type="hidden" name="action" value="course_select_form"/>';
151
+        echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.$icon.',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">';
152
+        echo '<input type="hidden" name="action" value="course_select_form"/>';
153 153
 
154
-		if (!empty($hidden_fields['destination_course']) &&
154
+        if (!empty($hidden_fields['destination_course']) &&
155 155
             !empty($hidden_fields['origin_course']) &&
156 156
             !empty($hidden_fields['destination_session']) &&
157 157
             !empty($hidden_fields['origin_session'])
158 158
         ) {
159
-			echo '<input type="hidden" name="destination_course" 	value="'.$hidden_fields['destination_course'].'"/>';
160
-			echo '<input type="hidden" name="origin_course" 		value="'.$hidden_fields['origin_course'].'"/>';
161
-			echo '<input type="hidden" name="destination_session" 	value="'.$hidden_fields['destination_session'].'"/>';
162
-			echo '<input type="hidden" name="origin_session" 		value="'.$hidden_fields['origin_session'].'"/>';
163
-		}
159
+            echo '<input type="hidden" name="destination_course" 	value="'.$hidden_fields['destination_course'].'"/>';
160
+            echo '<input type="hidden" name="origin_course" 		value="'.$hidden_fields['origin_course'].'"/>';
161
+            echo '<input type="hidden" name="destination_session" 	value="'.$hidden_fields['destination_session'].'"/>';
162
+            echo '<input type="hidden" name="origin_session" 		value="'.$hidden_fields['origin_session'].'"/>';
163
+        }
164 164
 
165
-		$element_count = 0;
165
+        $element_count = 0;
166 166
         $forum_categories = array();
167 167
         $forums = array();
168 168
         $forum_topics = array();
169 169
 
170 170
         echo '<p>';
171
-		echo get_lang('SelectResources');
172
-		echo '</p>';
171
+        echo get_lang('SelectResources');
172
+        echo '</p>';
173 173
 
174 174
         Display::display_normal_message(get_lang('DontForgetToSelectTheMediaFilesIfYourResourceNeedIt'));
175 175
 
176 176
         foreach ($course->resources as $type => $resources) {
177 177
             if (count($resources) > 0) {
178
-				switch ($type) {
179
-					//Resources to avoid
180
-					case RESOURCE_FORUMCATEGORY:
178
+                switch ($type) {
179
+                    //Resources to avoid
180
+                    case RESOURCE_FORUMCATEGORY:
181 181
                         foreach ($resources as $id => $resource) {
182 182
                             $forum_categories[$id] = $resource;
183 183
                         }
@@ -196,49 +196,49 @@  discard block
 block discarded – undo
196 196
                         $element_count++;
197 197
                         break;
198 198
                     case RESOURCE_LINKCATEGORY:
199
-					case RESOURCE_FORUMPOST:
200
-					case RESOURCE_QUIZQUESTION:
201
-					case RESOURCE_SURVEYQUESTION:
202
-					case RESOURCE_SURVEYINVITATION:
203
-					case RESOURCE_SCORM:
204
-						break;
199
+                    case RESOURCE_FORUMPOST:
200
+                    case RESOURCE_QUIZQUESTION:
201
+                    case RESOURCE_SURVEYQUESTION:
202
+                    case RESOURCE_SURVEYINVITATION:
203
+                    case RESOURCE_SCORM:
204
+                        break;
205 205
                     default :
206
-						echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" />&nbsp;';
207
-						echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[$type].'</b><br />';
208
-						echo '<div id="div_'.$type.'">';
209
-						if ($type == RESOURCE_LEARNPATH) {
210
-    						Display::display_warning_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz'));
211
-    						Display::display_warning_message(get_lang('IfYourLPsHaveAudioFilesIncludedYouShouldSelectThemFromTheDocuments'));
212
-						}
213
-						if ($type == RESOURCE_DOCUMENT) {
206
+                        echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" />&nbsp;';
207
+                        echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[$type].'</b><br />';
208
+                        echo '<div id="div_'.$type.'">';
209
+                        if ($type == RESOURCE_LEARNPATH) {
210
+                            Display::display_warning_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz'));
211
+                            Display::display_warning_message(get_lang('IfYourLPsHaveAudioFilesIncludedYouShouldSelectThemFromTheDocuments'));
212
+                        }
213
+                        if ($type == RESOURCE_DOCUMENT) {
214 214
                             if (api_get_setting('show_glossary_in_documents') != 'none') {
215 215
                                 Display::display_warning_message(get_lang('ToExportDocumentsWithGlossaryYouHaveToSelectGlossary'));
216 216
                             }
217
-						}
217
+                        }
218 218
 
219
-						echo '<blockquote>';
219
+                        echo '<blockquote>';
220 220
                         echo '<div class="btn-group">';
221
-						echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a>";
221
+                        echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a>";
222 222
                         echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript:setCheckbox('$type',false);\" >".get_lang('None')."</a>";
223
-						echo '</div><br />';
223
+                        echo '</div><br />';
224 224
 
225
-						foreach ($resources as $id => $resource) {
225
+                        foreach ($resources as $id => $resource) {
226 226
                             if ($resource) {
227
-								// Event obj in 1.9.x in 1.10.x the class is CalendarEvent
227
+                                // Event obj in 1.9.x in 1.10.x the class is CalendarEvent
228 228
                                 Coursecopy\Resource::setClassType($resource);
229 229
                                 echo '<label class="checkbox">';
230 230
                                 echo '<input type="checkbox" name="resource['.$type.']['.$id.']"  id="resource['.$type.']['.$id.']" />';
231 231
                                 $resource->show();
232 232
                                 echo '</label>';
233 233
                             }
234
-						}
235
-						echo '</blockquote>';
236
-						echo '</div>';
237
-						echo '<script language="javascript">exp('."'$type'".')</script>';
238
-						$element_count++;
234
+                        }
235
+                        echo '</blockquote>';
236
+                        echo '</div>';
237
+                        echo '<script language="javascript">exp('."'$type'".')</script>';
238
+                        $element_count++;
239 239
                 }
240
-			}
241
-		}
240
+            }
241
+        }
242 242
 
243 243
         //Fixes forum order
244 244
         if (!empty($forum_categories)) {
@@ -294,65 +294,65 @@  discard block
 block discarded – undo
294 294
             echo '<script language="javascript">exp('."'$type'".')</script>';
295 295
         }
296 296
 
297
-		if ($avoid_serialize) {
298
-			/*Documents are avoided due the huge amount of memory that the serialize php function "eats"
297
+        if ($avoid_serialize) {
298
+            /*Documents are avoided due the huge amount of memory that the serialize php function "eats"
299 299
 			(when there are directories with hundred/thousand of files) */
300
-			// this is a known issue of serialize
301
-			$course->resources['document']= null;
302
-		}
300
+            // this is a known issue of serialize
301
+            $course->resources['document']= null;
302
+        }
303 303
 
304
-		echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>';
304
+        echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>';
305 305
 
306
-		if (is_array($hidden_fields)) {
307
-			foreach ($hidden_fields as $key => $value) {
308
-				echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>';
309
-			}
310
-		}
306
+        if (is_array($hidden_fields)) {
307
+            foreach ($hidden_fields as $key => $value) {
308
+                echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>';
309
+            }
310
+        }
311 311
 
312 312
         $recycleOption = isset($_POST['recycle_option']) ? true : false;
313 313
 
314
-		if (empty($element_count)) {
315
-		    Display::display_warning_message(get_lang('NoDataAvailable'));
316
-		} else {
317
-    		if (!empty($hidden_fields['destination_session'])) {
318
-    			echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'.
314
+        if (empty($element_count)) {
315
+            Display::display_warning_message(get_lang('NoDataAvailable'));
316
+        } else {
317
+            if (!empty($hidden_fields['destination_session'])) {
318
+                echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'.
319 319
                     get_lang('Ok').'</button>';
320
-    		} else {
320
+            } else {
321 321
                 if ($recycleOption) {
322 322
                     echo '<br /><button class="save" type="submit">'.
323 323
                         get_lang('Ok').'</button>';
324 324
                 } else {
325
-    			    echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.
325
+                    echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.
326 326
                     get_lang('Ok').'</button>';
327 327
                 }
328
-    		}
329
-		}
328
+            }
329
+        }
330 330
 
331
-		CourseSelectForm :: display_hidden_quiz_questions($course);
332
-		CourseSelectForm :: display_hidden_scorm_directories($course);
333
-		echo '</form>';
334
-		echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>';
335
-	}
331
+        CourseSelectForm :: display_hidden_quiz_questions($course);
332
+        CourseSelectForm :: display_hidden_scorm_directories($course);
333
+        echo '</form>';
334
+        echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>';
335
+    }
336 336
 
337 337
     /**
338 338
      * @param $course
339 339
      */
340 340
     static function display_hidden_quiz_questions($course)
341 341
     {
342
-		if(is_array($course->resources)){
343
-			foreach ($course->resources as $type => $resources) {
344
-				if (count($resources) > 0) {
345
-					switch ($type) {
346
-						case RESOURCE_QUIZQUESTION:
347
-							foreach ($resources as $id => $resource) {
348
-								echo '<input type="hidden" name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />';
349
-							}
350
-							break;
351
-					}
352
-				}
353
-			}
354
-		}
355
-	}
342
+        if(is_array($course->resources)){
343
+            foreach ($course->resources as $type => $resources) {
344
+                if (count($resources) > 0) {
345
+                    switch ($type) {
346
+                        case RESOURCE_QUIZQUESTION:
347
+                            foreach ($resources as $id => $resource) {
348
+                                echo '<input type="hidden" name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />';
349
+                            }
350
+                            break;
351
+                    }
352
+                }
353
+            }
354
+        }
355
+    }
356 356
 
357 357
     /**
358 358
      * @param $course
@@ -360,30 +360,30 @@  discard block
 block discarded – undo
360 360
     static function display_hidden_scorm_directories($course)
361 361
     {
362 362
         if (is_array($course->resources)){
363
-			foreach ($course->resources as $type => $resources) {
364
-				if (count($resources) > 0) {
365
-					switch($type) {
366
-						case RESOURCE_SCORM:
367
-							foreach ($resources as $id => $resource) {
368
-								echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />';
369
-							}
370
-							break;
371
-					}
372
-				}
373
-			}
374
-		}
375
-	}
363
+            foreach ($course->resources as $type => $resources) {
364
+                if (count($resources) > 0) {
365
+                    switch($type) {
366
+                        case RESOURCE_SCORM:
367
+                            foreach ($resources as $id => $resource) {
368
+                                echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />';
369
+                            }
370
+                            break;
371
+                    }
372
+                }
373
+            }
374
+        }
375
+    }
376 376
 
377
-	/**
378
-	 * Get the posted course
379
-	 * @param string $from who calls the function?
377
+    /**
378
+     * Get the posted course
379
+     * @param string $from who calls the function?
380 380
      * It can be copy_course, create_backup, import_backup or recycle_course
381 381
      * @param int $session_id
382 382
      * @param string $course_code
383
-	 * @return course The course-object with all resources selected by the user
384
-	 * in the form given by display_form(...)
385
-	 */
386
-	public static function get_posted_course($from = '', $session_id = 0, $course_code = '')
383
+     * @return course The course-object with all resources selected by the user
384
+     * in the form given by display_form(...)
385
+     */
386
+    public static function get_posted_course($from = '', $session_id = 0, $course_code = '')
387 387
     {
388 388
         $course = null;
389 389
 
@@ -393,30 +393,30 @@  discard block
 block discarded – undo
393 393
             return false;
394 394
         }
395 395
 
396
-		// Create the resource DOCUMENT objects
397
-		// Loading the results from the checkboxes of ethe javascript
398
-		$resource = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null;
396
+        // Create the resource DOCUMENT objects
397
+        // Loading the results from the checkboxes of ethe javascript
398
+        $resource = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null;
399 399
 
400
-		$course_info = api_get_course_info($course_code);
401
-		$table_doc = Database::get_course_table(TABLE_DOCUMENT);
402
-		$table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY);
403
-		$course_id = $course_info['real_id'];
400
+        $course_info = api_get_course_info($course_code);
401
+        $table_doc = Database::get_course_table(TABLE_DOCUMENT);
402
+        $table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY);
403
+        $course_id = $course_info['real_id'];
404 404
 
405
-		/* Searching the documents resource that have been set to null because
405
+        /* Searching the documents resource that have been set to null because
406 406
         $avoid_serialize is true in the display_form() function*/
407
-		if ($from == 'copy_course') {
408
-			if (is_array($resource)) {
409
-				$resource = array_keys($resource);
407
+        if ($from == 'copy_course') {
408
+            if (is_array($resource)) {
409
+                $resource = array_keys($resource);
410 410
 
411
-				foreach	($resource as $resource_item) {
411
+                foreach	($resource as $resource_item) {
412 412
 
413
-					$condition_session = '';
414
-					if (!empty($session_id)) {
415
-						$session_id = intval($session_id);
416
-						$condition_session = ' AND d.session_id ='.$session_id;
417
-					}
413
+                    $condition_session = '';
414
+                    if (!empty($session_id)) {
415
+                        $session_id = intval($session_id);
416
+                        $condition_session = ' AND d.session_id ='.$session_id;
417
+                    }
418 418
 
419
-					$sql = 'SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size
419
+                    $sql = 'SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size
420 420
 							FROM '.$table_doc.' d, '.$table_prop.' p
421 421
 							WHERE
422 422
 							    d.c_id = '.$course_id.' AND
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
                                 p.ref = d.id AND p.visibility != 2 AND
426 426
                                 d.id = '.$resource_item.$condition_session.'
427 427
 							ORDER BY path';
428
-					$db_result = Database::query($sql);
429
-					while ($obj = Database::fetch_object($db_result)) {
428
+                    $db_result = Database::query($sql);
429
+                    while ($obj = Database::fetch_object($db_result)) {
430 430
                         $doc = new Document(
431 431
                             $obj->id,
432 432
                             $obj->path,
@@ -450,25 +450,25 @@  discard block
 block discarded – undo
450 450
                             }
451 451
                             $course->resources[RESOURCE_DOCUMENT][$resource_item]->item_properties = $all_properties;
452 452
                         }
453
-					}
454
-				}
455
-			}
456
-		}
453
+                    }
454
+                }
455
+            }
456
+        }
457 457
 
458
-		if (is_array($course->resources)) {
459
-			foreach ($course->resources as $type => $resources) {
458
+        if (is_array($course->resources)) {
459
+            foreach ($course->resources as $type => $resources) {
460 460
 
461
-				switch ($type) {
462
-					case RESOURCE_SURVEYQUESTION:
463
-						foreach($resources as $id => $obj) {
464
-						    if (isset($_POST['resource'][RESOURCE_SURVEY]) &&
461
+                switch ($type) {
462
+                    case RESOURCE_SURVEYQUESTION:
463
+                        foreach($resources as $id => $obj) {
464
+                            if (isset($_POST['resource'][RESOURCE_SURVEY]) &&
465 465
                                 is_array($_POST['resource'][RESOURCE_SURVEY]) &&
466 466
                                 !in_array($obj->survey_id, array_keys($_POST['resource'][RESOURCE_SURVEY]))
467 467
                             ) {
468
-								unset($course->resources[$type][$id]);
469
-							}
470
-						}
471
-						break;
468
+                                unset($course->resources[$type][$id]);
469
+                            }
470
+                        }
471
+                        break;
472 472
                     case RESOURCE_FORUMTOPIC:
473 473
                     case RESOURCE_FORUMPOST:
474 474
                        //Add post from topic
@@ -520,62 +520,62 @@  discard block
 block discarded – undo
520 520
                                 }
521 521
                             }
522 522
                         }
523
-					case RESOURCE_LINKCATEGORY :
524
-					case RESOURCE_FORUMCATEGORY :
525
-					case RESOURCE_QUIZQUESTION :
526
-					case RESOURCE_DOCUMENT:
527
-						// Mark folders to import which are not selected by the user to import,
528
-						// but in which a document was selected.
529
-						$documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null;
530
-						if (!empty($resources) && is_array($resources))
531
-							foreach ($resources as $id => $obj) {
532
-								if (isset($obj->file_type) && $obj->file_type == 'folder' &&
523
+                    case RESOURCE_LINKCATEGORY :
524
+                    case RESOURCE_FORUMCATEGORY :
525
+                    case RESOURCE_QUIZQUESTION :
526
+                    case RESOURCE_DOCUMENT:
527
+                        // Mark folders to import which are not selected by the user to import,
528
+                        // but in which a document was selected.
529
+                        $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null;
530
+                        if (!empty($resources) && is_array($resources))
531
+                            foreach ($resources as $id => $obj) {
532
+                                if (isset($obj->file_type) && $obj->file_type == 'folder' &&
533 533
                                     !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) &&
534 534
                                     is_array($documents)
535 535
                                 ) {
536
-									foreach ($documents as $id_to_check => $post_value) {
537
-										$obj_to_check = $resources[$id_to_check];
538
-										$shared_path_part = substr($obj_to_check->path,0,strlen($obj->path));
539
-										if ($id_to_check != $id && $obj->path == $shared_path_part) {
540
-											$_POST['resource'][RESOURCE_DOCUMENT][$id] = 1;
541
-											break;
542
-										}
543
-									}
544
-								}
545
-							}
546
-					default :
547
-						if (!empty($resources) && is_array($resources)) {
548
-							foreach ($resources as $id => $obj) {
549
-								$resource_is_used_elsewhere = $course->is_linked_resource($obj);
550
-								// check if document is in a quiz (audio/video)
551
-								if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) {
552
-									foreach($course->resources[RESOURCE_QUIZ] as $quiz) {
536
+                                    foreach ($documents as $id_to_check => $post_value) {
537
+                                        $obj_to_check = $resources[$id_to_check];
538
+                                        $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path));
539
+                                        if ($id_to_check != $id && $obj->path == $shared_path_part) {
540
+                                            $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1;
541
+                                            break;
542
+                                        }
543
+                                    }
544
+                                }
545
+                            }
546
+                    default :
547
+                        if (!empty($resources) && is_array($resources)) {
548
+                            foreach ($resources as $id => $obj) {
549
+                                $resource_is_used_elsewhere = $course->is_linked_resource($obj);
550
+                                // check if document is in a quiz (audio/video)
551
+                                if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) {
552
+                                    foreach($course->resources[RESOURCE_QUIZ] as $quiz) {
553 553
                                         $quiz = $quiz->obj;
554
-										if (isset($quiz->media) && $quiz->media == $id) {
555
-											$resource_is_used_elsewhere = true;
556
-										}
557
-									}
558
-								}
559
-								if (!isset($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere) {
560
-									unset($course->resources[$type][$id]);
561
-								}
562
-							}
563
-						}
564
-				}
565
-			}
566
-		}
567
-
568
-		return $course;
569
-	}
570
-
571
-	/**
572
-	 * Display the form session export
573
-	 * @param array $hidden_fields Hidden fields to add to the form.
574
-	 * @param boolean the document array will be serialize. This is used in the course_copy.php file
575
-	 */
576
-	 public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false)
577
-     {
578
-         ?>
554
+                                        if (isset($quiz->media) && $quiz->media == $id) {
555
+                                            $resource_is_used_elsewhere = true;
556
+                                        }
557
+                                    }
558
+                                }
559
+                                if (!isset($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere) {
560
+                                    unset($course->resources[$type][$id]);
561
+                                }
562
+                            }
563
+                        }
564
+                }
565
+            }
566
+        }
567
+
568
+        return $course;
569
+    }
570
+
571
+    /**
572
+     * Display the form session export
573
+     * @param array $hidden_fields Hidden fields to add to the form.
574
+     * @param boolean the document array will be serialize. This is used in the course_copy.php file
575
+     */
576
+        public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false)
577
+        {
578
+            ?>
579 579
 		<script>
580 580
 			function exp(item) {
581 581
 				el = document.getElementById('div_'+item);
@@ -617,65 +617,65 @@  discard block
 block discarded – undo
617 617
 		</script>
618 618
 		<?php
619 619
 
620
-		//get destination course title
621
-		if(!empty($hidden_fields['destination_course'])) {
622
-             if (!empty($hidden_fields['destination_session'])) {
623
-                 $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')';
624
-             } else {
625
-                 $sessionTitle = null;
626
-             }
620
+        //get destination course title
621
+        if(!empty($hidden_fields['destination_course'])) {
622
+                if (!empty($hidden_fields['destination_session'])) {
623
+                    $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')';
624
+                } else {
625
+                    $sessionTitle = null;
626
+                }
627 627
             $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']);
628
-			echo '<h3>';
629
-				echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle;
630
-			echo '</h3>';
631
-		}
628
+            echo '<h3>';
629
+                echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle;
630
+            echo '</h3>';
631
+        }
632 632
 
633
-		echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>';
634
-		echo '<script type="text/javascript">var myUpload = new upload(1000);</script>';
633
+        echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>';
634
+        echo '<script type="text/javascript">var myUpload = new upload(1000);</script>';
635 635
         $icon = Display::returnIconPath('progress_bar.gif');
636
-		echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.$icon.'\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">';
637
-		echo '<input type="hidden" name="action" value="course_select_form"/>';
638
-		foreach ($list_course as $course){
639
-			foreach ($course->resources as $type => $resources) {
640
-				if (count($resources) > 0) {
641
-					echo '<img id="img_'.$course->code.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$course->code'".');" />';
642
-					echo '<b  onclick="javascript:exp('."'$course->code'".');" > '.$course->code.'</b><br />';
643
-					echo '<div id="div_'.$course->code.'">';
644
-					echo '<blockquote>';
636
+        echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.$icon.'\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">';
637
+        echo '<input type="hidden" name="action" value="course_select_form"/>';
638
+        foreach ($list_course as $course){
639
+            foreach ($course->resources as $type => $resources) {
640
+                if (count($resources) > 0) {
641
+                    echo '<img id="img_'.$course->code.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$course->code'".');" />';
642
+                    echo '<b  onclick="javascript:exp('."'$course->code'".');" > '.$course->code.'</b><br />';
643
+                    echo '<div id="div_'.$course->code.'">';
644
+                    echo '<blockquote>';
645 645
 
646 646
                     echo '<div class="btn-group">';
647
-					echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',true);\" >".get_lang('All')."</a>";
647
+                    echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',true);\" >".get_lang('All')."</a>";
648 648
                     echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',false);\" >".get_lang('None')."</a>";
649
-					echo '</div><br />';
649
+                    echo '</div><br />';
650 650
 
651
-					foreach ($resources as $id => $resource) {
652
-						echo '<label class="checkbox" for="resource['.$course->code.']['.$id.']">';
651
+                    foreach ($resources as $id => $resource) {
652
+                        echo '<label class="checkbox" for="resource['.$course->code.']['.$id.']">';
653 653
                         echo '<input type="checkbox" name="resource['.$course->code.']['.$id.']" id="resource['.$course->code.']['.$id.']"/>';
654
-						$resource->show();
655
-						echo '</label>';
656
-					}
657
-					echo '</blockquote>';
658
-					echo '</div>';
659
-					echo '<script type="text/javascript">exp('."'$course->code'".')</script>';
660
-				}
661
-			}
662
-		}
663
-		if ($avoid_serialize) {
664
-			//Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files)
665
-			// this is a known issue of serialize
666
-			$course->resources['document']= null;
667
-		}
668
-		echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>';
669
-		if (is_array($hidden_fields)) {
670
-			foreach ($hidden_fields as $key => $value) {
671
-				echo "\n";
672
-				echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>';
673
-			}
674
-		}
675
-		echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.get_lang('Ok').'</button>';
676
-		CourseSelectForm :: display_hidden_quiz_questions($course);
677
-		CourseSelectForm :: display_hidden_scorm_directories($course);
678
-		echo '</form>';
679
-		echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>';
680
-	}
654
+                        $resource->show();
655
+                        echo '</label>';
656
+                    }
657
+                    echo '</blockquote>';
658
+                    echo '</div>';
659
+                    echo '<script type="text/javascript">exp('."'$course->code'".')</script>';
660
+                }
661
+            }
662
+        }
663
+        if ($avoid_serialize) {
664
+            //Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files)
665
+            // this is a known issue of serialize
666
+            $course->resources['document']= null;
667
+        }
668
+        echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>';
669
+        if (is_array($hidden_fields)) {
670
+            foreach ($hidden_fields as $key => $value) {
671
+                echo "\n";
672
+                echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>';
673
+            }
674
+        }
675
+        echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.get_lang('Ok').'</button>';
676
+        CourseSelectForm :: display_hidden_quiz_questions($course);
677
+        CourseSelectForm :: display_hidden_scorm_directories($course);
678
+        echo '</form>';
679
+        echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>';
680
+    }
681 681
 }
Please login to merge, or discard this patch.
main/coursecopy/classes/ScormDocument.class.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -13,18 +13,18 @@
 block discarded – undo
13 13
     public $path;
14 14
     public $title;
15 15
 
16
-	/**
17
-	 * Create a new Scorm Document
18
-	 * @param int $id
19
-	 * @param string $path
20
-	 * @param string $title
21
-	 */
16
+    /**
17
+     * Create a new Scorm Document
18
+     * @param int $id
19
+     * @param string $path
20
+     * @param string $title
21
+     */
22 22
     public function __construct($id, $path, $title)
23
-	{
24
-		parent::__construct($id,RESOURCE_SCORM);
25
-		$this->path = 'scorm'.$path;
26
-		$this->title = $title;
27
-	}
23
+    {
24
+        parent::__construct($id,RESOURCE_SCORM);
25
+        $this->path = 'scorm'.$path;
26
+        $this->title = $title;
27
+    }
28 28
 
29 29
     /**
30 30
      * Show this document
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
     public function __construct($id, $path, $title)
23 23
 	{
24
-		parent::__construct($id,RESOURCE_SCORM);
24
+		parent::__construct($id, RESOURCE_SCORM);
25 25
 		$this->path = 'scorm'.$path;
26 26
 		$this->title = $title;
27 27
 	}
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         echo $path;
37 37
         if (!empty($this->title)) {
38 38
             if (strpos($path, $this->title) === false) {
39
-                echo " - " . $this->title;
39
+                echo " - ".$this->title;
40 40
             }
41 41
         }
42 42
     }
Please login to merge, or discard this patch.
main/coursecopy/classes/Course.class.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
             if (is_array($resources)) {
41 41
                 foreach ($resources as $resource) {
42 42
                     Coursecopy\Resource::setClassType($resource);
43
-                    if ($resource->links_to($resource_to_check) ) {
43
+                    if ($resource->links_to($resource_to_check)) {
44 44
                         return true;
45 45
                     }
46
-                    if ($type == RESOURCE_LEARNPATH && get_class($resource)=='CourseCopyLearnpath') {
46
+                    if ($type == RESOURCE_LEARNPATH && get_class($resource) == 'CourseCopyLearnpath') {
47 47
                         if ($resource->has_item($resource_to_check)) {
48 48
                             return true;
49 49
                         }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function has_resources($resource_type = null)
72 72
     {
73
-        if( $resource_type != null) {
73
+        if ($resource_type != null) {
74 74
             return isset($this->resources[$resource_type]) && is_array($this->resources[$resource_type]) && (count(
75 75
                     $this->resources[$resource_type]
76 76
                 ) > 0);
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
                             $description = $resource->content;
178 178
                             break;
179 179
                         case RESOURCE_THEMATIC:
180
-                            $title 			= $resource->title;
181
-                            $description 	= $resource->content;
180
+                            $title = $resource->title;
181
+                            $description = $resource->content;
182 182
                             break;
183 183
                         case RESOURCE_ATTENDANCE:
184
-                            $title 			= $resource->params['name'];
185
-                            $description 	= $resource->params['description'];
184
+                            $title = $resource->params['name'];
185
+                            $description = $resource->params['description'];
186 186
                             break;
187 187
                         case RESOURCE_WORK:
188 188
                             $title = $resource->title;
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
     }
327 327
 
328 328
     /**
329
-    * Serialize the course with the best serializer available
330
-    * @return string
331
-    */
329
+     * Serialize the course with the best serializer available
330
+     * @return string
331
+     */
332 332
     public static function serialize($course)
333 333
     {
334 334
         if (extension_loaded('igbinary')) {
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
     }
340 340
 
341 341
     /**
342
-    * Unserialize the course with the best serializer available
343
-    * @param string $course
344
-    */
342
+     * Unserialize the course with the best serializer available
343
+     * @param string $course
344
+     */
345 345
     public static function unserialize($course)
346 346
     {
347 347
         if (extension_loaded('igbinary')) {
Please login to merge, or discard this patch.
main/coursecopy/classes/Survey.class.php 2 patches
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -10,86 +10,86 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class Survey extends Coursecopy\Resource
12 12
 {
13
-	/**
14
-	 * The survey code
15
-	 */
13
+    /**
14
+     * The survey code
15
+     */
16 16
     public $code;
17
-	/**
18
-	 * The title and subtitle
19
-	 */
17
+    /**
18
+     * The title and subtitle
19
+     */
20 20
     public $title;
21 21
     public $subtitle;
22
-	/**
23
-	 * The author's name
24
-	 */
22
+    /**
23
+     * The author's name
24
+     */
25 25
     public $author;
26
-	/**
27
-	 * The survey's language
28
-	 */
26
+    /**
27
+     * The survey's language
28
+     */
29 29
     public $lang;
30
-	/**
31
-	 * The availability period
32
-	 */
30
+    /**
31
+     * The availability period
32
+     */
33 33
     public $avail_from;
34 34
     public $avail_till;
35
-	/**
36
-	 * Flag for shared status
37
-	 */
35
+    /**
36
+     * Flag for shared status
37
+     */
38 38
     public $is_shared;
39
-	/**
40
-	 * Template used
41
-	 */
39
+    /**
40
+     * Template used
41
+     */
42 42
     public $template;
43
-	/**
44
-	 * Introduction text
45
-	 */
43
+    /**
44
+     * Introduction text
45
+     */
46 46
     public $intro;
47
-	/**
48
-	 * Thanks text
49
-	 */
47
+    /**
48
+     * Thanks text
49
+     */
50 50
     public $surveythanks;
51
-	/**
52
-	 * Creation date
53
-	 */
51
+    /**
52
+     * Creation date
53
+     */
54 54
     public $creation_date;
55
-	/**
56
-	 * Invitation status
57
-	 */
55
+    /**
56
+     * Invitation status
57
+     */
58 58
     public $invited;
59
-	/**
60
-	 * Answer status
61
-	 */
59
+    /**
60
+     * Answer status
61
+     */
62 62
     public $answered;
63
-	/**
64
-	 * Invitation and reminder mail contents
65
-	 */
63
+    /**
64
+     * Invitation and reminder mail contents
65
+     */
66 66
     public $invite_mail;
67 67
     public $reminder_mail;
68
-	/**
69
-	 * Questions and invitations lists
70
-	 */
68
+    /**
69
+     * Questions and invitations lists
70
+     */
71 71
     public $question_ids;
72 72
     public $invitation_ids;
73 73
 
74
-	/**
75
-	 * Create a new Survey
76
-	 * @param string $code
77
-	 * @param string $title
78
-	 * @param string $subtitle
79
-	 * @param string $author
80
-	 * @param string $lang
81
-	 * @param string $avail_from
82
-	 * @param string $avail_till
83
-	 * @param char $is_shared
84
-	 * @param string $template
85
-	 * @param string $intro
86
-	 * @param string $surveythanks
87
-	 * @param string $creation_date
88
-	 * @param int $invited
89
-	 * @param int $answered
90
-	 * @param string $invite_mail
91
-	 * @param string $reminder_mail
92
-	 */
74
+    /**
75
+     * Create a new Survey
76
+     * @param string $code
77
+     * @param string $title
78
+     * @param string $subtitle
79
+     * @param string $author
80
+     * @param string $lang
81
+     * @param string $avail_from
82
+     * @param string $avail_till
83
+     * @param char $is_shared
84
+     * @param string $template
85
+     * @param string $intro
86
+     * @param string $surveythanks
87
+     * @param string $creation_date
88
+     * @param int $invited
89
+     * @param int $answered
90
+     * @param string $invite_mail
91
+     * @param string $reminder_mail
92
+     */
93 93
     public function __construct(
94 94
         $id,
95 95
         $code,
@@ -109,49 +109,49 @@  discard block
 block discarded – undo
109 109
         $invite_mail,
110 110
         $reminder_mail
111 111
     ) {
112
-		parent::__construct($id,RESOURCE_SURVEY);
113
-		$this->code = $code;
114
-		$this->title = $title;
115
-		$this->subtitle = $subtitle;
116
-		$this->author = $author;
117
-		$this->lang = $lang;
118
-		$this->avail_from = $avail_from;
119
-		$this->avail_till = $avail_till;
120
-		$this->is_shared = $is_shared;
121
-		$this->template = $template;
122
-		$this->intro = $intro;
123
-		$this->surveythanks = $surveythanks;
124
-		$this->creation_date = $creation_date;
125
-		$this->invited = $invited;
126
-		$this->answered = $answered;
127
-		$this->invite_mail = $invite_mail;
128
-		$this->reminder_mail = $reminder_mail;
129
-		$this->question_ids = array();
130
-		$this->invitation_ids = array();
131
-	}
112
+        parent::__construct($id,RESOURCE_SURVEY);
113
+        $this->code = $code;
114
+        $this->title = $title;
115
+        $this->subtitle = $subtitle;
116
+        $this->author = $author;
117
+        $this->lang = $lang;
118
+        $this->avail_from = $avail_from;
119
+        $this->avail_till = $avail_till;
120
+        $this->is_shared = $is_shared;
121
+        $this->template = $template;
122
+        $this->intro = $intro;
123
+        $this->surveythanks = $surveythanks;
124
+        $this->creation_date = $creation_date;
125
+        $this->invited = $invited;
126
+        $this->answered = $answered;
127
+        $this->invite_mail = $invite_mail;
128
+        $this->reminder_mail = $reminder_mail;
129
+        $this->question_ids = array();
130
+        $this->invitation_ids = array();
131
+    }
132 132
 
133
-	/**
134
-	 * Add a question to this survey
135
-	 */
136
-	function add_question($id)
137
-	{
138
-		$this->question_ids[] = $id;
139
-	}
133
+    /**
134
+     * Add a question to this survey
135
+     */
136
+    function add_question($id)
137
+    {
138
+        $this->question_ids[] = $id;
139
+    }
140 140
 
141
-	/**
142
-	 * Add an invitation to this survey
143
-	 */
144
-	function add_invitation($id)
145
-	{
146
-		$this->invitation_ids[] = $id;
147
-	}
141
+    /**
142
+     * Add an invitation to this survey
143
+     */
144
+    function add_invitation($id)
145
+    {
146
+        $this->invitation_ids[] = $id;
147
+    }
148 148
 
149
-	/**
150
-	 * Show this survey
151
-	 */
152
-	function show()
153
-	{
154
-		parent::show();
155
-		echo $this->code.' - '.$this->title;
156
-	}
149
+    /**
150
+     * Show this survey
151
+     */
152
+    function show()
153
+    {
154
+        parent::show();
155
+        echo $this->code.' - '.$this->title;
156
+    }
157 157
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
         $invite_mail,
110 110
         $reminder_mail
111 111
     ) {
112
-		parent::__construct($id,RESOURCE_SURVEY);
112
+		parent::__construct($id, RESOURCE_SURVEY);
113 113
 		$this->code = $code;
114 114
 		$this->title = $title;
115 115
 		$this->subtitle = $subtitle;
Please login to merge, or discard this patch.
main/coursecopy/classes/Thematic.class.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
 {
12 12
     public $params = array();
13 13
     public $thematic_advance_list = array();
14
-	public $thematic_plan_list = array();
14
+    public $thematic_plan_list = array();
15 15
 
16 16
     /**
17
-    * Create a new Thematic
18
-    *
19
-    * @param array parameters
20
-    */
17
+     * Create a new Thematic
18
+     *
19
+     * @param array parameters
20
+     */
21 21
     public function __construct($params)
22 22
     {
23 23
         parent::__construct($params['id'], RESOURCE_THEMATIC);
Please login to merge, or discard this patch.
main/coursecopy/classes/CourseRecycler.class.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -619,8 +619,8 @@  discard block
 block discarded – undo
619 619
     }
620 620
 
621 621
     /**
622
-    * Recycle Thematics
623
-    */
622
+     * Recycle Thematics
623
+     */
624 624
     public function recycle_thematic($session_id = 0)
625 625
     {
626 626
         if ($this->course->has_resources(RESOURCE_THEMATIC)) {
@@ -685,8 +685,8 @@  discard block
 block discarded – undo
685 685
     }
686 686
 
687 687
     /**
688
-    * Recycle Attendances
689
-    */
688
+     * Recycle Attendances
689
+     */
690 690
     public function recycle_attendance($session_id = 0)
691 691
     {
692 692
         if ($this->course->has_resources(RESOURCE_ATTENDANCE)) {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     public function recycle_glossary()
161 161
     {
162 162
         if ($this->course->has_resources(RESOURCE_GLOSSARY)) {
163
-            $table_glossary	= Database::get_course_table(TABLE_GLOSSARY);
163
+            $table_glossary = Database::get_course_table(TABLE_GLOSSARY);
164 164
             $ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_GLOSSARY])));
165 165
             if (!empty($ids)) {
166 166
                 $sql = "DELETE FROM ".$table_glossary."
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
                     if (trim($learnpath->path) != '') {
557 557
                         // when $learnpath->path value is incorrect for some reason.
558 558
                         // The directory trat contains files of the SCORM package is to be deleted.
559
-                        $scorm_package_dir = realpath($this->course->path . 'scorm/' . $learnpath->path);
559
+                        $scorm_package_dir = realpath($this->course->path.'scorm/'.$learnpath->path);
560 560
                         rmdirr($scorm_package_dir);
561 561
                     }
562 562
                 }
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
             foreach ($resources[RESOURCE_THEMATIC] as $last_id => $thematic) {
633 633
                 if (is_numeric($last_id)) {
634 634
 
635
-                    foreach($thematic->thematic_advance_list as $thematic_advance) {
635
+                    foreach ($thematic->thematic_advance_list as $thematic_advance) {
636 636
                         $cond = array(
637 637
                             'id = ? AND  c_id = ?' => array(
638 638
                                 $thematic_advance['id'],
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
                         Database::delete($table_thematic_advance, $cond);
650 650
                     }
651 651
 
652
-                    foreach($thematic->thematic_plan_list as $thematic_plan) {
652
+                    foreach ($thematic->thematic_plan_list as $thematic_plan) {
653 653
                         $cond = array(
654 654
                             'id = ? AND  c_id = ?' => array(
655 655
                                 $thematic_plan['id'],
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
                         'ThematicDeleted',
679 679
                         api_get_user_id()
680 680
                     );
681
-                    Database::delete($table_thematic,$cond);
681
+                    Database::delete($table_thematic, $cond);
682 682
                 }
683 683
             }
684 684
         }
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
             $resources = $this->course->resources;
697 697
             foreach ($resources[RESOURCE_ATTENDANCE] as $last_id => $obj) {
698 698
                 if (is_numeric($last_id)) {
699
-                    foreach($obj->attendance_calendar as $attendance_calendar) {
699
+                    foreach ($obj->attendance_calendar as $attendance_calendar) {
700 700
                         $cond = array('id = ? AND c_id = ? '=>array($attendance_calendar['id'], $this->course_id));
701 701
                         Database::delete($table_attendance_calendar, $cond);
702 702
                     }
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
     public function recycle_work($session_id = 0)
721 721
     {
722 722
         if ($this->course->has_resources(RESOURCE_WORK)) {
723
-            $table_work          = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
723
+            $table_work = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
724 724
             $table_work_assignment = Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT);
725 725
 
726 726
             $resources = $this->course->resources;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
     }
39 39
 
40 40
     /**
41
-     * @return bool
41
+     * @return false|null
42 42
      */
43 43
     public function create_user_folder()
44 44
     {
Please login to merge, or discard this patch.