Completed
Push — 1.11.x ( c69862...ecc799 )
by José
207:40 queued 172:00
created
main/inc/lib/upload.xajax.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 include(dirname(__FILE__).'/../global.inc.php');
9 9
 $xajax_upload = new Xajax();
10
-$xajax_upload -> registerFunction ('updateProgress');
10
+$xajax_upload -> registerFunction('updateProgress');
11 11
 $xajax_upload -> processRequests();
12 12
 
13 13
 /**
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 
20 20
 	$objResponse = new xajaxResponse();
21 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) {
22
+	$percent = intval($ul_info['bytes_uploaded'] * 100 / $ul_info['bytes_total']);
23
+	if ($waitAfterupload && $ul_info['est_sec'] < 2) {
24 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'));
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 27
 		$objResponse->addScript('clearInterval("myUpload.__progress_bar_interval")');
28 28
 	}
29 29
 	$objResponse->addAssign($div_id.'_label', 'innerHTML', get_lang('UploadFile').' : '.$percent.' %');
Please login to merge, or discard this patch.
main/tracking/lp_results_by_user.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	$export_to_csv = true;
27 27
 }
28 28
 
29
-if (api_is_platform_admin() ) {
29
+if (api_is_platform_admin()) {
30 30
 	$global = true;
31 31
 } else {
32 32
 	$global = false;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 if ($global) {
36 36
 	$temp_course_list = CourseManager :: get_courses_list();
37
-	foreach($temp_course_list  as $temp_course_item) {
37
+	foreach ($temp_course_list  as $temp_course_item) {
38 38
 		$course_item = CourseManager ::get_course_information($temp_course_item['code']);
39 39
         $course_list[] = array(
40 40
             'code' => $course_item['code'],
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 $new_course_select = array();
50
-foreach($course_list as $data) {
50
+foreach ($course_list as $data) {
51 51
     $new_course_select[$data['code']] = $data['title'];
52 52
 }
53 53
 
54 54
 $form = new FormValidator('search_simple', 'POST', '', '', null, false);
55
-$form->addElement('select','course_code',get_lang('Course'), $new_course_select);
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 59
 	//Get exam lists
60 60
     $course_id = api_get_course_int_id();
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	                 ORDER BY quiz.title ASC";
65 65
 	$resultExercices = Database::query($sqlExercices);
66 66
 	$exercise_list[0] = get_lang('All');
67
-	while($a_exercices = Database::fetch_array($resultExercices)) {
67
+	while ($a_exercices = Database::fetch_array($resultExercices)) {
68 68
 		$exercise_list[$a_exercices['id']] = $a_exercices['title'];
69 69
 	}
70 70
 	$form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
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').'
90
-                &nbsp;'.get_lang('ExportAsCSV').'</a>' .
90
+                &nbsp;'.get_lang('ExportAsCSV').'</a>'.
91 91
                 '<a href="javascript: void(0);" onclick="javascript: window.print()">
92 92
                 '.Display::return_icon('printmgr.gif').'
93 93
                 &nbsp;'.get_lang('Print').'</a>
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
         }
102 102
 		$menu_items[] = get_lang('ExamTracking');
103 103
 		$nb_menu_items = count($menu_items);
104
-		if($nb_menu_items>1) {
105
-			foreach($menu_items as $key=> $item) {
104
+		if ($nb_menu_items > 1) {
105
+			foreach ($menu_items as $key=> $item) {
106 106
 				echo $item;
107
-				if($key!=$nb_menu_items-1) {
107
+				if ($key != $nb_menu_items - 1) {
108 108
 					echo ' | ';
109 109
 				}
110 110
 			}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 $session_id = 0;
129 129
 $user_list = array();
130 130
 // Getting course list
131
-foreach ($course_list  as $current_course ) {
131
+foreach ($course_list  as $current_course) {
132 132
 	$course_info = api_get_course_info($current_course['code']);
133 133
 	$_course = $course_info;
134 134
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 }
163 163
 
164 164
 if (!empty($user_list)) {
165
-    foreach($user_list as $user_id) {
165
+    foreach ($user_list as $user_id) {
166 166
         $user_data = api_get_user_info($user_id);
167 167
 		$user_list_name[$user_id] = api_get_person_name(
168 168
 			$user_data['firstname'],
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		);
171 171
     }
172 172
 }
173
-$export_array =  array();
173
+$export_array = array();
174 174
 if (!empty($main_result)) {
175 175
 
176 176
     $html_result .= '<table  class="data_table">';
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 
194 194
             foreach ($exercises as $exercise_id => $exercise_data) {
195 195
                 $users = $exercise_data['users'];
196
-                foreach($users as $user_id => $attempts) {
196
+                foreach ($users as $user_id => $attempts) {
197 197
                     $attempt = 1;
198
-                    foreach($attempts as $exe_id => $attempt_data) {
198
+                    foreach ($attempts as $exe_id => $attempt_data) {
199 199
                         $html_result .= '<tr colspan="">';
200 200
                         $html_result .= Display::tag('td', $course_code);
201 201
                         $html_result .= Display::tag('td', $lp_list_name[$lp_id]);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
             }
223 223
         }
224 224
     }
225
-    $html_result .='</table>';
225
+    $html_result .= '</table>';
226 226
 }
227 227
 
228 228
 if (!$export_to_csv) {
Please login to merge, or discard this patch.
main/inc/lib/search/tool_processors/link_processor.class.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 /**
9 9
  * Code
10 10
  */
11
-include_once dirname(__FILE__) . '/../../../global.inc.php';
12
-require_once dirname(__FILE__) . '/search_processor.class.php';
11
+include_once dirname(__FILE__).'/../../../global.inc.php';
12
+require_once dirname(__FILE__).'/search_processor.class.php';
13 13
 
14 14
 /**
15 15
  * Process links before pass it to search listing scripts
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 
105 105
             $link_id = intval($link_id);
106 106
             $sql = "SELECT insert_user_id FROM $item_property_table
107
-              		WHERE ref = $link_id AND tool = '" . TOOL_LINK . "' AND c_id = $course_id
107
+              		WHERE ref = $link_id AND tool = '".TOOL_LINK."' AND c_id = $course_id
108 108
               		LIMIT 1";
109 109
 
110 110
             $name = get_lang('Links');
111
-            $url = api_get_path(WEB_PATH) . 'main/link/link.php?cidReq=%s';
111
+            $url = api_get_path(WEB_PATH).'main/link/link.php?cidReq=%s';
112 112
             $url = sprintf($url, $course_id_alpha);
113 113
             // Get the image path
114 114
             $thumbnail = Display::returnIconPath('link.png');
Please login to merge, or discard this patch.
main/inc/lib/search/tool_processors/document_processor.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 /**
9 9
  * Code
10 10
  */
11
-include_once dirname(__FILE__) . '/../../../global.inc.php';
12
-require_once dirname(__FILE__) . '/search_processor.class.php';
11
+include_once dirname(__FILE__).'/../../../global.inc.php';
12
+require_once dirname(__FILE__).'/search_processor.class.php';
13 13
 
14 14
 /**
15 15
  * Process documents before pass it to search listing scripts
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             $dk_result = Database::query($sql);
83 83
 
84 84
             $sql = "SELECT insert_user_id FROM       $item_property_table
85
-                    WHERE   ref = $doc_id AND tool = '" . TOOL_DOCUMENT . "' AND c_id = $course_id
85
+                    WHERE   ref = $doc_id AND tool = '".TOOL_DOCUMENT."' AND c_id = $course_id
86 86
                     LIMIT 1";
87 87
             $name = '';
88 88
             if ($row = Database::fetch_array($dk_result)) {
Please login to merge, or discard this patch.
main/inc/lib/agenda.lib.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1499,12 +1499,12 @@  discard block
 block discarded – undo
1499 1499
             }
1500 1500
 
1501 1501
             if (empty($session_id)) {
1502
-                $sessionCondition =  "
1502
+                $sessionCondition = "
1503 1503
                 (
1504 1504
                     agenda.session_id = 0 AND (ip.session_id IS NULL OR ip.session_id = 0)
1505 1505
                 ) ";
1506 1506
             } else {
1507
-                $sessionCondition =  "
1507
+                $sessionCondition = "
1508 1508
                 (
1509 1509
                     agenda.session_id = $session_id AND
1510 1510
                     ip.session_id = $session_id
@@ -1543,13 +1543,13 @@  discard block
 block discarded – undo
1543 1543
             }
1544 1544
 
1545 1545
             if (empty($session_id)) {
1546
-                $sessionCondition =  "
1546
+                $sessionCondition = "
1547 1547
                 (
1548 1548
                     agenda.session_id = 0 AND
1549 1549
                     (ip.session_id IS NULL OR ip.session_id = 0)
1550 1550
                 ) ";
1551 1551
             } else {
1552
-                $sessionCondition =  "
1552
+                $sessionCondition = "
1553 1553
                 (
1554 1554
                     agenda.session_id = $session_id AND
1555 1555
                     ip.session_id = $session_id
@@ -1601,7 +1601,7 @@  discard block
 block discarded – undo
1601 1601
             while ($row = Database::fetch_array($result, 'ASSOC')) {
1602 1602
                 $event = array();
1603 1603
                 $event['id'] = 'course_'.$row['id'];
1604
-                $event['unique_id']  = $row['iid'];
1604
+                $event['unique_id'] = $row['iid'];
1605 1605
                 // To avoid doubles
1606 1606
                 if (in_array($event['unique_id'], $eventsAdded)) {
1607 1607
                     continue;
@@ -2151,7 +2151,7 @@  discard block
 block discarded – undo
2151 2151
             );
2152 2152
 
2153 2153
             $form->addLabel('',
2154
-                '<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span>&nbsp;('.sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize'))).')');
2154
+                '<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span>&nbsp;('.sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))).')');
2155 2155
 
2156 2156
 
2157 2157
             //if ($showAttachmentForm) {
@@ -2729,8 +2729,8 @@  discard block
 block discarded – undo
2729 2729
 
2730 2730
                 $startDateTime = api_get_local_time($start->format('Y-m-d H:i:s'), $currentTimeZone, $start->format('e'));
2731 2731
                 $endDateTime = api_get_local_time($end->format('Y-m-d H:i'), $currentTimeZone, $end->format('e'));
2732
-                $title = api_convert_encoding((string)$event->summary, $charset, 'UTF-8');
2733
-                $description = api_convert_encoding((string)$event->description, $charset, 'UTF-8');
2732
+                $title = api_convert_encoding((string) $event->summary, $charset, 'UTF-8');
2733
+                $description = api_convert_encoding((string) $event->description, $charset, 'UTF-8');
2734 2734
 
2735 2735
                 $id = $this->addEvent(
2736 2736
                     $startDateTime,
@@ -2872,7 +2872,7 @@  discard block
 block discarded – undo
2872 2872
 							ORDER BY start_date ";
2873 2873
             } else {
2874 2874
                 // if the user is not an administrator of that course
2875
-                if (is_array($group_memberships) && count($group_memberships)>0) {
2875
+                if (is_array($group_memberships) && count($group_memberships) > 0) {
2876 2876
                     $sqlquery = "SELECT	agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
2877 2877
 								FROM ".$TABLEAGENDA." agenda,
2878 2878
 									".$TABLE_ITEMPROPERTY." ip
@@ -2902,14 +2902,14 @@  discard block
 block discarded – undo
2902 2902
                 $agendaday = -1;
2903 2903
                 if ($item['start_date'] != '0000-00-00 00:00:00') {
2904 2904
                     $item['start_date'] = api_get_local_time($item['start_date']);
2905
-                    $item['start_date_tms']  = api_strtotime($item['start_date']);
2905
+                    $item['start_date_tms'] = api_strtotime($item['start_date']);
2906 2906
                     $agendaday = date("j", $item['start_date_tms']);
2907 2907
                 }
2908 2908
                 if ($item['end_date'] != '0000-00-00 00:00:00') {
2909 2909
                     $item['end_date'] = api_get_local_time($item['end_date']);
2910 2910
                 }
2911 2911
 
2912
-                $url  = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday";
2912
+                $url = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday";
2913 2913
 
2914 2914
                 $item['url'] = $url;
2915 2915
                 $item['course_name'] = $array_course_info['title'];
@@ -2921,9 +2921,9 @@  discard block
 block discarded – undo
2921 2921
         }
2922 2922
 
2923 2923
         // sorting by hour for every day
2924
-        $agendaitems = array ();
2924
+        $agendaitems = array();
2925 2925
         while (list ($agendaday, $tmpitems) = each($items)) {
2926
-            if(!isset($agendaitems[$agendaday])) {
2926
+            if (!isset($agendaitems[$agendaday])) {
2927 2927
                 $agendaitems[$agendaday] = '';
2928 2928
             }
2929 2929
             sort($tmpitems);
@@ -3097,9 +3097,9 @@  discard block
 block discarded – undo
3097 3097
             $end_year = $start_end_day_of_week['end']['year'];
3098 3098
             // in sql statements you have to use year-month-day for date calculations
3099 3099
             $start_filter = $start_year."-".$start_month."-".$start_day." 00:00:00";
3100
-            $start_filter  = api_get_utc_datetime($start_filter);
3100
+            $start_filter = api_get_utc_datetime($start_filter);
3101 3101
             $end_filter = $end_year."-".$end_month."-".$end_day." 23:59:59";
3102
-            $end_filter  = api_get_utc_datetime($end_filter);
3102
+            $end_filter = api_get_utc_datetime($end_filter);
3103 3103
             $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3104 3104
         }
3105 3105
         // 3. creating the SQL statement for getting the personal agenda items in DAY view
@@ -3107,18 +3107,18 @@  discard block
 block discarded – undo
3107 3107
             // we are in day view
3108 3108
             // we could use mysql date() function but this is only available from 4.1 and higher
3109 3109
             $start_filter = $year."-".$month."-".$day." 00:00:00";
3110
-            $start_filter  = api_get_utc_datetime($start_filter);
3110
+            $start_filter = api_get_utc_datetime($start_filter);
3111 3111
             $end_filter = $year."-".$month."-".$day." 23:59:59";
3112
-            $end_filter  = api_get_utc_datetime($end_filter);
3112
+            $end_filter = api_get_utc_datetime($end_filter);
3113 3113
             $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3114 3114
         }
3115 3115
 
3116 3116
         $result = Database::query($sql);
3117 3117
         while ($item = Database::fetch_array($result, 'ASSOC')) {
3118 3118
 
3119
-            $time_minute 	= api_convert_and_format_date($item['date'], TIME_NO_SEC_FORMAT);
3120
-            $item['date']   = api_get_local_time($item['date']);
3121
-            $item['start_date_tms']  = api_strtotime($item['date']);
3119
+            $time_minute = api_convert_and_format_date($item['date'], TIME_NO_SEC_FORMAT);
3120
+            $item['date'] = api_get_local_time($item['date']);
3121
+            $item['start_date_tms'] = api_strtotime($item['date']);
3122 3122
             $item['content'] = $item['text'];
3123 3123
 
3124 3124
             // we break the date field in the database into a date and a time part
@@ -3138,7 +3138,7 @@  discard block
 block discarded – undo
3138 3138
             $second = $agendatime[2];
3139 3139
 
3140 3140
             if ($type == 'month_view') {
3141
-                $item['calendar_type']  = 'personal';
3141
+                $item['calendar_type'] = 'personal';
3142 3142
                 $item['start_date']  	= $item['date'];
3143 3143
                 $agendaitems[$day][] 	= $item;
3144 3144
                 continue;
@@ -3163,7 +3163,7 @@  discard block
 block discarded – undo
3163 3163
                 // this is the array construction for the DAY view
3164 3164
                 $halfhour = 2 * $agendatime['0'];
3165 3165
                 if ($agendatime['1'] >= '30') {
3166
-                    $halfhour = $halfhour +1;
3166
+                    $halfhour = $halfhour + 1;
3167 3167
                 }
3168 3168
 
3169 3169
                 //Display events by list
@@ -3187,22 +3187,22 @@  discard block
 block discarded – undo
3187 3187
     {
3188 3188
         global $DaysShort, $course_path;
3189 3189
         //Handle leap year
3190
-        $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
3190
+        $numberofdays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
3191 3191
         if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
3192 3192
             $numberofdays[2] = 29;
3193 3193
         //Get the first day of the month
3194 3194
         $dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
3195 3195
         //Start the week on monday
3196 3196
         $startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6;
3197
-        $g_cc = (isset($_GET['courseCode'])?$_GET['courseCode']:'');
3197
+        $g_cc = (isset($_GET['courseCode']) ? $_GET['courseCode'] : '');
3198 3198
 
3199
-        $next_month = ($month == 1 ? 12 : $month -1);
3200
-        $prev_month = ($month == 12 ? 1 : $month +1);
3199
+        $next_month = ($month == 1 ? 12 : $month - 1);
3200
+        $prev_month = ($month == 12 ? 1 : $month + 1);
3201 3201
 
3202
-        $next_year = ($month == 1 ? $year -1 : $year);
3203
-        $prev_year = ($month == 12 ? $year +1 : $year);
3202
+        $next_year = ($month == 1 ? $year - 1 : $year);
3203
+        $prev_year = ($month == 12 ? $year + 1 : $year);
3204 3204
 
3205
-        if ($show_content)  {
3205
+        if ($show_content) {
3206 3206
             $back_url = Display::url(get_lang('Previous'), api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&action=view&view=month&month=".$next_month."&year=".$next_year);
3207 3207
             $next_url = Display::url(get_lang('Next'), api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&action=view&view=month&month=".$prev_month."&year=".$prev_year);
3208 3208
         } else {
@@ -3219,7 +3219,7 @@  discard block
 block discarded – undo
3219 3219
         $html .= '</div>';
3220 3220
         $html .= '<table id="agenda_list2" class="table table-bordered">';
3221 3221
         $html .= '<tr>';
3222
-        for ($ii = 1; $ii < 8; $ii ++) {
3222
+        for ($ii = 1; $ii < 8; $ii++) {
3223 3223
             $html .= '<td class="weekdays">'.$DaysShort[$ii % 7].'</td>';
3224 3224
         }
3225 3225
         $html .= '</tr>';
@@ -3228,7 +3228,7 @@  discard block
 block discarded – undo
3228 3228
         $today = getdate();
3229 3229
         while ($curday <= $numberofdays[$month]) {
3230 3230
             $html .= "<tr>";
3231
-            for ($ii = 0; $ii < 7; $ii ++) {
3231
+            for ($ii = 0; $ii < 7; $ii++) {
3232 3232
                 if (($curday == -1) && ($ii == $startdayofweek)) {
3233 3233
                     $curday = 1;
3234 3234
                 }
@@ -3242,21 +3242,21 @@  discard block
 block discarded – undo
3242 3242
                     $html .= "<td ".$class.">".$dayheader;
3243 3243
 
3244 3244
                     if (!empty($agendaitems[$curday])) {
3245
-                        $items =  $agendaitems[$curday];
3246
-                        $items =  msort($items, 'start_date_tms');
3245
+                        $items = $agendaitems[$curday];
3246
+                        $items = msort($items, 'start_date_tms');
3247 3247
 
3248
-                        foreach($items  as $value) {
3248
+                        foreach ($items  as $value) {
3249 3249
                             $value['title'] = Security::remove_XSS($value['title']);
3250 3250
                             $start_time = api_format_date($value['start_date'], TIME_NO_SEC_FORMAT);
3251 3251
                             $end_time = '';
3252 3252
 
3253 3253
                             if (!empty($value['end_date']) && $value['end_date'] != '0000-00-00 00:00:00') {
3254
-                                $end_time    = '-&nbsp;<i>'.api_format_date($value['end_date'], DATE_TIME_FORMAT_LONG).'</i>';
3254
+                                $end_time = '-&nbsp;<i>'.api_format_date($value['end_date'], DATE_TIME_FORMAT_LONG).'</i>';
3255 3255
                             }
3256 3256
                             $complete_time = '<i>'.api_format_date($value['start_date'], DATE_TIME_FORMAT_LONG).'</i>&nbsp;'.$end_time;
3257 3257
                             $time = '<i>'.$start_time.'</i>';
3258 3258
 
3259
-                            switch($value['calendar_type']) {
3259
+                            switch ($value['calendar_type']) {
3260 3260
                                 case 'personal':
3261 3261
                                     $bg_color = '#D0E7F4';
3262 3262
                                     $icon = Display::return_icon('user.png', get_lang('MyAgenda'), array(), ICON_SIZE_SMALL);
@@ -3308,7 +3308,7 @@  discard block
 block discarded – undo
3308 3308
                         }
3309 3309
                     }
3310 3310
                     $html .= "</td>";
3311
-                    $curday ++;
3311
+                    $curday++;
3312 3312
                 } else {
3313 3313
                     $html .= "<td></td>";
3314 3314
                 }
@@ -3329,18 +3329,18 @@  discard block
 block discarded – undo
3329 3329
      * where datestart and dateend are in yyyyMMddhhmmss format.
3330 3330
      * @TODO Implement really personal events (from user DB) and global events (from main DB)
3331 3331
      */
3332
-    public static function get_personal_agenda_items_between_dates($user_id, $date_start='', $date_end='')
3332
+    public static function get_personal_agenda_items_between_dates($user_id, $date_start = '', $date_end = '')
3333 3333
     {
3334
-        $items = array ();
3334
+        $items = array();
3335 3335
         if ($user_id != strval(intval($user_id))) { return $items; }
3336
-        if (empty($date_start)) { $date_start = date('Y-m-d H:i:s');}
3337
-        if (empty($date_end))   { $date_end = date('Y-m-d H:i:s',mktime(0, 0, 0, date("m"),   date("d"),   date("Y")+1));}
3336
+        if (empty($date_start)) { $date_start = date('Y-m-d H:i:s'); }
3337
+        if (empty($date_end)) { $date_end = date('Y-m-d H:i:s', mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1)); }
3338 3338
         $expr = '/\d{4}-\d{2}-\d{2}\ \d{2}:\d{2}:\d{2}/';
3339
-        if(!preg_match($expr,$date_start)) { return $items; }
3340
-        if(!preg_match($expr,$date_end)) { return $items; }
3339
+        if (!preg_match($expr, $date_start)) { return $items; }
3340
+        if (!preg_match($expr, $date_end)) { return $items; }
3341 3341
 
3342 3342
         // get agenda-items for every course
3343
-        $courses = api_get_user_courses($user_id,false);
3343
+        $courses = api_get_user_courses($user_id, false);
3344 3344
         foreach ($courses as $id => $course) {
3345 3345
             $c = api_get_course_info_by_id($course['real_id']);
3346 3346
             //databases of the courses
@@ -3364,9 +3364,9 @@  discard block
 block discarded – undo
3364 3364
                     " ORDER BY start_date ";
3365 3365
             } else {
3366 3366
                 // if the user is not an administrator of that course, then...
3367
-                if (is_array($group_memberships) && count($group_memberships)>0)
3367
+                if (is_array($group_memberships) && count($group_memberships) > 0)
3368 3368
                 {
3369
-                    $sqlquery = "SELECT " .
3369
+                    $sqlquery = "SELECT ".
3370 3370
                         "DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref ".
3371 3371
                         " FROM ".$t_a." agenda, ".
3372 3372
                         $t_ip." ip ".
@@ -3394,13 +3394,13 @@  discard block
 block discarded – undo
3394 3394
 
3395 3395
             $result = Database::query($sqlquery);
3396 3396
             while ($item = Database::fetch_array($result)) {
3397
-                $agendaday = date("j",strtotime($item['start_date']));
3398
-                $month = date("n",strtotime($item['start_date']));
3399
-                $year = date("Y",strtotime($item['start_date']));
3397
+                $agendaday = date("j", strtotime($item['start_date']));
3398
+                $month = date("n", strtotime($item['start_date']));
3399
+                $year = date("Y", strtotime($item['start_date']));
3400 3400
                 $URL = api_get_path(WEB_PATH)."main/calendar/agenda.php?cidReq=".urlencode($course["code"])."&day=$agendaday&month=$month&year=$year#$agendaday";
3401
-                list($year,$month,$day,$hour,$min,$sec) = split('[-: ]',$item['start_date']);
3401
+                list($year, $month, $day, $hour, $min, $sec) = split('[-: ]', $item['start_date']);
3402 3402
                 $start_date = $year.$month.$day.$hour.$min;
3403
-                list($year,$month,$day,$hour,$min,$sec) = split('[-: ]',$item['end_date']);
3403
+                list($year, $month, $day, $hour, $min, $sec) = split('[-: ]', $item['end_date']);
3404 3404
                 $end_date = $year.$month.$day.$hour.$min;
3405 3405
 
3406 3406
                 $items[] = array(
@@ -3429,7 +3429,7 @@  discard block
 block discarded – undo
3429 3429
         $user = api_get_user_id();
3430 3430
         $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE id=".$id." AND user = ".$user;
3431 3431
         $result = Database::query($sql);
3432
-        if(Database::num_rows($result)==1) {
3432
+        if (Database::num_rows($result) == 1) {
3433 3433
             $item = Database::fetch_array($result);
3434 3434
         } else {
3435 3435
             $item = null;
@@ -3451,9 +3451,9 @@  discard block
 block discarded – undo
3451 3451
         // step 2: we which day this is (0=sunday, 1=monday, ...)
3452 3452
         $number_day_in_week = date('w', $random_day_in_week);
3453 3453
         // step 3: we calculate the timestamp of the monday of the week we are in
3454
-        $start_timestamp = $random_day_in_week - (($number_day_in_week -1) * 24 * 60 * 60);
3454
+        $start_timestamp = $random_day_in_week - (($number_day_in_week - 1) * 24 * 60 * 60);
3455 3455
         // step 4: we calculate the timestamp of the sunday of the week we are in
3456
-        $end_timestamp = $random_day_in_week + ((7 - $number_day_in_week +1) * 24 * 60 * 60) - 3600;
3456
+        $end_timestamp = $random_day_in_week + ((7 - $number_day_in_week + 1) * 24 * 60 * 60) - 3600;
3457 3457
         // step 5: calculating the start_day, end_day, start_month, end_month, start_year, end_year
3458 3458
         $start_day = date('j', $start_timestamp);
3459 3459
         $start_month = date('n', $start_timestamp);
Please login to merge, or discard this patch.
main/admin/specific_fields.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,36 +15,36 @@  discard block
 block discarded – undo
15 15
 api_protect_admin_script();
16 16
 
17 17
 // Breadcrumb
18
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
19
-$interbreadcrumb[] = array ('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings'));
18
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
19
+$interbreadcrumb[] = array('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings'));
20 20
 
21 21
 $libpath = api_get_path(LIBRARY_PATH);
22 22
 
23 23
 include_once $libpath.'specific_fields_manager.lib.php';
24 24
 
25 25
 // Create an add-field box
26
-$form = new FormValidator('add_field','post','','',null,false);
27
-$renderer =& $form->defaultRenderer();
26
+$form = new FormValidator('add_field', 'post', '', '', null, false);
27
+$renderer = & $form->defaultRenderer();
28 28
 $renderer->setCustomElementTemplate('<span>{element}</span> ');
29
-$form->addElement('static','search_advanced_link',null,'<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>');
29
+$form->addElement('static', 'search_advanced_link', null, '<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>');
30 30
 
31 31
 // Create a sortable table with specific fields data
32
-$column_show = array(1,1,1);
33
-$column_order = array(3,2,1);
32
+$column_show = array(1, 1, 1);
33
+$column_order = array(3, 2, 1);
34 34
 $extra_fields = get_specific_field_list();
35 35
 $number_of_extra_fields = count($extra_fields);
36 36
 
37
-$table = new SortableTableFromArrayConfig($extra_fields,2,50,'',$column_show,$column_order);
38
-$table->set_header(0, '&nbsp;', false,null,'width="2%"', 'style="display:none"');
37
+$table = new SortableTableFromArrayConfig($extra_fields, 2, 50, '', $column_show, $column_order);
38
+$table->set_header(0, '&nbsp;', false, null, 'width="2%"', 'style="display:none"');
39 39
 $table->set_header(1, get_lang('Code'), TRUE, 'width="10%"');
40 40
 $table->set_header(2, get_lang('Name'));
41
-$table->set_header(3, get_lang('Modify'),false,'width="10%"');
41
+$table->set_header(3, get_lang('Modify'), false, 'width="10%"');
42 42
 $table->set_column_filter(3, 'edit_filter');
43 43
 
44
-function edit_filter($id,$url_params,$row) {
44
+function edit_filter($id, $url_params, $row) {
45 45
 	global $charset;
46
-	$return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>';
47
-	$return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a>';
46
+	$return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
47
+	$return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
48 48
 	return $return;
49 49
 }
50 50
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 Display::display_header(get_lang('SpecificSearchFields'));
61 61
 echo Display::display_normal_message(get_lang('SpecificSearchFieldsIntro'));
62 62
 
63
-if(!empty($_GET['message'])) {
63
+if (!empty($_GET['message'])) {
64 64
   Display::display_confirmation_message($_GET['message']);
65 65
 }
66 66
 
Please login to merge, or discard this patch.
main/admin/specific_fields_add.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
 // Create the form
33 33
 $form = new FormValidator('specific_fields_add');
34 34
 // Field variable name
35
-$form->addElement('hidden','field_id', $fieldId);
36
-$form->addElement('text','field_name',get_lang('FieldName'));
37
-$form->applyFilter('field_name','html_filter');
38
-$form->applyFilter('field_name','trim');
35
+$form->addElement('hidden', 'field_id', $fieldId);
36
+$form->addElement('text', 'field_name', get_lang('FieldName'));
37
+$form->applyFilter('field_name', 'html_filter');
38
+$form->applyFilter('field_name', 'trim');
39 39
 $form->addRule('field_name', get_lang('ThisFieldIsRequired'), 'required');
40 40
 $form->addRule('field_name', get_lang('OnlyLettersAndNumbersAllowed'), 'username');
41
-$form->addRule('field_name', '', 'maxlength',20);
41
+$form->addRule('field_name', '', 'maxlength', 20);
42 42
 
43 43
 // Set default values (only not empty when editing)
44 44
 $defaults = array();
45 45
 if ($fieldId) {
46
-    $form_information = get_specific_field_list(array( 'id' => $fieldId ));
46
+    $form_information = get_specific_field_list(array('id' => $fieldId));
47 47
     $defaults['field_name'] = $form_information[0]['name'];
48 48
 }
49 49
 $form->setDefaults($defaults);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 if ($form->validate()) {
55 55
     $field = $form->exportValues();
56 56
     $field_name = $field['field_name'];
57
-    if (is_numeric($field['field_id']) && $field['field_id']<>0 && !empty($field['field_id'])) {
57
+    if (is_numeric($field['field_id']) && $field['field_id'] <> 0 && !empty($field['field_id'])) {
58 58
         edit_specific_field($field['field_id'], $field['field_name']);
59 59
         $message = get_lang('FieldEdited');
60 60
     } else {
Please login to merge, or discard this patch.
main/inc/lib/search/search_widget.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 /**
8 8
  * Code
9 9
  */
10
-require_once dirname(__FILE__) . '/IndexableChunk.class.php';
10
+require_once dirname(__FILE__).'/IndexableChunk.class.php';
11 11
 require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
12 12
 
13 13
 /**
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * Get one term html select
31 31
  */
32
-function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr='size="7" class="sf-select-multiple"') {
32
+function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr = 'size="7" class="sf-select-multiple"') {
33 33
 	global $charset;
34
-    $multiple_select = '<select '. $extra_select_attr .' title="'. $prefix .'" id="sf-'. $prefix .'" name="sf_'. $prefix .'[]">';
34
+    $multiple_select = '<select '.$extra_select_attr.' title="'.$prefix.'" id="sf-'.$prefix.'" name="sf_'.$prefix.'[]">';
35 35
 
36 36
     $all_selected = '';
37
-    if (!empty($_REQUEST['sf_'. $prefix]) ) {
38
-        if (in_array('__all__', $_REQUEST['sf_'. $prefix])) {
37
+    if (!empty($_REQUEST['sf_'.$prefix])) {
38
+        if (in_array('__all__', $_REQUEST['sf_'.$prefix])) {
39 39
             $all_selected = 'selected="selected"';
40 40
         }
41 41
     }
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
     } else if ($op == 'or') {
45 45
         $all_selected_name = get_lang('Any');
46 46
     }
47
-    $multiple_select .= '<option value="__all__" '. $all_selected .' >-- '. $all_selected_name .' --</option>';
47
+    $multiple_select .= '<option value="__all__" '.$all_selected.' >-- '.$all_selected_name.' --</option>';
48 48
 
49 49
     foreach ($sf_term_array as $raw_term) {
50 50
         $term = substr($raw_term, 1);
51 51
         if (empty($term)) continue;
52 52
         $html_term = htmlspecialchars($term, ENT_QUOTES, $charset);
53 53
         $selected = '';
54
-        if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term,$_REQUEST['sf_'.$prefix])) {
54
+        if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term, $_REQUEST['sf_'.$prefix])) {
55 55
             $selected = 'selected="selected"';
56 56
         }
57
-        $multiple_select .= '<option value="'. $html_term .'" '.$selected.'>'. $html_term .'</option>';
57
+        $multiple_select .= '<option value="'.$html_term.'" '.$selected.'>'.$html_term.'</option>';
58 58
     }
59 59
     $multiple_select .= '</select>';
60 60
     return $multiple_select;
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
 /**
64 64
  * Get terms html selects
65 65
  */
66
-function format_specific_fields_selects($sf_terms, $op, $prefilter_prefix='') {
66
+function format_specific_fields_selects($sf_terms, $op, $prefilter_prefix = '') {
67 67
     // Process each prefix type term
68 68
     $i = 0;
69 69
     $max = count($sf_terms);
70
-    $multiple_selects ='';
70
+    $multiple_selects = '';
71 71
     foreach ($sf_terms as $prefix => $sf_term_array) {
72 72
         if ($prefix == $prefilter_prefix) continue;
73 73
         $multiple_select = '';
74
-        if ($i>0) {
74
+        if ($i > 0) {
75 75
             //print "+" image
76 76
             $multiple_select .= '<td><img class="sf-select-splitter" src="../img/search-big-plus.gif" alt="plus-sign-decoration"/></td>';
77 77
         }
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 
90 90
         $sf_copy = $sf_term_array;
91 91
         // get specific field name
92
-        $sf_value = get_specific_field_list(array( 'code' => "'$prefix'" ));
92
+        $sf_value = get_specific_field_list(array('code' => "'$prefix'"));
93 93
         $sf_value = array_shift($sf_value);
94
-        $multiple_select .= '<td><label class="sf-select-multiple-title" for="sf_'. $prefix .'[]">' . $sf_value['name'].'</label><br />';
94
+        $multiple_select .= '<td><label class="sf-select-multiple-title" for="sf_'.$prefix.'[]">'.$sf_value['name'].'</label><br />';
95 95
         $multiple_select .= format_one_specific_field_select($prefix, $sf_term_array, $op, 'multiple="multiple" size="7" class="sf-select-multiple"');
96 96
         $multiple_select .= '</td>';
97 97
         $multiple_selects .= $multiple_select;
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
  */
108 108
 function search_widget_normal_form($action, $show_thesaurus, $sf_terms, $op) {
109 109
     $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon'));
110
-    $advanced_options = '<a id="tags-toggle" href="#">'.  get_lang('SearchAdvancedOptions') .'</a>';
111
-    $display_thesaurus = ($show_thesaurus==true? 'block': 'none');
112
-    $help = '<h3>'. get_lang('SearchKeywordsHelpTitle') .'</h3>'. get_lang('SearchKeywordsHelpComment');
113
-    $mode = (!empty($_REQUEST['mode'])? htmlentities($_REQUEST['mode']): 'gallery');
114
-    $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal');
110
+    $advanced_options = '<a id="tags-toggle" href="#">'.get_lang('SearchAdvancedOptions').'</a>';
111
+    $display_thesaurus = ($show_thesaurus == true ? 'block' : 'none');
112
+    $help = '<h3>'.get_lang('SearchKeywordsHelpTitle').'</h3>'.get_lang('SearchKeywordsHelpComment');
113
+    $mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery');
114
+    $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal');
115 115
 
116 116
     /**
117 117
      * POST avoid long urls, but we are using GET because
@@ -119,36 +119,36 @@  discard block
 block discarded – undo
119 119
      * could not send a form in pagination
120 120
      */
121 121
 
122
-	if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) {
123
-		$action='index.php';
122
+	if (isset($_GET['action']) && strcmp(trim($_GET['action']), 'search') === 0) {
123
+		$action = 'index.php';
124 124
 	}
125 125
 	$navigator_info = api_get_navigator();
126 126
 
127
-	if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
128
-		$submit_button1	= '<input type="submit" id="submit" value="'. get_lang('Search') .'" />';
129
-		$submit_button2 = '<input class="lower-submit" type="submit" value="'. get_lang('Search') .'" />';
130
-        $reset_button 	= '<input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />';
127
+	if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
128
+		$submit_button1	= '<input type="submit" id="submit" value="'.get_lang('Search').'" />';
129
+		$submit_button2 = '<input class="lower-submit" type="submit" value="'.get_lang('Search').'" />';
130
+        $reset_button = '<input type="submit" id="tags-clean" value="'.get_lang('SearchResetKeywords').'" />';
131 131
 	} else {
132
-		$submit_button1 = '<button class="search" type="submit" id="submit" value="'. get_lang("Search") .'" /> '. get_lang('Search') .'</button>';
133
-		$submit_button2 = '<button class="search" type="submit" value="'. get_lang('Search') .'" />'. get_lang('Search') .'</button>';
134
-        $reset_button 	= '<button class="save"   type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />'. get_lang('SearchResetKeywords') .'</button> ';
132
+		$submit_button1 = '<button class="search" type="submit" id="submit" value="'.get_lang("Search").'" /> '.get_lang('Search').'</button>';
133
+		$submit_button2 = '<button class="search" type="submit" value="'.get_lang('Search').'" />'.get_lang('Search').'</button>';
134
+        $reset_button = '<button class="save"   type="submit" id="tags-clean" value="'.get_lang('SearchResetKeywords').'" />'.get_lang('SearchResetKeywords').'</button> ';
135 135
 	}
136 136
 
137 137
     $query = isset($_REQUEST['query']) ? Security::remove_XSS($_REQUEST['query']) : null;
138 138
 
139
-    $form = '<form id="chamilo_search" action="'. $action .'" method="GET">
140
-            <input type="text" id="query" name="query" size="40" value="' . $query . '" />
141
-            <input type="hidden" name="mode" value="'. $mode .'"/>
142
-            <input type="hidden" name="type" value="'. $type .'"/>
139
+    $form = '<form id="chamilo_search" action="'.$action.'" method="GET">
140
+            <input type="text" id="query" name="query" size="40" value="' . $query.'" />
141
+            <input type="hidden" name="mode" value="'. $mode.'"/>
142
+            <input type="hidden" name="type" value="'. $type.'"/>
143 143
             <input type="hidden" name="tablename_page_nr" value="1" />
144 144
           	'.$submit_button1.'
145 145
             <br /><br />';
146 146
     $list = get_specific_field_list();
147 147
 
148
-    if(!empty($list)) {
149
-        $form .= '<span class="search-links-box">'. $advanced_options .'&nbsp;</span>
150
-            <div id="tags" class="tags" style="display:'. $display_thesaurus .';">
151
-                <div class="search-help-box">'. $help .'</div>
148
+    if (!empty($list)) {
149
+        $form .= '<span class="search-links-box">'.$advanced_options.'&nbsp;</span>
150
+            <div id="tags" class="tags" style="display:'. $display_thesaurus.';">
151
+                <div class="search-help-box">'. $help.'</div>
152 152
                 <table>
153 153
                 <tr>';
154 154
         $form .= format_specific_fields_selects($sf_terms, $op);
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
         $form .= '</tr>
163 163
                     <tr>
164 164
                         <td id="operator-select">
165
-                            '. get_lang('SearchCombineSearchWith') .':<br />
166
-                            <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked .'>'. api_strtoupper(get_lang('Or')) .'</input>
167
-                            <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked .'>'. api_strtoupper(get_lang('And')) .'</input>
165
+                            '. get_lang('SearchCombineSearchWith').':<br />
166
+                            <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked.'>'.api_strtoupper(get_lang('Or')).'</input>
167
+                            <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked.'>'.api_strtoupper(get_lang('And')).'</input>
168 168
                         </td>
169 169
                         <td></td>
170 170
                         <td>
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
                     </table>
177 177
                 </div>';
178 178
     }
179
-    $form .='</form>
179
+    $form .= '</form>
180 180
     <br style="clear: both;"/>';
181 181
     return $form;
182 182
 }
@@ -186,36 +186,36 @@  discard block
 block discarded – undo
186 186
  *
187 187
  * This type allow filter all other multiple select terms by one term in a dinamic way
188 188
  */
189
-function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix=NULL) {
189
+function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix = NULL) {
190 190
     $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon'));
191
-    $advanced_options = '<a id="tags-toggle" href="#">'.  get_lang('SearchAdvancedOptions') .'</a>';
192
-    $display_thesaurus = ($show_thesaurus==true? 'block': 'none');
193
-    $help = '<h3>'. get_lang('SearchKeywordsHelpTitle') .'</h3>'. get_lang('SearchKeywordsHelpComment');
194
-    $mode = (!empty($_REQUEST['mode'])? htmlentities($_REQUEST['mode']): 'gallery');
195
-    $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal');
191
+    $advanced_options = '<a id="tags-toggle" href="#">'.get_lang('SearchAdvancedOptions').'</a>';
192
+    $display_thesaurus = ($show_thesaurus == true ? 'block' : 'none');
193
+    $help = '<h3>'.get_lang('SearchKeywordsHelpTitle').'</h3>'.get_lang('SearchKeywordsHelpComment');
194
+    $mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery');
195
+    $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal');
196 196
 
197 197
     /**
198 198
      * POST avoid long urls, but we are using GET because
199 199
      * SortableTableFromArray pagination is done with simple links, so now we
200 200
      * could not send a form in pagination
201 201
      */
202
-	if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) {
203
-		$action='index.php';
202
+	if (isset($_GET['action']) && strcmp(trim($_GET['action']), 'search') === 0) {
203
+		$action = 'index.php';
204 204
 	}
205 205
 
206 206
     $form = '
207
-        <form id="chamilo_search" action="'. $action .'" method="GET">
207
+        <form id="chamilo_search" action="'. $action.'" method="GET">
208 208
             <input type="text" id="query" name="query" size="40" />
209
-            <input type="hidden" name="mode" value="'. $mode .'"/>
210
-            <input type="hidden" name="type" value="'. $type .'"/>
209
+            <input type="hidden" name="mode" value="'. $mode.'"/>
210
+            <input type="hidden" name="type" value="'. $type.'"/>
211 211
             <input type="hidden" name="tablename_page_nr" value="1" />
212
-            <input type="submit" id="submit" value="'. get_lang("Search") .'" />
212
+            <input type="submit" id="submit" value="'. get_lang("Search").'" />
213 213
             <br /><br />';
214 214
         $list = get_specific_field_list();
215
-        if(!empty($list)) {
216
-            $form .=' <span class="search-links-box">'. $thesaurus_icon . $advanced_options .'&nbsp;</span>
217
-                    <div id="tags" class="tags" style="display:'. $display_thesaurus .';">
218
-                        <div class="search-help-box">'. $help .'</div>
215
+        if (!empty($list)) {
216
+            $form .= ' <span class="search-links-box">'.$thesaurus_icon.$advanced_options.'&nbsp;</span>
217
+                    <div id="tags" class="tags" style="display:'. $display_thesaurus.';">
218
+                        <div class="search-help-box">'. $help.'</div>
219 219
                         <table>
220 220
                         <tr>';
221 221
             if (!is_null($prefilter_prefix)) {
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
                 $sf_term_array = $temp;
231 231
 
232 232
                 // get specific field name
233
-                $sf_value = get_specific_field_list(array( 'code' => "'$prefilter_prefix'" ));
233
+                $sf_value = get_specific_field_list(array('code' => "'$prefilter_prefix'"));
234 234
                 $sf_value = array_shift($sf_value);
235
-                $form .= '<label class="sf-select-multiple-title" for="sf_'. $prefix .'[]">'.$icons_for_search_terms[$prefix].' '.$sf_value['name'].'</label><br />';
235
+                $form .= '<label class="sf-select-multiple-title" for="sf_'.$prefix.'[]">'.$icons_for_search_terms[$prefix].' '.$sf_value['name'].'</label><br />';
236 236
 
237 237
                 $form .= format_one_specific_field_select($prefilter_prefix, $sf_term_array, $op, 'id="prefilter"');
238 238
                 $form .= format_specific_fields_selects($sf_terms, $op, $prefilter_prefix);
@@ -252,15 +252,15 @@  discard block
 block discarded – undo
252 252
                         </tr>
253 253
                         <tr>
254 254
                             <td id="operator-select">
255
-                                '. get_lang('SearchCombineSearchWith') .':<br />
256
-                                <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked .'>'. api_strtoupper(get_lang('Or')) .'</input>
257
-                                <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked .'>'. api_strtoupper(get_lang('And')) .'</input>
255
+                                '. get_lang('SearchCombineSearchWith').':<br />
256
+                                <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked.'>'.api_strtoupper(get_lang('Or')).'</input>
257
+                                <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked.'>'.api_strtoupper(get_lang('And')).'</input>
258 258
                             </td>
259 259
                             <td></td>
260 260
                             <td>
261 261
                                 <br />
262
-                                <input class="lower-submit" type="submit" value="'. get_lang('Search') .'" />
263
-                                <input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />
262
+                                <input class="lower-submit" type="submit" value="'. get_lang('Search').'" />
263
+                                <input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords').'" />
264 264
                             </td>
265 265
                         </tr>
266 266
                         </table>
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
  * Show search form
278 278
  */
279 279
 function display_search_form($action, $show_thesaurus, $sf_terms, $op) {
280
-    $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal');
280
+    $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal');
281 281
 
282 282
     switch ($type) {
283 283
         case 'prefilter':
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
  * @param   string $action     Just in case your action is not
305 305
  * index.php
306 306
  */
307
-function search_widget_show($action='index.php')
307
+function search_widget_show($action = 'index.php')
308 308
 {
309 309
     require_once api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php';
310 310
     // TODO: load images dinamically when they're avalaible from specific field ui to add
@@ -317,14 +317,14 @@  discard block
 block discarded – undo
317 317
     if (($cid = api_get_course_id()) != -1) { // with cid
318 318
 
319 319
         // get search engine terms
320
-        $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid);
320
+        $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid);
321 321
         $dkterms = chamilo_query_simple_query('', 0, 1000, array($course_filter));
322 322
 
323 323
         //prepare specific fields names (and also get possible URL param names)
324 324
         foreach ($specific_fields as $specific_field) {
325 325
             $temp = array();
326
-            if (is_array($dkterms) && count($dkterms)>0) {
327
-            	foreach($dkterms[1] as $obj) {
326
+            if (is_array($dkterms) && count($dkterms) > 0) {
327
+            	foreach ($dkterms[1] as $obj) {
328 328
                 	$temp = array_merge($obj['sf-'.$specific_field['code']], $temp);
329 329
             	}
330 330
         	}
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
     }
353 353
 
354 354
     $op = 'or';
355
-    if (!empty($_REQUEST['operator']) && in_array($op,array('or','and'))) {
355
+    if (!empty($_REQUEST['operator']) && in_array($op, array('or', 'and'))) {
356 356
         $op = $_REQUEST['operator'];
357 357
     }
358 358
 
Please login to merge, or discard this patch.
main/document/upload.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 }
69 69
 
70 70
 if (empty($document_data)) {
71
-    $document_id  = $parent_id =  0;
71
+    $document_id = $parent_id = 0;
72 72
     $path = '/';
73 73
 } else {
74 74
     $document_id = $document_data['id'];
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 
202 202
 // Link back to the documents overview
203 203
 if ($is_certificate_mode) {
204
-    $actions = '<a href="document.php?id='.$document_id.'&selectcat=' . $selectcat.'&'.api_get_cidreq().'">'.
205
-        Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>';
204
+    $actions = '<a href="document.php?id='.$document_id.'&selectcat='.$selectcat.'&'.api_get_cidreq().'">'.
205
+        Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('CertificateOverview'), '', ICON_SIZE_MEDIUM).'</a>';
206 206
 } else {
207 207
     $actions = '<a href="document.php?id='.$document_id.'&'.api_get_cidreq().'">'.
208
-        Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
208
+        Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
209 209
 }
210 210
 
211 211
 // Link to create a folder
Please login to merge, or discard this patch.