Completed
Push — 1.10.x ( 5d5324...cf3164 )
by Julito
60:26
created
main/course_description/add.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,39 +13,39 @@  discard block
 block discarded – undo
13 13
 // display categories
14 14
 $categories = array ();
15 15
 foreach ($default_description_titles as $id => $title) {
16
-	$categories[$id] = $title;
16
+    $categories[$id] = $title;
17 17
 }
18 18
 $categories[ADD_BLOCK] = get_lang('NewBloc');
19 19
 
20 20
 $i=1;
21 21
 echo '<div class="actions" style="margin-bottom:30px">';
22 22
 echo '<a href="index.php?'.api_get_cidreq().'">'.
23
-	Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM).
24
-	'</a>';
23
+    Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM).
24
+    '</a>';
25 25
 ksort($categories);
26 26
 foreach ($categories as $id => $title) {
27
-	if ($i == ADD_BLOCK) {
28
-		echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
29
-			Display::return_icon($default_description_icon[$id], $title, '',ICON_SIZE_MEDIUM).'</a>';
30
-		break;
31
-	} else {
32
-		echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
33
-			Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
34
-		$i++;
35
-	}
27
+    if ($i == ADD_BLOCK) {
28
+        echo '<a href="index.php?'.api_get_cidreq().'&action=add">'.
29
+            Display::return_icon($default_description_icon[$id], $title, '',ICON_SIZE_MEDIUM).'</a>';
30
+        break;
31
+    } else {
32
+        echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'.
33
+            Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>';
34
+        $i++;
35
+    }
36 36
 }
37 37
 echo '</div>';
38 38
 
39 39
 // error messages
40 40
 if (isset($error) && intval($error) == 1) {
41
-	Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
41
+    Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
42 42
 }
43 43
 
44 44
 // default header title form
45 45
 $header = '';
46 46
 $description_type = intval($description_type);
47 47
 if ($description_type >= ADD_BLOCK) {
48
-	$header = $default_description_titles[ADD_BLOCK];
48
+    $header = $default_description_titles[ADD_BLOCK];
49 49
 }
50 50
 
51 51
 // display form
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 
75 75
 // display default questions
76 76
 if (isset ($question[$description_type])) {
77
-	$message = '<strong>'.get_lang('QuestionPlan').'</strong><br />';
78
-	$message .= $question[$description_type];
79
-	Display::display_normal_message($message, false);
77
+    $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />';
78
+    $message .= $question[$description_type];
79
+    Display::display_normal_message($message, false);
80 80
 }
81 81
 $form->display();
Please login to merge, or discard this patch.
main/reports/templates/exercicesMultiCourses.reports.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $reports_template['exercicesMultiCourses'] = array(
4
-	'description' => 'Result of each test per student',
5
-	'getSQL' => 'reports_template_exercicesMultiCourses_getSQL',
6
-	'wizard' =>
4
+    'description' => 'Result of each test per student',
5
+    'getSQL' => 'reports_template_exercicesMultiCourses_getSQL',
6
+    'wizard' =>
7 7
 '
8 8
 <span id="exercicesMultiCourses" class="step">
9 9
 	<span class="font_normal_07em_black">Result of each test per student</span><br />
@@ -32,39 +32,39 @@  discard block
 block discarded – undo
32 32
 ');
33 33
 
34 34
 function reports_template_exercicesMultiCourses_getSQL() {
35
-	// foreach quiz
36
-	$result = array();
37
-	$columns = Database::query('select r.id as kid, c.title as course, '.
38
-		'r.child_name as test from '.
39
-		Database::get_main_table(TABLE_MAIN_REPORTS_KEYS).' r, '.
40
-		Database::get_main_table(TABLE_MAIN_COURSE).' c '.
41
-		'where r.course_id=c.id and r.tool_id='.
42
-		reports_getToolId(TOOL_QUIZ).
43
-		' order by r.course_id, r.child_name');
44
-	if (Database::num_rows($columns) == 0)
45
-		die('<b>'.get_lang('no data found').'</b>');
46
-	$query = 'select u.lastname Name, u.firstname Firstname';
47
-	$columns = Database::store_result($columns);
48
-	if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max')
49
-		$function = $_REQUEST['tattempt'];
50
-	else
51
-		$function = 'avg';
52
-	foreach ($columns as $key => $column)
53
-		$query .= ', '.$function.'(k'.$key.'.score) as `'.
54
-				$column['course'].' - '.
55
-				$column['test'].'` ';
56
-	$query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
57
-	foreach ($columns as $key => $column) // fixme sessions
58
-		$query .= 'left outer join '.
59
-			Database::get_main_table(TABLE_MAIN_REPORTS_VALUES).
60
-			' k'.$key.
61
-			' on k'.$key.'.key_id = '.$column['kid'].
62
-				' and k'.$key.'.user_id = u.user_id ';
63
-	$query .= ' group by ';
64
-	foreach ($columns as $key => $column) // grouping attempt
65
-		$query .= 'k'.$key.'.attempt, ';
66
-	$query = substr($query, 0, -2); // removing last ', ';
35
+    // foreach quiz
36
+    $result = array();
37
+    $columns = Database::query('select r.id as kid, c.title as course, '.
38
+        'r.child_name as test from '.
39
+        Database::get_main_table(TABLE_MAIN_REPORTS_KEYS).' r, '.
40
+        Database::get_main_table(TABLE_MAIN_COURSE).' c '.
41
+        'where r.course_id=c.id and r.tool_id='.
42
+        reports_getToolId(TOOL_QUIZ).
43
+        ' order by r.course_id, r.child_name');
44
+    if (Database::num_rows($columns) == 0)
45
+        die('<b>'.get_lang('no data found').'</b>');
46
+    $query = 'select u.lastname Name, u.firstname Firstname';
47
+    $columns = Database::store_result($columns);
48
+    if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max')
49
+        $function = $_REQUEST['tattempt'];
50
+    else
51
+        $function = 'avg';
52
+    foreach ($columns as $key => $column)
53
+        $query .= ', '.$function.'(k'.$key.'.score) as `'.
54
+                $column['course'].' - '.
55
+                $column['test'].'` ';
56
+    $query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
57
+    foreach ($columns as $key => $column) // fixme sessions
58
+        $query .= 'left outer join '.
59
+            Database::get_main_table(TABLE_MAIN_REPORTS_VALUES).
60
+            ' k'.$key.
61
+            ' on k'.$key.'.key_id = '.$column['kid'].
62
+                ' and k'.$key.'.user_id = u.user_id ';
63
+    $query .= ' group by ';
64
+    foreach ($columns as $key => $column) // grouping attempt
65
+        $query .= 'k'.$key.'.attempt, ';
66
+    $query = substr($query, 0, -2); // removing last ', ';
67 67
 
68 68
 
69
-	return $query;
69
+    return $query;
70 70
 }
Please login to merge, or discard this patch.
main/session/session_add.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -31,27 +31,27 @@  discard block
 block discarded – undo
31 31
 function search_coachs($needle)
32 32
 {
33 33
     $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
34
-	$xajax_response = new xajaxResponse();
35
-	$return = '';
34
+    $xajax_response = new xajaxResponse();
35
+    $return = '';
36 36
 
37
-	if (!empty($needle)) {
38
-		$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
37
+    if (!empty($needle)) {
38
+        $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
39 39
 
40
-		// search users where username or firstname or lastname begins likes $needle
41
-		$sql = 'SELECT username, lastname, firstname
40
+        // search users where username or firstname or lastname begins likes $needle
41
+        $sql = 'SELECT username, lastname, firstname
42 42
 		        FROM '.$tbl_user.' user
43 43
 				WHERE (username LIKE "'.$needle.'%"
44 44
 				OR firstname LIKE "'.$needle.'%"
45 45
 				OR lastname LIKE "'.$needle.'%")
46 46
 				AND status=1'.
47
-				$order_clause.
48
-				' LIMIT 10';
49
-
50
-		if (api_is_multiple_url_enabled()) {
51
-			$tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
52
-			$access_url_id = api_get_current_access_url_id();
53
-			if ($access_url_id != -1) {
54
-				$sql = 'SELECT username, lastname, firstname
47
+                $order_clause.
48
+                ' LIMIT 10';
49
+
50
+        if (api_is_multiple_url_enabled()) {
51
+            $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
52
+            $access_url_id = api_get_current_access_url_id();
53
+            if ($access_url_id != -1) {
54
+                $sql = 'SELECT username, lastname, firstname
55 55
                         FROM '.$tbl_user.' user
56 56
                         INNER JOIN '.$tbl_user_rel_access_url.' url_user
57 57
                         ON (url_user.user_id=user.user_id)
@@ -65,16 +65,16 @@  discard block
 block discarded – undo
65 65
                             AND status=1'.
66 66
                         $order_clause.'
67 67
                         LIMIT 10';
68
-			}
69
-		}
70
-
71
-		$rs = Database::query($sql);
72
-		while ($user = Database :: fetch_array($rs)) {
73
-			$return .= '<a href="javascript: void(0);" onclick="javascript: fill_coach_field(\''.$user['username'].'\')">'.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')</a><br />';
74
-		}
75
-	}
76
-	$xajax_response -> addAssign('ajax_list_coachs','innerHTML', api_utf8_encode($return));
77
-	return $xajax_response;
68
+            }
69
+        }
70
+
71
+        $rs = Database::query($sql);
72
+        while ($user = Database :: fetch_array($rs)) {
73
+            $return .= '<a href="javascript: void(0);" onclick="javascript: fill_coach_field(\''.$user['username'].'\')">'.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')</a><br />';
74
+        }
75
+    }
76
+    $xajax_response -> addAssign('ajax_list_coachs','innerHTML', api_utf8_encode($return));
77
+    return $xajax_response;
78 78
 }
79 79
 $xajax -> processRequests();
80 80
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 </script>";
118 118
 
119 119
 if (isset($_POST['formSent']) && $_POST['formSent']) {
120
-	$formSent = 1;
120
+    $formSent = 1;
121 121
 }
122 122
 
123 123
 $tool_name = get_lang('AddSession');
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 Display::display_header($tool_name);
210 210
 
211 211
 if (!empty($return)) {
212
-	Display::display_error_message($return, false);
212
+    Display::display_error_message($return, false);
213 213
 }
214 214
 
215 215
 echo '<div class="actions">';
Please login to merge, or discard this patch.
main/gradebook/lib/fe/exportgradebook.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  */
15 15
 function print_table($data_array,$header_names,$view,$coursename)
16 16
 {
17
-	$printdata = '<!DOCTYPE html
17
+    $printdata = '<!DOCTYPE html
18 18
      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
19 19
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
20 20
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.api_get_language_isocode().'" lang="'.api_get_language_isocode().'">
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
  */
98 98
 function export_pdf_attendance($headers_table, $data_table, $headers_pdf, $footers_pdf, $title_pdf)
99 99
 {
100
-	$mpdf = new mPDF('UTF-8', 'A4-L', '', '', 15, 10, 35, 20, 4, 2, 'L');
101
-	$mpdf->useOnlyCoreFonts = true;
102
-	$mpdf->mirrorMargins = 0;
100
+    $mpdf = new mPDF('UTF-8', 'A4-L', '', '', 15, 10, 35, 20, 4, 2, 'L');
101
+    $mpdf->useOnlyCoreFonts = true;
102
+    $mpdf->mirrorMargins = 0;
103 103
     // Use different Odd/Even headers and footers and mirror margins
104 104
 
105
-	if (is_array($headers_pdf)) {
106
-		// preparing headers pdf
107
-		$header = '
105
+    if (is_array($headers_pdf)) {
106
+        // preparing headers pdf
107
+        $header = '
108 108
             <table width="100%"  cellspacing="1" cellpadding="1" border="0" class="strong">
109 109
             <tr>
110 110
                 <td ROWSPAN="3" style="text-align: left;" class="title">
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         $items_per_page = count($data_table);
159 159
     }
160 160
 
161
-	$count_pages = ceil(count($data_table) / $items_per_page);
161
+    $count_pages = ceil(count($data_table) / $items_per_page);
162 162
     $content_table = '';
163 163
     for ($x = 0; $x<$count_pages; $x++) {
164 164
         $content_table .= '<table width="100%" border="1" style="border-collapse:collapse">';
@@ -326,10 +326,10 @@  discard block
 block discarded – undo
326 326
  */
327 327
 function export_pdf($pdf, $newarray, $header_names, $format)
328 328
 {
329
-	$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
330
-	$pdf->ezSetCmMargins(0,0,0,0);
331
-	$pdf->ezSetY(($format=='portrait')?'820':'570');
332
-	$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
329
+    $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
330
+    $pdf->ezSetCmMargins(0,0,0,0);
331
+    $pdf->ezSetY(($format=='portrait')?'820':'570');
332
+    $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
333 333
     if ($format == 'portrait') {
334 334
         $pdf->line(40, 790, 540, 790);
335 335
         $pdf->line(40, 40, 540, 40);
@@ -345,5 +345,5 @@  discard block
 block discarded – undo
345 345
         'rowGap' => 3,
346 346
         'width' => (($format == 'portrait') ? '500' : '750'),
347 347
     ));
348
-	$pdf->ezStream();
348
+    $pdf->ezStream();
349 349
 }
Please login to merge, or discard this patch.
main/permissions/permissions_functions.inc.php 1 patch
Indentation   +401 added lines, -401 removed lines patch added patch discarded remove patch
@@ -25,38 +25,38 @@  discard block
 block discarded – undo
25 25
 function store_permissions($content, $id) {
26 26
     $course_id = api_get_course_int_id();
27 27
     
28
-	// Which database are we using (depending on the $content parameter)
29
-	if ($content=='user')
30
-	{
31
-		$table=Database::get_course_table(TABLE_PERMISSION_USER);
32
-		$id_field = user_id;
33
-	}
34
-	if ($content=='group')
35
-	{
36
-		$table=Database::get_course_table(TABLE_PERMISSION_GROUP);
37
-		$id_field = group_id;
38
-	}
39
-	if ($content=='role')
40
-	{
41
-		$table=Database::get_course_table(TABLE_ROLE_PERMISSION);
42
-		$id_field = role_id;
43
-	}
44
-
45
-	// We first delete all the existing permissions for that user/group/role
46
-	$sql="DELETE FROM $table  WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'";
47
-	$result=Database::query($sql);
48
-
49
-	// looping through the post values to find the permission (containing the string permission* )
50
-	foreach ($_POST as $key => $value)
51
-	{
52
-		if (strstr($key,"permission*"))
53
-		{
54
-			list($brol,$tool,$action)=explode("*",$key);
55
-			$sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')";
56
-			$result=Database::query($sql);
57
-		}
58
-	}
59
-	return get_lang('PermissionsStored');
28
+    // Which database are we using (depending on the $content parameter)
29
+    if ($content=='user')
30
+    {
31
+        $table=Database::get_course_table(TABLE_PERMISSION_USER);
32
+        $id_field = user_id;
33
+    }
34
+    if ($content=='group')
35
+    {
36
+        $table=Database::get_course_table(TABLE_PERMISSION_GROUP);
37
+        $id_field = group_id;
38
+    }
39
+    if ($content=='role')
40
+    {
41
+        $table=Database::get_course_table(TABLE_ROLE_PERMISSION);
42
+        $id_field = role_id;
43
+    }
44
+
45
+    // We first delete all the existing permissions for that user/group/role
46
+    $sql="DELETE FROM $table  WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'";
47
+    $result=Database::query($sql);
48
+
49
+    // looping through the post values to find the permission (containing the string permission* )
50
+    foreach ($_POST as $key => $value)
51
+    {
52
+        if (strstr($key,"permission*"))
53
+        {
54
+            list($brol,$tool,$action)=explode("*",$key);
55
+            $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')";
56
+            $result=Database::query($sql);
57
+        }
58
+    }
59
+    return get_lang('PermissionsStored');
60 60
 }
61 61
 
62 62
 /**
@@ -70,50 +70,50 @@  discard block
 block discarded – undo
70 70
 * @version 1.0
71 71
 */
72 72
 function store_one_permission($content, $action, $id, $tool,$permission) {
73
-	global $rights_full;
73
+    global $rights_full;
74 74
     $course_id = api_get_course_int_id();
75
-	// for some reason I don't know, he can't get to the $rights_full array, so commented the following lines out.
75
+    // for some reason I don't know, he can't get to the $rights_full array, so commented the following lines out.
76 76
 
77
-	// check
78
-	//if(!in_array($permission, $rights_full))
79
-	//{
80
-	//	return get_lang('Error');
81
-	//}
77
+    // check
78
+    //if(!in_array($permission, $rights_full))
79
+    //{
80
+    //	return get_lang('Error');
81
+    //}
82 82
 
83
-	// Which database are we using (depending on the $content parameter)
83
+    // Which database are we using (depending on the $content parameter)
84 84
     
85
-	if ($content=='user') {
86
-		$table=Database::get_course_table(TABLE_PERMISSION_USER);
87
-		$id_field = user_id;
88
-	}
89
-	if ($content=='group')
90
-	{
91
-		$table=Database::get_course_table(TABLE_PERMISSION_GROUP);
92
-		$id_field = group_id;
93
-	}
94
-	if ($content=='role')
95
-	{
96
-		$table=Database::get_course_table(TABLE_ROLE_PERMISSION);
97
-		$id_field = role_id;
98
-	}
99
-
100
-	// grating a right
101
-	if ($action=='grant') {
102
-		$sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')";
103
-		$result=Database::query($sql);
104
-		if($result) {
105
-			$result_message=get_lang('PermissionGranted');
106
-		}
107
-	}
108
-	if ($action=='revoke')
109
-	{
110
-		$sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'";
111
-		$result=Database::query($sql);
112
-		if($result) {
113
-			$result_message=get_lang('PermissionRevoked');
114
-		}
115
-	}
116
-	return $result_message;
85
+    if ($content=='user') {
86
+        $table=Database::get_course_table(TABLE_PERMISSION_USER);
87
+        $id_field = user_id;
88
+    }
89
+    if ($content=='group')
90
+    {
91
+        $table=Database::get_course_table(TABLE_PERMISSION_GROUP);
92
+        $id_field = group_id;
93
+    }
94
+    if ($content=='role')
95
+    {
96
+        $table=Database::get_course_table(TABLE_ROLE_PERMISSION);
97
+        $id_field = role_id;
98
+    }
99
+
100
+    // grating a right
101
+    if ($action=='grant') {
102
+        $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')";
103
+        $result=Database::query($sql);
104
+        if($result) {
105
+            $result_message=get_lang('PermissionGranted');
106
+        }
107
+    }
108
+    if ($action=='revoke')
109
+    {
110
+        $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'";
111
+        $result=Database::query($sql);
112
+        if($result) {
113
+            $result_message=get_lang('PermissionRevoked');
114
+        }
115
+    }
116
+    return $result_message;
117 117
 }
118 118
 
119 119
 /**
@@ -125,47 +125,47 @@  discard block
 block discarded – undo
125 125
 */
126 126
 function get_permissions($content, $id) {
127 127
     $course_id = api_get_course_int_id();
128
-	$currentpermissions=array();
129
-	// Which database are we using (depending on the $content parameter)
128
+    $currentpermissions=array();
129
+    // Which database are we using (depending on the $content parameter)
130 130
     $course_id_condition = " c_id = $course_id AND ";
131
-	if ($content == 'user')
132
-	{
133
-		$table=Database::get_course_table(TABLE_PERMISSION_USER);
134
-		$id_field = 'user_id';
135
-	}
136
-	elseif ($content == 'group')
137
-	{
138
-		$table=Database::get_course_table(TABLE_PERMISSION_GROUP);
139
-		$id_field = 'group_id';
140
-	}
141
-	elseif ($content == 'role')
142
-	{
143
-		$table=Database::get_course_table(TABLE_ROLE_PERMISSION);
144
-		$id_field = 'role_id';
145
-	}
146
-	elseif ($content == 'platform_role')
147
-	{
148
-		$table=Database::get_main_table(TABLE_ROLE_PERMISSION);
149
-		$id_field = 'role_id';
131
+    if ($content == 'user')
132
+    {
133
+        $table=Database::get_course_table(TABLE_PERMISSION_USER);
134
+        $id_field = 'user_id';
135
+    }
136
+    elseif ($content == 'group')
137
+    {
138
+        $table=Database::get_course_table(TABLE_PERMISSION_GROUP);
139
+        $id_field = 'group_id';
140
+    }
141
+    elseif ($content == 'role')
142
+    {
143
+        $table=Database::get_course_table(TABLE_ROLE_PERMISSION);
144
+        $id_field = 'role_id';
145
+    }
146
+    elseif ($content == 'platform_role')
147
+    {
148
+        $table=Database::get_main_table(TABLE_ROLE_PERMISSION);
149
+        $id_field = 'role_id';
150 150
         $course_id_condition = '';
151
-	}
152
-	elseif ($content == 'task')
153
-	{
154
-		$table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS);
155
-		$id_field = 'task_id';
156
-	}
157
-
158
-	// finding all the permissions. We store this in a multidimensional array
159
-	// where the first dimension is the tool.
160
-	$sql="
151
+    }
152
+    elseif ($content == 'task')
153
+    {
154
+        $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS);
155
+        $id_field = 'task_id';
156
+    }
157
+
158
+    // finding all the permissions. We store this in a multidimensional array
159
+    // where the first dimension is the tool.
160
+    $sql="
161 161
 		SELECT * FROM " . $table . "
162 162
 		WHERE $course_id_condition " . $id_field . "='" . Database::escape_string($id) . "'";
163
-	$result = Database::query($sql);
163
+    $result = Database::query($sql);
164 164
 
165
-	while($row = Database::fetch_array($result))
166
-		$currentpermissions[$row['tool']][] = $row['action'];
165
+    while($row = Database::fetch_array($result))
166
+        $currentpermissions[$row['tool']][] = $row['action'];
167 167
 
168
-	return $currentpermissions;
168
+    return $currentpermissions;
169 169
 }
170 170
 
171 171
 /**
@@ -179,38 +179,38 @@  discard block
 block discarded – undo
179 179
 */
180 180
 function limited_or_full($current_permissions)
181 181
 {
182
-	if (api_get_setting('permissions')=='limited')
183
-	{
184
-		foreach ($current_permissions as $tool=>$tool_rights)
185
-		{
186
-			// we loop through the possible permissions of a tool and unset the entry if it is view
187
-			// if it is visibility or move we have to grant the edit right
188
-			foreach ($tool_rights as $key=>$value)
189
-			{
190
-				if ($value=='View')
191
-				{
192
-					unset($current_permissions[$tool][$key]);
193
-				}
194
-				if ($value=='Visibility' OR $value=='Move')
195
-				{
196
-					if (!in_array('Edit',$current_permissions[$tool]))
197
-					{
198
-						$current_permissions[$tool][]='Edit';
199
-					}
200
-					unset($current_permissions[$tool][$key]);
201
-				}
202
-				//else
203
-				//{
204
-				//	$current_permissions[$tool][]=$value;
205
-				//}
206
-			}
207
-		}
208
-		return $current_permissions;
209
-	}
210
-	if (api_get_setting('permissions')=='full')
211
-	{
212
-		return $current_permissions;
213
-	}
182
+    if (api_get_setting('permissions')=='limited')
183
+    {
184
+        foreach ($current_permissions as $tool=>$tool_rights)
185
+        {
186
+            // we loop through the possible permissions of a tool and unset the entry if it is view
187
+            // if it is visibility or move we have to grant the edit right
188
+            foreach ($tool_rights as $key=>$value)
189
+            {
190
+                if ($value=='View')
191
+                {
192
+                    unset($current_permissions[$tool][$key]);
193
+                }
194
+                if ($value=='Visibility' OR $value=='Move')
195
+                {
196
+                    if (!in_array('Edit',$current_permissions[$tool]))
197
+                    {
198
+                        $current_permissions[$tool][]='Edit';
199
+                    }
200
+                    unset($current_permissions[$tool][$key]);
201
+                }
202
+                //else
203
+                //{
204
+                //	$current_permissions[$tool][]=$value;
205
+                //}
206
+            }
207
+        }
208
+        return $current_permissions;
209
+    }
210
+    if (api_get_setting('permissions')=='full')
211
+    {
212
+        return $current_permissions;
213
+    }
214 214
 }
215 215
 /**
216 216
 * This function displays a checked or unchecked checkbox. The checkbox will be checked if the
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
 */
225 225
 function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions=array())
226 226
 {
227
-	$checked="";
228
-	if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool]))
229
-	{
230
-		$checked="checked";
231
-	}
232
-	echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n";
227
+    $checked="";
228
+    if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool]))
229
+    {
230
+        $checked="checked";
231
+    }
232
+    echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n";
233 233
 
234 234
 }
235 235
 
@@ -245,62 +245,62 @@  discard block
 block discarded – undo
245 245
 */
246 246
 function display_image_matrix($permission_array, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true)
247 247
 {
248
-	if ($course_admin) {
249
-		echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">";
250
-	} else {
251
-		if (in_array($permission,$inherited_permissions[$tool])) {
252
-			echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">";
253
-		} else {
254
-			if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) {
255
-				if ($editable) {
256
-					$url=api_get_self();
257
-					$urlparameters = '';
258
-					foreach($_GET as $key=>$value) {
259
-						$parameter[$key]=$value;
260
-					}
261
-					$parameter['action']='revoke';
262
-					$parameter['permission']=$permission;
263
-					$parameter['tool']=$tool;
264
-					foreach ($parameter as $key=>$value) {
265
-						$urlparameters.=$key.'='.$value.'&amp;';
266
-					}
267
-					$url=$url.'?'.$urlparameters;
268
-
269
-					echo "\t\t\t <a href=\"".$url."\">";
270
-				}
271
-				echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/>";
272
-				if ($editable) {
273
-					echo "</a>";
274
-				}
275
-			} else {
276
-				if ($editable)
277
-				{
278
-					$url=api_get_self();
279
-					$urlparameters = '';
280
-					foreach ($_GET as $key=>$value)
281
-					{
282
-						$parameter[$key]=$value;
283
-					}
284
-					$parameter['action']='grant';
285
-					$parameter['permission']=$permission;
286
-					$parameter['tool']=$tool;
287
-					foreach ($parameter as $key=>$value)
288
-					{
289
-						$urlparameters.=$key.'='.$value.'&amp;';
290
-					}
291
-					$url=$url.'?'.$urlparameters;
292
-
293
-					//echo "\t\t\t <a href=\"".str_replace('&', '&amp;', $_SERVER['REQUEST_URI'])."&amp;action=grant&amp;permission=$permission&amp;tool=$tool\">";
294
-					echo "\t\t\t <a href=\"".$url."\">";
295
-				}
296
-				echo "<img src=\"../img/wrong.gif\" border=\"0\"/>";
297
-				if ($editable)
298
-				{
299
-					echo "</a>";
300
-				}
301
-			}
302
-		}
303
-	}
248
+    if ($course_admin) {
249
+        echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">";
250
+    } else {
251
+        if (in_array($permission,$inherited_permissions[$tool])) {
252
+            echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">";
253
+        } else {
254
+            if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) {
255
+                if ($editable) {
256
+                    $url=api_get_self();
257
+                    $urlparameters = '';
258
+                    foreach($_GET as $key=>$value) {
259
+                        $parameter[$key]=$value;
260
+                    }
261
+                    $parameter['action']='revoke';
262
+                    $parameter['permission']=$permission;
263
+                    $parameter['tool']=$tool;
264
+                    foreach ($parameter as $key=>$value) {
265
+                        $urlparameters.=$key.'='.$value.'&amp;';
266
+                    }
267
+                    $url=$url.'?'.$urlparameters;
268
+
269
+                    echo "\t\t\t <a href=\"".$url."\">";
270
+                }
271
+                echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/>";
272
+                if ($editable) {
273
+                    echo "</a>";
274
+                }
275
+            } else {
276
+                if ($editable)
277
+                {
278
+                    $url=api_get_self();
279
+                    $urlparameters = '';
280
+                    foreach ($_GET as $key=>$value)
281
+                    {
282
+                        $parameter[$key]=$value;
283
+                    }
284
+                    $parameter['action']='grant';
285
+                    $parameter['permission']=$permission;
286
+                    $parameter['tool']=$tool;
287
+                    foreach ($parameter as $key=>$value)
288
+                    {
289
+                        $urlparameters.=$key.'='.$value.'&amp;';
290
+                    }
291
+                    $url=$url.'?'.$urlparameters;
292
+
293
+                    //echo "\t\t\t <a href=\"".str_replace('&', '&amp;', $_SERVER['REQUEST_URI'])."&amp;action=grant&amp;permission=$permission&amp;tool=$tool\">";
294
+                    echo "\t\t\t <a href=\"".$url."\">";
295
+                }
296
+                echo "<img src=\"../img/wrong.gif\" border=\"0\"/>";
297
+                if ($editable)
298
+                {
299
+                    echo "</a>";
300
+                }
301
+            }
302
+        }
303
+    }
304 304
 }
305 305
 
306 306
 
@@ -318,72 +318,72 @@  discard block
 block discarded – undo
318 318
 function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true)
319 319
 {
320 320
 
321
-	if ($course_admin)
322
-	{
323
-		echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">";
324
-	}
325
-	else
326
-	{
327
-		if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool]))
328
-		{
329
-			echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">";
330
-		}
331
-		else
332
-		{
333
-			if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool]))
334
-			{
335
-				if ($editable)
336
-				{
337
-					$url = api_get_self();
338
-					$urlparameters = '';
339
-					foreach($_GET as $key => $value)
340
-					{
341
-						$parameter[$key] = $value;
342
-					}
343
-					$parameter['action']='manage_rights';
344
-					$parameter['do']='revoke';
345
-					$parameter['permission']=$permission;
346
-					$parameter['tool']=$tool;
347
-					$parameter['user_id']=$user_id;
348
-					foreach ($parameter as $key=>$value)
349
-					{
350
-						$urlparameters .= $key . '=' . $value . '&amp;';
351
-					}
352
-					$url = $url . '?' . $urlparameters;
353
-
354
-					echo "\t\t\t <a href=\"".$url."\">";
355
-				}
356
-				echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermission')."\">";
357
-				if ($editable) {
358
-					echo "</a>";
359
-				}
360
-			} else {
361
-				if ($editable) {
362
-					$url = api_get_self();
363
-					$urlparameters = '';
364
-					foreach ($_GET as $key=>$value) {
365
-						$parameter[$key]=$value;
366
-					}
367
-					$parameter['action']='manage_rights';
368
-					$parameter['do']='grant';
369
-					$parameter['permission']=$permission;
370
-					$parameter['tool']=$tool;
371
-					$parameter['user_id']=$user_id;
372
-					foreach ($parameter as $key=>$value) {
373
-						$urlparameters .= $key . '=' . $value . '&amp;';
374
-					}
375
-					$url=$url.'?'.$urlparameters;
376
-
377
-					//echo "\t\t\t <a href=\"".str_replace('&', '&amp;', $_SERVER['REQUEST_URI'])."&amp;action=grant&amp;permission=$permission&amp;tool=$tool\">";
378
-					echo "\t\t\t <a href=\"".$url."\">";
379
-				}
380
-				echo "<img src=\"../img/wrong.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermissionNot')."\">";
381
-				if ($editable) {
382
-					echo "</a>";
383
-				}
384
-			}
385
-		}
386
-	}
321
+    if ($course_admin)
322
+    {
323
+        echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">";
324
+    }
325
+    else
326
+    {
327
+        if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool]))
328
+        {
329
+            echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">";
330
+        }
331
+        else
332
+        {
333
+            if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool]))
334
+            {
335
+                if ($editable)
336
+                {
337
+                    $url = api_get_self();
338
+                    $urlparameters = '';
339
+                    foreach($_GET as $key => $value)
340
+                    {
341
+                        $parameter[$key] = $value;
342
+                    }
343
+                    $parameter['action']='manage_rights';
344
+                    $parameter['do']='revoke';
345
+                    $parameter['permission']=$permission;
346
+                    $parameter['tool']=$tool;
347
+                    $parameter['user_id']=$user_id;
348
+                    foreach ($parameter as $key=>$value)
349
+                    {
350
+                        $urlparameters .= $key . '=' . $value . '&amp;';
351
+                    }
352
+                    $url = $url . '?' . $urlparameters;
353
+
354
+                    echo "\t\t\t <a href=\"".$url."\">";
355
+                }
356
+                echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermission')."\">";
357
+                if ($editable) {
358
+                    echo "</a>";
359
+                }
360
+            } else {
361
+                if ($editable) {
362
+                    $url = api_get_self();
363
+                    $urlparameters = '';
364
+                    foreach ($_GET as $key=>$value) {
365
+                        $parameter[$key]=$value;
366
+                    }
367
+                    $parameter['action']='manage_rights';
368
+                    $parameter['do']='grant';
369
+                    $parameter['permission']=$permission;
370
+                    $parameter['tool']=$tool;
371
+                    $parameter['user_id']=$user_id;
372
+                    foreach ($parameter as $key=>$value) {
373
+                        $urlparameters .= $key . '=' . $value . '&amp;';
374
+                    }
375
+                    $url=$url.'?'.$urlparameters;
376
+
377
+                    //echo "\t\t\t <a href=\"".str_replace('&', '&amp;', $_SERVER['REQUEST_URI'])."&amp;action=grant&amp;permission=$permission&amp;tool=$tool\">";
378
+                    echo "\t\t\t <a href=\"".$url."\">";
379
+                }
380
+                echo "<img src=\"../img/wrong.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermissionNot')."\">";
381
+                if ($editable) {
382
+                    echo "</a>";
383
+                }
384
+            }
385
+        }
386
+    }
387 387
 }
388 388
 
389 389
 
@@ -394,41 +394,41 @@  discard block
 block discarded – undo
394 394
 */
395 395
 function display_role_list($current_course_roles, $current_platform_roles)
396 396
 {
397
-	global $setting_visualisation;
397
+    global $setting_visualisation;
398 398
     $course_id = api_get_course_int_id();
399 399
 
400
-	$coures_roles_table=Database::get_course_table(TABLE_ROLE);
401
-
402
-	// course roles
403
-	$sql="SELECT * FROM $coures_roles_table WHERE c_id = $course_id ";
404
-	$result=Database::query($sql);
405
-	while ($row=Database::fetch_array($result))
406
-	{
407
-		if (in_array($row['role_id'], $current_course_roles))
408
-		{
409
-			$checked='checked';
410
-			$image='checkbox_on2.gif';
411
-			$action='revoke';
412
-		}
413
-		else
414
-		{
415
-			$checked='';
416
-			$image='wrong.gif';
417
-			$action='grant';
418
-		}
419
-		if ($setting_visualisation=='checkbox')
420
-		{
421
-			echo "<input type=\"checkbox\" name=\"role*course*".$row['role_id']."\" $checked>";
422
-		}
423
-		if ($setting_visualisation=='image')
424
-		{
425
-			echo "<a href=\"".str_replace('&', '&amp;', $_SERVER['REQUEST_URI'])."&amp;action=$action&amp;role=".$row['role_id']."&amp;scope=course\"><img src=\"../img/".$image."\" border=\"0\"/></a>";
426
-		}
427
-
428
-
429
-		echo $row['role_name']." <a href=\"../permissions/roles.php?role_id=".$row['role_id']."&amp;scope=course\"><img src=\"../img/edit.gif\" /></a><br />\n";
430
-		echo $row['role_comment']."<br />\n";
431
-	}
400
+    $coures_roles_table=Database::get_course_table(TABLE_ROLE);
401
+
402
+    // course roles
403
+    $sql="SELECT * FROM $coures_roles_table WHERE c_id = $course_id ";
404
+    $result=Database::query($sql);
405
+    while ($row=Database::fetch_array($result))
406
+    {
407
+        if (in_array($row['role_id'], $current_course_roles))
408
+        {
409
+            $checked='checked';
410
+            $image='checkbox_on2.gif';
411
+            $action='revoke';
412
+        }
413
+        else
414
+        {
415
+            $checked='';
416
+            $image='wrong.gif';
417
+            $action='grant';
418
+        }
419
+        if ($setting_visualisation=='checkbox')
420
+        {
421
+            echo "<input type=\"checkbox\" name=\"role*course*".$row['role_id']."\" $checked>";
422
+        }
423
+        if ($setting_visualisation=='image')
424
+        {
425
+            echo "<a href=\"".str_replace('&', '&amp;', $_SERVER['REQUEST_URI'])."&amp;action=$action&amp;role=".$row['role_id']."&amp;scope=course\"><img src=\"../img/".$image."\" border=\"0\"/></a>";
426
+        }
427
+
428
+
429
+        echo $row['role_name']." <a href=\"../permissions/roles.php?role_id=".$row['role_id']."&amp;scope=course\"><img src=\"../img/edit.gif\" /></a><br />\n";
430
+        echo $row['role_comment']."<br />\n";
431
+    }
432 432
 }
433 433
 
434 434
 /**
@@ -442,24 +442,24 @@  discard block
 block discarded – undo
442 442
 */
443 443
 function get_roles($content,$id, $scope='course') {
444 444
     $course_id  = api_get_course_int_id();    
445
-	if ($content=='user') {
446
-		$table=Database::get_course_table(TABLE_ROLE_USER);
447
-		$id_field = user_id;
448
-	}
449
-	if ($content=='group') {
450
-		$table=Database::get_course_table(TABLE_ROLE_GROUP);
451
-		$id_field = 'group_id';
452
-	}
453
-	$table_role=Database::get_course_table(TABLE_ROLE);
454
-
455
-	$current_roles=array();
456
-	//$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";
457
-	$sql="SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'";
458
-	$result=Database::query($sql);
459
-	while ($row=Database::fetch_array($result)) {
460
-		$current_roles[]=$row['role_id'];
461
-	}
462
-	return $current_roles;
445
+    if ($content=='user') {
446
+        $table=Database::get_course_table(TABLE_ROLE_USER);
447
+        $id_field = user_id;
448
+    }
449
+    if ($content=='group') {
450
+        $table=Database::get_course_table(TABLE_ROLE_GROUP);
451
+        $id_field = 'group_id';
452
+    }
453
+    $table_role=Database::get_course_table(TABLE_ROLE);
454
+
455
+    $current_roles=array();
456
+    //$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";
457
+    $sql="SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'";
458
+    $result=Database::query($sql);
459
+    while ($row=Database::fetch_array($result)) {
460
+        $current_roles[]=$row['role_id'];
461
+    }
462
+    return $current_roles;
463 463
 }
464 464
 
465 465
 /**
@@ -472,25 +472,25 @@  discard block
 block discarded – undo
472 472
     $course_id = api_get_course_int_id();
473 473
     $course_id_condition = " WHERE c_id = $course_id ";
474 474
     
475
-	if ($content=='course')
476
-	{
477
-		$table_role=Database::get_course_table(TABLE_ROLE);
478
-	}
479
-	if ($content=='platform')
480
-	{
481
-		$table_role=Database::get_main_table(TABLE_ROLE);
482
-		$course_id_condition = '';
483
-	}
484
-
485
-	$current_roles=array();
486
-	$sql="SELECT * FROM $table_role $course_id_condition ";
487
-	$result=Database::query($sql);
488
-	while ($row=Database::fetch_array($result))
489
-	{
490
-		$roles[]=$row;
491
-	}
492
-
493
-	return $roles;
475
+    if ($content=='course')
476
+    {
477
+        $table_role=Database::get_course_table(TABLE_ROLE);
478
+    }
479
+    if ($content=='platform')
480
+    {
481
+        $table_role=Database::get_main_table(TABLE_ROLE);
482
+        $course_id_condition = '';
483
+    }
484
+
485
+    $current_roles=array();
486
+    $sql="SELECT * FROM $table_role $course_id_condition ";
487
+    $result=Database::query($sql);
488
+    while ($row=Database::fetch_array($result))
489
+    {
490
+        $roles[]=$row;
491
+    }
492
+
493
+    return $roles;
494 494
 }
495 495
 
496 496
 
@@ -506,34 +506,34 @@  discard block
 block discarded – undo
506 506
 */
507 507
 function get_roles_permissions($content,$id, $scope='course') {
508 508
     $course_id = api_get_course_int_id();
509
-	if ($content == 'user') {
510
-		$table=Database::get_course_table(TABLE_ROLE_USER);
511
-		$id_field = 'user_id';
512
-	}
513
-
514
-	if ($content == 'group') {
515
-		$table = Database::get_course_table(TABLE_ROLE_GROUP);
516
-		$id_field = 'group_id';
517
-	}
518
-
519
-	// course roles or platform roles
520
-	$scope = 'course';
521
-	if ($scope == 'course') {
522
-		$table_role = Database::get_course_table(TABLE_ROLE);
523
-		$table_role_permissions = Database::get_course_table(TABLE_ROLE_PERMISSION);
509
+    if ($content == 'user') {
510
+        $table=Database::get_course_table(TABLE_ROLE_USER);
511
+        $id_field = 'user_id';
512
+    }
513
+
514
+    if ($content == 'group') {
515
+        $table = Database::get_course_table(TABLE_ROLE_GROUP);
516
+        $id_field = 'group_id';
517
+    }
518
+
519
+    // course roles or platform roles
520
+    $scope = 'course';
521
+    if ($scope == 'course') {
522
+        $table_role = Database::get_course_table(TABLE_ROLE);
523
+        $table_role_permissions = Database::get_course_table(TABLE_ROLE_PERMISSION);
524 524
         
525 525
         $role_condition = " role.c_id = $course_id AND role_permissions.c_id = $course_id AND ";
526
-	}
526
+    }
527 527
 
528
-	if ($scope == 'platform') {
529
-		$table_role = Database::get_main_table(TABLE_ROLE);
530
-		$table_role_permissions = Database::get_main_table(TABLE_ROLE_PERMISSION);
528
+    if ($scope == 'platform') {
529
+        $table_role = Database::get_main_table(TABLE_ROLE);
530
+        $table_role_permissions = Database::get_main_table(TABLE_ROLE_PERMISSION);
531 531
         $role_condition = '';
532
-	}
532
+    }
533 533
 
534
-	$current_roles = array();
534
+    $current_roles = array();
535 535
 
536
-	$sql = "
536
+    $sql = "
537 537
 		SELECT *
538 538
 		FROM
539 539
 			" . $table . " role_group_user,
@@ -547,12 +547,12 @@  discard block
 block discarded – undo
547 547
 			role_group_user.role_id = role.role_id AND
548 548
 			role.role_id = role_permissions.role_id";
549 549
 
550
-	$result = Database::query($sql);
550
+    $result = Database::query($sql);
551 551
     $current_role_permissions = array();
552
-	while ($row=Database::fetch_array($result)) {
553
-		$current_role_permissions[$row['tool']][]=$row['action'];
552
+    while ($row=Database::fetch_array($result)) {
553
+        $current_role_permissions[$row['tool']][]=$row['action'];
554 554
     }
555
-	return $current_role_permissions;
555
+    return $current_role_permissions;
556 556
 }
557 557
 
558 558
 /**
@@ -566,34 +566,34 @@  discard block
 block discarded – undo
566 566
 
567 567
 function assign_role($content, $action, $id, $role_id, $scope='course') {
568 568
     $course_id = api_get_course_int_id();
569
-	// Which database are we using (depending on the $content parameter)
570
-	if ($content=='user') {
571
-		$table=Database::get_course_table(TABLE_ROLE_USER);
572
-		$id_field = 'user_id';
573
-	} elseif($content=='group') {
574
-		$table=Database::get_course_table(TABLE_ROLE_GROUP);
575
-		$id_field = 'group_id';
576
-	} else {
577
-		return  get_lang('Error');
578
-	}
579
-
580
-	// grating a right
581
-	if ($action=='grant') {
582
-		$sql="INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')";
583
-		$result=Database::query($sql);
584
-		if ($result) {
585
-			$result_message=get_lang('RoleGranted');
586
-		}
587
-	}
569
+    // Which database are we using (depending on the $content parameter)
570
+    if ($content=='user') {
571
+        $table=Database::get_course_table(TABLE_ROLE_USER);
572
+        $id_field = 'user_id';
573
+    } elseif($content=='group') {
574
+        $table=Database::get_course_table(TABLE_ROLE_GROUP);
575
+        $id_field = 'group_id';
576
+    } else {
577
+        return  get_lang('Error');
578
+    }
579
+
580
+    // grating a right
581
+    if ($action=='grant') {
582
+        $sql="INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')";
583
+        $result=Database::query($sql);
584
+        if ($result) {
585
+            $result_message=get_lang('RoleGranted');
586
+        }
587
+    }
588 588
     
589
-	if ($action=='revoke') {
590
-		$sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'";
591
-		$result=Database::query($sql);
592
-		if ($result) {
593
-			$result_message=get_lang('RoleRevoked');
594
-		}
595
-	}
596
-	return $result_message;
589
+    if ($action=='revoke') {
590
+        $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'";
591
+        $result=Database::query($sql);
592
+        if ($result) {
593
+            $result_message=get_lang('RoleRevoked');
594
+        }
595
+    }
596
+    return $result_message;
597 597
 }
598 598
 
599 599
 
@@ -603,21 +603,21 @@  discard block
 block discarded – undo
603 603
 */
604 604
 function permission_array_merge($array1, $array2)
605 605
 {
606
-	foreach ($array2 as $tool=>$permissions)
607
-	{
608
-		foreach ($permissions as $permissionkey=>$permissionvalue)
609
-		{
610
-			$array1[$tool][]=$permissionvalue;
611
-		}
612
-	}
613
-	return $array1;
606
+    foreach ($array2 as $tool=>$permissions)
607
+    {
608
+        foreach ($permissions as $permissionkey=>$permissionvalue)
609
+        {
610
+            $array1[$tool][]=$permissionvalue;
611
+        }
612
+    }
613
+    return $array1;
614 614
 }
615 615
 
616 616
 
617 617
 function my_print_r($array)
618 618
 {
619
-	echo '<pre>';
620
-	print_r($array);
621
-	echo '</pre>';
619
+    echo '<pre>';
620
+    print_r($array);
621
+    echo '</pre>';
622 622
 }
623 623
 ?>
Please login to merge, or discard this patch.
main/document/edit_document.php 1 patch
Indentation   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 $sessionId = api_get_session_id();
66 66
 
67 67
 if (api_is_in_group()) {
68
-	$group_properties = GroupManager::get_group_properties($group_id);
68
+    $group_properties = GroupManager::get_group_properties($group_id);
69 69
 }
70 70
 
71 71
 $dir = '/';
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $_GET['id'],
78 78
         api_get_course_id(),
79 79
         true,
80
-		0
80
+        0
81 81
     );
82 82
 
83 83
     if (!empty($sessionId) && empty($document_data)) {
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
         );
90 90
     }
91 91
 
92
-	$document_id = $document_data['id'];
93
-	$file = $document_data['path'];
94
-	$parent_id = DocumentManager::get_document_id($course_info, dirname($file));
95
-	$dir = dirname($document_data['path']);
96
-	$dir_original = $dir;
97
-	$doc = basename($file);
98
-	$readonly = $document_data['readonly'];
92
+    $document_id = $document_data['id'];
93
+    $file = $document_data['path'];
94
+    $parent_id = DocumentManager::get_document_id($course_info, dirname($file));
95
+    $dir = dirname($document_data['path']);
96
+    $dir_original = $dir;
97
+    $doc = basename($file);
98
+    $readonly = $document_data['readonly'];
99 99
 }
100 100
 
101 101
 if (empty($document_data)) {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 // Level correction for group documents.
119 119
 if (!empty($group_properties['directory'])) {
120
-	$count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
120
+    $count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
121 121
 }
122 122
 $relative_url = '';
123 123
 for ($i = 0; $i < ($count_dir); $i++) {
@@ -139,13 +139,13 @@  discard block
 block discarded – undo
139 139
 );
140 140
 
141 141
 if ($is_certificate_mode) {
142
-	$editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
143
-	$editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
144
-	$editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir;
142
+    $editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
143
+    $editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/';
144
+    $editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir;
145 145
 }
146 146
 
147 147
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights']||
148
-	DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $sessionId);
148
+    DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $sessionId);
149 149
 $noPHP_SELF = true;
150 150
 
151 151
 /*	Other initialization code */
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
         'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
159 159
         'name' => get_lang('GroupSpace'),
160 160
     );
161
-	$group_document = true;
162
-	$noPHP_SELF = true;
161
+    $group_document = true;
162
+    $noPHP_SELF = true;
163 163
 }
164 164
 
165 165
 if (!$is_certificate_mode) {
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 
194 194
 //TODO:check the below code and his funcionality
195 195
 if (!api_is_allowed_to_edit()) {
196
-	if (DocumentManager::check_readonly($course_info, $user_id, $file)) {
197
-		api_not_allowed();
198
-	}
196
+    if (DocumentManager::check_readonly($course_info, $user_id, $file)) {
197
+        api_not_allowed();
198
+    }
199 199
 }
200 200
 
201 201
 /* MAIN TOOL CODE */
@@ -203,18 +203,18 @@  discard block
 block discarded – undo
203 203
 /*	Code to change the comment	*/
204 204
 
205 205
 if (isset($_POST['comment'])) {
206
-	// Fixing the path if it is wrong
207
-	$comment = trim($_POST['comment']);
208
-	$title = trim($_POST['title']);
206
+    // Fixing the path if it is wrong
207
+    $comment = trim($_POST['comment']);
208
+    $title = trim($_POST['title']);
209 209
 
210 210
     // Just in case see BT#3525
211 211
     if (empty($title)) {
212
-		$title = $document_data['title'];
213
-	}
212
+        $title = $document_data['title'];
213
+    }
214 214
 
215
-	if (empty($title)) {
216
-		$title = get_document_title($_POST['filename']);
217
-	}
215
+    if (empty($title)) {
216
+        $title = get_document_title($_POST['filename']);
217
+    }
218 218
 
219 219
     if (!empty($document_id)) {
220 220
         $params = [
@@ -226,43 +226,43 @@  discard block
 block discarded – undo
226 226
             $params,
227 227
             ['c_id = ? AND id = ?' => [$course_id, $document_id]]
228 228
         );
229
-		Display::addFlash(Display::return_message(get_lang('fileModified')));
229
+        Display::addFlash(Display::return_message(get_lang('fileModified')));
230 230
     }
231 231
 }
232 232
 
233 233
 /*	WYSIWYG HTML EDITOR - Program Logic */
234 234
 if ($is_allowed_to_edit) {
235
-	if (isset($_POST['formSent']) && $_POST['formSent'] == 1) {
235
+    if (isset($_POST['formSent']) && $_POST['formSent'] == 1) {
236 236
 
237
-		$filename = stripslashes($_POST['filename']);
237
+        $filename = stripslashes($_POST['filename']);
238 238
         $extension = $_POST['extension'];
239
-		$content = isset($_POST['content']) ? trim(str_replace(array("\r", "\n"), '', stripslashes($_POST['content']))) : null;
240
-		$content = Security::remove_XSS($content, COURSEMANAGERLOWSECURITY);
239
+        $content = isset($_POST['content']) ? trim(str_replace(array("\r", "\n"), '', stripslashes($_POST['content']))) : null;
240
+        $content = Security::remove_XSS($content, COURSEMANAGERLOWSECURITY);
241 241
 
242 242
         if ($dir == '/') {
243 243
             $dir = '';
244 244
         }
245 245
 
246
-		$file = $dir.'/'.$filename.'.'.$extension;
247
-		$read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null;
248
-		$read_only_flag = empty($read_only_flag) ? 0 : 1;
246
+        $file = $dir.'/'.$filename.'.'.$extension;
247
+        $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null;
248
+        $read_only_flag = empty($read_only_flag) ? 0 : 1;
249 249
 
250
-		if (empty($filename)) {
250
+        if (empty($filename)) {
251 251
             Display::addFlash(Display::return_message(get_lang('NoFileName'), 'warning'));
252
-		} else {
252
+        } else {
253 253
 
254
-		    $file_size = filesize($document_data['absolute_path']);
254
+            $file_size = filesize($document_data['absolute_path']);
255 255
 
256
-			if ($read_only_flag == 0) {
257
-				if (!empty($content)) {
258
-					if ($fp = @fopen($document_data['absolute_path'], 'w')) {
259
-						// For flv player, change absolute path temporarily to prevent from erasing it in the following lines
260
-						$content = str_replace(array('flv=h', 'flv=/'), array('flv=h|', 'flv=/|'), $content);
261
- 						fputs($fp, $content);
262
-						fclose($fp);
256
+            if ($read_only_flag == 0) {
257
+                if (!empty($content)) {
258
+                    if ($fp = @fopen($document_data['absolute_path'], 'w')) {
259
+                        // For flv player, change absolute path temporarily to prevent from erasing it in the following lines
260
+                        $content = str_replace(array('flv=h', 'flv=/'), array('flv=h|', 'flv=/|'), $content);
261
+                            fputs($fp, $content);
262
+                        fclose($fp);
263 263
 
264 264
                         $filepath = $document_data['absolute_parent_path'];
265
-						/*
265
+                        /*
266 266
 						if (!is_dir($filepath.'css')) {
267 267
 							mkdir($filepath.'css', api_get_permissions_for_new_directories());
268 268
 							$doc_id = add_document($_course, $dir.'css', 'folder', 0, 'css');
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 							);
293 293
 						}*/
294 294
 
295
-						/*if (!is_file($filepath.'css/frames.css')) {
295
+                        /*if (!is_file($filepath.'css/frames.css')) {
296 296
 							$platform_theme = api_get_setting('stylesheets');
297 297
 							if (file_exists(api_get_path(SYS_CODE_PATH).'css/'.$platform_theme.'/frames.css')) {
298 298
 								copy(api_get_path(SYS_CODE_PATH).'css/'.$platform_theme.'/frames.css', $filepath.'css/frames.css');
@@ -330,54 +330,54 @@  discard block
 block discarded – undo
330 330
 							}
331 331
 						}*/
332 332
 
333
-						// "WHAT'S NEW" notification: update table item_property
334
-						$document_id = DocumentManager::get_document_id($_course, $file);
335
-
336
-						if ($document_id) {
337
-							update_existing_document(
338
-								$_course,
339
-								$document_id,
340
-								$file_size,
341
-								$read_only_flag
342
-							);
343
-							api_item_property_update(
344
-								$_course,
345
-								TOOL_DOCUMENT,
346
-								$document_id,
347
-								'DocumentUpdated',
348
-								api_get_user_id(),
349
-								null,
350
-								null,
351
-								null,
352
-								null,
353
-								$sessionId
354
-							);
355
-							// Update parent folders
356
-							item_property_update_on_folder(
357
-								$_course,
358
-								$dir,
359
-								api_get_user_id()
360
-							);
361
-							header('Location: document.php?id=' . $document_data['parent_id'] . '&' . api_get_cidreq() . ($is_certificate_mode?'&curdirpath=/certificates&selectcat=1':''));
362
-							exit;
363
-						} else {
333
+                        // "WHAT'S NEW" notification: update table item_property
334
+                        $document_id = DocumentManager::get_document_id($_course, $file);
335
+
336
+                        if ($document_id) {
337
+                            update_existing_document(
338
+                                $_course,
339
+                                $document_id,
340
+                                $file_size,
341
+                                $read_only_flag
342
+                            );
343
+                            api_item_property_update(
344
+                                $_course,
345
+                                TOOL_DOCUMENT,
346
+                                $document_id,
347
+                                'DocumentUpdated',
348
+                                api_get_user_id(),
349
+                                null,
350
+                                null,
351
+                                null,
352
+                                null,
353
+                                $sessionId
354
+                            );
355
+                            // Update parent folders
356
+                            item_property_update_on_folder(
357
+                                $_course,
358
+                                $dir,
359
+                                api_get_user_id()
360
+                            );
361
+                            header('Location: document.php?id=' . $document_data['parent_id'] . '&' . api_get_cidreq() . ($is_certificate_mode?'&curdirpath=/certificates&selectcat=1':''));
362
+                            exit;
363
+                        } else {
364 364
                             Display::addFlash(Display::return_message(get_lang('Impossible'), 'warning'));
365
-						}
366
-					} else {
365
+                        }
366
+                    } else {
367 367
                         Display::addFlash(Display::return_message(get_lang('Impossible'), 'warning'));
368
-					}
369
-				} else {
370
-					if ($document_id) {
368
+                    }
369
+                } else {
370
+                    if ($document_id) {
371 371
                         update_existing_document($_course, $document_id, $file_size, $read_only_flag);
372
-					}
373
-				}
374
-			} else {
372
+                    }
373
+                }
374
+            } else {
375 375
                 if ($document_id) {
376 376
                     update_existing_document($_course, $document_id, $file_size, $read_only_flag);
377 377
                 }
378
-			}
379
-		}
380
-	}
378
+            }
379
+        }
380
+    }
381 381
 }
382 382
 
383 383
 // Replace relative paths by absolute web paths (e.g. './' => 'http://www.chamilo.org/courses/ABC/document/')
@@ -431,35 +431,35 @@  discard block
 block discarded – undo
431 431
         api_get_group_id()
432 432
     )
433 433
 ) {
434
-	$action = api_get_self().'?id='.$document_data['id'].'&'.api_get_cidreq();
434
+    $action = api_get_self().'?id='.$document_data['id'].'&'.api_get_cidreq();
435 435
     if ($is_certificate_mode) {
436 436
         $action .= '&curdirpath=/certificates&selectcat=1';
437 437
     }
438
-	$form = new FormValidator('formEdit', 'post', $action, null, array('class' => 'form-vertical'));
439
-
440
-	// Form title
441
-	$form->addElement('header', $nameTools);
442
-	$form->addElement('hidden', 'filename');
443
-	$form->addElement('hidden', 'extension');
444
-	$form->addElement('hidden', 'file_path');
445
-	$form->addElement('hidden', 'commentPath');
446
-	$form->addElement('hidden', 'showedit');
447
-	$form->addElement('hidden', 'origin');
448
-	$form->addElement('hidden', 'origin_opt');
438
+    $form = new FormValidator('formEdit', 'post', $action, null, array('class' => 'form-vertical'));
439
+
440
+    // Form title
441
+    $form->addElement('header', $nameTools);
442
+    $form->addElement('hidden', 'filename');
443
+    $form->addElement('hidden', 'extension');
444
+    $form->addElement('hidden', 'file_path');
445
+    $form->addElement('hidden', 'commentPath');
446
+    $form->addElement('hidden', 'showedit');
447
+    $form->addElement('hidden', 'origin');
448
+    $form->addElement('hidden', 'origin_opt');
449 449
     $form->addText('title', get_lang('Title'), true, array('cols-size' => [2, 10, 0], 'autofocus'));
450 450
 
451
-	$defaults['title'] = $document_data['title'];
451
+    $defaults['title'] = $document_data['title'];
452 452
 
453
-	$form->addElement('hidden', 'formSent');
454
-	$defaults['formSent'] = 1;
453
+    $form->addElement('hidden', 'formSent');
454
+    $defaults['formSent'] = 1;
455 455
 
456
-	$read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null;
456
+    $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null;
457 457
 
458
-	// Desactivation of IE proprietary commenting tags inside the text before loading it on the online editor.
459
-	// This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573
460
-	$defaults['content'] = str_replace('<!--[', '<!-- [', $content);
458
+    // Desactivation of IE proprietary commenting tags inside the text before loading it on the online editor.
459
+    // This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573
460
+    $defaults['content'] = str_replace('<!--[', '<!-- [', $content);
461 461
 
462
-	// HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved.
462
+    // HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved.
463 463
 
464 464
     $showSystemFolders = api_get_course_setting('show_system_folders');
465 465
     $condition = stripos($dir, '/HotPotatoes_files') === false;
@@ -467,44 +467,44 @@  discard block
 block discarded – undo
467 467
         $condition = true;
468 468
     }
469 469
 
470
-	if (($extension == 'htm' || $extension == 'html') && $condition) {
471
-		if (empty($readonly) && $readonly == 0) {
470
+    if (($extension == 'htm' || $extension == 'html') && $condition) {
471
+        if (empty($readonly) && $readonly == 0) {
472 472
             $form->addHtmlEditor('content', '', true, true, $editorConfig);
473
-		}
474
-	}
473
+        }
474
+    }
475 475
 
476
-	if (!$group_document && !DocumentManager::is_my_shared_folder(api_get_user_id(), $currentDirPath, $sessionId)) {
477
-		// Updated on field
478
-		$last_edit_date = api_get_local_time($last_edit_date);
476
+    if (!$group_document && !DocumentManager::is_my_shared_folder(api_get_user_id(), $currentDirPath, $sessionId)) {
477
+        // Updated on field
478
+        $last_edit_date = api_get_local_time($last_edit_date);
479 479
         $display_date = date_to_str_ago($last_edit_date).' <span class="dropbox_date">'.api_format_date($last_edit_date).'</span>';
480
-		$form->addElement('static', null, get_lang('UpdatedOn'), $display_date);
481
-	}
480
+        $form->addElement('static', null, get_lang('UpdatedOn'), $display_date);
481
+    }
482 482
 
483
-	$form->addElement('textarea', 'comment', get_lang('Comment'), ['cols-size' => [2, 10, 0]]);
483
+    $form->addElement('textarea', 'comment', get_lang('Comment'), ['cols-size' => [2, 10, 0]]);
484 484
 
485
-	if ($owner_id == api_get_user_id() || api_is_platform_admin()) {
486
-		$checked =& $form->addElement('checkbox', 'readonly', null, get_lang('ReadOnly'));
487
-		if ($readonly == 1) {
488
-			$checked->setChecked(true);
489
-		}
490
-	}
485
+    if ($owner_id == api_get_user_id() || api_is_platform_admin()) {
486
+        $checked =& $form->addElement('checkbox', 'readonly', null, get_lang('ReadOnly'));
487
+        if ($readonly == 1) {
488
+            $checked->setChecked(true);
489
+        }
490
+    }
491 491
 
492
-	if ($is_certificate_mode) {
493
-		$form->addButtonUpdate(get_lang('SaveCertificate'));
492
+    if ($is_certificate_mode) {
493
+        $form->addButtonUpdate(get_lang('SaveCertificate'));
494 494
     } else {
495
-		$form->addButtonUpdate(get_lang('SaveDocument'));
495
+        $form->addButtonUpdate(get_lang('SaveDocument'));
496 496
     }
497 497
 
498
-	$defaults['filename'] = $filename;
499
-	$defaults['extension'] = $extension;
500
-	$defaults['file_path'] = isset($_GET['file']) ? Security::remove_XSS($_GET['file']) : null;
501
-	$defaults['commentPath'] = $file;
502
-	$defaults['renameTo'] = $file_name;
503
-	$defaults['comment'] = $document_data['comment'];
504
-	$defaults['origin'] = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null;
505
-	$defaults['origin_opt'] = isset($_GET['origin_opt']) ? Security::remove_XSS($_GET['origin_opt']) : null;
498
+    $defaults['filename'] = $filename;
499
+    $defaults['extension'] = $extension;
500
+    $defaults['file_path'] = isset($_GET['file']) ? Security::remove_XSS($_GET['file']) : null;
501
+    $defaults['commentPath'] = $file;
502
+    $defaults['renameTo'] = $file_name;
503
+    $defaults['comment'] = $document_data['comment'];
504
+    $defaults['origin'] = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null;
505
+    $defaults['origin_opt'] = isset($_GET['origin_opt']) ? Security::remove_XSS($_GET['origin_opt']) : null;
506 506
 
507
-	$form->setDefaults($defaults);
507
+    $form->setDefaults($defaults);
508 508
 
509 509
     show_return(
510 510
         $parent_id,
@@ -514,25 +514,25 @@  discard block
 block discarded – undo
514 514
         $is_certificate_mode
515 515
     );
516 516
 
517
-	if ($is_certificate_mode) {
518
-		$all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate(
519
-			api_get_user_id(),
520
-			api_get_course_id()
521
-		);
522
-		$str_info = '';
523
-		foreach ($all_information_by_create_certificate[0] as $info_value) {
524
-			$str_info .= $info_value.'<br/>';
525
-		}
526
-		$create_certificate=get_lang('CreateCertificateWithTags');
527
-		Display::display_normal_message(
528
-			$create_certificate.': <br /><br />'.$str_info,
529
-			false
530
-		);
531
-	}
532
-
533
-	if ($extension=='svg' && !api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true'){
534
-		Display::display_warning_message(get_lang('BrowserDontSupportsSVG'));
535
-	}
517
+    if ($is_certificate_mode) {
518
+        $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate(
519
+            api_get_user_id(),
520
+            api_get_course_id()
521
+        );
522
+        $str_info = '';
523
+        foreach ($all_information_by_create_certificate[0] as $info_value) {
524
+            $str_info .= $info_value.'<br/>';
525
+        }
526
+        $create_certificate=get_lang('CreateCertificateWithTags');
527
+        Display::display_normal_message(
528
+            $create_certificate.': <br /><br />'.$str_info,
529
+            false
530
+        );
531
+    }
532
+
533
+    if ($extension=='svg' && !api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true'){
534
+        Display::display_warning_message(get_lang('BrowserDontSupportsSVG'));
535
+    }
536 536
     echo '<div class="row" style="overflow:hidden">
537 537
             <div id="template_col" class="col-md-2">
538 538
                 <div class="panel panel-default">
@@ -560,57 +560,57 @@  discard block
 block discarded – undo
560 560
 */
561 561
 function change_name($base_work_dir, $source_file, $rename_to, $dir, $doc)
562 562
 {
563
-	$file_name_for_change = $base_work_dir.$dir.$source_file;
563
+    $file_name_for_change = $base_work_dir.$dir.$source_file;
564 564
     $rename_to = disable_dangerous_file($rename_to); // Avoid renaming to .htaccess file
565
-	$rename_to = my_rename($file_name_for_change, stripslashes($rename_to)); // fileManage API
566
-
567
-	if ($rename_to) {
568
-		if (isset($dir) && $dir != '') {
569
-			$source_file = $dir.$source_file;
570
-			$new_full_file_name = dirname($source_file).'/'.$rename_to;
571
-		} else {
572
-			$source_file = '/'.$source_file;
573
-			$new_full_file_name = '/'.$rename_to;
574
-		}
575
-
576
-		update_db_info('update', $source_file, $new_full_file_name); // fileManage API
565
+    $rename_to = my_rename($file_name_for_change, stripslashes($rename_to)); // fileManage API
566
+
567
+    if ($rename_to) {
568
+        if (isset($dir) && $dir != '') {
569
+            $source_file = $dir.$source_file;
570
+            $new_full_file_name = dirname($source_file).'/'.$rename_to;
571
+        } else {
572
+            $source_file = '/'.$source_file;
573
+            $new_full_file_name = '/'.$rename_to;
574
+        }
575
+
576
+        update_db_info('update', $source_file, $new_full_file_name); // fileManage API
577 577
         Display::addFlash(Display::return_message(get_lang('fileModified')));
578 578
 
579
-		return true;
580
-	} else {
579
+        return true;
580
+    } else {
581 581
         Display::addFlash(Display::return_message(get_lang('FileExists')));
582
-	}
582
+    }
583 583
 }
584 584
 
585 585
 //return button back to
586 586
 function show_return($document_id, $path, $call_from_tool='', $slide_id=0, $is_certificate_mode=false)
587 587
 {
588 588
     global $parent_id;
589
-	echo '<div class="actions">';
589
+    echo '<div class="actions">';
590 590
 
591 591
     $url = api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq().'&id='.$parent_id;
592 592
 
593
-	if ($is_certificate_mode) {
594
-		echo '<a href="document.php?curdirpath='.Security::remove_XSS($_GET['curdirpath']).'&selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.
593
+    if ($is_certificate_mode) {
594
+        echo '<a href="document.php?curdirpath='.Security::remove_XSS($_GET['curdirpath']).'&selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.
595 595
             Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>';
596
-	} elseif($call_from_tool=='slideshow') {
597
-		echo '<a href="'.api_get_path(WEB_PATH).'main/document/slideshow.php?slide_id='.$slide_id.'&curdirpath='.Security::remove_XSS(urlencode($_GET['curdirpath'])).'">'.
596
+    } elseif($call_from_tool=='slideshow') {
597
+        echo '<a href="'.api_get_path(WEB_PATH).'main/document/slideshow.php?slide_id='.$slide_id.'&curdirpath='.Security::remove_XSS(urlencode($_GET['curdirpath'])).'">'.
598 598
             Display::return_icon('slideshow.png', get_lang('BackTo').' '.get_lang('ViewSlideshow'),'',ICON_SIZE_MEDIUM).'</a>';
599
-	} elseif($call_from_tool=='editdraw') {
600
-		echo '<a href="'.$url.'">'.
599
+    } elseif($call_from_tool=='editdraw') {
600
+        echo '<a href="'.$url.'">'.
601 601
             Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
602
-		echo '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('BackTo').' '.get_lang('Draw'), array(), 32).'</a>';
603
-	} elseif($call_from_tool=='editodf') {
602
+        echo '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('BackTo').' '.get_lang('Draw'), array(), 32).'</a>';
603
+    } elseif($call_from_tool=='editodf') {
604 604
         echo '<a href="'.$url.'">'.
605 605
             Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
606 606
         echo '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('BackTo').' '.get_lang('Write'), array(), 32).'</a>';
607 607
     } elseif($call_from_tool=='editpaint'){
608
-		echo '<a href="'.$url.'">'.
608
+        echo '<a href="'.$url.'">'.
609 609
             Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), array(), ICON_SIZE_MEDIUM).'</a>';
610
-		echo '<a href="javascript:history.back(1)">'.Display::return_icon('paint.png', get_lang('BackTo').' '.get_lang('Paint'), array(), 32).'</a>';
611
-	} else {
612
-		echo '<a href="'.$url.'">'.
610
+        echo '<a href="javascript:history.back(1)">'.Display::return_icon('paint.png', get_lang('BackTo').' '.get_lang('Paint'), array(), 32).'</a>';
611
+    } else {
612
+        echo '<a href="'.$url.'">'.
613 613
             Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
614
-	}
615
-	echo '</div>';
614
+    }
615
+    echo '</div>';
616 616
 }
Please login to merge, or discard this patch.
main/survey/survey.php 1 patch
Indentation   +145 added lines, -145 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) {
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 if (!api_is_allowed_to_edit(false, true) ||
32 32
     (api_is_course_coach() && $extend_rights_for_coachs == 'false')
33 33
 ) {
34
-	Display :: display_header(get_lang('ToolSurvey'));
35
-	Display :: display_error_message(get_lang('NotAllowed'), false);
36
-	Display :: display_footer();
37
-	exit;
34
+    Display :: display_header(get_lang('ToolSurvey'));
35
+    Display :: display_error_message(get_lang('NotAllowed'), false);
36
+    Display :: display_footer();
37
+    exit;
38 38
 }
39 39
 
40 40
 // Database table definitions
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
 
52 52
 // Breadcrumbs
53 53
 $interbreadcrumb[] = array(
54
-		'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php',
55
-		'name' => get_lang('SurveyList'),
54
+        'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php',
55
+        'name' => get_lang('SurveyList'),
56 56
 );
57 57
 
58 58
 // Getting the survey information
59 59
 if (!empty($_GET['survey_id'])) {
60
-	$course_code = api_get_course_id();
61
-	if ($course_code!=-1) {
62
-		$survey_data = SurveyManager::get_survey($survey_id);
63
-	} else {
64
-		Display :: display_header(get_lang('ToolSurvey'));
65
-		Display :: display_error_message(get_lang('NotAllowed'), false);
66
-		Display :: display_footer();
67
-		exit;
68
-	}
60
+    $course_code = api_get_course_id();
61
+    if ($course_code!=-1) {
62
+        $survey_data = SurveyManager::get_survey($survey_id);
63
+    } else {
64
+        Display :: display_header(get_lang('ToolSurvey'));
65
+        Display :: display_error_message(get_lang('NotAllowed'), false);
66
+        Display :: display_footer();
67
+        exit;
68
+    }
69 69
 } else {
70 70
     Display :: display_header(get_lang('ToolSurvey'));
71 71
     Display :: display_error_message(get_lang('NotAllowed'), false);
@@ -78,30 +78,30 @@  discard block
 block discarded – undo
78 78
 $is_survey_type_1 = $survey_data['survey_type'] == 1;
79 79
 
80 80
 if (api_strlen(strip_tags($survey_data['title'])) > 40) {
81
-	$tool_name .= '...';
81
+    $tool_name .= '...';
82 82
 }
83 83
 
84 84
 if ($is_survey_type_1 && ($action == 'addgroup' || $action == 'deletegroup')) {
85
-	$_POST['name'] = trim($_POST['name']);
86
-	if ($action == 'addgroup') {
87
-		if (!empty($_POST['group_id'])) {
88
-			Database::query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\'
85
+    $_POST['name'] = trim($_POST['name']);
86
+    if ($action == 'addgroup') {
87
+        if (!empty($_POST['group_id'])) {
88
+            Database::query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\'
89 89
 			                 WHERE c_id = '.$course_id.' AND id = \''.Database::escape_string($_POST['group_id']).'\'');
90
-			$sendmsg = 'GroupUpdatedSuccessfully';
91
-		} elseif(!empty($_POST['name'])) {
92
-			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).'\') ');
93
-			$sendmsg = 'GroupCreatedSuccessfully';
94
-		} else {
95
-			$sendmsg = 'GroupNeedName';
96
-		}
97
-	}
98
-
99
-	if ($action == 'deletegroup') {
100
-		Database::query('DELETE FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' and survey_id = '.intval($survey_id));
101
-		$sendmsg = 'GroupDeletedSuccessfully';
102
-	}
103
-	header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&sendmsg='.$sendmsg);
104
-	exit;
90
+            $sendmsg = 'GroupUpdatedSuccessfully';
91
+        } elseif(!empty($_POST['name'])) {
92
+            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).'\') ');
93
+            $sendmsg = 'GroupCreatedSuccessfully';
94
+        } else {
95
+            $sendmsg = 'GroupNeedName';
96
+        }
97
+    }
98
+
99
+    if ($action == 'deletegroup') {
100
+        Database::query('DELETE FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' and survey_id = '.intval($survey_id));
101
+        $sendmsg = 'GroupDeletedSuccessfully';
102
+    }
103
+    header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&sendmsg='.$sendmsg);
104
+    exit;
105 105
 }
106 106
 
107 107
 // Displaying the header
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 $message_information    = isset($_GET['message']) ? Security::remove_XSS($_GET['message']) : null;
116 116
 
117 117
 if (isset($action)) {
118
-	if (($action == 'moveup' || $action == 'movedown') && isset($_GET['question_id'])) {
119
-		SurveyManager::move_survey_question($my_action_survey,$my_question_id_survey,$my_survey_id_survey);
120
-		Display::display_confirmation_message(get_lang('SurveyQuestionMoved'));
121
-	}
122
-	if ($action == 'delete' AND is_numeric($_GET['question_id'])) {
123
-		SurveyManager::delete_survey_question($my_survey_id_survey, $my_question_id_survey, $survey_data['is_shared']);
124
-	}
118
+    if (($action == 'moveup' || $action == 'movedown') && isset($_GET['question_id'])) {
119
+        SurveyManager::move_survey_question($my_action_survey,$my_question_id_survey,$my_survey_id_survey);
120
+        Display::display_confirmation_message(get_lang('SurveyQuestionMoved'));
121
+    }
122
+    if ($action == 'delete' AND is_numeric($_GET['question_id'])) {
123
+        SurveyManager::delete_survey_question($my_survey_id_survey, $my_question_id_survey, $survey_data['is_shared']);
124
+    }
125 125
 }
126 126
 
127 127
 if (!empty($survey_data['survey_version'])) echo '<b>'.get_lang('Version').': '.$survey_data['survey_version'].'</b>';
@@ -139,26 +139,26 @@  discard block
 block discarded – undo
139 139
 echo '<div class="actions">'.$survey_actions.'</div>';
140 140
 
141 141
 if ($survey_data['survey_type'] == 0) {
142
-	echo '<div class="panel panel-default">';
142
+    echo '<div class="panel panel-default">';
143 143
         echo '<div class="panel-body">';
144
-	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>';
145
-	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>';
146
-	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>';
147
-	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>';
148
-	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>';
149
-	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>';
150
-	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>';
151
-	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>';
152
-	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>';
153
-	echo '</div>';
144
+    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>';
145
+    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>';
146
+    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>';
147
+    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>';
148
+    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>';
149
+    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>';
150
+    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>';
151
+    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>';
152
+    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>';
153
+    echo '</div>';
154 154
         echo '</div>';
155 155
 } else {
156
-	echo '<div class="panel panel-default">';
156
+    echo '<div class="panel panel-default">';
157 157
         echo '<div class="panel-body">';
158
-	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.'">';
159
-	echo Display::return_icon("yesno.png");
160
-	echo '</a></div>';
161
-	echo '</div>';
158
+    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.'">';
159
+    echo Display::return_icon("yesno.png");
160
+    echo '</a></div>';
161
+    echo '</div>';
162 162
         echo '</div>';
163 163
 }
164 164
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 echo '		<th width="50" >'.get_lang('NumberOfOptions').'</th>';
172 172
 echo '		<th width="100">'.get_lang('Modify').'</th>';
173 173
 if ($is_survey_type_1) {
174
-	echo '<th width="100">'.get_lang('Condition').'</th>';
174
+    echo '<th width="100">'.get_lang('Condition').'</th>';
175 175
     echo '<th width="40">'.get_lang('Group').'</th>';
176 176
 }
177 177
 echo '	</tr>';
@@ -198,97 +198,97 @@  discard block
 block discarded – undo
198 198
 $result = Database::query($sql);
199 199
 $question_counter_max = Database::num_rows($result);
200 200
 while ($row = Database::fetch_array($result, 'ASSOC')) {
201
-	echo '<tr>';
202
-	echo '	<td>'.$question_counter.'</td>';
203
-	echo '	<td>';
204
-	if (api_strlen($row['survey_question']) > 100) {
205
-		echo api_substr(strip_tags($row['survey_question']), 0, 100).' ... ';
206
-	} else {
207
-		echo $row['survey_question'];
208
-	}
209
-
210
-	if ($row['type'] == 'yesno') {
211
-		$tool_name = get_lang('YesNo');
212
-	} else if ($row['type'] == 'multiplechoice') {
213
-		$tool_name = get_lang('UniqueSelect');
214
-	} else {
215
-		$tool_name = get_lang(api_ucfirst(Security::remove_XSS($row['type'])));
216
-	}
217
-
218
-	echo '</td>';
219
-	echo '	<td>'.$tool_name.'</td>';
220
-	echo '	<td>'.$row['number_of_options'].'</td>';
221
-	echo '	<td>';
222
-	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>';
223
-	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>';
224
-	if ($question_counter > 1) {
225
-		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>';
226
-	} else {
227
-		Display::display_icon('up_na.png','&nbsp;','',ICON_SIZE_SMALL);
228
-	}
229
-	if ($question_counter < $question_counter_max) {
230
-		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>';
231
-	} else {
232
-		Display::display_icon('down_na.png','&nbsp;','',ICON_SIZE_SMALL);
233
-	}
234
-	echo '	</td>';
235
-	$question_counter++;
236
-
237
-	if ($is_survey_type_1) {
238
-    	echo '<td>'.(($row['survey_group_pri']==0)?get_lang('Secondary'):get_lang('Primary')).'</td>';
201
+    echo '<tr>';
202
+    echo '	<td>'.$question_counter.'</td>';
203
+    echo '	<td>';
204
+    if (api_strlen($row['survey_question']) > 100) {
205
+        echo api_substr(strip_tags($row['survey_question']), 0, 100).' ... ';
206
+    } else {
207
+        echo $row['survey_question'];
208
+    }
209
+
210
+    if ($row['type'] == 'yesno') {
211
+        $tool_name = get_lang('YesNo');
212
+    } else if ($row['type'] == 'multiplechoice') {
213
+        $tool_name = get_lang('UniqueSelect');
214
+    } else {
215
+        $tool_name = get_lang(api_ucfirst(Security::remove_XSS($row['type'])));
216
+    }
217
+
218
+    echo '</td>';
219
+    echo '	<td>'.$tool_name.'</td>';
220
+    echo '	<td>'.$row['number_of_options'].'</td>';
221
+    echo '	<td>';
222
+    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>';
223
+    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>';
224
+    if ($question_counter > 1) {
225
+        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>';
226
+    } else {
227
+        Display::display_icon('up_na.png','&nbsp;','',ICON_SIZE_SMALL);
228
+    }
229
+    if ($question_counter < $question_counter_max) {
230
+        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>';
231
+    } else {
232
+        Display::display_icon('down_na.png','&nbsp;','',ICON_SIZE_SMALL);
233
+    }
234
+    echo '	</td>';
235
+    $question_counter++;
236
+
237
+    if ($is_survey_type_1) {
238
+        echo '<td>'.(($row['survey_group_pri']==0)?get_lang('Secondary'):get_lang('Primary')).'</td>';
239 239
         echo '<td>'.(($row['survey_group_pri']==0)?$groups[$row['survey_group_sec1']].'-'.$groups[$row['survey_group_sec2']]:$groups[$row['survey_group_pri']]).'</td>';
240 240
     }
241
-	echo '</tr>';
241
+    echo '</tr>';
242 242
 }
243 243
 
244 244
 echo '</table>';
245 245
 
246 246
 if ($is_survey_type_1) {
247
-	echo '<br /><br /><b>'.get_lang('ManageGroups').'</b><br /><br />';
248
-
249
-	if (in_array($_GET['sendmsg'], array('GroupUpdatedSuccessfully', 'GroupDeletedSuccessfully', 'GroupCreatedSuccessfully'))) {
250
-		echo Display::display_confirmation_message(get_lang($_GET['sendmsg']), false);
251
-	}
252
-
253
-	if (in_array($_GET['sendmsg'], array('GroupNeedName'))){
254
-		echo Display::display_warning_message(get_lang($_GET['sendmsg']), false);
255
-	}
256
-	echo '<table border="0"><tr><td width="100">'.get_lang('Name').'</td><td>'.get_lang('Description').'</td></tr></table>';
257
-	echo '<form action="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?action=addgroup&survey_id='.$survey_id.'" method="post">';
258
-	if ($_GET['action'] == 'editgroup') {
259
-		$sql = 'SELECT name,description FROM '.$table_survey_question_group.' WHERE id = '.intval($_GET['gid']).' AND survey_id = '.intval($survey_id).' limit 1';
260
-		$rs = Database::query($sql);
261
-		$editedrow = Database::fetch_array($rs,'ASSOC');
262
-		echo	'<input type="text" maxlength="20" name="name" value="'.$editedrow['name'].'" size="10" disabled>';
263
-		echo	'<input type="text" maxlength="150" name="description" value="'.$editedrow['description'].'" size="40">';
264
-		echo	'<input type="hidden" name="group_id" value="'.Security::remove_XSS($_GET['gid']).'">';
265
-		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).'\';" />';
266
-	} else {
267
-		echo	'<input type="text" maxlength="20" name="name" value="" size="10">';
268
-		echo	'<input type="text" maxlength="250" name="description" value="" size="80">';
269
-		echo	'<input type="submit" value="'.get_lang('Create').'"';
270
-	}
271
-	echo	'</form><br />';
272
-
273
-	echo '<table class="data_table">';
274
-	echo '	<tr class="row_odd">';
275
-	echo '		<th width="200">'.get_lang('Name').'</th>';
276
-	echo '		<th>'.get_lang('Description').'</th>';
277
-	echo '		<th width="100">'.get_lang('Modify').'</th>';
278
-	echo '	</tr>';
279
-
280
-	$sql = 'SELECT id,name,description FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND survey_id = '.intval($survey_id).' ORDER BY name';
281
-
282
-	$rs = Database::query($sql);
283
-	while($row = Database::fetch_array($rs,ASSOC)){
284
-		$grouplist .= '<tr><td>'.$row['name'].'</td><td>'.$row['description'].'</td><td>'.
285
-		'<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=editgroup">'.
286
-		Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> '.
287
-		'<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;">'.
288
-		Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
289
-		'</td></tr>';
290
-	}
291
-	echo $grouplist.'</table>';
247
+    echo '<br /><br /><b>'.get_lang('ManageGroups').'</b><br /><br />';
248
+
249
+    if (in_array($_GET['sendmsg'], array('GroupUpdatedSuccessfully', 'GroupDeletedSuccessfully', 'GroupCreatedSuccessfully'))) {
250
+        echo Display::display_confirmation_message(get_lang($_GET['sendmsg']), false);
251
+    }
252
+
253
+    if (in_array($_GET['sendmsg'], array('GroupNeedName'))){
254
+        echo Display::display_warning_message(get_lang($_GET['sendmsg']), false);
255
+    }
256
+    echo '<table border="0"><tr><td width="100">'.get_lang('Name').'</td><td>'.get_lang('Description').'</td></tr></table>';
257
+    echo '<form action="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?action=addgroup&survey_id='.$survey_id.'" method="post">';
258
+    if ($_GET['action'] == 'editgroup') {
259
+        $sql = 'SELECT name,description FROM '.$table_survey_question_group.' WHERE id = '.intval($_GET['gid']).' AND survey_id = '.intval($survey_id).' limit 1';
260
+        $rs = Database::query($sql);
261
+        $editedrow = Database::fetch_array($rs,'ASSOC');
262
+        echo	'<input type="text" maxlength="20" name="name" value="'.$editedrow['name'].'" size="10" disabled>';
263
+        echo	'<input type="text" maxlength="150" name="description" value="'.$editedrow['description'].'" size="40">';
264
+        echo	'<input type="hidden" name="group_id" value="'.Security::remove_XSS($_GET['gid']).'">';
265
+        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).'\';" />';
266
+    } else {
267
+        echo	'<input type="text" maxlength="20" name="name" value="" size="10">';
268
+        echo	'<input type="text" maxlength="250" name="description" value="" size="80">';
269
+        echo	'<input type="submit" value="'.get_lang('Create').'"';
270
+    }
271
+    echo	'</form><br />';
272
+
273
+    echo '<table class="data_table">';
274
+    echo '	<tr class="row_odd">';
275
+    echo '		<th width="200">'.get_lang('Name').'</th>';
276
+    echo '		<th>'.get_lang('Description').'</th>';
277
+    echo '		<th width="100">'.get_lang('Modify').'</th>';
278
+    echo '	</tr>';
279
+
280
+    $sql = 'SELECT id,name,description FROM '.$table_survey_question_group.' WHERE c_id = '.$course_id.' AND survey_id = '.intval($survey_id).' ORDER BY name';
281
+
282
+    $rs = Database::query($sql);
283
+    while($row = Database::fetch_array($rs,ASSOC)){
284
+        $grouplist .= '<tr><td>'.$row['name'].'</td><td>'.$row['description'].'</td><td>'.
285
+        '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=editgroup">'.
286
+        Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> '.
287
+        '<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;">'.
288
+        Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
289
+        '</td></tr>';
290
+    }
291
+    echo $grouplist.'</table>';
292 292
 }
293 293
 
294 294
 Session::erase('answer_count');
Please login to merge, or discard this patch.
main/tracking/lp_results_by_user.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -16,34 +16,34 @@  discard block
 block discarded – undo
16 16
 $is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || $is_courseCoach || $is_sessionAdmin;
17 17
 
18 18
 if (!$is_allowedToTrack) {
19
-	Display :: display_header(null);
20
-	api_not_allowed();
21
-	Display :: display_footer();
19
+    Display :: display_header(null);
20
+    api_not_allowed();
21
+    Display :: display_footer();
22 22
 }
23 23
 
24 24
 $export_to_csv = false;
25 25
 if (isset($_GET['export'])) {
26
-	$export_to_csv = true;
26
+    $export_to_csv = true;
27 27
 }
28 28
 
29 29
 if (api_is_platform_admin() ) {
30
-	$global = true;
30
+    $global = true;
31 31
 } else {
32
-	$global = false;
32
+    $global = false;
33 33
 }
34 34
 
35 35
 if ($global) {
36
-	$temp_course_list = CourseManager :: get_courses_list();
37
-	foreach($temp_course_list  as $temp_course_item) {
38
-		$course_item = CourseManager ::get_course_information($temp_course_item['code']);
36
+    $temp_course_list = CourseManager :: get_courses_list();
37
+    foreach($temp_course_list  as $temp_course_item) {
38
+        $course_item = CourseManager ::get_course_information($temp_course_item['code']);
39 39
         $course_list[] = array(
40 40
             'code' => $course_item['code'],
41 41
             'title' => $course_item['title'],
42 42
         );
43
-	}
43
+    }
44 44
 } else {
45 45
     $current_course['code'] = $_course['id'];
46
-	$course_list = array($current_course);
46
+    $course_list = array($current_course);
47 47
 }
48 48
 
49 49
 $new_course_select = array();
@@ -54,20 +54,20 @@  discard block
 block discarded – undo
54 54
 $form = new FormValidator('search_simple', 'POST', '', '', null, false);
55 55
 $form->addElement('select','course_code',get_lang('Course'), $new_course_select);
56 56
 if ($global) {
57
-	$form->addElement('hidden','view','admin');
57
+    $form->addElement('hidden','view','admin');
58 58
 } else {
59
-	//Get exam lists
59
+    //Get exam lists
60 60
     $course_id = api_get_course_int_id();
61
-	$t_quiz = Database::get_course_table(TABLE_QUIZ_TEST);
62
-	$sqlExercices = "SELECT quiz.title,id FROM ".$t_quiz." AS quiz
61
+    $t_quiz = Database::get_course_table(TABLE_QUIZ_TEST);
62
+    $sqlExercices = "SELECT quiz.title,id FROM ".$t_quiz." AS quiz
63 63
 	                 WHERE c_id = $course_id AND active='1'
64 64
 	                 ORDER BY quiz.title ASC";
65
-	$resultExercices = Database::query($sqlExercices);
66
-	$exercise_list[0] = get_lang('All');
67
-	while($a_exercices = Database::fetch_array($resultExercices)) {
68
-		$exercise_list[$a_exercices['id']] = $a_exercices['title'];
69
-	}
70
-	$form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list);
65
+    $resultExercices = Database::query($sqlExercices);
66
+    $exercise_list[0] = get_lang('All');
67
+    while($a_exercices = Database::fetch_array($resultExercices)) {
68
+        $exercise_list[$a_exercices['id']] = $a_exercices['title'];
69
+    }
70
+    $form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list);
71 71
 }
72 72
 
73 73
 //$form->addElement('submit','submit',get_lang('Filter'));
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 }
82 82
 
83 83
 if (!$export_to_csv) {
84
-	Display :: display_header(get_lang('Reporting'));
85
-	echo '<div class="actions" style ="font-size:10pt;">';
86
-	if ($global) {
84
+    Display :: display_header(get_lang('Reporting'));
85
+    echo '<div class="actions" style ="font-size:10pt;">';
86
+    if ($global) {
87 87
 
88 88
         echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
89 89
                 '.Display::return_icon('csv.gif').'
@@ -93,81 +93,81 @@  discard block
 block discarded – undo
93 93
                 &nbsp;'.get_lang('Print').'</a>
94 94
                 	</div>';
95 95
 
96
-		$menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher">'.get_lang('TeacherInterface').'</a>';
96
+        $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher">'.get_lang('TeacherInterface').'</a>';
97 97
         if (api_is_platform_admin()) {
98
-		  $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=admin">'.get_lang('AdminInterface').'</a>';
98
+            $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=admin">'.get_lang('AdminInterface').'</a>';
99 99
         } else {
100 100
             $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=coach">'.get_lang('AdminInterface').'</a>';
101 101
         }
102
-		$menu_items[] = get_lang('ExamTracking');
103
-		$nb_menu_items = count($menu_items);
104
-		if($nb_menu_items>1) {
105
-			foreach($menu_items as $key=> $item) {
106
-				echo $item;
107
-				if($key!=$nb_menu_items-1) {
108
-					echo ' | ';
109
-				}
110
-			}
111
-			echo '<br />';
112
-		}
113
-	} else {
114
-	    echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.get_lang('StudentsTracking').'</a>&nbsp;|
102
+        $menu_items[] = get_lang('ExamTracking');
103
+        $nb_menu_items = count($menu_items);
104
+        if($nb_menu_items>1) {
105
+            foreach($menu_items as $key=> $item) {
106
+                echo $item;
107
+                if($key!=$nb_menu_items-1) {
108
+                    echo ' | ';
109
+                }
110
+            }
111
+            echo '<br />';
112
+        }
113
+    } else {
114
+        echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.get_lang('StudentsTracking').'</a>&nbsp;|
115 115
 		     <a href="courseLog.php?'.api_get_cidreq().'&studentlist=false">'.get_lang('CourseTracking').'</a>&nbsp;|&nbsp';
116 116
         echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=resources">'.get_lang('ResourcesTracking').'</a>';
117
-		echo ' | '.get_lang('ExamTracking').'';
117
+        echo ' | '.get_lang('ExamTracking').'';
118 118
         echo '<a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
119 119
             '.Display::return_icon('excel.gif').'
120 120
             &nbsp;'.get_lang('ExportAsXLS').'</a><br /><br />';
121 121
 
122
-	}
122
+    }
123 123
     echo '</div>';
124
-	echo '<br /><br />';
125
-	$form->display();
124
+    echo '<br /><br />';
125
+    $form->display();
126 126
 }
127 127
 $main_result = array();
128 128
 $session_id = 0;
129 129
 $user_list = array();
130 130
 // Getting course list
131 131
 foreach ($course_list  as $current_course ) {
132
-	$course_info = api_get_course_info($current_course['code']);
133
-	$_course = $course_info;
134
-
135
-	// Getting LP list
136
-	$list = new LearnpathList('', $current_course['code'], $session_id);
137
-	$lp_list = $list->get_flat_list();
138
-
139
-	// Looping LPs
140
-	$lps = array();
141
-	foreach ($lp_list as $lp_id =>$lp) {
142
-		$exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']);
143
-		$attempt_result = array();
144
-		// Looping Chamilo Exercises in LP
145
-		foreach ($exercise_list as $exercise) {
146
-			$exercise_stats = Event::get_all_exercise_event_from_lp(
147
-				$exercise['path'],
148
-				$course_info['real_id'],
149
-				$session_id
150
-			);
151
-			// Looping Exercise Attempts
152
-			foreach ($exercise_stats as $stats) {
153
-				$attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = $stats;
154
-				$user_list[$stats['exe_user_id']] = $stats['exe_user_id'];
155
-			}
156
-			$exercise_list_name[$exercise['id']] = $exercise['title'];
157
-		}
158
-		$lps[$lp_id] = array('lp_name' =>$lp['lp_name'], 'exercises' =>$attempt_result);
159
-		$lp_list_name[$lp_id] = $lp['lp_name'];
160
-	}
161
-	$main_result[$current_course['code']] = $lps;
132
+    $course_info = api_get_course_info($current_course['code']);
133
+    $_course = $course_info;
134
+
135
+    // Getting LP list
136
+    $list = new LearnpathList('', $current_course['code'], $session_id);
137
+    $lp_list = $list->get_flat_list();
138
+
139
+    // Looping LPs
140
+    $lps = array();
141
+    foreach ($lp_list as $lp_id =>$lp) {
142
+        $exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']);
143
+        $attempt_result = array();
144
+        // Looping Chamilo Exercises in LP
145
+        foreach ($exercise_list as $exercise) {
146
+            $exercise_stats = Event::get_all_exercise_event_from_lp(
147
+                $exercise['path'],
148
+                $course_info['real_id'],
149
+                $session_id
150
+            );
151
+            // Looping Exercise Attempts
152
+            foreach ($exercise_stats as $stats) {
153
+                $attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = $stats;
154
+                $user_list[$stats['exe_user_id']] = $stats['exe_user_id'];
155
+            }
156
+            $exercise_list_name[$exercise['id']] = $exercise['title'];
157
+        }
158
+        $lps[$lp_id] = array('lp_name' =>$lp['lp_name'], 'exercises' =>$attempt_result);
159
+        $lp_list_name[$lp_id] = $lp['lp_name'];
160
+    }
161
+    $main_result[$current_course['code']] = $lps;
162 162
 }
163 163
 
164 164
 if (!empty($user_list)) {
165 165
     foreach($user_list as $user_id) {
166 166
         $user_data = api_get_user_info($user_id);
167
-		$user_list_name[$user_id] = api_get_person_name(
168
-			$user_data['firstname'],
169
-			$user_data['lastname']
170
-		);
167
+        $user_list_name[$user_id] = api_get_person_name(
168
+            $user_data['firstname'],
169
+            $user_data['lastname']
170
+        );
171 171
     }
172 172
 }
173 173
 $export_array =  array();
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
                         $html_result .= Display::tag('td', $result);
208 208
 
209 209
                         $html_result .= '</tr>';
210
-						$export_array[] = array(
211
-							$course_code,
212
-							$lp_list_name[$lp_id],
213
-							$exercise_list_name[$exercise_id],
214
-							$user_list_name[$user_id],
215
-							$attempt,
216
-							api_get_local_time($attempt_data['exe_date']),
217
-							$result,
218
-						);
210
+                        $export_array[] = array(
211
+                            $course_code,
212
+                            $lp_list_name[$lp_id],
213
+                            $exercise_list_name[$exercise_id],
214
+                            $user_list_name[$user_id],
215
+                            $attempt,
216
+                            api_get_local_time($attempt_data['exe_date']),
217
+                            $result,
218
+                        );
219 219
                         $attempt++;
220 220
                     }
221 221
                 }
@@ -226,30 +226,30 @@  discard block
 block discarded – undo
226 226
 }
227 227
 
228 228
 if (!$export_to_csv) {
229
-	echo $html_result;
229
+    echo $html_result;
230 230
 }
231 231
 $filename = 'learning_path_results-'.date('Y-m-d-h:i:s').'.xls';
232 232
 if ($export_to_csv) {
233 233
     export_complete_report_csv($filename, $export_array);
234
-	exit;
234
+    exit;
235 235
 }
236 236
 
237 237
 function export_complete_report_csv($filename, $array)
238 238
 {
239
-	$header[] = array(
240
-		get_lang('Course'),
241
-		get_lang('LearningPath'),
242
-		get_lang('Exercise'),
243
-		get_lang('User'),
244
-		get_lang('Attempt'),
245
-		get_lang('Date'),
246
-		get_lang('Results'),
247
-	);
248
-	if (!empty($array)) {
249
-		$array = array_merge($header, $array);
250
-		Export :: arrayToCsv($array, $filename);
251
-	}
252
-	exit;
239
+    $header[] = array(
240
+        get_lang('Course'),
241
+        get_lang('LearningPath'),
242
+        get_lang('Exercise'),
243
+        get_lang('User'),
244
+        get_lang('Attempt'),
245
+        get_lang('Date'),
246
+        get_lang('Results'),
247
+    );
248
+    if (!empty($array)) {
249
+        $array = array_merge($header, $array);
250
+        Export :: arrayToCsv($array, $filename);
251
+    }
252
+    exit;
253 253
 
254 254
 }
255 255
 Display :: display_footer();
Please login to merge, or discard this patch.
main/inc/lib/upload.xajax.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,17 +17,17 @@
 block discarded – undo
17 17
  */
18 18
 function updateProgress($div_id, $upload_id, $waitAfterupload = false) {
19 19
 
20
-	$objResponse = new xajaxResponse();
21
-	$ul_info = uploadprogress_get_info($upload_id);
22
-	$percent = intval($ul_info['bytes_uploaded']*100/$ul_info['bytes_total']);
23
-	if($waitAfterupload && $ul_info['est_sec']<2) {
24
-		$percent = 100;
25
-		$objResponse->addAssign($div_id.'_label' , 'innerHTML', get_lang('UploadFile').' : '.$percent.' %');
26
-		$objResponse->addAssign($div_id.'_waiter_frame','innerHTML', Display::return_icon('progress_bar.gif'));
27
-		$objResponse->addScript('clearInterval("myUpload.__progress_bar_interval")');
28
-	}
29
-	$objResponse->addAssign($div_id.'_label', 'innerHTML', get_lang('UploadFile').' : '.$percent.' %');
30
-	$objResponse->addAssign($div_id.'_filled', 'style.width', $percent.'%');
20
+    $objResponse = new xajaxResponse();
21
+    $ul_info = uploadprogress_get_info($upload_id);
22
+    $percent = intval($ul_info['bytes_uploaded']*100/$ul_info['bytes_total']);
23
+    if($waitAfterupload && $ul_info['est_sec']<2) {
24
+        $percent = 100;
25
+        $objResponse->addAssign($div_id.'_label' , 'innerHTML', get_lang('UploadFile').' : '.$percent.' %');
26
+        $objResponse->addAssign($div_id.'_waiter_frame','innerHTML', Display::return_icon('progress_bar.gif'));
27
+        $objResponse->addScript('clearInterval("myUpload.__progress_bar_interval")');
28
+    }
29
+    $objResponse->addAssign($div_id.'_label', 'innerHTML', get_lang('UploadFile').' : '.$percent.' %');
30
+    $objResponse->addAssign($div_id.'_filled', 'style.width', $percent.'%');
31 31
 
32
-	return $objResponse;
32
+    return $objResponse;
33 33
 }
Please login to merge, or discard this patch.