Completed
Push — 1.11.x ( 55a6a1...a914dc )
by José
60:32 queued 35:06
created
main/course_description/edit.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -10,67 +10,67 @@  discard block
 block discarded – undo
10 10
 // protect a course script
11 11
 api_protect_course_script(true);
12 12
 if (empty($id)) {
13
-	$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : '';
14
-	if (empty($id)) {
15
-		// If the ID was not provided, find the first matching description item given the item type
16
-		$course_description = new CourseDescription();
17
-		$description = $course_description->get_data_by_description_type($description_type);
18
-		if (count($description) > 0) {
19
-			$id = $description['id'];
20
-		}
21
-		// If no corresponding description is found, edit a new one
22
-		unset($course_description);
23
-	}
13
+    $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : '';
14
+    if (empty($id)) {
15
+        // If the ID was not provided, find the first matching description item given the item type
16
+        $course_description = new CourseDescription();
17
+        $description = $course_description->get_data_by_description_type($description_type);
18
+        if (count($description) > 0) {
19
+            $id = $description['id'];
20
+        }
21
+        // If no corresponding description is found, edit a new one
22
+        unset($course_description);
23
+    }
24 24
 }
25 25
 $original_id = $id;
26 26
 
27 27
 if (empty($error)) {
28
-	$token = Security::get_token();
28
+    $token = Security::get_token();
29 29
 }
30 30
 // display categories
31 31
 $categories = array();
32 32
 foreach ($default_description_titles as $id => $title) {
33
-	$categories[$id] = $title;
33
+    $categories[$id] = $title;
34 34
 }
35 35
 $categories[ADD_BLOCK] = get_lang('NewBloc');
36 36
 
37 37
 $i=1;
38 38
 echo '<div class="actions" style="margin-bottom:30px">';
39 39
 echo '<a href="index.php?'.api_get_cidreq().'">'.
40
-		Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM).
41
-	'</a>';
40
+        Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM).
41
+    '</a>';
42 42
 
43 43
 ksort($categories);
44 44
 foreach ($categories as $id => $title) {
45
-	if ($i==ADD_BLOCK) {
46
-		echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
47
-			Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
48
-		break;
49
-	} else {
50
-		echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
51
-			Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
52
-		$i++;
53
-	}
45
+    if ($i==ADD_BLOCK) {
46
+        echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
47
+            Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
48
+        break;
49
+    } else {
50
+        echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
51
+            Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
52
+        $i++;
53
+    }
54 54
 }
55 55
 echo '</div>';
56 56
 
57 57
 // error messages
58 58
 if (isset($error) && intval($error) == 1) {
59
-	Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
59
+    Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
60 60
 }
61 61
 
62 62
 // default header title form
63 63
 $description_type = intval($description_type);
64 64
 $header = $default_description_titles[$description_type];
65 65
 if ($description_type >= ADD_BLOCK) {
66
-	$header = $default_description_titles[ADD_BLOCK];
66
+    $header = $default_description_titles[ADD_BLOCK];
67 67
 }
68 68
 
69 69
 // display form
70 70
 $form = new FormValidator(
71
-	'course_description',
72
-	'POST',
73
-	'index.php?action=edit&id='.$original_id.'&description_type='.$description_type.'&'.api_get_cidreq()
71
+    'course_description',
72
+    'POST',
73
+    'index.php?action=edit&id='.$original_id.'&description_type='.$description_type.'&'.api_get_cidreq()
74 74
 );
75 75
 
76 76
 $form->addElement('header', $header);
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 $form->addText('title', get_lang('Title'), true, array('size' => '50'));
81 81
 $form->applyFilter('title', 'html_filter');
82 82
 $form->addHtmlEditor(
83
-	'contentDescription',
84
-	get_lang('Content'),
85
-	true,
86
-	false,
87
-	array(
88
-		'ToolbarSet' => 'TrainingDescription',
89
-		'Width' => '100%',
90
-		'Height' => '200',
91
-	)
83
+    'contentDescription',
84
+    get_lang('Content'),
85
+    true,
86
+    false,
87
+    array(
88
+        'ToolbarSet' => 'TrainingDescription',
89
+        'Width' => '100%',
90
+        'Height' => '200',
91
+    )
92 92
 );
93 93
 $form->addButtonCreate(get_lang('Save'));
94 94
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 $form->setDefaults($default);
105 105
 
106 106
 if (isset ($question[$description_type])) {
107
-	$message = '<strong>'.get_lang('QuestionPlan').'</strong><br />';
108
-	$message .= $question[$description_type];
109
-	Display::display_normal_message($message, false);
107
+    $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />';
108
+    $message .= $question[$description_type];
109
+    Display::display_normal_message($message, false);
110 110
 }
111 111
 $form->display();
Please login to merge, or discard this patch.
main/course_description/listing.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,27 +18,27 @@  discard block
 block discarded – undo
18 18
     }
19 19
     $categories[ADD_BLOCK] = get_lang('NewBloc');
20 20
 
21
-	$i=1;
22
-	echo '<div class="actions" style="margin-bottom:30px">';
23
-	ksort($categories);
24
-	foreach ($categories as $id => $title) {
25
-		if ($i==ADD_BLOCK) {
26
-			echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
21
+    $i=1;
22
+    echo '<div class="actions" style="margin-bottom:30px">';
23
+    ksort($categories);
24
+    foreach ($categories as $id => $title) {
25
+        if ($i==ADD_BLOCK) {
26
+            echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
27 27
                 Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
28
-			break;
29
-		} else {
30
-			echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
28
+            break;
29
+        } else {
30
+            echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
31 31
                 Display::return_icon($default_description_icon[$id], $title, '', ICON_SIZE_MEDIUM).'</a>';
32
-			$i++;
33
-		}
34
-	}
35
-	echo '</div>';
32
+            $i++;
33
+        }
34
+    }
35
+    echo '</div>';
36 36
 }
37 37
 $history = isset($history) ? $history : null;
38 38
 
39 39
 // display course description list
40 40
 if ($history) {
41
-	echo '<div>
41
+    echo '<div>
42 42
         <table width="100%">
43 43
             <tr>
44 44
                 <td><h3>'.get_lang('ThematicAdvanceHistory').'</h3></td>
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 $user_info = api_get_user_info();
50 50
 
51 51
 if (isset($descriptions) && count($descriptions) > 0) {
52
-	foreach ($descriptions as $id => $description) {
52
+    foreach ($descriptions as $id => $description) {
53 53
         if (!empty($description)) {
54 54
             $actions = '';
55 55
             if (api_is_allowed_to_edit(null,true) && !$history) {
Please login to merge, or discard this patch.
main/user/add_users_to_session.php 1 patch
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -49,29 +49,29 @@  discard block
 block discarded – undo
49 49
     $extra_field_list = UserManager::get_extra_fields();
50 50
     $new_field_list = array();
51 51
     if (is_array($extra_field_list)) {
52
-    	foreach ($extra_field_list as $extra_field) {
53
-    		//if is enabled to filter and is a "<select>" field type
54
-    		if ($extra_field[8]==1 && $extra_field[2]==4 ) {
52
+        foreach ($extra_field_list as $extra_field) {
53
+            //if is enabled to filter and is a "<select>" field type
54
+            if ($extra_field[8]==1 && $extra_field[2]==4 ) {
55 55
                 $new_field_list[] = array(
56 56
                     'name' => $extra_field[3],
57 57
                     'variable' => $extra_field[1],
58 58
                     'data' => $extra_field[9],
59 59
                 );
60
-    		}
61
-    	}
60
+            }
61
+        }
62 62
     }
63 63
 
64 64
     function search_users($needle, $type)
65 65
     {
66
-    	global $id_session;
66
+        global $id_session;
67 67
 
68 68
         $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
69 69
         $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
70 70
 
71
-    	$xajax_response = new xajaxResponse();
72
-    	$return = '';
71
+        $xajax_response = new xajaxResponse();
72
+        $return = '';
73 73
 
74
-    	if (!empty($needle) && !empty($type)) {
74
+        if (!empty($needle) && !empty($type)) {
75 75
 
76 76
             //normal behaviour
77 77
             if ($type == 'any_session' && $needle == 'false')  {
@@ -79,32 +79,32 @@  discard block
 block discarded – undo
79 79
                 $needle = '';
80 80
             }
81 81
 
82
-    		// xajax send utf8 datas... datas in db can be non-utf8 datas
83
-    		$charset = api_get_system_encoding();
84
-    		$needle = Database::escape_string($needle);
85
-    		$needle = api_convert_encoding($needle, $charset, 'utf-8');
82
+            // xajax send utf8 datas... datas in db can be non-utf8 datas
83
+            $charset = api_get_system_encoding();
84
+            $needle = Database::escape_string($needle);
85
+            $needle = api_convert_encoding($needle, $charset, 'utf-8');
86 86
 
87
-    		$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
88
-    		$cond_user_id = '';
87
+            $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
88
+            $cond_user_id = '';
89 89
 
90 90
             //Only for single & multiple
91 91
             if (in_array($type, array('single','multiple'))) {
92
-        		if (!empty($id_session)) {
93
-        		    $id_session = intval($id_session);
94
-        			// check id_user from session_rel_user table
95
-        			$sql = 'SELECT user_id FROM '.$tbl_session_rel_user.'
92
+                if (!empty($id_session)) {
93
+                    $id_session = intval($id_session);
94
+                    // check id_user from session_rel_user table
95
+                    $sql = 'SELECT user_id FROM '.$tbl_session_rel_user.'
96 96
         			        WHERE session_id ="'.$id_session.'" AND relation_type<>'.SESSION_RELATION_TYPE_RRHH.' ';
97
-        			$res = Database::query($sql);
98
-        			$user_ids = array();
99
-        			if (Database::num_rows($res) > 0) {
100
-        				while ($row = Database::fetch_row($res)) {
101
-        					$user_ids[] = (int)$row[0];
102
-        				}
103
-        			}
104
-        			if (count($user_ids) > 0) {
105
-        				$cond_user_id = ' AND user.user_id NOT IN('.implode(",",$user_ids).')';
106
-        			}
107
-        		}
97
+                    $res = Database::query($sql);
98
+                    $user_ids = array();
99
+                    if (Database::num_rows($res) > 0) {
100
+                        while ($row = Database::fetch_row($res)) {
101
+                            $user_ids[] = (int)$row[0];
102
+                        }
103
+                    }
104
+                    if (count($user_ids) > 0) {
105
+                        $cond_user_id = ' AND user.user_id NOT IN('.implode(",",$user_ids).')';
106
+                    }
107
+                }
108 108
             }
109 109
 
110 110
             switch ($type) {
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
                                 user.status <> 6 '.$cond_user_id.
137 137
                             $order_clause;
138 138
                     break;
139
-    		}
140
-    		if (api_is_multiple_url_enabled()) {
141
-    			$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
142
-    			$access_url_id = api_get_current_access_url_id();
143
-    			if ($access_url_id != -1) {
139
+            }
140
+            if (api_is_multiple_url_enabled()) {
141
+                $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
142
+                $access_url_id = api_get_current_access_url_id();
143
+                if ($access_url_id != -1) {
144 144
                     switch ($type) {
145 145
                         case 'single':
146 146
                             $sql = 'SELECT user.user_id, username, lastname, firstname
@@ -178,36 +178,36 @@  discard block
 block discarded – undo
178 178
                                         user.status<>6 '.$cond_user_id.
179 179
                             $order_clause;
180 180
                             break;
181
-    				}
182
-    			}
183
-    		}
181
+                    }
182
+                }
183
+            }
184 184
 
185
-    		$rs = Database::query($sql);
185
+            $rs = Database::query($sql);
186 186
             $i=0;
187
-    		if ($type == 'single') {
188
-    			while ($user = Database::fetch_array($rs)) {
189
-    	            $i++;
190
-    	            if ($i<=10) {
191
-                		$person_name = api_get_person_name($user['firstname'], $user['lastname']);
192
-    					$return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_session(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />';
193
-    	            } else {
194
-    	            	$return .= '...<br />';
195
-    	            }
196
-    			}
197
-
198
-    			$xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return));
199
-    		} else {
200
-    			$return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">';
201
-    			while ($user = Database :: fetch_array($rs)) {
202
-    				$person_name = api_get_person_name($user['firstname'], $user['lastname']);
203
-    	            $return .= '<option value="'.$user['user_id'].'">'.$person_name.' ('.$user['username'].')</option>';
204
-    			}
205
-    			$return .= '</select>';
206
-    			$xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return));
207
-    		}
208
-    	}
187
+            if ($type == 'single') {
188
+                while ($user = Database::fetch_array($rs)) {
189
+                    $i++;
190
+                    if ($i<=10) {
191
+                        $person_name = api_get_person_name($user['firstname'], $user['lastname']);
192
+                        $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_session(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />';
193
+                    } else {
194
+                        $return .= '...<br />';
195
+                    }
196
+                }
197
+
198
+                $xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return));
199
+            } else {
200
+                $return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">';
201
+                while ($user = Database :: fetch_array($rs)) {
202
+                    $person_name = api_get_person_name($user['firstname'], $user['lastname']);
203
+                    $return .= '<option value="'.$user['user_id'].'">'.$person_name.' ('.$user['username'].')</option>';
204
+                }
205
+                $return .= '</select>';
206
+                $xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return));
207
+            }
208
+        }
209 209
 
210
-    	return $xajax_response;
210
+        return $xajax_response;
211 211
     }
212 212
 
213 213
     $xajax -> processRequests();
@@ -347,8 +347,8 @@  discard block
 block discarded – undo
347 347
 
348 348
         if ($use_extra_fields) {
349 349
             $final_result = array();
350
-           	if (count($extra_field_result)>1) {
351
-    	    for($i=0;$i<count($extra_field_result)-1;$i++) {
350
+                if (count($extra_field_result)>1) {
351
+            for($i=0;$i<count($extra_field_result)-1;$i++) {
352 352
                     if (is_array($extra_field_result[$i+1])) {
353 353
                         $final_result = array_intersect(
354 354
                             $extra_field_result[$i],
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
                     'un' => $user['username']
427 427
                 );
428 428
                 unset($users[$uid]);
429
-    	}
429
+        }
430 430
         }
431 431
         unset($users); //clean to free memory
432 432
 
@@ -471,13 +471,13 @@  discard block
 block discarded – undo
471 471
     }
472 472
 
473 473
     if ($add_type === 'multiple') {
474
-    	$link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=unique">'.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
475
-    	$link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple');
474
+        $link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=unique">'.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
475
+        $link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple');
476 476
     } else {
477
-    	$link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique');
478
-    	$link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
477
+        $link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique');
478
+        $link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
479 479
     }
480
-    	$link_add_group = '<a href="usergroups.php">'.
480
+        $link_add_group = '<a href="usergroups.php">'.
481 481
             Display::return_icon('multiple.gif', get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups').'</a>';
482 482
     ?>
483 483
     <div class="actions">
@@ -487,30 +487,30 @@  discard block
 block discarded – undo
487 487
     <?php echo '<legend>'.$tool_name.' (' . $session->getName() . ') </legend>'; ?>
488 488
     <?php
489 489
     if ($add_type === 'multiple') {
490
-    	if (is_array($extra_field_list)) {
491
-    		if (is_array($new_field_list) && count($new_field_list)>0 ) {
492
-    			echo '<h3>'.get_lang('FilterUsers').'</h3>';
493
-    			foreach ($new_field_list as $new_field) {
494
-    				echo $new_field['name'];
495
-    				$varname = 'field_'.$new_field['variable'];
496
-    				echo '&nbsp;<select name="'.$varname.'">';
497
-    				echo '<option value="0">--'.get_lang('Select').'--</option>';
498
-    				foreach	($new_field['data'] as $option) {
499
-    					$checked='';
500
-    					if (isset($_POST[$varname])) {
501
-    						if ($_POST[$varname] == $option[1]) {
502
-    							$checked = 'selected="true"';
503
-    						}
504
-    					}
505
-    					echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>';
506
-    				}
507
-    				echo '</select>';
508
-    				echo '&nbsp;&nbsp;';
509
-    			}
510
-    			echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />';
511
-    			echo '<br /><br />';
512
-    		}
513
-    	}
490
+        if (is_array($extra_field_list)) {
491
+            if (is_array($new_field_list) && count($new_field_list)>0 ) {
492
+                echo '<h3>'.get_lang('FilterUsers').'</h3>';
493
+                foreach ($new_field_list as $new_field) {
494
+                    echo $new_field['name'];
495
+                    $varname = 'field_'.$new_field['variable'];
496
+                    echo '&nbsp;<select name="'.$varname.'">';
497
+                    echo '<option value="0">--'.get_lang('Select').'--</option>';
498
+                    foreach	($new_field['data'] as $option) {
499
+                        $checked='';
500
+                        if (isset($_POST[$varname])) {
501
+                            if ($_POST[$varname] == $option[1]) {
502
+                                $checked = 'selected="true"';
503
+                            }
504
+                        }
505
+                        echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>';
506
+                    }
507
+                    echo '</select>';
508
+                    echo '&nbsp;&nbsp;';
509
+                }
510
+                echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />';
511
+                echo '<br /><br />';
512
+            }
513
+        }
514 514
     }
515 515
     ?>
516 516
     <input type="hidden" name="form_sent" value="1" />
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
                 <div id="content_source">
534 534
                 <?php
535 535
                 if (!($add_type == 'multiple')) {
536
-                  ?>
536
+                    ?>
537 537
                   <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
538 538
                   <div id="ajax_list_users_single"></div>
539 539
                   <?php
@@ -542,12 +542,12 @@  discard block
 block discarded – undo
542 542
                 <div id="ajax_list_users_multiple">
543 543
                 <select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" class="span5">
544 544
                   <?php
545
-                  foreach ($nosessionUsersList as $uid => $enreg) {
546
-                  ?>
545
+                    foreach ($nosessionUsersList as $uid => $enreg) {
546
+                    ?>
547 547
                       <option value="<?php echo $uid; ?>" <?php if(in_array($uid,$UserList)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; ?></option>
548 548
                   <?php
549
-                  }
550
-                  ?>
549
+                    }
550
+                    ?>
551 551
                 </select>
552 552
                 </div>
553 553
                     <input type="checkbox" onchange="checked_in_no_session(this.checked);" name="user_with_any_session" id="user_with_any_session_id">
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
                 <?php
556 556
                 }
557 557
                 unset($nosessionUsersList);
558
-               ?>
558
+                ?>
559 559
             </div>
560 560
         </div>
561 561
 
@@ -582,13 +582,13 @@  discard block
 block discarded – undo
582 582
             <br />
583 583
             <br />
584 584
     		<?php
585
-    		if (isset($_GET['add'])) {
586
-    			echo '<button class="btn btn-primary" type="button" value="" onclick="valide()" >'.get_lang('FinishSessionCreation').'</button>';
585
+            if (isset($_GET['add'])) {
586
+                echo '<button class="btn btn-primary" type="button" value="" onclick="valide()" >'.get_lang('FinishSessionCreation').'</button>';
587 587
             } else {
588 588
                 //@todo see that the call to "valide()" doesn't duplicate the onsubmit of the form (necessary to avoid delete on "enter" key pressed)
589
-    			echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToSession').'</button>';
589
+                echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToSession').'</button>';
590 590
             }
591
-    		?>
591
+            ?>
592 592
         </div>
593 593
         <div class="span5">
594 594
             <div class="multiple_select_header">
Please login to merge, or discard this patch.
main/mySpace/current_courses.php 1 patch
Indentation   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 $filename = 'reporting.xlsx';
13 13
 
14 14
 if (!api_is_allowed_to_create_course()) {
15
-	api_not_allowed(true);
15
+    api_not_allowed(true);
16 16
 }
17 17
 
18 18
 $user_id = api_get_user_id();
@@ -23,226 +23,226 @@  discard block
 block discarded – undo
23 23
 $session_id = 0;
24 24
 
25 25
 if (!empty($my_courses)) {
26
-	foreach ($my_courses as $course) {
27
-		$course_code = $course['code'];
28
-		$course_id = $course['real_id'];
29
-		$course_info = api_get_course_info($course_code);
30
-
31
-		//Only show open courses
32
-		if ($course_info['visibility'] == 0) {
33
-			continue;
34
-		}
35
-
36
-		$teachers = CourseManager::get_teacher_list_from_course_code($course_code);
37
-		$teacher_list =  array();
38
-
39
-		if (!empty($teachers)) {
40
-			foreach($teachers as $teacher) {
41
-				$teacher_list[]= $teacher['firstname'].' '.$teacher['lastname'];
42
-			}
43
-		}
44
-
45
-		$tmp_students = CourseManager :: get_student_list_from_course_code($course_code, false);
46
-
47
-		//Cleaning students only REAL students
48
-		$students = array();
49
-		foreach ($tmp_students  as $student) {
50
-			$user_info = api_get_user_info($student['user_id']);
51
-			if ($user_info['status'] != STUDENT) {
52
-				continue;
53
-			}
54
-			$students[] = $student['user_id'];
55
-		}
56
-
57
-		$t_lp 	= Database :: get_course_table(TABLE_LP_MAIN);
58
-		$sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp
26
+    foreach ($my_courses as $course) {
27
+        $course_code = $course['code'];
28
+        $course_id = $course['real_id'];
29
+        $course_info = api_get_course_info($course_code);
30
+
31
+        //Only show open courses
32
+        if ($course_info['visibility'] == 0) {
33
+            continue;
34
+        }
35
+
36
+        $teachers = CourseManager::get_teacher_list_from_course_code($course_code);
37
+        $teacher_list =  array();
38
+
39
+        if (!empty($teachers)) {
40
+            foreach($teachers as $teacher) {
41
+                $teacher_list[]= $teacher['firstname'].' '.$teacher['lastname'];
42
+            }
43
+        }
44
+
45
+        $tmp_students = CourseManager :: get_student_list_from_course_code($course_code, false);
46
+
47
+        //Cleaning students only REAL students
48
+        $students = array();
49
+        foreach ($tmp_students  as $student) {
50
+            $user_info = api_get_user_info($student['user_id']);
51
+            if ($user_info['status'] != STUDENT) {
52
+                continue;
53
+            }
54
+            $students[] = $student['user_id'];
55
+        }
56
+
57
+        $t_lp 	= Database :: get_course_table(TABLE_LP_MAIN);
58
+        $sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp
59 59
 				   WHERE c_id = $course_id AND lp.session_id = 0";
60
-		$rs_lp 	= Database::query($sql_lp);
61
-		$t_lpi 	= Database :: get_course_table(TABLE_LP_ITEM);
62
-		$t_news = Database :: get_course_table(TABLE_ANNOUNCEMENT);
63
-
64
-		$total_tools_list = Tracking::get_tools_most_used_by_course(
65
-			$course_id,
66
-			$session_id
67
-		);
68
-
69
-		$total_tools = 0;
70
-		foreach($total_tools_list as $tool) {
71
-			$total_tools += $tool['count_access_tool'];
72
-		}
73
-
74
-		if (Database :: num_rows($rs_lp) > 0) {
75
-			while ($learnpath = Database :: fetch_array($rs_lp)) {
76
-				$lp_id = $learnpath['id'];
77
-
78
-				$lp_items =
79
-				$array[$i]['lp'] = '<a href="'.api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?cidReq='.$course_code.'&amp;action=view&amp;lp_id='.$lp_id.'" target="_blank">'.$learnpath['name'].'</a>';
80
-
81
-				$array[$i]['teachers'] = '';
82
-				if (!empty($teacher_list)) {
83
-					$array[$i]['teachers'] = implode(', ', $teacher_list);
84
-				}
85
-
86
-				$array[$i]['course_name'] = $course['title'];
87
-				$count_students_accessing = 0;
88
-				$count_students_complete_all_activities = 0;
89
-				$count_students_complete_all_activities_at_50 = 0;
90
-				$total_time_spent = 0;
91
-				$total_average_progress = 0;
92
-
93
-				if (!empty($students)) {
94
-					foreach ($students  as $student_id) {
95
-						$avg_student_progress   = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
96
-						$myavg_temp 			= Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id);
97
-						$avg_progress_in_course = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
98
-
99
-						if (intval($avg_progress_in_course) == 100) {
100
-							$count_students_complete_all_activities++;
101
-						}
102
-						if (intval($avg_progress_in_course) > 0 && intval($avg_progress_in_course) <= 50) {
103
-							$count_students_complete_all_activities_at_50 ++;
104
-						}
105
-						$total_average_progress +=$avg_progress_in_course;
106
-
107
-						$time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_id, $session_id);
108
-						$total_time_spent += $time_spent;
109
-						if (!empty($time_spent)) {
110
-							$count_students_accessing++;
111
-						}
112
-					}
113
-					//$total_tools += $nb_assignments +  $messages + $links + $chat_last_connection + $documents;
114
-				}
115
-
116
-				$student_count = count($students);
117
-
118
-				$array[$i]['count_students'] = $student_count;
119
-				$array[$i]['count_students_accessing'] = 0;
120
-				$array[$i]['count_students_accessing_percentage'] = 0;
121
-				$array[$i]['count_students_complete_all_activities_at_50'] = 0;
122
-				$array[$i]['count_students_complete_all_activities'] = 0;
123
-				$array[$i]['average_percentage_activities_completed_per_student'] = 0;
124
-				$array[$i]['total_time_spent'] = 0;
125
-				$array[$i]['average_time_spent_per_student'] = 0;
126
-				$array[$i]['total_time_spent'] = 0;
127
-				$array[$i]['average_time_spent_per_student'] = 0;
128
-				//$array[$i]['tools_used'] = 0;
129
-				$array[$i]['learnpath_docs'] = 0;
130
-				$array[$i]['learnpath_exercises'] = 0;
131
-				$array[$i]['learnpath_links'] = 0;
132
-				$array[$i]['learnpath_forums'] = 0;
133
-				$array[$i]['learnpath_assignments'] = 0;
134
-
135
-				//registering the number of each category of
136
-				//items in learning path
137
-				$sql_lpi = "SELECT lpi.item_type FROM $t_lpi lpi
60
+        $rs_lp 	= Database::query($sql_lp);
61
+        $t_lpi 	= Database :: get_course_table(TABLE_LP_ITEM);
62
+        $t_news = Database :: get_course_table(TABLE_ANNOUNCEMENT);
63
+
64
+        $total_tools_list = Tracking::get_tools_most_used_by_course(
65
+            $course_id,
66
+            $session_id
67
+        );
68
+
69
+        $total_tools = 0;
70
+        foreach($total_tools_list as $tool) {
71
+            $total_tools += $tool['count_access_tool'];
72
+        }
73
+
74
+        if (Database :: num_rows($rs_lp) > 0) {
75
+            while ($learnpath = Database :: fetch_array($rs_lp)) {
76
+                $lp_id = $learnpath['id'];
77
+
78
+                $lp_items =
79
+                $array[$i]['lp'] = '<a href="'.api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?cidReq='.$course_code.'&amp;action=view&amp;lp_id='.$lp_id.'" target="_blank">'.$learnpath['name'].'</a>';
80
+
81
+                $array[$i]['teachers'] = '';
82
+                if (!empty($teacher_list)) {
83
+                    $array[$i]['teachers'] = implode(', ', $teacher_list);
84
+                }
85
+
86
+                $array[$i]['course_name'] = $course['title'];
87
+                $count_students_accessing = 0;
88
+                $count_students_complete_all_activities = 0;
89
+                $count_students_complete_all_activities_at_50 = 0;
90
+                $total_time_spent = 0;
91
+                $total_average_progress = 0;
92
+
93
+                if (!empty($students)) {
94
+                    foreach ($students  as $student_id) {
95
+                        $avg_student_progress   = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
96
+                        $myavg_temp 			= Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id);
97
+                        $avg_progress_in_course = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
98
+
99
+                        if (intval($avg_progress_in_course) == 100) {
100
+                            $count_students_complete_all_activities++;
101
+                        }
102
+                        if (intval($avg_progress_in_course) > 0 && intval($avg_progress_in_course) <= 50) {
103
+                            $count_students_complete_all_activities_at_50 ++;
104
+                        }
105
+                        $total_average_progress +=$avg_progress_in_course;
106
+
107
+                        $time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_id, $session_id);
108
+                        $total_time_spent += $time_spent;
109
+                        if (!empty($time_spent)) {
110
+                            $count_students_accessing++;
111
+                        }
112
+                    }
113
+                    //$total_tools += $nb_assignments +  $messages + $links + $chat_last_connection + $documents;
114
+                }
115
+
116
+                $student_count = count($students);
117
+
118
+                $array[$i]['count_students'] = $student_count;
119
+                $array[$i]['count_students_accessing'] = 0;
120
+                $array[$i]['count_students_accessing_percentage'] = 0;
121
+                $array[$i]['count_students_complete_all_activities_at_50'] = 0;
122
+                $array[$i]['count_students_complete_all_activities'] = 0;
123
+                $array[$i]['average_percentage_activities_completed_per_student'] = 0;
124
+                $array[$i]['total_time_spent'] = 0;
125
+                $array[$i]['average_time_spent_per_student'] = 0;
126
+                $array[$i]['total_time_spent'] = 0;
127
+                $array[$i]['average_time_spent_per_student'] = 0;
128
+                //$array[$i]['tools_used'] = 0;
129
+                $array[$i]['learnpath_docs'] = 0;
130
+                $array[$i]['learnpath_exercises'] = 0;
131
+                $array[$i]['learnpath_links'] = 0;
132
+                $array[$i]['learnpath_forums'] = 0;
133
+                $array[$i]['learnpath_assignments'] = 0;
134
+
135
+                //registering the number of each category of
136
+                //items in learning path
137
+                $sql_lpi = "SELECT lpi.item_type FROM $t_lpi lpi
138 138
 						    WHERE c_id = $course_id AND lpi.lp_id = $lp_id
139 139
 						    ORDER BY item_type";
140
-				$res_lpi = Database::query($sql_lpi);
141
-				while ($row_lpi = Database::fetch_array($res_lpi)) {
142
-					switch($row_lpi['item_type']) {
143
-						case 'document':
144
-							$array[$i]['learnpath_docs']++;
145
-							break;
146
-						case 'quiz':
147
-							$array[$i]['learnpath_exercises']++;
148
-							break;
149
-						case 'link':
150
-							$array[$i]['learnpath_links']++;
151
-							break;
152
-						case 'forum':
153
-						case 'thread':
154
-							$array[$i]['learnpath_forums']++;
155
-							break;
156
-						case 'student_publication':
157
-							$array[$i]['learnpath_assignments']++;
158
-							break;
159
-					}
160
-				}
161
-				// Count announcements
162
-				$array[$i]['total_announcements'] = 0;
163
-				$sql_news = "SELECT count(id) FROM $t_news WHERE c_id = $course_id ";
164
-				$res_news = Database::query($sql_news);
165
-				while ($row_news = Database::fetch_array($res_news)) {
166
-					$array[$i]['total_announcements'] = $row_news[0];
167
-				}
168
-
169
-				//@todo don't know what means this value
170
-				$count_students_complete_all_activities_at_50 = 0;
171
-
172
-				if (!empty($student_count)) {
173
-					$array[$i]['count_students_accessing'] = $count_students_accessing;
174
-					$array[$i]['count_students_accessing_percentage'] = round($count_students_accessing / $student_count *100 , 0);
175
-					$array[$i]['count_students_complete_all_activities_at_50'] = $count_students_complete_all_activities;
176
-					$array[$i]['count_students_complete_all_activities'] = round($count_students_complete_all_activities / $student_count *100 , 0);;
177
-					$array[$i]['average_percentage_activities_completed_per_student'] = round($count_students_complete_all_activities/$student_count*100,2);
178
-					$array[$i]['total_time_spent'] = 0;
179
-					$array[$i]['average_time_spent_per_student'] = 0;
180
-
181
-					if (!empty($total_time_spent)) {
182
-						$array[$i]['total_time_spent'] = api_time_to_hms($total_time_spent);
183
-						$array[$i]['average_time_spent_per_student'] = api_time_to_hms($total_time_spent / $student_count);
184
-					}
185
-					//$array[$i]['tools_used'] = $total_tools;
186
-				}
187
-				$i++;
188
-			}
189
-		}
190
-	}
140
+                $res_lpi = Database::query($sql_lpi);
141
+                while ($row_lpi = Database::fetch_array($res_lpi)) {
142
+                    switch($row_lpi['item_type']) {
143
+                        case 'document':
144
+                            $array[$i]['learnpath_docs']++;
145
+                            break;
146
+                        case 'quiz':
147
+                            $array[$i]['learnpath_exercises']++;
148
+                            break;
149
+                        case 'link':
150
+                            $array[$i]['learnpath_links']++;
151
+                            break;
152
+                        case 'forum':
153
+                        case 'thread':
154
+                            $array[$i]['learnpath_forums']++;
155
+                            break;
156
+                        case 'student_publication':
157
+                            $array[$i]['learnpath_assignments']++;
158
+                            break;
159
+                    }
160
+                }
161
+                // Count announcements
162
+                $array[$i]['total_announcements'] = 0;
163
+                $sql_news = "SELECT count(id) FROM $t_news WHERE c_id = $course_id ";
164
+                $res_news = Database::query($sql_news);
165
+                while ($row_news = Database::fetch_array($res_news)) {
166
+                    $array[$i]['total_announcements'] = $row_news[0];
167
+                }
168
+
169
+                //@todo don't know what means this value
170
+                $count_students_complete_all_activities_at_50 = 0;
171
+
172
+                if (!empty($student_count)) {
173
+                    $array[$i]['count_students_accessing'] = $count_students_accessing;
174
+                    $array[$i]['count_students_accessing_percentage'] = round($count_students_accessing / $student_count *100 , 0);
175
+                    $array[$i]['count_students_complete_all_activities_at_50'] = $count_students_complete_all_activities;
176
+                    $array[$i]['count_students_complete_all_activities'] = round($count_students_complete_all_activities / $student_count *100 , 0);;
177
+                    $array[$i]['average_percentage_activities_completed_per_student'] = round($count_students_complete_all_activities/$student_count*100,2);
178
+                    $array[$i]['total_time_spent'] = 0;
179
+                    $array[$i]['average_time_spent_per_student'] = 0;
180
+
181
+                    if (!empty($total_time_spent)) {
182
+                        $array[$i]['total_time_spent'] = api_time_to_hms($total_time_spent);
183
+                        $array[$i]['average_time_spent_per_student'] = api_time_to_hms($total_time_spent / $student_count);
184
+                    }
185
+                    //$array[$i]['tools_used'] = $total_tools;
186
+                }
187
+                $i++;
188
+            }
189
+        }
190
+    }
191 191
 }
192 192
 
193 193
 $headers = array(
194
-	get_lang('LearningPath'),
195
-	get_lang('Teachers'),
196
-	get_lang('Courses'),
197
-	get_lang('NumberOfStudents'),
198
-	get_lang('NumberStudentsAccessingCourse'),
199
-	get_lang('PercentageStudentsAccessingCourse'),
200
-	get_lang('NumberStudentsCompleteAllActivities'),
201
-	get_lang('PercentageStudentsCompleteAllActivities'),
202
-	get_lang('AverageOfActivitiesCompletedPerStudent'),
203
-	get_lang('TotalTimeSpentInTheCourse'),
204
-	get_lang('AverageTimePerStudentInCourse'),
205
-	get_lang('NumberOfDocumentsInLearnpath'),
206
-	get_lang('NumberOfExercisesInLearnpath'),
207
-	get_lang('NumberOfLinksInLearnpath'),
208
-	get_lang('NumberOfForumsInLearnpath'),
209
-	get_lang('NumberOfAssignmentsInLearnpath'),
210
-	get_lang('NumberOfAnnouncementsInCourse'),
194
+    get_lang('LearningPath'),
195
+    get_lang('Teachers'),
196
+    get_lang('Courses'),
197
+    get_lang('NumberOfStudents'),
198
+    get_lang('NumberStudentsAccessingCourse'),
199
+    get_lang('PercentageStudentsAccessingCourse'),
200
+    get_lang('NumberStudentsCompleteAllActivities'),
201
+    get_lang('PercentageStudentsCompleteAllActivities'),
202
+    get_lang('AverageOfActivitiesCompletedPerStudent'),
203
+    get_lang('TotalTimeSpentInTheCourse'),
204
+    get_lang('AverageTimePerStudentInCourse'),
205
+    get_lang('NumberOfDocumentsInLearnpath'),
206
+    get_lang('NumberOfExercisesInLearnpath'),
207
+    get_lang('NumberOfLinksInLearnpath'),
208
+    get_lang('NumberOfForumsInLearnpath'),
209
+    get_lang('NumberOfAssignmentsInLearnpath'),
210
+    get_lang('NumberOfAnnouncementsInCourse'),
211 211
 );
212 212
 
213 213
 if (isset($_GET['export'])) {
214
-	global $charset;
214
+    global $charset;
215 215
     $spreadsheet = new PHPExcel();
216 216
     $spreadsheet->setActiveSheetIndex(0);
217 217
     $worksheet = $spreadsheet->getActiveSheet();
218 218
 
219
-	$line = 0;
220
-	$column = 0; //skip the first column (row titles)
221
-
222
-	foreach ($headers as $header) {
223
-		$worksheet->setCellValueByColumnAndRow($column, $line, $header);
224
-		$column++;
225
-	}
226
-	$line++;
227
-	foreach ($array as $row) {
228
-		$column = 0;
229
-		foreach ($row as $item) {
219
+    $line = 0;
220
+    $column = 0; //skip the first column (row titles)
221
+
222
+    foreach ($headers as $header) {
223
+        $worksheet->setCellValueByColumnAndRow($column, $line, $header);
224
+        $column++;
225
+    }
226
+    $line++;
227
+    foreach ($array as $row) {
228
+        $column = 0;
229
+        foreach ($row as $item) {
230 230
             $worksheet->setCellValueByColumnAndRow(
231 231
                 $column,
232 232
                 $line,
233 233
                 html_entity_decode(strip_tags($item))
234 234
             );
235
-			$column++;
236
-		}
237
-		$line++;
238
-	}
239
-	$line++;
235
+            $column++;
236
+        }
237
+        $line++;
238
+    }
239
+    $line++;
240 240
 
241 241
     $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename);
242 242
     $writer = new PHPExcel_Writer_Excel2007($spreadsheet);
243 243
     $writer->save($file);
244 244
     DocumentManager::file_send_for_download($file, true, $filename);
245
-	exit;
245
+    exit;
246 246
 }
247 247
 
248 248
 $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace'));
@@ -253,20 +253,20 @@  discard block
 block discarded – undo
253 253
 $row = 0;
254 254
 $column = 0;
255 255
 foreach ($headers as $header) {
256
-	$table->setHeaderContents($row, $column, $header);
257
-	$column++;
256
+    $table->setHeaderContents($row, $column, $header);
257
+    $column++;
258 258
 }
259 259
 $row++;
260 260
 
261 261
 foreach ($array as $row_table) {
262
-	$column = 0;
263
-	foreach ($row_table as $cell) {
264
-		$table->setCellContents($row, $column, $cell);
265
-		//$table->updateCellAttributes($row, $column, 'align="center"');
266
-		$column++;
267
-	}
268
-	$table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
269
-	$row++;
262
+    $column = 0;
263
+    foreach ($row_table as $cell) {
264
+        $table->setCellContents($row, $column, $cell);
265
+        //$table->updateCellAttributes($row, $column, 'align="center"');
266
+        $column++;
267
+    }
268
+    $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
269
+    $row++;
270 270
 }
271 271
 
272 272
 echo '<div class="actions">';
Please login to merge, or discard this patch.
main/mySpace/user_edit.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -109,23 +109,23 @@  discard block
 block discarded – undo
109 109
 $form->addGroup($html_results_enabled);
110 110
 // Validate form
111 111
 if ($form->validate()) {
112
-	$check = Security::check_token('post');
113
-	if ($check) {
114
-		$user = $form->exportValues();
115
-		$email = $userInfo['email'];
112
+    $check = Security::check_token('post');
113
+    if ($check) {
114
+        $user = $form->exportValues();
115
+        $email = $userInfo['email'];
116 116
         $username = $userInfo['username'];
117
-		$send_mail = intval($user['mail']['send_mail']);
117
+        $send_mail = intval($user['mail']['send_mail']);
118 118
         $auth_source = PLATFORM_AUTH_SOURCE;
119 119
 
120 120
         $resetPassword = $user['password']['password_auto'] == '1' ? 0 : 2;
121 121
 
122
-		if (count($extAuthSource) > 0 && $user['password']['password_auto'] == '2') {
123
-			//$auth_source = $user['password']['auth_source'];
124
-			//$password = 'PLACEHOLDER';
125
-		} else {
126
-			//$auth_source = PLATFORM_AUTH_SOURCE;
127
-			//$password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password'];
128
-		}
122
+        if (count($extAuthSource) > 0 && $user['password']['password_auto'] == '2') {
123
+            //$auth_source = $user['password']['auth_source'];
124
+            //$password = 'PLACEHOLDER';
125
+        } else {
126
+            //$auth_source = PLATFORM_AUTH_SOURCE;
127
+            //$password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password'];
128
+        }
129 129
 
130 130
         $auth_source = $userInfo['auth_source'];
131 131
         $password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password'];
@@ -153,18 +153,18 @@  discard block
 block discarded – undo
153 153
             $resetPassword
154 154
         );
155 155
 
156
-		if (!empty($email) && $send_mail) {
157
-			$emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
158
-			$portal_url = api_get_path(WEB_PATH);
159
-			if (api_is_multiple_url_enabled()) {
160
-				$access_url_id = api_get_current_access_url_id();
161
-				if ($access_url_id != -1) {
162
-					$url = api_get_access_url($access_url_id);
163
-					$portal_url = $url['url'];
164
-				}
165
-			}
166
-
167
-			$emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($userInfo['firstname'], $userInfo['lastname'])).",\n\n".
156
+        if (!empty($email) && $send_mail) {
157
+            $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
158
+            $portal_url = api_get_path(WEB_PATH);
159
+            if (api_is_multiple_url_enabled()) {
160
+                $access_url_id = api_get_current_access_url_id();
161
+                if ($access_url_id != -1) {
162
+                    $url = api_get_access_url($access_url_id);
163
+                    $portal_url = $url['url'];
164
+                }
165
+            }
166
+
167
+            $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($userInfo['firstname'], $userInfo['lastname'])).",\n\n".
168 168
                 get_lang('YouAreReg')." ". api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".
169 169
                 get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" .
170 170
                 get_lang('Address') ." ". api_get_setting('siteName') ." ".
@@ -178,26 +178,26 @@  discard block
 block discarded – undo
178 178
                 get_lang('Email') ." : ".api_get_setting('emailAdministrator');
179 179
             $emailbody = nl2br($emailbody);
180 180
 
181
-			api_mail_html(
181
+            api_mail_html(
182 182
                 api_get_person_name($userInfo['firstname'], $userInfo['lastname'], null, PERSON_NAME_EMAIL_ADDRESS),
183 183
                 $email,
184 184
                 $emailsubject,
185 185
                 $emailbody
186 186
             );
187
-		}
187
+        }
188 188
 
189
-		Security::clear_token();
189
+        Security::clear_token();
190 190
         $tok = Security::get_token();
191 191
         header('Location: '.$url.'&message=1');
192 192
         exit();
193
-	}
193
+    }
194 194
 } else {
195
-	if (isset($_POST['submit'])) {
196
-		Security::clear_token();
197
-	}
198
-	$token = Security::get_token();
199
-	$form->addElement('hidden', 'sec_token');
200
-	$form->setConstants(array('sec_token' => $token));
195
+    if (isset($_POST['submit'])) {
196
+        Security::clear_token();
197
+    }
198
+    $token = Security::get_token();
199
+    $form->addElement('hidden', 'sec_token');
200
+    $form->setConstants(array('sec_token' => $token));
201 201
 }
202 202
 
203 203
 $interbreadcrumb[] = array(
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 Display::display_header($tool_name);
210 210
 
211 211
 if (isset($_REQUEST['message'])) {
212
-	Display::display_normal_message(get_lang('Updated'));
212
+    Display::display_normal_message(get_lang('Updated'));
213 213
 }
214 214
 $form->display();
215 215
 
Please login to merge, or discard this patch.
main/mySpace/index.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 }
103 103
 
104 104
 if ($is_drh) {
105
-	$view = 'drh';
105
+    $view = 'drh';
106 106
     $menu_items[] = Display::url(
107 107
         Display::return_icon('user_na.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM),
108 108
         '#'
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
         echo "</div><br />";
162 162
     }
163 163
 } else {
164
-	echo Display::url(
164
+    echo Display::url(
165 165
         Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),
166 166
         api_get_path(WEB_CODE_PATH)."auth/my_progress.php"
167 167
     );
@@ -431,11 +431,11 @@  discard block
 block discarded – undo
431 431
 
432 432
 // Send the csv file if asked
433 433
 if ($export_csv) {
434
-	ob_end_clean();
435
-	Export :: arrayToCsv($csv_content, 'reporting_index');
436
-	exit;
434
+    ob_end_clean();
435
+    Export :: arrayToCsv($csv_content, 'reporting_index');
436
+    exit;
437 437
 }
438 438
 
439 439
 if (!$export_csv) {
440
-	Display::display_footer();
440
+    Display::display_footer();
441 441
 }
Please login to merge, or discard this patch.
main/survey/survey.php 1 patch
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 // Coach can't view this page
21 21
 $extend_rights_for_coachs = api_get_setting('extend_rights_for_coach_on_survey');
22 22
 $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
23
-	api_get_user_id(),
24
-	api_get_course_info()
23
+    api_get_user_id(),
24
+    api_get_course_info()
25 25
 );
26 26
 
27 27
 if ($isDrhOfCourse) {
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     (api_is_course_coach() && $extend_rights_for_coachs == 'false')
33 33
 ) {
34 34
     api_not_allowed(true);
35
-	exit;
35
+    exit;
36 36
 }
37 37
 
38 38
 // Database table definitions
@@ -49,21 +49,21 @@  discard block
 block discarded – undo
49 49
 
50 50
 // Breadcrumbs
51 51
 $interbreadcrumb[] = array(
52
-		'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php',
53
-		'name' => get_lang('SurveyList'),
52
+        'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php',
53
+        'name' => get_lang('SurveyList'),
54 54
 );
55 55
 
56 56
 // Getting the survey information
57 57
 if (!empty($_GET['survey_id'])) {
58
-	$course_code = api_get_course_id();
59
-	if ($course_code!=-1) {
60
-		$survey_data = SurveyManager::get_survey($survey_id);
61
-	} else {
62
-		Display :: display_header(get_lang('ToolSurvey'));
63
-		Display :: display_error_message(get_lang('NotAllowed'), false);
64
-		Display :: display_footer();
65
-		exit;
66
-	}
58
+    $course_code = api_get_course_id();
59
+    if ($course_code!=-1) {
60
+        $survey_data = SurveyManager::get_survey($survey_id);
61
+    } else {
62
+        Display :: display_header(get_lang('ToolSurvey'));
63
+        Display :: display_error_message(get_lang('NotAllowed'), false);
64
+        Display :: display_footer();
65
+        exit;
66
+    }
67 67
 } else {
68 68
     Display :: display_header(get_lang('ToolSurvey'));
69 69
     Display :: display_error_message(get_lang('NotAllowed'), false);
@@ -76,30 +76,30 @@  discard block
 block discarded – undo
76 76
 $is_survey_type_1 = $survey_data['survey_type'] == 1;
77 77
 
78 78
 if (api_strlen(strip_tags($survey_data['title'])) > 40) {
79
-	$tool_name .= '...';
79
+    $tool_name .= '...';
80 80
 }
81 81
 
82 82
 if ($is_survey_type_1 && ($action == 'addgroup' || $action == 'deletegroup')) {
83
-	$_POST['name'] = trim($_POST['name']);
84
-	if ($action == 'addgroup') {
85
-		if (!empty($_POST['group_id'])) {
86
-			Database::query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\'
83
+    $_POST['name'] = trim($_POST['name']);
84
+    if ($action == 'addgroup') {
85
+        if (!empty($_POST['group_id'])) {
86
+            Database::query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\'
87 87
 			                 WHERE c_id = '.$course_id.' AND id = \''.Database::escape_string($_POST['group_id']).'\'');
88
-			$sendmsg = 'GroupUpdatedSuccessfully';
89
-		} elseif(!empty($_POST['name'])) {
90
-			Database::query('INSERT INTO '.$table_survey_question_group.' (c_id, name,description,survey_id) values ('.$course_id.', \''.Database::escape_string($_POST['name']).'\',\''.Database::escape_string($_POST['description']).'\',\''.Database::escape_string($survey_id).'\') ');
91
-			$sendmsg = 'GroupCreatedSuccessfully';
92
-		} else {
93
-			$sendmsg = 'GroupNeedName';
94
-		}
95
-	}
96
-
97
-	if ($action == 'deletegroup') {
98
-		Database::query('DELETE FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' and survey_id = '.intval($survey_id));
99
-		$sendmsg = 'GroupDeletedSuccessfully';
100
-	}
101
-	header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&sendmsg='.$sendmsg);
102
-	exit;
88
+            $sendmsg = 'GroupUpdatedSuccessfully';
89
+        } elseif(!empty($_POST['name'])) {
90
+            Database::query('INSERT INTO '.$table_survey_question_group.' (c_id, name,description,survey_id) values ('.$course_id.', \''.Database::escape_string($_POST['name']).'\',\''.Database::escape_string($_POST['description']).'\',\''.Database::escape_string($survey_id).'\') ');
91
+            $sendmsg = 'GroupCreatedSuccessfully';
92
+        } else {
93
+            $sendmsg = 'GroupNeedName';
94
+        }
95
+    }
96
+
97
+    if ($action == 'deletegroup') {
98
+        Database::query('DELETE FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' and survey_id = '.intval($survey_id));
99
+        $sendmsg = 'GroupDeletedSuccessfully';
100
+    }
101
+    header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&sendmsg='.$sendmsg);
102
+    exit;
103 103
 }
104 104
 
105 105
 // Displaying the header
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 $message_information    = isset($_GET['message']) ? Security::remove_XSS($_GET['message']) : null;
114 114
 
115 115
 if (isset($action)) {
116
-	if (($action == 'moveup' || $action == 'movedown') && isset($_GET['question_id'])) {
117
-		SurveyManager::move_survey_question($my_action_survey,$my_question_id_survey,$my_survey_id_survey);
118
-		Display::display_confirmation_message(get_lang('SurveyQuestionMoved'));
119
-	}
120
-	if ($action == 'delete' AND is_numeric($_GET['question_id'])) {
121
-		SurveyManager::delete_survey_question($my_survey_id_survey, $my_question_id_survey, $survey_data['is_shared']);
122
-	}
116
+    if (($action == 'moveup' || $action == 'movedown') && isset($_GET['question_id'])) {
117
+        SurveyManager::move_survey_question($my_action_survey,$my_question_id_survey,$my_survey_id_survey);
118
+        Display::display_confirmation_message(get_lang('SurveyQuestionMoved'));
119
+    }
120
+    if ($action == 'delete' AND is_numeric($_GET['question_id'])) {
121
+        SurveyManager::delete_survey_question($my_survey_id_survey, $my_question_id_survey, $survey_data['is_shared']);
122
+    }
123 123
 }
124 124
 
125 125
 if (!empty($survey_data['survey_version'])) echo '<b>'.get_lang('Version').': '.$survey_data['survey_version'].'</b>';
@@ -137,26 +137,26 @@  discard block
 block discarded – undo
137 137
 echo '<div class="actions">'.$survey_actions.'</div>';
138 138
 
139 139
 if ($survey_data['survey_type'] == 0) {
140
-	echo '<div class="panel panel-default">';
140
+    echo '<div class="panel panel-default">';
141 141
         echo '<div class="panel-body">';
142
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=yesno&amp;survey_id='.$survey_id.'">'.Display::return_icon('yesno.png', get_lang('YesNo'), null, ICON_SIZE_BIG).'</a>';
143
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=multiplechoice&amp;survey_id='.$survey_id.'">'.Display::return_icon('mcua.png', get_lang('UniqueSelect'), null, ICON_SIZE_BIG).'</a>';
144
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=multipleresponse&amp;survey_id='.$survey_id.'">'.Display::return_icon('mcma.png', get_lang('MultipleResponse'), null, ICON_SIZE_BIG).'</a>';
145
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=open&amp;survey_id='.$survey_id.'">'.Display::return_icon('open_answer.png', get_lang('Open'), null, ICON_SIZE_BIG).'</a>';
146
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=dropdown&amp;survey_id='.$survey_id.'">'.Display::return_icon('dropdown.png', get_lang('Dropdown'), null, ICON_SIZE_BIG).'</a>';
147
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=percentage&amp;survey_id='.$survey_id.'">'.Display::return_icon('percentagequestion.png', get_lang('Percentage'), null, ICON_SIZE_BIG).'</a>';
148
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=score&amp;survey_id='.$survey_id.'">'.Display::return_icon('scorequestion.png', get_lang('Score'), null, ICON_SIZE_BIG).'</a>';
149
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=comment&amp;survey_id='.$survey_id.'">'.Display::return_icon('commentquestion.png', get_lang('Comment'), null, ICON_SIZE_BIG).'</a>';
150
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=pagebreak&amp;survey_id='.$survey_id.'">'.Display::return_icon('page_end.png', get_lang('Pagebreak'), null, ICON_SIZE_BIG).'</a>';
151
-	echo '</div>';
142
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=yesno&amp;survey_id='.$survey_id.'">'.Display::return_icon('yesno.png', get_lang('YesNo'), null, ICON_SIZE_BIG).'</a>';
143
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=multiplechoice&amp;survey_id='.$survey_id.'">'.Display::return_icon('mcua.png', get_lang('UniqueSelect'), null, ICON_SIZE_BIG).'</a>';
144
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=multipleresponse&amp;survey_id='.$survey_id.'">'.Display::return_icon('mcma.png', get_lang('MultipleResponse'), null, ICON_SIZE_BIG).'</a>';
145
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=open&amp;survey_id='.$survey_id.'">'.Display::return_icon('open_answer.png', get_lang('Open'), null, ICON_SIZE_BIG).'</a>';
146
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=dropdown&amp;survey_id='.$survey_id.'">'.Display::return_icon('dropdown.png', get_lang('Dropdown'), null, ICON_SIZE_BIG).'</a>';
147
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=percentage&amp;survey_id='.$survey_id.'">'.Display::return_icon('percentagequestion.png', get_lang('Percentage'), null, ICON_SIZE_BIG).'</a>';
148
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=score&amp;survey_id='.$survey_id.'">'.Display::return_icon('scorequestion.png', get_lang('Score'), null, ICON_SIZE_BIG).'</a>';
149
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=comment&amp;survey_id='.$survey_id.'">'.Display::return_icon('commentquestion.png', get_lang('Comment'), null, ICON_SIZE_BIG).'</a>';
150
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=pagebreak&amp;survey_id='.$survey_id.'">'.Display::return_icon('page_end.png', get_lang('Pagebreak'), null, ICON_SIZE_BIG).'</a>';
151
+    echo '</div>';
152 152
         echo '</div>';
153 153
 } else {
154
-	echo '<div class="panel panel-default">';
154
+    echo '<div class="panel panel-default">';
155 155
         echo '<div class="panel-body">';
156
-	echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=personality&amp;survey_id='.$survey_id.'">';
157
-	echo Display::return_icon("yesno.png");
158
-	echo '</a></div>';
159
-	echo '</div>';
156
+    echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=add&type=personality&amp;survey_id='.$survey_id.'">';
157
+    echo Display::return_icon("yesno.png");
158
+    echo '</a></div>';
159
+    echo '</div>';
160 160
         echo '</div>';
161 161
 }
162 162
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 echo '		<th width="50" >'.get_lang('NumberOfOptions').'</th>';
170 170
 echo '		<th width="100">'.get_lang('Modify').'</th>';
171 171
 if ($is_survey_type_1) {
172
-	echo '<th width="100">'.get_lang('Condition').'</th>';
172
+    echo '<th width="100">'.get_lang('Condition').'</th>';
173 173
     echo '<th width="40">'.get_lang('Group').'</th>';
174 174
 }
175 175
 echo '	</tr>';
@@ -196,97 +196,97 @@  discard block
 block discarded – undo
196 196
 $result = Database::query($sql);
197 197
 $question_counter_max = Database::num_rows($result);
198 198
 while ($row = Database::fetch_array($result, 'ASSOC')) {
199
-	echo '<tr>';
200
-	echo '	<td>'.$question_counter.'</td>';
201
-	echo '	<td>';
202
-	if (api_strlen($row['survey_question']) > 100) {
203
-		echo api_substr(strip_tags($row['survey_question']), 0, 100).' ... ';
204
-	} else {
205
-		echo $row['survey_question'];
206
-	}
207
-
208
-	if ($row['type'] == 'yesno') {
209
-		$tool_name = get_lang('YesNo');
210
-	} else if ($row['type'] == 'multiplechoice') {
211
-		$tool_name = get_lang('UniqueSelect');
212
-	} else {
213
-		$tool_name = get_lang(api_ucfirst(Security::remove_XSS($row['type'])));
214
-	}
215
-
216
-	echo '</td>';
217
-	echo '	<td>'.$tool_name.'</td>';
218
-	echo '	<td>'.$row['number_of_options'].'</td>';
219
-	echo '	<td>';
220
-	echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=edit&amp;type='.$row['type'].'&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
221
-	echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurveyQuestion").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
222
-	if ($question_counter > 1) {
223
-		echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=moveup&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('up.png', get_lang('MoveUp'),'',ICON_SIZE_SMALL).'</a>';
224
-	} else {
225
-		Display::display_icon('up_na.png','&nbsp;','',ICON_SIZE_SMALL);
226
-	}
227
-	if ($question_counter < $question_counter_max) {
228
-		echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=movedown&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('down.png', get_lang('MoveDown'),'',ICON_SIZE_SMALL).'</a>';
229
-	} else {
230
-		Display::display_icon('down_na.png','&nbsp;','',ICON_SIZE_SMALL);
231
-	}
232
-	echo '	</td>';
233
-	$question_counter++;
234
-
235
-	if ($is_survey_type_1) {
236
-    	echo '<td>'.(($row['survey_group_pri']==0)?get_lang('Secondary'):get_lang('Primary')).'</td>';
199
+    echo '<tr>';
200
+    echo '	<td>'.$question_counter.'</td>';
201
+    echo '	<td>';
202
+    if (api_strlen($row['survey_question']) > 100) {
203
+        echo api_substr(strip_tags($row['survey_question']), 0, 100).' ... ';
204
+    } else {
205
+        echo $row['survey_question'];
206
+    }
207
+
208
+    if ($row['type'] == 'yesno') {
209
+        $tool_name = get_lang('YesNo');
210
+    } else if ($row['type'] == 'multiplechoice') {
211
+        $tool_name = get_lang('UniqueSelect');
212
+    } else {
213
+        $tool_name = get_lang(api_ucfirst(Security::remove_XSS($row['type'])));
214
+    }
215
+
216
+    echo '</td>';
217
+    echo '	<td>'.$tool_name.'</td>';
218
+    echo '	<td>'.$row['number_of_options'].'</td>';
219
+    echo '	<td>';
220
+    echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/question.php?'.api_get_cidreq().'&amp;action=edit&amp;type='.$row['type'].'&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
221
+    echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurveyQuestion").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
222
+    if ($question_counter > 1) {
223
+        echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=moveup&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('up.png', get_lang('MoveUp'),'',ICON_SIZE_SMALL).'</a>';
224
+    } else {
225
+        Display::display_icon('up_na.png','&nbsp;','',ICON_SIZE_SMALL);
226
+    }
227
+    if ($question_counter < $question_counter_max) {
228
+        echo '		<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?'.api_get_cidreq().'&amp;action=movedown&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('down.png', get_lang('MoveDown'),'',ICON_SIZE_SMALL).'</a>';
229
+    } else {
230
+        Display::display_icon('down_na.png','&nbsp;','',ICON_SIZE_SMALL);
231
+    }
232
+    echo '	</td>';
233
+    $question_counter++;
234
+
235
+    if ($is_survey_type_1) {
236
+        echo '<td>'.(($row['survey_group_pri']==0)?get_lang('Secondary'):get_lang('Primary')).'</td>';
237 237
         echo '<td>'.(($row['survey_group_pri']==0)?$groups[$row['survey_group_sec1']].'-'.$groups[$row['survey_group_sec2']]:$groups[$row['survey_group_pri']]).'</td>';
238 238
     }
239
-	echo '</tr>';
239
+    echo '</tr>';
240 240
 }
241 241
 
242 242
 echo '</table>';
243 243
 
244 244
 if ($is_survey_type_1) {
245
-	echo '<br /><br /><b>'.get_lang('ManageGroups').'</b><br /><br />';
246
-
247
-	if (in_array($_GET['sendmsg'], array('GroupUpdatedSuccessfully', 'GroupDeletedSuccessfully', 'GroupCreatedSuccessfully'))) {
248
-		echo Display::display_confirmation_message(get_lang($_GET['sendmsg']), false);
249
-	}
250
-
251
-	if (in_array($_GET['sendmsg'], array('GroupNeedName'))){
252
-		echo Display::display_warning_message(get_lang($_GET['sendmsg']), false);
253
-	}
254
-	echo '<table border="0"><tr><td width="100">'.get_lang('Name').'</td><td>'.get_lang('Description').'</td></tr></table>';
255
-	echo '<form action="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?action=addgroup&survey_id='.$survey_id.'" method="post">';
256
-	if ($_GET['action'] == 'editgroup') {
257
-		$sql = 'SELECT name,description FROM '.$table_survey_question_group.' WHERE id = '.intval($_GET['gid']).' AND survey_id = '.intval($survey_id).' limit 1';
258
-		$rs = Database::query($sql);
259
-		$editedrow = Database::fetch_array($rs,'ASSOC');
260
-		echo	'<input type="text" maxlength="20" name="name" value="'.$editedrow['name'].'" size="10" disabled>';
261
-		echo	'<input type="text" maxlength="150" name="description" value="'.$editedrow['description'].'" size="40">';
262
-		echo	'<input type="hidden" name="group_id" value="'.Security::remove_XSS($_GET['gid']).'">';
263
-		echo	'<input type="submit" value="'.get_lang('Save').'"'.'<input type="button" value="'.get_lang('Cancel').'" onclick="window.location.href = \'survey.php?survey_id='.Security::remove_XSS($survey_id).'\';" />';
264
-	} else {
265
-		echo	'<input type="text" maxlength="20" name="name" value="" size="10">';
266
-		echo	'<input type="text" maxlength="250" name="description" value="" size="80">';
267
-		echo	'<input type="submit" value="'.get_lang('Create').'"';
268
-	}
269
-	echo	'</form><br />';
270
-
271
-	echo '<table class="data_table">';
272
-	echo '	<tr class="row_odd">';
273
-	echo '		<th width="200">'.get_lang('Name').'</th>';
274
-	echo '		<th>'.get_lang('Description').'</th>';
275
-	echo '		<th width="100">'.get_lang('Modify').'</th>';
276
-	echo '	</tr>';
277
-
278
-	$sql = 'SELECT id,name,description FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND survey_id = '.intval($survey_id).' ORDER BY name';
279
-
280
-	$rs = Database::query($sql);
281
-	while($row = Database::fetch_array($rs,ASSOC)){
282
-		$grouplist .= '<tr><td>'.$row['name'].'</td><td>'.$row['description'].'</td><td>'.
283
-		'<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=editgroup">'.
284
-		Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> '.
285
-		'<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=deletegroup" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('DeleteSurveyGroup'),$row['name']).'?',ENT_QUOTES)).'\')) return false;">'.
286
-		Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
287
-		'</td></tr>';
288
-	}
289
-	echo $grouplist.'</table>';
245
+    echo '<br /><br /><b>'.get_lang('ManageGroups').'</b><br /><br />';
246
+
247
+    if (in_array($_GET['sendmsg'], array('GroupUpdatedSuccessfully', 'GroupDeletedSuccessfully', 'GroupCreatedSuccessfully'))) {
248
+        echo Display::display_confirmation_message(get_lang($_GET['sendmsg']), false);
249
+    }
250
+
251
+    if (in_array($_GET['sendmsg'], array('GroupNeedName'))){
252
+        echo Display::display_warning_message(get_lang($_GET['sendmsg']), false);
253
+    }
254
+    echo '<table border="0"><tr><td width="100">'.get_lang('Name').'</td><td>'.get_lang('Description').'</td></tr></table>';
255
+    echo '<form action="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?action=addgroup&survey_id='.$survey_id.'" method="post">';
256
+    if ($_GET['action'] == 'editgroup') {
257
+        $sql = 'SELECT name,description FROM '.$table_survey_question_group.' WHERE id = '.intval($_GET['gid']).' AND survey_id = '.intval($survey_id).' limit 1';
258
+        $rs = Database::query($sql);
259
+        $editedrow = Database::fetch_array($rs,'ASSOC');
260
+        echo	'<input type="text" maxlength="20" name="name" value="'.$editedrow['name'].'" size="10" disabled>';
261
+        echo	'<input type="text" maxlength="150" name="description" value="'.$editedrow['description'].'" size="40">';
262
+        echo	'<input type="hidden" name="group_id" value="'.Security::remove_XSS($_GET['gid']).'">';
263
+        echo	'<input type="submit" value="'.get_lang('Save').'"'.'<input type="button" value="'.get_lang('Cancel').'" onclick="window.location.href = \'survey.php?survey_id='.Security::remove_XSS($survey_id).'\';" />';
264
+    } else {
265
+        echo	'<input type="text" maxlength="20" name="name" value="" size="10">';
266
+        echo	'<input type="text" maxlength="250" name="description" value="" size="80">';
267
+        echo	'<input type="submit" value="'.get_lang('Create').'"';
268
+    }
269
+    echo	'</form><br />';
270
+
271
+    echo '<table class="data_table">';
272
+    echo '	<tr class="row_odd">';
273
+    echo '		<th width="200">'.get_lang('Name').'</th>';
274
+    echo '		<th>'.get_lang('Description').'</th>';
275
+    echo '		<th width="100">'.get_lang('Modify').'</th>';
276
+    echo '	</tr>';
277
+
278
+    $sql = 'SELECT id,name,description FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND survey_id = '.intval($survey_id).' ORDER BY name';
279
+
280
+    $rs = Database::query($sql);
281
+    while($row = Database::fetch_array($rs,ASSOC)){
282
+        $grouplist .= '<tr><td>'.$row['name'].'</td><td>'.$row['description'].'</td><td>'.
283
+        '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=editgroup">'.
284
+        Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> '.
285
+        '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=deletegroup" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('DeleteSurveyGroup'),$row['name']).'?',ENT_QUOTES)).'\')) return false;">'.
286
+        Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
287
+        '</td></tr>';
288
+    }
289
+    echo $grouplist.'</table>';
290 290
 }
291 291
 
292 292
 Session::erase('answer_count');
Please login to merge, or discard this patch.
main/ticket/categories.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@
 block discarded – undo
173 173
         );
174 174
     }
175 175
 
176
-	return $result;
176
+    return $result;
177 177
 }
178 178
 
179 179
 $table->set_header(0, '', false);
Please login to merge, or discard this patch.
main/ticket/ticket_details.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -541,7 +541,7 @@
 block discarded – undo
541 541
         $form->addElement(
542 542
             'checkbox',
543 543
             'confirmation',
544
-             null,
544
+                null,
545 545
             get_lang('RequestConfirmation')
546 546
         );
547 547
     }
Please login to merge, or discard this patch.