Completed
Push — 1.11.x ( 6904fa...6a92e6 )
by José
525:44 queued 484:20
created
main/gradebook/lib/fe/usertable.class.php 1 patch
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -10,128 +10,128 @@
 block discarded – undo
10 10
  */
11 11
 class UserTable extends SortableTable
12 12
 {
13
-	private $userid;
14
-	private $datagen;
13
+    private $userid;
14
+    private $datagen;
15 15
 
16
-	/**
17
-	 * Constructor
18
-	 */
19
-	public function __construct($userid, $evals = array(), $links = array(), $addparams = null)
20
-	{
21
-		parent :: __construct ('userlist', null, null, 0);
22
-		$this->userid = $userid;
23
-		$this->datagen = new UserDataGenerator($userid, $evals, $links);
24
-		if (isset($addparams)) {
25
-			$this->set_additional_parameters($addparams);
26
-		}
27
-		$column = 0;
28
-		$this->set_header($column++, get_lang('Type'));
29
-		$this->set_header($column++, get_lang('Evaluation'));
30
-		$this->set_header($column++, get_lang('Course'));
31
-		$this->set_header($column++, get_lang('Category'));
32
-		$this->set_header($column++, get_lang('EvaluationAverage'));
33
-		$this->set_header($column++, get_lang('Result'));
16
+    /**
17
+     * Constructor
18
+     */
19
+    public function __construct($userid, $evals = array(), $links = array(), $addparams = null)
20
+    {
21
+        parent :: __construct ('userlist', null, null, 0);
22
+        $this->userid = $userid;
23
+        $this->datagen = new UserDataGenerator($userid, $evals, $links);
24
+        if (isset($addparams)) {
25
+            $this->set_additional_parameters($addparams);
26
+        }
27
+        $column = 0;
28
+        $this->set_header($column++, get_lang('Type'));
29
+        $this->set_header($column++, get_lang('Evaluation'));
30
+        $this->set_header($column++, get_lang('Course'));
31
+        $this->set_header($column++, get_lang('Category'));
32
+        $this->set_header($column++, get_lang('EvaluationAverage'));
33
+        $this->set_header($column++, get_lang('Result'));
34 34
 
35
-		$scoredisplay = ScoreDisplay :: instance();
36
-		if ($scoredisplay->is_custom()) {
37
-			$this->set_header($column++, get_lang('Display'));
38
-		}
39
-	}
35
+        $scoredisplay = ScoreDisplay :: instance();
36
+        if ($scoredisplay->is_custom()) {
37
+            $this->set_header($column++, get_lang('Display'));
38
+        }
39
+    }
40 40
 
41
-	/**
42
-	 * Function used by SortableTable to get total number of items in the table
43
-	 */
44
-	function get_total_number_of_items()
45
-	{
46
-		return $this->datagen->get_total_items_count();
47
-	}
41
+    /**
42
+     * Function used by SortableTable to get total number of items in the table
43
+     */
44
+    function get_total_number_of_items()
45
+    {
46
+        return $this->datagen->get_total_items_count();
47
+    }
48 48
 
49
-	/**
50
-	 * Function used by SortableTable to generate the data to display
51
-	 */
52
-	public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null)
53
-	{
54
-		$scoredisplay = ScoreDisplay :: instance();
49
+    /**
50
+     * Function used by SortableTable to generate the data to display
51
+     */
52
+    public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null)
53
+    {
54
+        $scoredisplay = ScoreDisplay :: instance();
55 55
 
56
-		// determine sorting type
57
-		switch ($this->column) {
58
-			// Type
59
-			case 0:
60
-				$sorting = UserDataGenerator :: UDG_SORT_TYPE;
61
-				break;
62
-			case 1:
63
-				$sorting = UserDataGenerator :: UDG_SORT_NAME;
64
-				break;
65
-			case 2:
66
-				$sorting = UserDataGenerator :: UDG_SORT_COURSE;
67
-				break;
68
-			case 3:
69
-				$sorting = UserDataGenerator :: UDG_SORT_CATEGORY;
70
-				break;
71
-			case 4:
72
-				$sorting = UserDataGenerator :: UDG_SORT_AVERAGE;
73
-				break;
74
-			case 5:
75
-				$sorting = UserDataGenerator :: UDG_SORT_SCORE;
76
-				break;
77
-			case 6:
78
-				$sorting = UserDataGenerator :: UDG_SORT_MASK;
79
-				break;
80
-		}
81
-		if ($this->direction == 'DESC') {
82
-			$sorting |= UserDataGenerator :: UDG_SORT_DESC;
83
-		} else {
84
-			$sorting |= UserDataGenerator :: UDG_SORT_ASC;
85
-		}
86
-		$data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
87
-		// generate the data to display
88
-		$sortable_data = array();
89
-		foreach ($data_array as $data) {
90
-			if ($data[2]!="") {//filter by course removed
91
-				$row = array ();
92
-				$row[] = $this->build_type_column($data[0]);
93
-				$row[] = $this->build_name_link($data[0]);
94
-				$row[] = $data[2];
95
-				$row[] = $data[3];
96
-				$row[] = $data[4];
97
-				$row[] = $data[5];
98
-				if ($scoredisplay->is_custom())
99
-					$row[] = $data[6];
100
-				$sortable_data[] = $row;
101
-			}
102
-		}
56
+        // determine sorting type
57
+        switch ($this->column) {
58
+            // Type
59
+            case 0:
60
+                $sorting = UserDataGenerator :: UDG_SORT_TYPE;
61
+                break;
62
+            case 1:
63
+                $sorting = UserDataGenerator :: UDG_SORT_NAME;
64
+                break;
65
+            case 2:
66
+                $sorting = UserDataGenerator :: UDG_SORT_COURSE;
67
+                break;
68
+            case 3:
69
+                $sorting = UserDataGenerator :: UDG_SORT_CATEGORY;
70
+                break;
71
+            case 4:
72
+                $sorting = UserDataGenerator :: UDG_SORT_AVERAGE;
73
+                break;
74
+            case 5:
75
+                $sorting = UserDataGenerator :: UDG_SORT_SCORE;
76
+                break;
77
+            case 6:
78
+                $sorting = UserDataGenerator :: UDG_SORT_MASK;
79
+                break;
80
+        }
81
+        if ($this->direction == 'DESC') {
82
+            $sorting |= UserDataGenerator :: UDG_SORT_DESC;
83
+        } else {
84
+            $sorting |= UserDataGenerator :: UDG_SORT_ASC;
85
+        }
86
+        $data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
87
+        // generate the data to display
88
+        $sortable_data = array();
89
+        foreach ($data_array as $data) {
90
+            if ($data[2]!="") {//filter by course removed
91
+                $row = array ();
92
+                $row[] = $this->build_type_column($data[0]);
93
+                $row[] = $this->build_name_link($data[0]);
94
+                $row[] = $data[2];
95
+                $row[] = $data[3];
96
+                $row[] = $data[4];
97
+                $row[] = $data[5];
98
+                if ($scoredisplay->is_custom())
99
+                    $row[] = $data[6];
100
+                $sortable_data[] = $row;
101
+            }
102
+        }
103 103
 
104
-		return $sortable_data;
105
-	}
104
+        return $sortable_data;
105
+    }
106 106
 
107
-	/**
108
-	 * @param $item
109
-	 * @return string
110
-	 */
111
-	private function build_type_column($item)
112
-	{
113
-		return GradebookUtils::build_type_icon_tag($item->get_icon_name());
114
-	}
107
+    /**
108
+     * @param $item
109
+     * @return string
110
+     */
111
+    private function build_type_column($item)
112
+    {
113
+        return GradebookUtils::build_type_icon_tag($item->get_icon_name());
114
+    }
115 115
 
116
-	/**
117
-	 * @param $item
118
-	 * @return string
119
-	 */
120
-	private function build_name_link($item)
121
-	{
122
-		switch ($item->get_item_type()) {
123
-			// evaluation
124
-			case 'E' :
125
-				return ' '
126
-				. '<a href="gradebook_view_result.php?selecteval=' . $item->get_id() . '">'
127
-				. $item->get_name()
128
-				. '</a>';
129
-			// link
130
-			case 'L' :
131
-				return '&nbsp;<a href="' . $item->get_link() . '">'
132
-				. $item->get_name()
133
-				. '</a>'
134
-				. '&nbsp;[' . $item->get_type_name() . ']';
135
-		}
136
-	}
116
+    /**
117
+     * @param $item
118
+     * @return string
119
+     */
120
+    private function build_name_link($item)
121
+    {
122
+        switch ($item->get_item_type()) {
123
+            // evaluation
124
+            case 'E' :
125
+                return '&nbsp;'
126
+                . '<a href="gradebook_view_result.php?selecteval=' . $item->get_id() . '">'
127
+                . $item->get_name()
128
+                . '</a>';
129
+            // link
130
+            case 'L' :
131
+                return '&nbsp;<a href="' . $item->get_link() . '">'
132
+                . $item->get_name()
133
+                . '</a>'
134
+                . '&nbsp;[' . $item->get_type_name() . ']';
135
+        }
136
+    }
137 137
 }
Please login to merge, or discard this patch.
app/Resources/public/assets/ckeditor/samples/old/assets/posteddata.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -27,22 +27,22 @@
 block discarded – undo
27 27
 
28 28
 if (!empty($_POST))
29 29
 {
30
-	foreach ( $_POST as $key => $value )
31
-	{
32
-		if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) )
33
-			continue;
30
+    foreach ( $_POST as $key => $value )
31
+    {
32
+        if ( ( !is_string($value) && !is_numeric($value) ) || !is_string($key) )
33
+            continue;
34 34
 
35
-		if ( get_magic_quotes_gpc() )
36
-			$value = htmlspecialchars( stripslashes((string)$value) );
37
-		else
38
-			$value = htmlspecialchars( (string)$value );
35
+        if ( get_magic_quotes_gpc() )
36
+            $value = htmlspecialchars( stripslashes((string)$value) );
37
+        else
38
+            $value = htmlspecialchars( (string)$value );
39 39
 ?>
40 40
 		<tr>
41 41
 			<th style="vertical-align: top"><?php echo htmlspecialchars( (string)$key ); ?></th>
42 42
 			<td><pre class="samples"><?php echo $value; ?></pre></td>
43 43
 		</tr>
44 44
 	<?php
45
-	}
45
+    }
46 46
 }
47 47
 ?>
48 48
 	</table>
Please login to merge, or discard this patch.
main/inc/lib/system_announcements.lib.php 1 patch
Indentation   +428 added lines, -428 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@  discard block
 block discarded – undo
10 10
     CONST VISIBLE_STUDENT = 2;
11 11
     CONST VISIBLE_TEACHER = 3;
12 12
 
13
-	/**
14
-	 * Displays all announcements
15
-	 * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER
16
-	 * @param int $id The identifier of the announcement to display
17
-	 */
18
-	public static function display_announcements($visible, $id = -1)
13
+    /**
14
+     * Displays all announcements
15
+     * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER
16
+     * @param int $id The identifier of the announcement to display
17
+     */
18
+    public static function display_announcements($visible, $id = -1)
19 19
     {
20
-		$user_selected_language = api_get_interface_language();
21
-		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
20
+        $user_selected_language = api_get_interface_language();
21
+        $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
22 22
         $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
23
-		$userGroup = new UserGroup();
23
+        $userGroup = new UserGroup();
24 24
 
25 25
         $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0);
26 26
         $groups = array();
@@ -55,47 +55,47 @@  discard block
 block discarded – undo
55 55
                         WHERE group_id in $groups_string
56 56
                     ) ";
57 57
         }
58
-		$current_access_url_id = 1;
59
-		if (api_is_multiple_url_enabled()) {
60
-			$current_access_url_id = api_get_current_access_url_id();
61
-		}
62
-		$sql .= " AND access_url_id = '$current_access_url_id' ";
63
-		$sql .= " ORDER BY date_start DESC LIMIT 0,7";
64
-
65
-		$announcements = Database::query($sql);
66
-		if (Database::num_rows($announcements) > 0) {
67
-			$query_string = ereg_replace('announcement=[1-9]+', '', $_SERVER['QUERY_STRING']);
68
-			$query_string = ereg_replace('&$', '', $query_string);
69
-			$url = api_get_self();
70
-			echo '<div class="system_announcements">';
71
-			echo '<h3>'.get_lang('SystemAnnouncements').'</h3>';
72
-			echo '<div style="margin:10px;text-align:right;"><a href="news_list.php">'.get_lang('More').'</a></div>';
73
-
74
-			while ($announcement = Database::fetch_object($announcements)) {
75
-				if ($id != $announcement->id) {
76
-					if (strlen($query_string) > 0) {
77
-						$show_url = 'news_list.php#'.$announcement->id;
78
-					} else {
79
-						$show_url = 'news_list.php#'.$announcement->id;
80
-					}
81
-			        $display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG);
82
-					echo '<a name="'.$announcement->id.'"></a>
58
+        $current_access_url_id = 1;
59
+        if (api_is_multiple_url_enabled()) {
60
+            $current_access_url_id = api_get_current_access_url_id();
61
+        }
62
+        $sql .= " AND access_url_id = '$current_access_url_id' ";
63
+        $sql .= " ORDER BY date_start DESC LIMIT 0,7";
64
+
65
+        $announcements = Database::query($sql);
66
+        if (Database::num_rows($announcements) > 0) {
67
+            $query_string = ereg_replace('announcement=[1-9]+', '', $_SERVER['QUERY_STRING']);
68
+            $query_string = ereg_replace('&$', '', $query_string);
69
+            $url = api_get_self();
70
+            echo '<div class="system_announcements">';
71
+            echo '<h3>'.get_lang('SystemAnnouncements').'</h3>';
72
+            echo '<div style="margin:10px;text-align:right;"><a href="news_list.php">'.get_lang('More').'</a></div>';
73
+
74
+            while ($announcement = Database::fetch_object($announcements)) {
75
+                if ($id != $announcement->id) {
76
+                    if (strlen($query_string) > 0) {
77
+                        $show_url = 'news_list.php#'.$announcement->id;
78
+                    } else {
79
+                        $show_url = 'news_list.php#'.$announcement->id;
80
+                    }
81
+                    $display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG);
82
+                    echo '<a name="'.$announcement->id.'"></a>
83 83
 						<div class="system_announcement">
84 84
 							<div class="system_announcement_title"><a name="ann'.$announcement->id.'" href="'.$show_url.'">'.$announcement->title.'</a></div><div class="system_announcement_date">'.$display_date.'</div>
85 85
 					  	</div>';
86
-				} else {
87
-					echo '<div class="system_announcement">
86
+                } else {
87
+                    echo '<div class="system_announcement">
88 88
 							<div class="system_announcement_title">'
89
-								.$announcement->display_date.'
89
+                                .$announcement->display_date.'
90 90
 								<a name="ann'.$announcement->id.'" href="'.$url.'?'.$query_string.'#ann'.$announcement->id.'">'.$announcement->title.'</a>
91 91
 							</div>';
92
-				}
93
-				echo '<br />';
94
-			}
95
-			echo '</div>';
96
-		}
97
-		return;
98
-	}
92
+                }
93
+                echo '<br />';
94
+            }
95
+            echo '</div>';
96
+        }
97
+        return;
98
+    }
99 99
 
100 100
     /**
101 101
      * @param $visible
@@ -106,100 +106,100 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public static function display_all_announcements($visible, $id = -1, $start = 0,$user_id='')
108 108
     {
109
-		$user_selected_language = api_get_interface_language();
110
-		$start	= intval($start);
109
+        $user_selected_language = api_get_interface_language();
110
+        $start	= intval($start);
111 111
         $userGroup = new UserGroup();
112
-	    $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
113
-	    $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0);
112
+        $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
113
+        $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0);
114 114
         $groups = array();
115
-	    foreach ($temp_user_groups as $user_group) {
116
-	        $groups = array_merge($groups, array($user_group['id']));
117
-	        $groups = array_merge($groups, $userGroup->get_parent_groups($user_group['id']));
118
-	    }
115
+        foreach ($temp_user_groups as $user_group) {
116
+            $groups = array_merge($groups, array($user_group['id']));
117
+            $groups = array_merge($groups, $userGroup->get_parent_groups($user_group['id']));
118
+        }
119 119
 
120
-	    // Checks if tables exists to not break platform not updated
121
-	    $groups_string = '('.implode($groups,',').')';
120
+        // Checks if tables exists to not break platform not updated
121
+        $groups_string = '('.implode($groups,',').')';
122 122
 
123
-		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
124
-		$now  = api_get_utc_datetime();
123
+        $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
124
+        $now  = api_get_utc_datetime();
125 125
 
126
-		$sql = "SELECT * FROM ".$db_table."
126
+        $sql = "SELECT * FROM ".$db_table."
127 127
 				WHERE
128 128
 				    (lang = '$user_selected_language' OR lang IS NULL) AND
129 129
 				    ( '$now' >= date_start AND '$now' <= date_end) ";
130 130
 
131
-		switch ($visible) {
132
-			case self::VISIBLE_GUEST :
133
-				$sql .= " AND visible_guest = 1 ";
134
-				break;
135
-			case self::VISIBLE_STUDENT :
136
-				$sql .= " AND visible_student = 1 ";
137
-				break;
138
-			case self::VISIBLE_TEACHER :
139
-				$sql .= " AND visible_teacher = 1 ";
140
-				break;
141
-		}
142
-
143
-	    if (count($groups) > 0) {
131
+        switch ($visible) {
132
+            case self::VISIBLE_GUEST :
133
+                $sql .= " AND visible_guest = 1 ";
134
+                break;
135
+            case self::VISIBLE_STUDENT :
136
+                $sql .= " AND visible_student = 1 ";
137
+                break;
138
+            case self::VISIBLE_TEACHER :
139
+                $sql .= " AND visible_teacher = 1 ";
140
+                break;
141
+        }
142
+
143
+        if (count($groups) > 0) {
144 144
             $sql .= " OR id IN (
145 145
                     SELECT announcement_id FROM $tbl_announcement_group
146 146
                     WHERE group_id in $groups_string
147 147
                     ) ";
148
-	    }
148
+        }
149 149
 
150
-		if (api_is_multiple_url_enabled()) {
151
-			$current_access_url_id = api_get_current_access_url_id();
150
+        if (api_is_multiple_url_enabled()) {
151
+            $current_access_url_id = api_get_current_access_url_id();
152 152
             $sql .= " AND access_url_id IN ('1', '$current_access_url_id')";
153
-		}
154
-
155
-		if(!isset($_GET['start']) || $_GET['start'] == 0) {
156
-			$sql .= " ORDER BY date_start DESC LIMIT ".$start.",20";
157
-		} else {
158
-			$sql .= " ORDER BY date_start DESC LIMIT ".($start+1).",20";
159
-		}
160
-		$announcements = Database::query($sql);
161
-		$content = '';
162
-		if (Database::num_rows($announcements) > 0) {
163
-			$query_string = ereg_replace('announcement=[1-9]+', '', $_SERVER['QUERY_STRING']);
164
-			$query_string = ereg_replace('&$', '', $query_string);
165
-			$url = api_get_self();
166
-			$content .= '<div class="system_announcements">';
167
-			$content .= '<h3>'.get_lang('SystemAnnouncements').'</h3>';
168
-			$content .= '<table align="center">';
169
-				$content .= '<tr>';
170
-					$content .= '<td>';
171
-						$content .= SystemAnnouncementManager :: display_arrow($user_id);
172
-					$content .= '</td>';
173
-				$content .= '</tr>';
174
-			$content .= '</table>';
175
-			$content .= '<table align="center" border="0" width="900px">';
176
-			while ($announcement = Database::fetch_object($announcements)) {
177
-				$display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG);
178
-				$content .= '<tr><td>';
179
-				$content .= '<a name="'.$announcement->id.'"></a>
153
+        }
154
+
155
+        if(!isset($_GET['start']) || $_GET['start'] == 0) {
156
+            $sql .= " ORDER BY date_start DESC LIMIT ".$start.",20";
157
+        } else {
158
+            $sql .= " ORDER BY date_start DESC LIMIT ".($start+1).",20";
159
+        }
160
+        $announcements = Database::query($sql);
161
+        $content = '';
162
+        if (Database::num_rows($announcements) > 0) {
163
+            $query_string = ereg_replace('announcement=[1-9]+', '', $_SERVER['QUERY_STRING']);
164
+            $query_string = ereg_replace('&$', '', $query_string);
165
+            $url = api_get_self();
166
+            $content .= '<div class="system_announcements">';
167
+            $content .= '<h3>'.get_lang('SystemAnnouncements').'</h3>';
168
+            $content .= '<table align="center">';
169
+                $content .= '<tr>';
170
+                    $content .= '<td>';
171
+                        $content .= SystemAnnouncementManager :: display_arrow($user_id);
172
+                    $content .= '</td>';
173
+                $content .= '</tr>';
174
+            $content .= '</table>';
175
+            $content .= '<table align="center" border="0" width="900px">';
176
+            while ($announcement = Database::fetch_object($announcements)) {
177
+                $display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG);
178
+                $content .= '<tr><td>';
179
+                $content .= '<a name="'.$announcement->id.'"></a>
180 180
 						<div class="system_announcement">
181 181
 						<h2>'.$announcement->title.'</h2><div class="system_announcement_date">'.$display_date.'</div>
182 182
 						<br />
183 183
 					  	<div class="system_announcement_content">'
184
-					  			.$announcement->content.'
184
+                                    .$announcement->content.'
185 185
 						</div>
186 186
 					  </div><br />';
187
-				$content .= '</tr></td>';
188
-			}
189
-			$content .= '</table>';
190
-
191
-			$content .= '<table align="center">';
192
-				$content .= '<tr>';
193
-					$content .= '<td>';
194
-						$content .= SystemAnnouncementManager :: display_arrow($user_id);
195
-					$content .= '</td>';
196
-				$content .= '</tr>';
197
-			$content .= '</table>';
198
-			$content .= '</div>';
199
-		}
200
-
201
-		return $content;
202
-	}
187
+                $content .= '</tr></td>';
188
+            }
189
+            $content .= '</table>';
190
+
191
+            $content .= '<table align="center">';
192
+                $content .= '<tr>';
193
+                    $content .= '<td>';
194
+                        $content .= SystemAnnouncementManager :: display_arrow($user_id);
195
+                    $content .= '</td>';
196
+                $content .= '</tr>';
197
+            $content .= '</table>';
198
+            $content .= '</div>';
199
+        }
200
+
201
+        return $content;
202
+    }
203 203
 
204 204
     /**
205 205
      * @param int $user_id
@@ -207,23 +207,23 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public static function display_arrow($user_id)
209 209
     {
210
-		$start = (int)$_GET['start'];
211
-		$nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start,$user_id);
212
-		$next = ((int)$_GET['start']+19);
213
-		$prev = ((int)$_GET['start']-19);
214
-		$content = '';
215
-		if(!isset($_GET['start']) || $_GET['start'] == 0) {
216
-			if($nb_announcement > 20) {
217
-				$content .= '<a href="news_list.php?start='.$next.'">'.get_lang('NextBis').' >> </a>';
218
-			}
219
-		} else {
220
-			echo '<a href="news_list.php?start='.$prev.'"> << '.get_lang('Prev').'</a>';
221
-			if ($nb_announcement > 20) {
222
-				$content .= '<a href="news_list.php?start='.$next.'">'.get_lang('NextBis').' >> </a>';
223
-			}
224
-		}
225
-		return $content;
226
-	}
210
+        $start = (int)$_GET['start'];
211
+        $nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start,$user_id);
212
+        $next = ((int)$_GET['start']+19);
213
+        $prev = ((int)$_GET['start']-19);
214
+        $content = '';
215
+        if(!isset($_GET['start']) || $_GET['start'] == 0) {
216
+            if($nb_announcement > 20) {
217
+                $content .= '<a href="news_list.php?start='.$next.'">'.get_lang('NextBis').' >> </a>';
218
+            }
219
+        } else {
220
+            echo '<a href="news_list.php?start='.$prev.'"> << '.get_lang('Prev').'</a>';
221
+            if ($nb_announcement > 20) {
222
+                $content .= '<a href="news_list.php?start='.$next.'">'.get_lang('NextBis').' >> </a>';
223
+            }
224
+        }
225
+        return $content;
226
+    }
227 227
 
228 228
     /**
229 229
      * @param int $start
@@ -232,82 +232,82 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public static function count_nb_announcement($start = 0, $user_id = '')
234 234
     {
235
-		$start = intval($start);
236
-		$visibility = api_is_allowed_to_create_course() ? self::VISIBLE_TEACHER : self::VISIBLE_STUDENT;
237
-		$user_selected_language = api_get_interface_language();
238
-		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
239
-		$sql = 'SELECT id FROM '.$db_table.'
235
+        $start = intval($start);
236
+        $visibility = api_is_allowed_to_create_course() ? self::VISIBLE_TEACHER : self::VISIBLE_STUDENT;
237
+        $user_selected_language = api_get_interface_language();
238
+        $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
239
+        $sql = 'SELECT id FROM '.$db_table.'
240 240
 		        WHERE (lang="'.$user_selected_language.'" OR lang IS NULL) ';
241
-		if (isset($user_id)) {
242
-			switch ($visibility) {
243
-				case self::VISIBLE_GUEST :
244
-					$sql .= " AND visible_guest = 1 ";
245
-					break;
246
-				case self::VISIBLE_STUDENT :
247
-					$sql .= " AND visible_student = 1 ";
248
-					break;
249
-				case self::VISIBLE_TEACHER :
250
-					$sql .= " AND visible_teacher = 1 ";
251
-					break;
252
-			}
253
- 		}
254
-
255
-		$current_access_url_id = 1;
256
-		if (api_is_multiple_url_enabled()) {
257
-			$current_access_url_id = api_get_current_access_url_id();
258
-		}
259
-		$sql .= " AND access_url_id = '$current_access_url_id' ";
260
-
261
-
262
-		$sql .= 'LIMIT '.$start.', 21';
263
-		$announcements = Database::query($sql);
264
-		$i = 0;
265
-		while ($rows = Database::fetch_array($announcements)) {
266
-			$i++;
267
-		}
268
-		return $i;
269
-	}
270
-
271
-	/**
272
-	 * Get all announcements
273
-	 * @return array An array with all available system announcements (as php
274
-	 * objects)
275
-	 */
276
-	public static function get_all_announcements()
241
+        if (isset($user_id)) {
242
+            switch ($visibility) {
243
+                case self::VISIBLE_GUEST :
244
+                    $sql .= " AND visible_guest = 1 ";
245
+                    break;
246
+                case self::VISIBLE_STUDENT :
247
+                    $sql .= " AND visible_student = 1 ";
248
+                    break;
249
+                case self::VISIBLE_TEACHER :
250
+                    $sql .= " AND visible_teacher = 1 ";
251
+                    break;
252
+            }
253
+            }
254
+
255
+        $current_access_url_id = 1;
256
+        if (api_is_multiple_url_enabled()) {
257
+            $current_access_url_id = api_get_current_access_url_id();
258
+        }
259
+        $sql .= " AND access_url_id = '$current_access_url_id' ";
260
+
261
+
262
+        $sql .= 'LIMIT '.$start.', 21';
263
+        $announcements = Database::query($sql);
264
+        $i = 0;
265
+        while ($rows = Database::fetch_array($announcements)) {
266
+            $i++;
267
+        }
268
+        return $i;
269
+    }
270
+
271
+    /**
272
+     * Get all announcements
273
+     * @return array An array with all available system announcements (as php
274
+     * objects)
275
+     */
276
+    public static function get_all_announcements()
277 277
     {
278
-		$table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
279
-		$now = api_get_utc_datetime();
280
-		$sql = "SELECT *, IF ( '$now'  >= date_start AND '$now' <= date_end, '1', '0') AS visible
278
+        $table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
279
+        $now = api_get_utc_datetime();
280
+        $sql = "SELECT *, IF ( '$now'  >= date_start AND '$now' <= date_end, '1', '0') AS visible
281 281
 				FROM $table";
282 282
 
283
-		$current_access_url_id = 1;
284
-		if (api_is_multiple_url_enabled()) {
285
-			$current_access_url_id = api_get_current_access_url_id();
286
-		}
287
-		$sql .= " WHERE access_url_id = '$current_access_url_id' ";
288
-		$sql .= " ORDER BY date_start ASC";
289
-
290
-		$announcements = Database::query($sql);
291
-		$all_announcements = array();
292
-		while ($announcement = Database::fetch_object($announcements)) {
293
-			$all_announcements[] = $announcement;
294
-		}
295
-		return $all_announcements;
296
-	}
297
-
298
-	/**
299
-	 * Adds an announcement to the database
300
-	 * @param string Title of the announcement
301
-	 * @param string Content of the announcement
302
-	 * @param string Start date (YYYY-MM-DD HH:II: SS)
303
-	 * @param string End date (YYYY-MM-DD HH:II: SS)
304
-	 * @param int    Whether the announcement should be visible to teachers (1) or not (0)
305
-	 * @param int    Whether the announcement should be visible to students (1) or not (0)
306
-	 * @param int    Whether the announcement should be visible to anonymous users (1) or not (0)
307
-	 * @param string The language for which the announvement should be shown. Leave null for all langages
308
-	 * @param int    Whether to send an e-mail to all users (1) or not (0)
309
-	 * @return mixed  insert_id on success, false on failure
310
-	 */
283
+        $current_access_url_id = 1;
284
+        if (api_is_multiple_url_enabled()) {
285
+            $current_access_url_id = api_get_current_access_url_id();
286
+        }
287
+        $sql .= " WHERE access_url_id = '$current_access_url_id' ";
288
+        $sql .= " ORDER BY date_start ASC";
289
+
290
+        $announcements = Database::query($sql);
291
+        $all_announcements = array();
292
+        while ($announcement = Database::fetch_object($announcements)) {
293
+            $all_announcements[] = $announcement;
294
+        }
295
+        return $all_announcements;
296
+    }
297
+
298
+    /**
299
+     * Adds an announcement to the database
300
+     * @param string Title of the announcement
301
+     * @param string Content of the announcement
302
+     * @param string Start date (YYYY-MM-DD HH:II: SS)
303
+     * @param string End date (YYYY-MM-DD HH:II: SS)
304
+     * @param int    Whether the announcement should be visible to teachers (1) or not (0)
305
+     * @param int    Whether the announcement should be visible to students (1) or not (0)
306
+     * @param int    Whether the announcement should be visible to anonymous users (1) or not (0)
307
+     * @param string The language for which the announvement should be shown. Leave null for all langages
308
+     * @param int    Whether to send an e-mail to all users (1) or not (0)
309
+     * @return mixed  insert_id on success, false on failure
310
+     */
311 311
     public static function add_announcement(
312 312
         $title,
313 313
         $content,
@@ -321,115 +321,115 @@  discard block
 block discarded – undo
321 321
         $add_to_calendar = false,
322 322
         $sendEmailTest = false
323 323
     ) {
324
-		$original_content = $content;
325
-		$a_dateS = explode(' ',$date_start);
326
-		$a_arraySD = explode('-',$a_dateS[0]);
327
-		$a_arraySH = explode(':',$a_dateS[1]);
328
-		$date_start_to_compare = array_merge($a_arraySD,$a_arraySH);
324
+        $original_content = $content;
325
+        $a_dateS = explode(' ',$date_start);
326
+        $a_arraySD = explode('-',$a_dateS[0]);
327
+        $a_arraySH = explode(':',$a_dateS[1]);
328
+        $date_start_to_compare = array_merge($a_arraySD,$a_arraySH);
329 329
 
330
-		$a_dateE = explode(' ',$date_end);
331
-		$a_arrayED = explode('-',$a_dateE[0]);
332
-		$a_arrayEH = explode(':',$a_dateE[1]);
333
-		$date_end_to_compare = array_merge($a_arrayED,$a_arrayEH);
330
+        $a_dateE = explode(' ',$date_end);
331
+        $a_arrayED = explode('-',$a_dateE[0]);
332
+        $a_arrayEH = explode(':',$a_dateE[1]);
333
+        $date_end_to_compare = array_merge($a_arrayED,$a_arrayEH);
334 334
 
335
-		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
335
+        $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
336 336
 
337
-		if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) {
338
-			Display :: display_normal_message(get_lang('InvalidStartDate'));
339
-			return false;
340
-		}
337
+        if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) {
338
+            Display :: display_normal_message(get_lang('InvalidStartDate'));
339
+            return false;
340
+        }
341 341
 
342
-		if (($date_end_to_compare[1] ||
342
+        if (($date_end_to_compare[1] ||
343 343
             $date_end_to_compare[2] ||
344 344
             $date_end_to_compare[0]) &&
345 345
             !checkdate($date_end_to_compare[1], $date_end_to_compare[2], $date_end_to_compare[0])
346 346
         ) {
347
-			Display :: display_normal_message(get_lang('InvalidEndDate'));
348
-			return false;
349
-		}
350
-		if (strlen(trim($title)) == 0) {
351
-			Display::display_normal_message(get_lang('InvalidTitle'));
352
-			return false;
353
-		}
354
-
355
-		$start = api_get_utc_datetime($date_start);
347
+            Display :: display_normal_message(get_lang('InvalidEndDate'));
348
+            return false;
349
+        }
350
+        if (strlen(trim($title)) == 0) {
351
+            Display::display_normal_message(get_lang('InvalidTitle'));
352
+            return false;
353
+        }
354
+
355
+        $start = api_get_utc_datetime($date_start);
356 356
         $end = api_get_utc_datetime($date_end);
357 357
 
358
-		//Fixing urls that are sent by email
359
-		//$content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content);
360
-		//$content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content);
361
-		$content = str_replace('src=\"'.api_get_path(REL_HOME_PATH), 'src=\"'.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content);
362
-		$content = str_replace('file='.api_get_path(REL_HOME_PATH), 'file='.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content);
363
-
364
-
365
-		$lang = is_null($lang) ? '' : $lang;
366
-
367
-		$current_access_url_id = 1;
368
-		if (api_is_multiple_url_enabled()) {
369
-			$current_access_url_id = api_get_current_access_url_id();
370
-		}
371
-
372
-		$params = [
373
-			'title' => $title,
374
-			'content' => $content,
375
-			'date_start' => $start,
376
-			'date_end' => $end,
377
-			'visible_teacher' => $visible_teacher,
378
-			'visible_student' => $visible_student,
379
-			'visible_guest' => $visible_guest,
380
-			'lang' => $lang,
381
-			'access_url_id' => $current_access_url_id,
382
-		];
383
-
384
-		$resultId = Database::insert($db_table, $params);
385
-
386
-		if ($resultId) {
387
-
388
-			if ($sendEmailTest) {
389
-				SystemAnnouncementManager::send_system_announcement_by_email(
390
-					$title,
391
-					$content,
392
-					$visible_teacher,
393
-					$visible_student,
394
-					$lang,
395
-					true
396
-				);
397
-			} else {
398
-				if ($send_mail == 1) {
399
-					SystemAnnouncementManager::send_system_announcement_by_email(
400
-						$title,
401
-						$content,
402
-						$visible_teacher,
403
-						$visible_student,
404
-						$lang
405
-					);
406
-				}
407
-			}
408
-
409
-			if ($add_to_calendar) {
410
-				$agenda = new Agenda();
411
-				$agenda->setType('admin');
412
-				$agenda->addEvent(
413
-					$date_start,
414
-					$date_end,
415
-					false,
416
-					$title,
417
-					$original_content
418
-				);
419
-			}
420
-
421
-			return $resultId;
422
-
423
-		}
424
-
425
-		return false;
426
-	}
358
+        //Fixing urls that are sent by email
359
+        //$content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content);
360
+        //$content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content);
361
+        $content = str_replace('src=\"'.api_get_path(REL_HOME_PATH), 'src=\"'.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content);
362
+        $content = str_replace('file='.api_get_path(REL_HOME_PATH), 'file='.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content);
363
+
364
+
365
+        $lang = is_null($lang) ? '' : $lang;
366
+
367
+        $current_access_url_id = 1;
368
+        if (api_is_multiple_url_enabled()) {
369
+            $current_access_url_id = api_get_current_access_url_id();
370
+        }
371
+
372
+        $params = [
373
+            'title' => $title,
374
+            'content' => $content,
375
+            'date_start' => $start,
376
+            'date_end' => $end,
377
+            'visible_teacher' => $visible_teacher,
378
+            'visible_student' => $visible_student,
379
+            'visible_guest' => $visible_guest,
380
+            'lang' => $lang,
381
+            'access_url_id' => $current_access_url_id,
382
+        ];
383
+
384
+        $resultId = Database::insert($db_table, $params);
385
+
386
+        if ($resultId) {
387
+
388
+            if ($sendEmailTest) {
389
+                SystemAnnouncementManager::send_system_announcement_by_email(
390
+                    $title,
391
+                    $content,
392
+                    $visible_teacher,
393
+                    $visible_student,
394
+                    $lang,
395
+                    true
396
+                );
397
+            } else {
398
+                if ($send_mail == 1) {
399
+                    SystemAnnouncementManager::send_system_announcement_by_email(
400
+                        $title,
401
+                        $content,
402
+                        $visible_teacher,
403
+                        $visible_student,
404
+                        $lang
405
+                    );
406
+                }
407
+            }
408
+
409
+            if ($add_to_calendar) {
410
+                $agenda = new Agenda();
411
+                $agenda->setType('admin');
412
+                $agenda->addEvent(
413
+                    $date_start,
414
+                    $date_end,
415
+                    false,
416
+                    $title,
417
+                    $original_content
418
+                );
419
+            }
420
+
421
+            return $resultId;
422
+
423
+        }
424
+
425
+        return false;
426
+    }
427 427
 
428 428
     /**
429
-    * Makes the announcement id visible only for groups in groups_array
430
-    * @param int announcement id
431
-    * @param array array of group id
432
-    **/
429
+     * Makes the announcement id visible only for groups in groups_array
430
+     * @param int announcement id
431
+     * @param array array of group id
432
+     **/
433 433
     public static function announcement_for_groups($announcement_id, $group_array)
434 434
     {
435 435
         $tbl_announcement_group = Database:: get_main_table(
@@ -463,10 +463,10 @@  discard block
 block discarded – undo
463 463
     }
464 464
 
465 465
     /**
466
-    * Gets the groups of this announce
467
-    * @param int announcement id
468
-    * @return array array of group id
469
-    **/
466
+     * Gets the groups of this announce
467
+     * @param int announcement id
468
+     * @return array array of group id
469
+     **/
470 470
     public static function get_announcement_groups($announcement_id)
471 471
     {
472 472
         $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
@@ -485,15 +485,15 @@  discard block
 block discarded – undo
485 485
         return $groups;
486 486
     }
487 487
 
488
-	/**
489
-	 * Updates an announcement to the database
490
-	 * @param integer $id      : id of the announcement
491
-	 * @param string  $title   : title of the announcement
492
-	 * @param string  $content : content of the announcement
493
-	 * @param array $date_start: start date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute)
494
-	 * @param array $date_end : end date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute)
495
-	 * @return	bool	True on success, false on failure
496
-	 */
488
+    /**
489
+     * Updates an announcement to the database
490
+     * @param integer $id      : id of the announcement
491
+     * @param string  $title   : title of the announcement
492
+     * @param string  $content : content of the announcement
493
+     * @param array $date_start: start date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute)
494
+     * @param array $date_end : end date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute)
495
+     * @return	bool	True on success, false on failure
496
+     */
497 497
     public static function update_announcement(
498 498
         $id,
499 499
         $title,
@@ -509,43 +509,43 @@  discard block
 block discarded – undo
509 509
     ) {
510 510
         $em = Database::getManager();
511 511
 
512
-		$a_dateS = explode(' ',$date_start);
513
-		$a_arraySD = explode('-',$a_dateS[0]);
514
-		$a_arraySH = explode(':',$a_dateS[1]);
515
-		$date_start_to_compare = array_merge($a_arraySD,$a_arraySH);
512
+        $a_dateS = explode(' ',$date_start);
513
+        $a_arraySD = explode('-',$a_dateS[0]);
514
+        $a_arraySH = explode(':',$a_dateS[1]);
515
+        $date_start_to_compare = array_merge($a_arraySD,$a_arraySH);
516 516
 
517
-		$a_dateE = explode(' ',$date_end);
518
-		$a_arrayED = explode('-',$a_dateE[0]);
519
-		$a_arrayEH = explode(':',$a_dateE[1]);
520
-		$date_end_to_compare = array_merge($a_arrayED,$a_arrayEH);
517
+        $a_dateE = explode(' ',$date_end);
518
+        $a_arrayED = explode('-',$a_dateE[0]);
519
+        $a_arrayEH = explode(':',$a_dateE[1]);
520
+        $date_end_to_compare = array_merge($a_arrayED,$a_arrayEH);
521 521
 
522 522
         $lang = is_null($lang) ? '' : $lang;
523 523
 
524
-		if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) {
525
-			Display :: display_normal_message(get_lang('InvalidStartDate'));
526
-			return false;
527
-		}
524
+        if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) {
525
+            Display :: display_normal_message(get_lang('InvalidStartDate'));
526
+            return false;
527
+        }
528 528
 
529
-		if (($date_end_to_compare[1] ||
529
+        if (($date_end_to_compare[1] ||
530 530
             $date_end_to_compare[2] ||
531 531
             $date_end_to_compare[0]) &&
532 532
             !checkdate($date_end_to_compare[1], $date_end_to_compare[2], $date_end_to_compare[0])
533 533
         ) {
534
-			Display :: display_normal_message(get_lang('InvalidEndDate'));
535
-			return false;
536
-		}
534
+            Display :: display_normal_message(get_lang('InvalidEndDate'));
535
+            return false;
536
+        }
537 537
 
538
-		if (strlen(trim($title)) == 0) {
539
-			Display::display_normal_message(get_lang('InvalidTitle'));
540
-			return false;
541
-		}
538
+        if (strlen(trim($title)) == 0) {
539
+            Display::display_normal_message(get_lang('InvalidTitle'));
540
+            return false;
541
+        }
542 542
 
543
-	    $start    = api_get_utc_datetime($date_start);
543
+        $start    = api_get_utc_datetime($date_start);
544 544
         $end      = api_get_utc_datetime($date_end);
545 545
 
546
-		//Fixing urls that are sent by email
547
-		//$content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content);
548
-		//$content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content);
546
+        //Fixing urls that are sent by email
547
+        //$content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content);
548
+        //$content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content);
549 549
         $content = str_replace('src=\"'.api_get_path(REL_HOME_PATH), 'src=\"'.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content);
550 550
         $content = str_replace('file='.api_get_path(REL_HOME_PATH), 'file='.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content);
551 551
 
@@ -595,84 +595,84 @@  discard block
 block discarded – undo
595 595
         $em->merge($announcement);
596 596
         $em->flush();
597 597
 
598
-		return true;
599
-	}
598
+        return true;
599
+    }
600 600
 
601
-	/**
602
-	 * Deletes an announcement
603
-	 * @param 	int $id The identifier of the announcement that should be
604
-	 * @return	bool	True on success, false on failure
605
-	 */
606
-	public static function delete_announcement($id)
601
+    /**
602
+     * Deletes an announcement
603
+     * @param 	int $id The identifier of the announcement that should be
604
+     * @return	bool	True on success, false on failure
605
+     */
606
+    public static function delete_announcement($id)
607 607
     {
608
-		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
609
-		$id = intval($id);
610
-		$sql = "DELETE FROM ".$db_table." WHERE id =".$id;
611
-		$res = Database::query($sql);
612
-		if ($res === false) {
613
-
614
-			return false;
615
-		}
616
-		return true;
617
-	}
618
-
619
-	/**
620
-	 * Gets an announcement
621
-	 * @param 	int		$id The identifier of the announcement that should be
622
-	 * @return	object	Object of class StdClass or the required class, containing the query result row
623
-	 */
624
-	public static function get_announcement($id)
608
+        $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
609
+        $id = intval($id);
610
+        $sql = "DELETE FROM ".$db_table." WHERE id =".$id;
611
+        $res = Database::query($sql);
612
+        if ($res === false) {
613
+
614
+            return false;
615
+        }
616
+        return true;
617
+    }
618
+
619
+    /**
620
+     * Gets an announcement
621
+     * @param 	int		$id The identifier of the announcement that should be
622
+     * @return	object	Object of class StdClass or the required class, containing the query result row
623
+     */
624
+    public static function get_announcement($id)
625 625
     {
626
-		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
627
-		$id = intval($id);
628
-		$sql = "SELECT * FROM ".$db_table." WHERE id = ".$id;
629
-		$announcement = Database::fetch_object(Database::query($sql));
630
-
631
-		return $announcement;
632
-	}
633
-
634
-	/**
635
-	 * Change the visibility of an announcement
636
-	 * @param 	int $announcement_id
637
-	 * @param 	int $user For who should the visibility be changed
626
+        $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
627
+        $id = intval($id);
628
+        $sql = "SELECT * FROM ".$db_table." WHERE id = ".$id;
629
+        $announcement = Database::fetch_object(Database::query($sql));
630
+
631
+        return $announcement;
632
+    }
633
+
634
+    /**
635
+     * Change the visibility of an announcement
636
+     * @param 	int $announcement_id
637
+     * @param 	int $user For who should the visibility be changed
638 638
      * (possible values are VISIBLE_TEACHER, VISIBLE_STUDENT, VISIBLE_GUEST)
639
-	 * @return 	bool	True on success, false on failure
640
-	 */
641
-	public static function set_visibility($announcement_id, $user, $visible)
639
+     * @return 	bool	True on success, false on failure
640
+     */
641
+    public static function set_visibility($announcement_id, $user, $visible)
642 642
     {
643
-		$db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
644
-		$visible = intval($visible);
645
-		$announcement_id = intval($announcement_id);
643
+        $db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
644
+        $visible = intval($visible);
645
+        $announcement_id = intval($announcement_id);
646 646
 
647 647
         if (!in_array($user, array(self::VISIBLE_GUEST, self::VISIBLE_STUDENT, self::VISIBLE_TEACHER))) {
648 648
             return false;
649 649
         }
650 650
 
651
-		$field = ($user == self::VISIBLE_TEACHER ? 'visible_teacher' : ($user == self::VISIBLE_STUDENT ? 'visible_student' : 'visible_guest'));
651
+        $field = ($user == self::VISIBLE_TEACHER ? 'visible_teacher' : ($user == self::VISIBLE_STUDENT ? 'visible_student' : 'visible_guest'));
652 652
 
653
-		$sql = "UPDATE ".$db_table." SET ".$field." = '".$visible."'
653
+        $sql = "UPDATE ".$db_table." SET ".$field." = '".$visible."'
654 654
 		        WHERE id='".$announcement_id."'";
655
-		$res = Database::query($sql);
656
-
657
-		if ($res === false) {
658
-			return false;
659
-		}
660
-
661
-		return true;
662
-	}
663
-
664
-	/**
665
-	 * Send a system announcement by e-mail to all teachers/students depending on parameters
666
-	 * @param	string	Title
667
-	 * @param	string	Content
668
-	 * @param	int		Whether to send to all teachers (1) or not (0)
669
-	 * @param	int		Whether to send to all students (1) or not (0)
670
-	 * @param	string	Language (optional, considered for all languages if left empty)
655
+        $res = Database::query($sql);
656
+
657
+        if ($res === false) {
658
+            return false;
659
+        }
660
+
661
+        return true;
662
+    }
663
+
664
+    /**
665
+     * Send a system announcement by e-mail to all teachers/students depending on parameters
666
+     * @param	string	Title
667
+     * @param	string	Content
668
+     * @param	int		Whether to send to all teachers (1) or not (0)
669
+     * @param	int		Whether to send to all students (1) or not (0)
670
+     * @param	string	Language (optional, considered for all languages if left empty)
671 671
      * @return  bool    True if the message was sent or there was no destination matching. False on database or e-mail sending error.
672
-	 */
673
-	public static function send_system_announcement_by_email($title, $content, $teacher, $student, $language = null, $sendEmailTest = false)
672
+     */
673
+    public static function send_system_announcement_by_email($title, $content, $teacher, $student, $language = null, $sendEmailTest = false)
674 674
     {
675
-		global $charset;
675
+        global $charset;
676 676
 
677 677
         $title = api_html_entity_decode(stripslashes($title), ENT_QUOTES, $charset);
678 678
         $content = api_html_entity_decode(stripslashes(str_replace(array('\r\n', '\n', '\r'),'', $content)), ENT_QUOTES, $charset);
@@ -691,22 +691,22 @@  discard block
 block discarded – undo
691 691
         }
692 692
 
693 693
         if ($teacher <> 0 AND $student == 0) {
694
-			$sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '1' ";
695
-		}
694
+            $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '1' ";
695
+        }
696 696
 
697
-		if ($teacher == 0 AND $student <> 0) {
698
-			$sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '5' ";
699
-		}
697
+        if ($teacher == 0 AND $student <> 0) {
698
+            $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '5' ";
699
+        }
700 700
 
701
-		if ($teacher<> 0 AND $student <> 0) {
702
-			$sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE 1 = 1 ";
703
-		}
701
+        if ($teacher<> 0 AND $student <> 0) {
702
+            $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE 1 = 1 ";
703
+        }
704 704
 
705
-		if (!empty($language)) { //special condition because language was already treated for SQL insert before
706
-			$sql .= " AND language = '".Database::escape_string($language)."' ";
707
-		}
705
+        if (!empty($language)) { //special condition because language was already treated for SQL insert before
706
+            $sql .= " AND language = '".Database::escape_string($language)."' ";
707
+        }
708 708
 
709
-		if (api_is_multiple_url_enabled()) {
709
+        if (api_is_multiple_url_enabled()) {
710 710
             $sql .= " AND access_url_id = '".$current_access_url_id."' ";
711 711
         }
712 712
 
@@ -716,25 +716,25 @@  discard block
 block discarded – undo
716 716
         // Expiration date
717 717
         $sql .= " AND (expiration_date = '' OR expiration_date IS NULL OR expiration_date > '$now') ";
718 718
 
719
-		if ((empty($teacher) or $teacher == '0') AND  (empty($student) or $student == '0')) {
720
-			return true;
721
-		}
719
+        if ((empty($teacher) or $teacher == '0') AND  (empty($student) or $student == '0')) {
720
+            return true;
721
+        }
722 722
 
723
-		$result = Database::query($sql);
724
-		if ($result === false) {
725
-			return false;
726
-		}
723
+        $result = Database::query($sql);
724
+        if ($result === false) {
725
+            return false;
726
+        }
727 727
 
728 728
         $message_sent = false;
729 729
 
730
-		while ($row = Database::fetch_array($result,'ASSOC')) {
730
+        while ($row = Database::fetch_array($result,'ASSOC')) {
731 731
             MessageManager::send_message_simple($row['user_id'], $title, $content);
732 732
             $message_sent = true;
733
-		}
734
-		return $message_sent; //true if at least one e-mail was sent
735
-	}
733
+        }
734
+        return $message_sent; //true if at least one e-mail was sent
735
+    }
736 736
 
737
-	/**
737
+    /**
738 738
      * Displays announcements as an slideshow
739 739
      * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER
740 740
      * @param int $id The identifier of the announcement to display
Please login to merge, or discard this patch.
plugin/customfooter/lib/customfooter_plugin.class.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
         parent::__construct('1.1', 'Valery Fremaux');
27 27
     }
28 28
 
29
-	function pix_url($pixname, $size = 16) {
29
+    function pix_url($pixname, $size = 16) {
30 30
         global $_configuration;
31 31
 
32 32
         if (file_exists($_configuration['root_sys'].'/plugin/customplugin/pix/'.$pixname.'.png')){
Please login to merge, or discard this patch.
main/document/create_paint.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -50,26 +50,26 @@  discard block
 block discarded – undo
50 50
 // Please, do not modify this dirname formatting
51 51
 
52 52
 if (strstr($dir, '..')) {
53
-	$dir = '/';
53
+    $dir = '/';
54 54
 }
55 55
 
56 56
 if ($dir[0] == '.') {
57
-	$dir = substr($dir, 1);
57
+    $dir = substr($dir, 1);
58 58
 }
59 59
 
60 60
 if ($dir[0] != '/') {
61
-	$dir = '/'.$dir;
61
+    $dir = '/'.$dir;
62 62
 }
63 63
 
64 64
 if ($dir[strlen($dir) - 1] != '/') {
65
-	$dir .= '/';
65
+    $dir .= '/';
66 66
 }
67 67
 
68 68
 $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
69 69
 
70 70
 if (!is_dir($filepath)) {
71
-	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
72
-	$dir = '/';
71
+    $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
72
+    $dir = '/';
73 73
 }
74 74
 
75 75
 $groupId = api_get_group_id();
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 }
98 98
 
99 99
 if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] ||
100
-	DocumentManager::is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id()))
100
+    DocumentManager::is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id()))
101 101
 ) {
102 102
     api_not_allowed(true);
103 103
 }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
 // Interbreadcrumb for the current directory root path
116 116
 if (empty($document_data['parents'])) {
117
-	$interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']);
117
+    $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']);
118 118
 } else {
119 119
     foreach ($document_data['parents'] as $document_sub_data) {
120 120
         $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']);
@@ -147,17 +147,17 @@  discard block
 block discarded – undo
147 147
 $locktitle="false";
148 148
 
149 149
 if ($_SERVER['HTTP_HOST']=="localhost") {
150
-	$path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml';
151
-	if (!file_exists($path_and_file)) {
152
-		$crossdomain='<?xml version="1.0"?>
150
+    $path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml';
151
+    if (!file_exists($path_and_file)) {
152
+        $crossdomain='<?xml version="1.0"?>
153 153
 			<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
154 154
 			<cross-domain-policy>
155 155
 				<allow-access-from domain="cdn.pixlr.com" />
156 156
 				<site-control permitted-cross-domain-policies="master-only"/>
157 157
 				<allow-http-request-headers-from domain="cnd.pixlr.com" headers="*" secure="true"/>
158 158
 			</cross-domain-policy>';//more open domain="*"
159
-		@file_put_contents($path_and_file, $crossdomain);
160
-	}
159
+        @file_put_contents($path_and_file, $crossdomain);
160
+    }
161 161
     $credentials = "true";
162 162
 } else {
163 163
     $credentials = "false";
Please login to merge, or discard this patch.
main/gradebook/lib/fe/resulttable.class.php 1 patch
Indentation   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -10,166 +10,166 @@
 block discarded – undo
10 10
  */
11 11
 class ResultTable extends SortableTable
12 12
 {
13
-	private $datagen;
14
-	private $evaluation;
15
-	private $allresults;
16
-	private $iscourse;
17
-
18
-	/**
19
-	 * Constructor
20
-	 */
13
+    private $datagen;
14
+    private $evaluation;
15
+    private $allresults;
16
+    private $iscourse;
17
+
18
+    /**
19
+     * Constructor
20
+     */
21 21
     public function __construct($evaluation, $results = array(), $iscourse, $addparams = null,$forprint = false)
22
-	{
23
-    	parent :: __construct('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1);
24
-
25
-		$this->datagen = new ResultsDataGenerator($evaluation, $results, true);
26
-
27
-		$this->evaluation = $evaluation;
28
-		$this->iscourse = $iscourse;
29
-		$this->forprint = $forprint;
30
-
31
-		if (isset ($addparams))  {
32
-			$this->set_additional_parameters($addparams);
33
-		}
34
-		$scoredisplay = ScoreDisplay :: instance();
35
-		$column= 0;
36
-		if ($this->iscourse == '1') {
37
-			$this->set_header($column++, '', false);
38
-			$this->set_form_actions(array (
39
-					'delete' => get_lang('Delete')
40
-			));
41
-		}
42
-		if (api_is_western_name_order()) {
43
-			$this->set_header($column++, get_lang('FirstName'));
44
-			$this->set_header($column++, get_lang('LastName'));
45
-		} else {
46
-			$this->set_header($column++, get_lang('LastName'));
47
-			$this->set_header($column++, get_lang('FirstName'));
48
-		}
49
-		$this->set_header($column++, get_lang('Score'));
50
-		if ($scoredisplay->is_custom()) {
51
-			$this->set_header($column++, get_lang('Display'));
52
-		}
53
-		if (!$this->forprint) {
54
-			$this->set_header($column++, get_lang('Modify'),false);
55
-		}
22
+    {
23
+        parent :: __construct('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1);
24
+
25
+        $this->datagen = new ResultsDataGenerator($evaluation, $results, true);
26
+
27
+        $this->evaluation = $evaluation;
28
+        $this->iscourse = $iscourse;
29
+        $this->forprint = $forprint;
30
+
31
+        if (isset ($addparams))  {
32
+            $this->set_additional_parameters($addparams);
33
+        }
34
+        $scoredisplay = ScoreDisplay :: instance();
35
+        $column= 0;
36
+        if ($this->iscourse == '1') {
37
+            $this->set_header($column++, '', false);
38
+            $this->set_form_actions(array (
39
+                    'delete' => get_lang('Delete')
40
+            ));
41
+        }
42
+        if (api_is_western_name_order()) {
43
+            $this->set_header($column++, get_lang('FirstName'));
44
+            $this->set_header($column++, get_lang('LastName'));
45
+        } else {
46
+            $this->set_header($column++, get_lang('LastName'));
47
+            $this->set_header($column++, get_lang('FirstName'));
48
+        }
49
+        $this->set_header($column++, get_lang('Score'));
50
+        if ($scoredisplay->is_custom()) {
51
+            $this->set_header($column++, get_lang('Display'));
52
+        }
53
+        if (!$this->forprint) {
54
+            $this->set_header($column++, get_lang('Modify'),false);
55
+        }
56 56
     }
57 57
 
58 58
 
59
-	/**
60
-	 * Function used by SortableTable to get total number of items in the table
61
-	 */
62
-	public function get_total_number_of_items ()
59
+    /**
60
+     * Function used by SortableTable to get total number of items in the table
61
+     */
62
+    public function get_total_number_of_items ()
63 63
     {
64
-		return $this->datagen->get_total_results_count();
65
-	}
66
-
67
-	/**
68
-	 * Function used by SortableTable to generate the data to display
69
-	 */
70
-	public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) {
71
-
72
-		$is_western_name_order = api_is_western_name_order();
73
-		$scoredisplay = ScoreDisplay :: instance();
74
-
75
-		// determine sorting type
76
-		$col_adjust = $this->iscourse == '1' ? 1 : 0;
77
-
78
-		switch ($this->column) {
79
-			// first name or last name
80
-			case (0 + $col_adjust):
81
-				if ($is_western_name_order) {
82
-					$sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME;
83
-				} else {
84
-					$sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME;
85
-				}
86
-				break;
64
+        return $this->datagen->get_total_results_count();
65
+    }
66
+
67
+    /**
68
+     * Function used by SortableTable to generate the data to display
69
+     */
70
+    public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) {
71
+
72
+        $is_western_name_order = api_is_western_name_order();
73
+        $scoredisplay = ScoreDisplay :: instance();
74
+
75
+        // determine sorting type
76
+        $col_adjust = $this->iscourse == '1' ? 1 : 0;
77
+
78
+        switch ($this->column) {
87 79
             // first name or last name
88
-			case (1 + $col_adjust):
89
-				if ($is_western_name_order) {
90
-					$sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME;
91
-				} else {
92
-					$sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME;
93
-				}
94
-				break;
80
+            case (0 + $col_adjust):
81
+                if ($is_western_name_order) {
82
+                    $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME;
83
+                } else {
84
+                    $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME;
85
+                }
86
+                break;
87
+            // first name or last name
88
+            case (1 + $col_adjust):
89
+                if ($is_western_name_order) {
90
+                    $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME;
91
+                } else {
92
+                    $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME;
93
+                }
94
+                break;
95 95
             //Score
96
-			case (2 + $col_adjust):
97
-				$sorting = ResultsDataGenerator :: RDG_SORT_SCORE;
98
-				break;
99
-			case (3 + $col_adjust):
100
-				$sorting = ResultsDataGenerator :: RDG_SORT_MASK;
101
-				break;
102
-		}
103
-
104
-		if ($this->direction == 'DESC') {
105
-			$sorting |= ResultsDataGenerator :: RDG_SORT_DESC;
106
-		} else {
107
-			$sorting |= ResultsDataGenerator :: RDG_SORT_ASC;
108
-		}
109
-
110
-		$data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
111
-
112
-		// generate the data to display
113
-		$sortable_data = array();
114
-		foreach ($data_array as $item) {
115
-			$row = array ();
116
-			if ($this->iscourse == '1') {
117
-				 $row[] = $item['result_id'];
118
-			}
119
-			if ($is_western_name_order) {
120
-				$row[] = $item['firstname'];
121
-				$row[] = $item['lastname'];
122
-			} else {
123
-				$row[] = $item['lastname'];
124
-				$row[] = $item['firstname'];
125
-			}
126
-
127
-			$row[] =  Display::bar_progress($item['percentage_score'], false, $item['score']);
96
+            case (2 + $col_adjust):
97
+                $sorting = ResultsDataGenerator :: RDG_SORT_SCORE;
98
+                break;
99
+            case (3 + $col_adjust):
100
+                $sorting = ResultsDataGenerator :: RDG_SORT_MASK;
101
+                break;
102
+        }
103
+
104
+        if ($this->direction == 'DESC') {
105
+            $sorting |= ResultsDataGenerator :: RDG_SORT_DESC;
106
+        } else {
107
+            $sorting |= ResultsDataGenerator :: RDG_SORT_ASC;
108
+        }
109
+
110
+        $data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
111
+
112
+        // generate the data to display
113
+        $sortable_data = array();
114
+        foreach ($data_array as $item) {
115
+            $row = array ();
116
+            if ($this->iscourse == '1') {
117
+                    $row[] = $item['result_id'];
118
+            }
119
+            if ($is_western_name_order) {
120
+                $row[] = $item['firstname'];
121
+                $row[] = $item['lastname'];
122
+            } else {
123
+                $row[] = $item['lastname'];
124
+                $row[] = $item['firstname'];
125
+            }
126
+
127
+            $row[] =  Display::bar_progress($item['percentage_score'], false, $item['score']);
128 128
             //$row[] =  Display::bar_progress($item['percentage_score'], true);
129
-			if ($scoredisplay->is_custom()) {
130
-				$row[] = $item['display'];
131
-			}
132
-			if (!$this->forprint) {
133
-				$row[] = $this->build_edit_column ($item);
134
-			}
135
-			$sortable_data[] = $row;
136
-		}
137
-
138
-		return $sortable_data;
139
-	}
140
-
141
-	private function build_edit_column ($item)
142
-	{
143
-		$status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
144
-		$locked_status = $this->evaluation->get_locked();
145
-		if (api_is_allowed_to_edit(null, true) && $locked_status == 0) {
146
-			//api_is_course_admin()
147
-			$edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'.
148
-				Display::return_icon('edit.png', get_lang('Modify'),'','22').'</a>';
149
-			$edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'.
150
-				Display::return_icon('delete.png', get_lang('Delete'),'','22').'</a>';
151
-		}
152
-
153
-		if ($this->evaluation->get_course_code() == null) {
154
-			$edit_column .= '&nbsp;<a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">';
155
-			$edit_column .= Display::return_icon('delete.png', get_lang('Delete'));
156
-			$edit_column .= '</a>';
157
-		    $edit_column .= '&nbsp;<a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&'.api_get_cidreq().'">';
158
-			$edit_column .= Display::return_icon('statistics.gif', get_lang('Statistics'));
159
-		    $edit_column .= '</a>';
160
-		}
161
-
162
-		// Evaluation's origin is a link
163
-		if ($this->evaluation->get_category_id() < 0) {
164
-			$link = LinkFactory::get_evaluation_link($this->evaluation->get_id());
165
-			$doc_url = $link->get_view_url($item['id']);
166
-
167
-			if ($doc_url != null) {
168
-				$edit_column .= '&nbsp;<a href="'. $doc_url . '" target="_blank">';
169
-				$edit_column .= Display::return_icon('link.gif', get_lang('OpenDocument')).'</a>';
170
-			}
171
-		}
172
-
173
-		return $edit_column;
174
-	}
129
+            if ($scoredisplay->is_custom()) {
130
+                $row[] = $item['display'];
131
+            }
132
+            if (!$this->forprint) {
133
+                $row[] = $this->build_edit_column ($item);
134
+            }
135
+            $sortable_data[] = $row;
136
+        }
137
+
138
+        return $sortable_data;
139
+    }
140
+
141
+    private function build_edit_column ($item)
142
+    {
143
+        $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
144
+        $locked_status = $this->evaluation->get_locked();
145
+        if (api_is_allowed_to_edit(null, true) && $locked_status == 0) {
146
+            //api_is_course_admin()
147
+            $edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'.
148
+                Display::return_icon('edit.png', get_lang('Modify'),'','22').'</a>';
149
+            $edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'.
150
+                Display::return_icon('delete.png', get_lang('Delete'),'','22').'</a>';
151
+        }
152
+
153
+        if ($this->evaluation->get_course_code() == null) {
154
+            $edit_column .= '&nbsp;<a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">';
155
+            $edit_column .= Display::return_icon('delete.png', get_lang('Delete'));
156
+            $edit_column .= '</a>';
157
+            $edit_column .= '&nbsp;<a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&'.api_get_cidreq().'">';
158
+            $edit_column .= Display::return_icon('statistics.gif', get_lang('Statistics'));
159
+            $edit_column .= '</a>';
160
+        }
161
+
162
+        // Evaluation's origin is a link
163
+        if ($this->evaluation->get_category_id() < 0) {
164
+            $link = LinkFactory::get_evaluation_link($this->evaluation->get_id());
165
+            $doc_url = $link->get_view_url($item['id']);
166
+
167
+            if ($doc_url != null) {
168
+                $edit_column .= '&nbsp;<a href="'. $doc_url . '" target="_blank">';
169
+                $edit_column .= Display::return_icon('link.gif', get_lang('OpenDocument')).'</a>';
170
+            }
171
+        }
172
+
173
+        return $edit_column;
174
+    }
175 175
 }
Please login to merge, or discard this patch.
main/document/edit_paint.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -61,44 +61,44 @@  discard block
 block discarded – undo
61 61
 /* Please, do not modify this dirname formatting */
62 62
 
63 63
 if (strstr($dir, '..')) {
64
-	$dir = '/';
64
+    $dir = '/';
65 65
 }
66 66
 
67 67
 if ($dir[0] == '.') {
68
-	$dir = substr($dir, 1);
68
+    $dir = substr($dir, 1);
69 69
 }
70 70
 
71 71
 if ($dir[0] != '/') {
72
-	$dir = '/'.$dir;
72
+    $dir = '/'.$dir;
73 73
 }
74 74
 
75 75
 if ($dir[strlen($dir) - 1] != '/') {
76
-	$dir .= '/';
76
+    $dir .= '/';
77 77
 }
78 78
 
79 79
 $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
80 80
 
81 81
 if (!is_dir($filepath)) {
82
-	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
83
-	$dir = '/';
82
+    $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
83
+    $dir = '/';
84 84
 }
85 85
 
86 86
 //groups //TODO:clean
87 87
 if (!empty($groupId)) {
88
-	$interbreadcrumb[] = array(
89
-		'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
90
-		'name' => get_lang('GroupSpace'),
91
-	);
92
-	$group_document = true;
93
-	$noPHP_SELF = true;
88
+    $interbreadcrumb[] = array(
89
+        'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
90
+        'name' => get_lang('GroupSpace'),
91
+    );
92
+    $group_document = true;
93
+    $noPHP_SELF = true;
94 94
 }
95 95
 
96 96
 $is_certificate_mode = DocumentManager::is_certificate_mode($dir);
97 97
 
98 98
 if (!$is_certificate_mode)
99
-	$interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents'));
99
+    $interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents'));
100 100
 else
101
-	$interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
101
+    $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
102 102
 
103 103
 // Interbreadcrumb for the current directory root path
104 104
 if (empty($document_data['parents'])) {
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 }
114 114
 
115 115
 $is_allowedToEdit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights'] ||
116
-	DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id);
116
+    DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id);
117 117
 
118 118
 if (!$is_allowedToEdit) {
119
-	api_not_allowed(true);
119
+    api_not_allowed(true);
120 120
 }
121 121
 
122 122
 Event::event_access_tool(TOOL_DOCUMENT);
@@ -148,21 +148,21 @@  discard block
 block discarded – undo
148 148
 $locktitle="false";
149 149
 
150 150
 if ($_SERVER['HTTP_HOST']=="localhost") {
151
-	$path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml';
152
-	if (!file_exists($path_and_file)) {
153
-		$crossdomain='<?xml version="1.0"?>
151
+    $path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml';
152
+    if (!file_exists($path_and_file)) {
153
+        $crossdomain='<?xml version="1.0"?>
154 154
 			<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
155 155
 			<cross-domain-policy>
156 156
 				<allow-access-from domain="cdn.pixlr.com" />
157 157
 				<site-control permitted-cross-domain-policies="master-only"/>
158 158
 				<allow-http-request-headers-from domain="cnd.pixlr.com" headers="*" secure="true"/>
159 159
 			</cross-domain-policy>';//more open domain="*"
160
-		@file_put_contents($path_and_file, $crossdomain);
161
-	}
162
-	$credentials="true";
160
+        @file_put_contents($path_and_file, $crossdomain);
161
+    }
162
+    $credentials="true";
163 163
 }
164 164
 else {
165
-	$credentials="false";
165
+    $credentials="false";
166 166
 }
167 167
 
168 168
 //make temp images
@@ -175,23 +175,23 @@  discard block
 block discarded – undo
175 175
 $htaccess=api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess';
176 176
 if (!file_exists($htaccess)) {
177 177
 
178
-	$htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes";
178
+    $htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes";
179 179
 
180
-	$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w');
181
-	if ($fp) {
182
-		fwrite($fp, $htaccess_content);
183
-		fclose($fp);
184
-	}
180
+    $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w');
181
+    if ($fp) {
182
+        fwrite($fp, $htaccess_content);
183
+        fclose($fp);
184
+    }
185 185
 }
186 186
 
187 187
 $html_index=api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html';
188 188
 if (!file_exists($html_index)) {
189
-	$html_index_content="<html><head></head><body></body></html>";
190
-	$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w');
191
-	if ($fp) {
192
-		fwrite($fp, $html_index_content);
193
-		fclose($fp);
194
-	}
189
+    $html_index_content="<html><head></head><body></body></html>";
190
+    $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w');
191
+    if ($fp) {
192
+        fwrite($fp, $html_index_content);
193
+        fclose($fp);
194
+    }
195 195
 }
196 196
 
197 197
 //encript temp name file
Please login to merge, or discard this patch.
custompages/first_login-dist.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * Security checks
15 15
  */
16 16
 if (! isset($_SESSION['conditional_login']['uid']))
17
-  die("Not Authorised");
17
+    die("Not Authorised");
18 18
 
19 19
 if (isset($_POST['password'])) {
20 20
     $u = api_get_user_info($_SESSION['conditional_login']['uid']);
@@ -27,26 +27,26 @@  discard block
 block discarded – undo
27 27
         exit();
28 28
     }
29 29
     $password = $_POST['password'];
30
-	$updated = UserManager::update_user(
31
-		$u['user_id'],
32
-		$u['firstname'],
33
-		$u['lastname'],
34
-		$u['username'],
35
-		$password,
36
-		$u['auth_source'],
37
-		$u['email'],
38
-		$u['status'],
39
-		$u['official_code'],
40
-		$u['phone'],
41
-		$u['picture_uri'],
42
-		$u['expiration_date'],
43
-		$u['active'],
44
-		$u['creator_id'],
45
-		$u['hr_dept_id'],
46
-		null,
47
-		$u['language'],
48
-		''
49
-	);
30
+    $updated = UserManager::update_user(
31
+        $u['user_id'],
32
+        $u['firstname'],
33
+        $u['lastname'],
34
+        $u['username'],
35
+        $password,
36
+        $u['auth_source'],
37
+        $u['email'],
38
+        $u['status'],
39
+        $u['official_code'],
40
+        $u['phone'],
41
+        $u['picture_uri'],
42
+        $u['expiration_date'],
43
+        $u['active'],
44
+        $u['creator_id'],
45
+        $u['hr_dept_id'],
46
+        null,
47
+        $u['language'],
48
+        ''
49
+    );
50 50
 
51 51
     if ($updated !== false) {
52 52
         UserManager::update_extra_field_value($u['user_id'], 'already_logged_in', 'true');
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 		<div id="changepassword-form-box" class="form-box">
105 105
       <div class="info"> <?php echo custompages_get_lang('FirstLoginChangePassword');?> </div>
106 106
 		<?php if (isset($error_message)) {
107
-			echo '<div id="changepassword-form-error" class="form-error">'.$error_message.'</div>';
108
-		}?>
107
+            echo '<div id="changepassword-form-error" class="form-error">'.$error_message.'</div>';
108
+        }?>
109 109
 			<form id="changepassword-form" class="form" method="post">
110 110
 				<div>
111 111
           <label for="password">*<?php echo custompages_get_lang('Password');?></label>
Please login to merge, or discard this patch.
main/auth/ldap/authldap.php 1 patch
Indentation   +20 added lines, -21 removed lines patch added patch discarded remove patch
@@ -46,10 +46,9 @@  discard block
 block discarded – undo
46 46
     - Universite Jean Monet (J Dubois / Michel Courbon)
47 47
     - Michel Panckoucke for reporting and fixing a bug
48 48
     - Patrick Cool: fixing security hole
49
-
50
-    *    @author Roan Embrechts
51
-    *    @version 3.0
52
-    *    @package chamilo.auth.ldap
49
+ *    @author Roan Embrechts
50
+ *    @version 3.0
51
+ *    @package chamilo.auth.ldap
53 52
  * Note:
54 53
  * If you are using a firewall, you might need to check port 389 is open in
55 54
  * order for Chamilo to communicate with the LDAP server.
@@ -211,8 +210,8 @@  discard block
 block discarded – undo
211 210
     $language = api_get_setting('platformLanguage');
212 211
     if (empty($language)) { $language = 'english'; }
213 212
     $_userId = UserManager::create_user($prenom, $nom, $status,
214
-                     $email, $uname, $password, $official_code,
215
-                     $language,'', '', 'ldap');
213
+                        $email, $uname, $password, $official_code,
214
+                        $language,'', '', 'ldap');
216 215
 
217 216
     //echo "new user added to Chamilo, id = $_userId";
218 217
 
@@ -271,7 +270,7 @@  discard block
 block discarded – undo
271 270
         // Open anonymous LDAP connection
272 271
         $result=false;
273 272
         $ldap_bind_res = ldap_handle_bind($ds,$result);
274
-	// Executing the search with the $filter parametr
273
+    // Executing the search with the $filter parametr
275 274
         //error_log('Searching for '.$filter.' on LDAP server',0);
276 275
         $sr=ldap_search($ds,$ldap_basedn,$filter);
277 276
         $info = ldap_get_entries($ds, $sr);
@@ -564,35 +563,35 @@  discard block
 block discarded – undo
564 563
         foreach ($UserList as $enreg_user) {
565 564
             $enreg_user = (int) $enreg_user;
566 565
             Database::query("INSERT IGNORE ".
567
-              " INTO $tbl_session_rel_course_rel_user ".
568
-              "(session_id,c_id,user_id) VALUES ".
569
-              "('$id_session','$enreg_course','$enreg_user')");
566
+                " INTO $tbl_session_rel_course_rel_user ".
567
+                "(session_id,c_id,user_id) VALUES ".
568
+                "('$id_session','$enreg_course','$enreg_user')");
570 569
         }
571 570
         $sql = "SELECT COUNT(user_id) as nbUsers ".
572
-               " FROM $tbl_session_rel_course_rel_user " .
573
-               " WHERE session_id='$id_session' ".
574
-               " AND c_id='$enreg_course'";
571
+                " FROM $tbl_session_rel_course_rel_user " .
572
+                " WHERE session_id='$id_session' ".
573
+                " AND c_id='$enreg_course'";
575 574
         $rs = Database::query($sql);
576 575
         list($nbr_users) = Database::fetch_array($rs);
577 576
         Database::query("UPDATE $tbl_session_rel_course  ".
578
-               " SET nbr_users=$nbr_users " .
579
-               " WHERE session_id='$id_session' ".
580
-               " AND c_id='$enreg_course'");
577
+                " SET nbr_users=$nbr_users " .
578
+                " WHERE session_id='$id_session' ".
579
+                " AND c_id='$enreg_course'");
581 580
     }
582 581
     foreach ($UserList as $enreg_user) {
583 582
         $enreg_user = (int) $enreg_user;
584 583
         Database::query("INSERT IGNORE INTO $tbl_session_rel_user ".
585
-               " (session_id, user_id, registered_at) " .
586
-               " VALUES('$id_session','$enreg_user', '" . api_get_utc_datetime() . "')");
584
+                " (session_id, user_id, registered_at) " .
585
+                " VALUES('$id_session','$enreg_user', '" . api_get_utc_datetime() . "')");
587 586
     }
588 587
     // We update the number of users in the session
589 588
     $sql = "SELECT COUNT(user_id) as nbUsers FROM $tbl_session_rel_user ".
590
-           " WHERE session_id='$id_session' ".
591
-           " AND relation_type<>".SESSION_RELATION_TYPE_RRHH." ";
589
+            " WHERE session_id='$id_session' ".
590
+            " AND relation_type<>".SESSION_RELATION_TYPE_RRHH." ";
592 591
     $rs = Database::query($sql);
593 592
     list($nbr_users) = Database::fetch_array($rs);
594 593
     Database::query("UPDATE $tbl_session SET nbr_users=$nbr_users ".
595
-           " WHERE id='$id_session'");
594
+            " WHERE id='$id_session'");
596 595
 }
597 596
 
598 597
 function syncro_users() {
Please login to merge, or discard this patch.