@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | if (!empty($gradebook) && $gradebook == 'view') { |
25 | - $interbreadcrumb[]= array( |
|
25 | + $interbreadcrumb[] = array( |
|
26 | 26 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
27 | 27 | 'name' => get_lang('ToolGradebook') |
28 | 28 | ); |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | $term_array = array(); |
63 | 63 | $specific_fields = get_specific_field_list(); |
64 | 64 | foreach ($specific_fields as $specific_field) { |
65 | - if (!empty($_REQUEST['sf_'. $specific_field['code']])) { |
|
66 | - $values = $_REQUEST['sf_'. $specific_field['code']]; |
|
65 | + if (!empty($_REQUEST['sf_'.$specific_field['code']])) { |
|
66 | + $values = $_REQUEST['sf_'.$specific_field['code']]; |
|
67 | 67 | if (in_array('__all__', $values)) { |
68 | 68 | $sf_terms_for_code = xapian_get_all_terms(1000, $specific_field['code']); |
69 | 69 | foreach ($sf_terms_for_code as $term) { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | foreach ($values as $term) { |
76 | 76 | if (!empty($term)) { |
77 | 77 | $prefix = $specific_field['code']; |
78 | - $term_array[] = chamilo_get_boolean_query($prefix . $term); |
|
78 | + $term_array[] = chamilo_get_boolean_query($prefix.$term); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | // Get right group of terms to show on multiple select. |
94 | 94 | $fixed_queries = array(); |
95 | 95 | $course_filter = null; |
96 | -if (($cid=api_get_course_id()) != -1 ) { |
|
96 | +if (($cid = api_get_course_id()) != -1) { |
|
97 | 97 | // Results only from actual course. |
98 | - $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid); |
|
98 | + $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | if (count($term_array)) { |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | if ($mode == 'gallery') { |
148 | - $title = $a_prefix.str_replace('_', ' ', $result['title']). $a_suffix; |
|
148 | + $title = $a_prefix.str_replace('_', ' ', $result['title']).$a_suffix; |
|
149 | 149 | $blocks[] = array(1 => |
150 | - $a_prefix .'<img src="'.$result['thumbnail'].'" />'. $a_suffix .'<br />'.$title.'<br />'.$result['author'], |
|
150 | + $a_prefix.'<img src="'.$result['thumbnail'].'" />'.$a_suffix.'<br />'.$title.'<br />'.$result['author'], |
|
151 | 151 | ); |
152 | 152 | } else { |
153 | - $title = '<div style="text-align:left;">'. $a_prefix . $result['title']. $a_suffix .(!empty($result['author']) ? ' '.$result['author'] : '').'<div>'; |
|
153 | + $title = '<div style="text-align:left;">'.$a_prefix.$result['title'].$a_suffix.(!empty($result['author']) ? ' '.$result['author'] : '').'<div>'; |
|
154 | 154 | $blocks[] = array(1 => $title); |
155 | 155 | } |
156 | 156 | } |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | ); |
170 | 170 | $get_params = ''; |
171 | 171 | foreach ($specific_fields as $specific_field) { |
172 | - if (isset($_REQUEST['sf_'. $specific_field['code']])) { |
|
173 | - $values = $_REQUEST['sf_'. $specific_field['code']]; |
|
172 | + if (isset($_REQUEST['sf_'.$specific_field['code']])) { |
|
173 | + $values = $_REQUEST['sf_'.$specific_field['code']]; |
|
174 | 174 | //Sortable additional_parameters doesn't accept multi dimensional arrays |
175 | 175 | //$additional_parameters[ 'sf_'. $specific_field['code'] ] = $values; |
176 | - foreach ( $values as $value ) { |
|
177 | - $get_params .= '&sf_' . $specific_field['code'] .'[]='. $value; |
|
176 | + foreach ($values as $value) { |
|
177 | + $get_params .= '&sf_'.$specific_field['code'].'[]='.$value; |
|
178 | 178 | } |
179 | 179 | $get_params .= '&'; |
180 | 180 | } |
@@ -199,13 +199,13 @@ discard block |
||
199 | 199 | $res = Database::query($sql); |
200 | 200 | if (Database::num_rows($res) > 0) { |
201 | 201 | $se_ref = Database::fetch_array($res); |
202 | - $this->search_did = (int)$se_ref['search_did']; |
|
202 | + $this->search_did = (int) $se_ref['search_did']; |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | $this->audio = $row['audio']; |
206 | 206 | if (self::debug > 0) { |
207 | 207 | error_log( |
208 | - 'New LP - End of learnpathItem constructor for item ' . $id, |
|
208 | + 'New LP - End of learnpathItem constructor for item '.$id, |
|
209 | 209 | 0 |
210 | 210 | ); |
211 | 211 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | public function delete() |
315 | 315 | { |
316 | 316 | if (self::debug > 0) { |
317 | - error_log('learnpath_item::delete() for item ' . $this->db_id, 0); |
|
317 | + error_log('learnpath_item::delete() for item '.$this->db_id, 0); |
|
318 | 318 | } |
319 | 319 | $lp_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW); |
320 | 320 | $lp_item = Database::get_course_table(TABLE_LP_ITEM); |
@@ -322,29 +322,29 @@ discard block |
||
322 | 322 | $course_id = api_get_course_int_id(); |
323 | 323 | |
324 | 324 | $sql = "DELETE FROM $lp_item_view |
325 | - WHERE c_id = $course_id AND lp_item_id = " . $this->db_id; |
|
325 | + WHERE c_id = $course_id AND lp_item_id = ".$this->db_id; |
|
326 | 326 | if (self::debug > 0) { |
327 | - error_log('Deleting from lp_item_view: ' . $sql, 0); |
|
327 | + error_log('Deleting from lp_item_view: '.$sql, 0); |
|
328 | 328 | } |
329 | 329 | Database::query($sql); |
330 | 330 | |
331 | 331 | $sql = "SELECT * FROM $lp_item |
332 | - WHERE c_id = $course_id AND id = " . $this->db_id; |
|
332 | + WHERE c_id = $course_id AND id = ".$this->db_id; |
|
333 | 333 | $res_sel = Database::query($sql); |
334 | 334 | if (Database::num_rows($res_sel) < 1) { |
335 | 335 | return false; |
336 | 336 | } |
337 | 337 | |
338 | 338 | $sql = "DELETE FROM $lp_item |
339 | - WHERE c_id = $course_id AND id = " . $this->db_id; |
|
339 | + WHERE c_id = $course_id AND id = ".$this->db_id; |
|
340 | 340 | Database::query($sql); |
341 | 341 | if (self::debug > 0) { |
342 | - error_log('Deleting from lp_item: ' . $sql); |
|
342 | + error_log('Deleting from lp_item: '.$sql); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | if (api_get_setting('search_enabled') == 'true') { |
346 | 346 | if (!is_null($this->search_did)) { |
347 | - require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; |
|
347 | + require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
|
348 | 348 | $di = new ChamiloIndexer(); |
349 | 349 | $di->remove_document($this->search_did); |
350 | 350 | } |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | { |
381 | 381 | if (self::debug > 0) { |
382 | 382 | error_log( |
383 | - 'learnpathItem::get_attempt_id() on item ' . $this->db_id, |
|
383 | + 'learnpathItem::get_attempt_id() on item '.$this->db_id, |
|
384 | 384 | 0 |
385 | 385 | ); |
386 | 386 | } |
@@ -390,8 +390,8 @@ discard block |
||
390 | 390 | } |
391 | 391 | if (self::debug > 0) { |
392 | 392 | error_log( |
393 | - 'New LP - End of learnpathItem::get_attempt_id() on item ' . |
|
394 | - $this->db_id . ' - Returning ' . $res, |
|
393 | + 'New LP - End of learnpathItem::get_attempt_id() on item '. |
|
394 | + $this->db_id.' - Returning '.$res, |
|
395 | 395 | 0 |
396 | 396 | ); |
397 | 397 | } |
@@ -453,12 +453,12 @@ discard block |
||
453 | 453 | if (self::debug > 2) { |
454 | 454 | error_log( |
455 | 455 | 'learnpathItem::get_credit() - get_prevent_reinit!=0 and '. |
456 | - 'status is ' . $status, |
|
456 | + 'status is '.$status, |
|
457 | 457 | 0 |
458 | 458 | ); |
459 | 459 | } |
460 | 460 | //0=not attempted - 1 = incomplete |
461 | - if ($status != $this->possible_status[0]&& |
|
461 | + if ($status != $this->possible_status[0] && |
|
462 | 462 | $status != $this->possible_status[1] |
463 | 463 | ) { |
464 | 464 | $credit = 'no-credit'; |
@@ -530,13 +530,13 @@ discard block |
||
530 | 530 | case TOOL_DOCUMENT: |
531 | 531 | $table_doc = Database::get_course_table(TABLE_DOCUMENT); |
532 | 532 | $sql = 'SELECT path |
533 | - FROM ' . $table_doc . ' |
|
533 | + FROM ' . $table_doc.' |
|
534 | 534 | WHERE |
535 | - c_id = ' . $course_id . ' AND |
|
535 | + c_id = ' . $course_id.' AND |
|
536 | 536 | id = ' . $path; |
537 | 537 | $res = Database::query($sql); |
538 | 538 | $row = Database::fetch_array($res); |
539 | - $real_path = 'document' . $row['path']; |
|
539 | + $real_path = 'document'.$row['path']; |
|
540 | 540 | return $real_path; |
541 | 541 | case TOOL_STUDENTPUBLICATION: |
542 | 542 | case TOOL_QUIZ: |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | } |
549 | 549 | } else { |
550 | 550 | if (!empty($path_to_scorm_dir)) { |
551 | - $path = $path_to_scorm_dir . $path; |
|
551 | + $path = $path_to_scorm_dir.$path; |
|
552 | 552 | } |
553 | 553 | return $path; |
554 | 554 | } |
@@ -584,8 +584,8 @@ discard block |
||
584 | 584 | $sql = "SELECT id FROM $tbl |
585 | 585 | WHERE |
586 | 586 | c_id = $course_id AND |
587 | - lp_item_id = " . $this->db_id . " AND |
|
588 | - lp_view_id = " . $this->view_id . " AND |
|
587 | + lp_item_id = ".$this->db_id." AND |
|
588 | + lp_view_id = " . $this->view_id." AND |
|
589 | 589 | view_count = " . $this->attempt_id; |
590 | 590 | $res = Database::query($sql); |
591 | 591 | if (Database::num_rows($res) > 0) { |
@@ -628,8 +628,8 @@ discard block |
||
628 | 628 | $sql = "SELECT id FROM $tbl |
629 | 629 | WHERE |
630 | 630 | c_id = $course_id AND |
631 | - lp_item_id = " . $this->db_id . " AND |
|
632 | - lp_view_id = " . $this->view_id ." AND |
|
631 | + lp_item_id = ".$this->db_id." AND |
|
632 | + lp_view_id = " . $this->view_id." AND |
|
633 | 633 | view_count = " . $this->get_attempt_id(); |
634 | 634 | $res = Database::query($sql); |
635 | 635 | if (Database::num_rows($res) > 0) { |
@@ -669,13 +669,13 @@ discard block |
||
669 | 669 | foreach ($this->interactions as $id => $in) { |
670 | 670 | $return .= "[ |
671 | 671 | '$id', |
672 | - '" . $in[1] . "', |
|
673 | - '" . $in[2] . "', |
|
674 | - '" . $in[3] . "', |
|
675 | - '" . $in[4] . "', |
|
676 | - '" . $in[5] . "', |
|
677 | - '" . $in[6] . "', |
|
678 | - '" . $in[7] . "'],"; |
|
672 | + '".$in[1]."', |
|
673 | + '" . $in[2]."', |
|
674 | + '" . $in[3]."', |
|
675 | + '" . $in[4]."', |
|
676 | + '" . $in[5]."', |
|
677 | + '" . $in[6]."', |
|
678 | + '" . $in[7]."'],"; |
|
679 | 679 | } |
680 | 680 | if (!empty($return)) { |
681 | 681 | $return = substr($return, 0, -1); |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | $table = Database::get_course_table(TABLE_LP_MAIN); |
918 | 918 | $sql = "SELECT prevent_reinit |
919 | 919 | FROM $table |
920 | - WHERE c_id = $course_id AND id = " . $this->lp_id; |
|
920 | + WHERE c_id = $course_id AND id = ".$this->lp_id; |
|
921 | 921 | $res = Database::query($sql); |
922 | 922 | if (Database::num_rows($res) < 1) { |
923 | 923 | $this->error = "Could not find parent learnpath in lp table"; |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | } |
940 | 940 | if (self::debug > 2) { |
941 | 941 | error_log( |
942 | - 'New LP - End of learnpathItem::get_prevent_reinit() - Returned ' . $this->prevent_reinit, |
|
942 | + 'New LP - End of learnpathItem::get_prevent_reinit() - Returned '.$this->prevent_reinit, |
|
943 | 943 | 0 |
944 | 944 | ); |
945 | 945 | } |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | $table = Database::get_course_table(TABLE_LP_MAIN); |
965 | 965 | $sql = "SELECT seriousgame_mode |
966 | 966 | FROM $table |
967 | - WHERE c_id = $course_id AND id = " . $this->lp_id; |
|
967 | + WHERE c_id = $course_id AND id = ".$this->lp_id; |
|
968 | 968 | $res = Database::query($sql); |
969 | 969 | if (Database::num_rows($res) < 1) { |
970 | 970 | $this->error = "Could not find parent learnpath in learnpath table"; |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | } |
986 | 986 | if (self::debug > 2) { |
987 | 987 | error_log( |
988 | - 'New LP - End of learnpathItem::get_seriousgame_mode() - Returned ' . $this->seriousgame_mode, |
|
988 | + 'New LP - End of learnpathItem::get_seriousgame_mode() - Returned '.$this->seriousgame_mode, |
|
989 | 989 | 0 |
990 | 990 | ); |
991 | 991 | } |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | } |
1031 | 1031 | if (!isset($abs_path)) { |
1032 | 1032 | $path = $this->get_file_path(); |
1033 | - $abs_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . $path; |
|
1033 | + $abs_path = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.$path; |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | $files_list = array(); |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | $abs_path |
1306 | 1306 | ); |
1307 | 1307 | $new_abs_path = realpath( |
1308 | - $dir . '/' . $second_part |
|
1308 | + $dir.'/'.$second_part |
|
1309 | 1309 | ); |
1310 | 1310 | $in_files_list[] = learnpathItem::get_resources_from_source( |
1311 | 1311 | TOOL_DOCUMENT, |
@@ -1343,7 +1343,7 @@ discard block |
||
1343 | 1343 | $abs_path |
1344 | 1344 | ); |
1345 | 1345 | $new_abs_path = realpath( |
1346 | - $dir . '/' . $second_part |
|
1346 | + $dir.'/'.$second_part |
|
1347 | 1347 | ); |
1348 | 1348 | $in_files_list[] = learnpathItem::get_resources_from_source( |
1349 | 1349 | TOOL_DOCUMENT, |
@@ -1450,7 +1450,7 @@ discard block |
||
1450 | 1450 | $abs_path |
1451 | 1451 | ); |
1452 | 1452 | $new_abs_path = realpath( |
1453 | - $dir . '/' . $source |
|
1453 | + $dir.'/'.$source |
|
1454 | 1454 | ); |
1455 | 1455 | $in_files_list[] = learnpathItem::get_resources_from_source( |
1456 | 1456 | TOOL_DOCUMENT, |
@@ -1488,7 +1488,7 @@ discard block |
||
1488 | 1488 | $abs_path |
1489 | 1489 | ); |
1490 | 1490 | $new_abs_path = realpath( |
1491 | - $dir . '/' . $source |
|
1491 | + $dir.'/'.$source |
|
1492 | 1492 | ); |
1493 | 1493 | $in_files_list[] = learnpathItem::get_resources_from_source( |
1494 | 1494 | TOOL_DOCUMENT, |
@@ -1572,7 +1572,7 @@ discard block |
||
1572 | 1572 | ); |
1573 | 1573 | $dir = dirname($abs_path); |
1574 | 1574 | $new_abs_path = realpath( |
1575 | - $dir . '/' . $source |
|
1575 | + $dir.'/'.$source |
|
1576 | 1576 | ); |
1577 | 1577 | $in_files_list[] = learnpathItem::get_resources_from_source( |
1578 | 1578 | TOOL_DOCUMENT, |
@@ -1617,7 +1617,7 @@ discard block |
||
1617 | 1617 | ); |
1618 | 1618 | $dir = dirname($abs_path); |
1619 | 1619 | $new_abs_path = realpath( |
1620 | - $dir . '/' . $source |
|
1620 | + $dir.'/'.$source |
|
1621 | 1621 | ); |
1622 | 1622 | $in_files_list[] = learnpathItem::get_resources_from_source( |
1623 | 1623 | TOOL_DOCUMENT, |
@@ -1677,7 +1677,7 @@ discard block |
||
1677 | 1677 | } |
1678 | 1678 | if (self::debug > 1) { |
1679 | 1679 | error_log( |
1680 | - 'New LP - Out of learnpathItem::get_score() - returning ' . $res, |
|
1680 | + 'New LP - Out of learnpathItem::get_score() - returning '.$res, |
|
1681 | 1681 | 0 |
1682 | 1682 | ); |
1683 | 1683 | } |
@@ -1697,7 +1697,7 @@ discard block |
||
1697 | 1697 | $course_id = api_get_course_int_id(); |
1698 | 1698 | $debug = self::debug; |
1699 | 1699 | if ($debug > 0) { |
1700 | - error_log('learnpathItem::get_status() on item ' . $this->db_id, 0); |
|
1700 | + error_log('learnpathItem::get_status() on item '.$this->db_id, 0); |
|
1701 | 1701 | } |
1702 | 1702 | if ($check_db) { |
1703 | 1703 | if ($debug > 2) { |
@@ -1708,12 +1708,12 @@ discard block |
||
1708 | 1708 | $sql = "SELECT status FROM $table |
1709 | 1709 | WHERE |
1710 | 1710 | c_id = $course_id AND |
1711 | - id = '" . $this->db_item_view_id . "' AND |
|
1712 | - view_count = '" . $this->get_attempt_id() . "'"; |
|
1711 | + id = '".$this->db_item_view_id."' AND |
|
1712 | + view_count = '" . $this->get_attempt_id()."'"; |
|
1713 | 1713 | |
1714 | 1714 | if ($debug > 2) { |
1715 | 1715 | error_log( |
1716 | - 'learnpathItem::get_status() - Checking DB: ' . $sql, |
|
1716 | + 'learnpathItem::get_status() - Checking DB: '.$sql, |
|
1717 | 1717 | 0 |
1718 | 1718 | ); |
1719 | 1719 | } |
@@ -1724,7 +1724,7 @@ discard block |
||
1724 | 1724 | if ($update_local) { |
1725 | 1725 | if ($debug > 2) { |
1726 | 1726 | error_log( |
1727 | - 'learnpathItem::set_status() :' . $row['status'], |
|
1727 | + 'learnpathItem::set_status() :'.$row['status'], |
|
1728 | 1728 | 0 |
1729 | 1729 | ); |
1730 | 1730 | } |
@@ -1732,7 +1732,7 @@ discard block |
||
1732 | 1732 | } |
1733 | 1733 | if ($debug > 2) { |
1734 | 1734 | error_log( |
1735 | - 'learnpathItem::get_status() - Returning db value ' . $row['status'], |
|
1735 | + 'learnpathItem::get_status() - Returning db value '.$row['status'], |
|
1736 | 1736 | 0 |
1737 | 1737 | ); |
1738 | 1738 | } |
@@ -1749,7 +1749,7 @@ discard block |
||
1749 | 1749 | if (!empty($this->status)) { |
1750 | 1750 | if ($debug > 2) { |
1751 | 1751 | error_log( |
1752 | - 'learnpathItem::get_status() - Returning attrib: ' . $this->status, |
|
1752 | + 'learnpathItem::get_status() - Returning attrib: '.$this->status, |
|
1753 | 1753 | 0 |
1754 | 1754 | ); |
1755 | 1755 | } |
@@ -1759,7 +1759,7 @@ discard block |
||
1759 | 1759 | |
1760 | 1760 | if ($debug > 2) { |
1761 | 1761 | error_log( |
1762 | - 'learnpathItem::get_status() - Returning default ' . $this->possible_status[0], |
|
1762 | + 'learnpathItem::get_status() - Returning default '.$this->possible_status[0], |
|
1763 | 1763 | 0 |
1764 | 1764 | ); |
1765 | 1765 | } |
@@ -1799,7 +1799,7 @@ discard block |
||
1799 | 1799 | if ($origin == 'js') { |
1800 | 1800 | return '00 : 00: 00'; |
1801 | 1801 | } else { |
1802 | - return '00 ' . $h . ' 00 \' 00"'; |
|
1802 | + return '00 '.$h.' 00 \' 00"'; |
|
1803 | 1803 | } |
1804 | 1804 | } else { |
1805 | 1805 | return api_format_time($time, $origin); |
@@ -1824,7 +1824,7 @@ discard block |
||
1824 | 1824 | if (!isset($given_time)) { |
1825 | 1825 | if (self::debug > 2) { |
1826 | 1826 | error_log( |
1827 | - 'learnpathItem::get_scorm_time(): given time empty, current_start_time = ' . $this->current_start_time, |
|
1827 | + 'learnpathItem::get_scorm_time(): given time empty, current_start_time = '.$this->current_start_time, |
|
1828 | 1828 | 0 |
1829 | 1829 | ); |
1830 | 1830 | } |
@@ -1834,8 +1834,8 @@ discard block |
||
1834 | 1834 | FROM $table |
1835 | 1835 | WHERE |
1836 | 1836 | c_id = $course_id AND |
1837 | - id = '" . $this->db_item_view_id . "' AND |
|
1838 | - view_count = '" . $this->get_attempt_id() . "'"; |
|
1837 | + id = '".$this->db_item_view_id."' AND |
|
1838 | + view_count = '" . $this->get_attempt_id()."'"; |
|
1839 | 1839 | $res = Database::query($sql); |
1840 | 1840 | $row = Database::fetch_array($res); |
1841 | 1841 | $start = $row['start_time']; |
@@ -1856,7 +1856,7 @@ discard block |
||
1856 | 1856 | } |
1857 | 1857 | if (self::debug > 2) { |
1858 | 1858 | error_log( |
1859 | - 'learnpathItem::get_scorm_time(): intermediate = ' . $time, |
|
1859 | + 'learnpathItem::get_scorm_time(): intermediate = '.$time, |
|
1860 | 1860 | 0 |
1861 | 1861 | ); |
1862 | 1862 | } |
@@ -1876,7 +1876,7 @@ discard block |
||
1876 | 1876 | $sql = "SELECT * FROM $lp_item |
1877 | 1877 | WHERE |
1878 | 1878 | c_id = $course_id AND |
1879 | - id='" . intval($this->db_id) . "'"; |
|
1879 | + id='".intval($this->db_id)."'"; |
|
1880 | 1880 | $res = Database::query($sql); |
1881 | 1881 | $row = Database::fetch_array($res); |
1882 | 1882 | return $row['terms']; |
@@ -1905,9 +1905,9 @@ discard block |
||
1905 | 1905 | { |
1906 | 1906 | if (self::debug > 0) { |
1907 | 1907 | error_log( |
1908 | - 'learnpathItem::get_total_time() for item ' . $this->db_id . |
|
1909 | - ' - Initially, current_start_time = ' . $this->current_start_time . |
|
1910 | - ' and current_stop_time = ' . $this->current_stop_time, |
|
1908 | + 'learnpathItem::get_total_time() for item '.$this->db_id. |
|
1909 | + ' - Initially, current_start_time = '.$this->current_start_time. |
|
1910 | + ' and current_stop_time = '.$this->current_stop_time, |
|
1911 | 1911 | 0 |
1912 | 1912 | ); |
1913 | 1913 | } |
@@ -1948,9 +1948,9 @@ discard block |
||
1948 | 1948 | } else { |
1949 | 1949 | if (self::debug > 2) { |
1950 | 1950 | error_log( |
1951 | - 'learnpathItem::get_total_time() - Current start time = ' . |
|
1952 | - $this->current_start_time . ', current stop time = ' . |
|
1953 | - $this->current_stop_time . ' Returning ' . $time . "-----------\n", |
|
1951 | + 'learnpathItem::get_total_time() - Current start time = '. |
|
1952 | + $this->current_start_time.', current stop time = '. |
|
1953 | + $this->current_stop_time.' Returning '.$time."-----------\n", |
|
1954 | 1954 | 0 |
1955 | 1955 | ); |
1956 | 1956 | } |
@@ -1970,7 +1970,7 @@ discard block |
||
1970 | 1970 | } |
1971 | 1971 | if (self::debug > 2) { |
1972 | 1972 | error_log( |
1973 | - 'learnpathItem::get_type() - Returning ' . $res . ' for item ' . $this->db_id, |
|
1973 | + 'learnpathItem::get_type() - Returning '.$res.' for item '.$this->db_id, |
|
1974 | 1974 | 0 |
1975 | 1975 | ); |
1976 | 1976 | } |
@@ -2010,8 +2010,8 @@ discard block |
||
2010 | 2010 | if ($this->status_is($completedStatusList)) { |
2011 | 2011 | if (self::debug > 2) { |
2012 | 2012 | error_log( |
2013 | - 'learnpath::is_done() - Item ' . $this->get_id( |
|
2014 | - ) . ' is complete', |
|
2013 | + 'learnpath::is_done() - Item '.$this->get_id( |
|
2014 | + ).' is complete', |
|
2015 | 2015 | 0 |
2016 | 2016 | ); |
2017 | 2017 | } |
@@ -2020,8 +2020,8 @@ discard block |
||
2020 | 2020 | } else { |
2021 | 2021 | if (self::debug > 2) { |
2022 | 2022 | error_log( |
2023 | - 'learnpath::is_done() - Item ' . $this->get_id( |
|
2024 | - ) . ' is not complete', |
|
2023 | + 'learnpath::is_done() - Item '.$this->get_id( |
|
2024 | + ).' is not complete', |
|
2025 | 2025 | 0 |
2026 | 2026 | ); |
2027 | 2027 | } |
@@ -2058,7 +2058,7 @@ discard block |
||
2058 | 2058 | } |
2059 | 2059 | if (self::debug > 2) { |
2060 | 2060 | error_log( |
2061 | - 'New LP - End of learnpathItem::is_restart_allowed() - Returning ' . $restart, |
|
2061 | + 'New LP - End of learnpathItem::is_restart_allowed() - Returning '.$restart, |
|
2062 | 2062 | 0 |
2063 | 2063 | ); |
2064 | 2064 | } |
@@ -2137,7 +2137,7 @@ discard block |
||
2137 | 2137 | { |
2138 | 2138 | if (self::debug > 0) { |
2139 | 2139 | error_log( |
2140 | - 'learnpathItem::parse_prereq() for learnpath ' . $this->lp_id . ' with string ' . $prereqs_string, |
|
2140 | + 'learnpathItem::parse_prereq() for learnpath '.$this->lp_id.' with string '.$prereqs_string, |
|
2141 | 2141 | 0 |
2142 | 2142 | ); |
2143 | 2143 | } |
@@ -2338,7 +2338,7 @@ discard block |
||
2338 | 2338 | // Strange... |
2339 | 2339 | if (self::debug > 1) { |
2340 | 2340 | error_log( |
2341 | - 'New LP - Found ~ but strange string: ' . $prereqs_string, |
|
2341 | + 'New LP - Found ~ but strange string: '.$prereqs_string, |
|
2342 | 2342 | 0 |
2343 | 2343 | ); |
2344 | 2344 | } |
@@ -2366,7 +2366,7 @@ discard block |
||
2366 | 2366 | // the big brackets-enclosed condition. |
2367 | 2367 | if (self::debug > 1) { |
2368 | 2368 | error_log( |
2369 | - 'New LP - Dealing with group ' . $gr, |
|
2369 | + 'New LP - Dealing with group '.$gr, |
|
2370 | 2370 | 0 |
2371 | 2371 | ); |
2372 | 2372 | } |
@@ -2380,7 +2380,7 @@ discard block |
||
2380 | 2380 | ) { |
2381 | 2381 | if (self::debug > 1) { |
2382 | 2382 | error_log( |
2383 | - 'New LP - Found multiplier ' . $multi[0], |
|
2383 | + 'New LP - Found multiplier '.$multi[0], |
|
2384 | 2384 | 0 |
2385 | 2385 | ); |
2386 | 2386 | } |
@@ -2396,7 +2396,7 @@ discard block |
||
2396 | 2396 | $mytrue++; |
2397 | 2397 | if (self::debug > 1) { |
2398 | 2398 | error_log( |
2399 | - 'New LP - Found true item, counting.. (' . ($mytrue) . ')', |
|
2399 | + 'New LP - Found true item, counting.. ('.($mytrue).')', |
|
2400 | 2400 | 0 |
2401 | 2401 | ); |
2402 | 2402 | } |
@@ -2404,7 +2404,7 @@ discard block |
||
2404 | 2404 | } else { |
2405 | 2405 | if (self::debug > 1) { |
2406 | 2406 | error_log( |
2407 | - 'New LP - item ' . $cond . ' does not exist in items list', |
|
2407 | + 'New LP - item '.$cond.' does not exist in items list', |
|
2408 | 2408 | 0 |
2409 | 2409 | ); |
2410 | 2410 | } |
@@ -2451,7 +2451,7 @@ discard block |
||
2451 | 2451 | } else { |
2452 | 2452 | if (self::debug > 1) { |
2453 | 2453 | error_log( |
2454 | - 'New LP - ' . |
|
2454 | + 'New LP - '. |
|
2455 | 2455 | ' Found false item, the set is not true, return false', |
2456 | 2456 | 0 |
2457 | 2457 | ); |
@@ -2462,7 +2462,7 @@ discard block |
||
2462 | 2462 | } else { |
2463 | 2463 | if (self::debug > 1) { |
2464 | 2464 | error_log( |
2465 | - 'New LP - item ' . $cond . ' does not exist in items list', |
|
2465 | + 'New LP - item '.$cond.' does not exist in items list', |
|
2466 | 2466 | 0 |
2467 | 2467 | ); |
2468 | 2468 | } |
@@ -2488,7 +2488,7 @@ discard block |
||
2488 | 2488 | // value of the corresponding resource completion status. |
2489 | 2489 | if (self::debug > 1) { |
2490 | 2490 | error_log( |
2491 | - 'New LP - Didnt find any group, returning value for ' . $prereqs_string, |
|
2491 | + 'New LP - Didnt find any group, returning value for '.$prereqs_string, |
|
2492 | 2492 | 0 |
2493 | 2493 | ); |
2494 | 2494 | } |
@@ -2505,14 +2505,14 @@ discard block |
||
2505 | 2505 | if (!$returnstatus) { |
2506 | 2506 | if (self::debug > 1) { |
2507 | 2507 | error_log( |
2508 | - 'New LP - Prerequisite ' . $prereqs_string . ' not complete', |
|
2508 | + 'New LP - Prerequisite '.$prereqs_string.' not complete', |
|
2509 | 2509 | 0 |
2510 | 2510 | ); |
2511 | 2511 | } |
2512 | 2512 | } else { |
2513 | 2513 | if (self::debug > 1) { |
2514 | 2514 | error_log( |
2515 | - 'New LP - Prerequisite ' . $prereqs_string . ' complete', |
|
2515 | + 'New LP - Prerequisite '.$prereqs_string.' complete', |
|
2516 | 2516 | 0 |
2517 | 2517 | ); |
2518 | 2518 | } |
@@ -2524,12 +2524,12 @@ discard block |
||
2524 | 2524 | if ($returnstatus) { |
2525 | 2525 | //AND origin_lp_item_id = '.$user_id.' |
2526 | 2526 | $sql = 'SELECT exe_result, exe_weighting |
2527 | - FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES) . ' |
|
2527 | + FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES).' |
|
2528 | 2528 | WHERE |
2529 | - exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path . ' AND |
|
2530 | - exe_user_id = ' . $user_id . ' AND |
|
2531 | - orig_lp_id = ' . $this->lp_id . ' AND |
|
2532 | - orig_lp_item_id = ' . $prereqs_string . ' AND |
|
2529 | + exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path.' AND |
|
2530 | + exe_user_id = ' . $user_id.' AND |
|
2531 | + orig_lp_id = ' . $this->lp_id.' AND |
|
2532 | + orig_lp_item_id = ' . $prereqs_string.' AND |
|
2533 | 2533 | status <> "incomplete" |
2534 | 2534 | ORDER BY exe_date DESC |
2535 | 2535 | LIMIT 0, 1'; |
@@ -2567,12 +2567,12 @@ discard block |
||
2567 | 2567 | |
2568 | 2568 | // Checking in the database. |
2569 | 2569 | $sql = 'SELECT exe_result, exe_weighting |
2570 | - FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES) . ' |
|
2570 | + FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES).' |
|
2571 | 2571 | WHERE |
2572 | - exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path . ' AND |
|
2573 | - exe_user_id = ' . $user_id . ' AND |
|
2574 | - orig_lp_id = ' . $this->lp_id . ' AND |
|
2575 | - orig_lp_item_id = ' . $prereqs_string . ' '; |
|
2572 | + exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path.' AND |
|
2573 | + exe_user_id = ' . $user_id.' AND |
|
2574 | + orig_lp_id = ' . $this->lp_id.' AND |
|
2575 | + orig_lp_item_id = ' . $prereqs_string.' '; |
|
2576 | 2576 | |
2577 | 2577 | $rs_quiz = Database::query($sql); |
2578 | 2578 | if (Database::num_rows($rs_quiz) > 0) { |
@@ -2619,14 +2619,14 @@ discard block |
||
2619 | 2619 | if (!$returnstatus) { |
2620 | 2620 | if (self::debug > 1) { |
2621 | 2621 | error_log( |
2622 | - 'New LP - Prerequisite ' . $prereqs_string . ' not complete', |
|
2622 | + 'New LP - Prerequisite '.$prereqs_string.' not complete', |
|
2623 | 2623 | 0 |
2624 | 2624 | ); |
2625 | 2625 | } |
2626 | 2626 | } else { |
2627 | 2627 | if (self::debug > 1) { |
2628 | 2628 | error_log( |
2629 | - 'New LP - Prerequisite ' . $prereqs_string . ' complete', |
|
2629 | + 'New LP - Prerequisite '.$prereqs_string.' complete', |
|
2630 | 2630 | 0 |
2631 | 2631 | ); |
2632 | 2632 | } |
@@ -2641,11 +2641,11 @@ discard block |
||
2641 | 2641 | TABLE_LP_VIEW |
2642 | 2642 | ); |
2643 | 2643 | |
2644 | - $sql = 'SELECT id FROM ' . $lp_view . ' |
|
2644 | + $sql = 'SELECT id FROM '.$lp_view.' |
|
2645 | 2645 | WHERE |
2646 | - c_id = ' . $course_id . ' AND |
|
2647 | - user_id = ' . $user_id . ' AND |
|
2648 | - lp_id = ' . $this->lp_id . ' AND |
|
2646 | + c_id = ' . $course_id.' AND |
|
2647 | + user_id = ' . $user_id.' AND |
|
2648 | + lp_id = ' . $this->lp_id.' AND |
|
2649 | 2649 | session_id = '.$sessionId.' |
2650 | 2650 | LIMIT 0, 1'; |
2651 | 2651 | $rs_lp = Database::query($sql); |
@@ -2654,11 +2654,11 @@ discard block |
||
2654 | 2654 | ); |
2655 | 2655 | $my_lp_id = $lp_id[0]; |
2656 | 2656 | |
2657 | - $sql = 'SELECT status FROM ' . $lp_item_view . ' |
|
2657 | + $sql = 'SELECT status FROM '.$lp_item_view.' |
|
2658 | 2658 | WHERE |
2659 | - c_id = ' . $course_id . ' AND |
|
2660 | - lp_view_id = ' . $my_lp_id . ' AND |
|
2661 | - lp_item_id = ' . $refs_list[$prereqs_string] . ' |
|
2659 | + c_id = ' . $course_id.' AND |
|
2660 | + lp_view_id = ' . $my_lp_id.' AND |
|
2661 | + lp_item_id = ' . $refs_list[$prereqs_string].' |
|
2662 | 2662 | LIMIT 0, 1'; |
2663 | 2663 | $rs_lp = Database::query($sql); |
2664 | 2664 | $status_array = Database :: fetch_row( |
@@ -2675,14 +2675,14 @@ discard block |
||
2675 | 2675 | if (!$returnstatus) { |
2676 | 2676 | if (self::debug > 1) { |
2677 | 2677 | error_log( |
2678 | - 'New LP - Prerequisite ' . $prereqs_string . ' not complete', |
|
2678 | + 'New LP - Prerequisite '.$prereqs_string.' not complete', |
|
2679 | 2679 | 0 |
2680 | 2680 | ); |
2681 | 2681 | } |
2682 | 2682 | } else { |
2683 | 2683 | if (self::debug > 1) { |
2684 | 2684 | error_log( |
2685 | - 'New LP - Prerequisite ' . $prereqs_string . ' complete', |
|
2685 | + 'New LP - Prerequisite '.$prereqs_string.' complete', |
|
2686 | 2686 | 0 |
2687 | 2687 | ); |
2688 | 2688 | } |
@@ -2693,7 +2693,7 @@ discard block |
||
2693 | 2693 | } else { |
2694 | 2694 | if (self::debug > 1) { |
2695 | 2695 | error_log( |
2696 | - 'New LP - Could not find ' . $prereqs_string . ' in ' . print_r( |
|
2696 | + 'New LP - Could not find '.$prereqs_string.' in '.print_r( |
|
2697 | 2697 | $refs_list, |
2698 | 2698 | true |
2699 | 2699 | ), |
@@ -2716,7 +2716,7 @@ discard block |
||
2716 | 2716 | foreach ($list as $condition) { |
2717 | 2717 | if (self::debug > 1) { |
2718 | 2718 | error_log( |
2719 | - 'New LP - Found OR, adding it (' . $condition . ')', |
|
2719 | + 'New LP - Found OR, adding it ('.$condition.')', |
|
2720 | 2720 | 0 |
2721 | 2721 | ); |
2722 | 2722 | } |
@@ -2770,7 +2770,7 @@ discard block |
||
2770 | 2770 | |
2771 | 2771 | if (self::debug > 1) { |
2772 | 2772 | error_log( |
2773 | - 'New LP - End of parse_prereq. Error code is now ' . $this->prereq_alert, |
|
2773 | + 'New LP - End of parse_prereq. Error code is now '.$this->prereq_alert, |
|
2774 | 2774 | 0 |
2775 | 2775 | ); |
2776 | 2776 | } |
@@ -2888,7 +2888,7 @@ discard block |
||
2888 | 2888 | $this->set_score($value); |
2889 | 2889 | if (self::debug > 2) { |
2890 | 2890 | error_log( |
2891 | - 'learnpathItem::save() - setting score to ' . $value, |
|
2891 | + 'learnpathItem::save() - setting score to '.$value, |
|
2892 | 2892 | 0 |
2893 | 2893 | ); |
2894 | 2894 | } |
@@ -2897,7 +2897,7 @@ discard block |
||
2897 | 2897 | $this->set_max_score($value); |
2898 | 2898 | if (self::debug > 2) { |
2899 | 2899 | error_log( |
2900 | - 'learnpathItem::save() - setting view_max_score to ' . $value, |
|
2900 | + 'learnpathItem::save() - setting view_max_score to '.$value, |
|
2901 | 2901 | 0 |
2902 | 2902 | ); |
2903 | 2903 | } |
@@ -2906,7 +2906,7 @@ discard block |
||
2906 | 2906 | $this->min_score = $value; |
2907 | 2907 | if (self::debug > 2) { |
2908 | 2908 | error_log( |
2909 | - 'learnpathItem::save() - setting min_score to ' . $value, |
|
2909 | + 'learnpathItem::save() - setting min_score to '.$value, |
|
2910 | 2910 | 0 |
2911 | 2911 | ); |
2912 | 2912 | } |
@@ -2916,7 +2916,7 @@ discard block |
||
2916 | 2916 | $this->set_status($value); |
2917 | 2917 | if (self::debug > 2) { |
2918 | 2918 | error_log( |
2919 | - 'learnpathItem::save() - setting status to ' . $value, |
|
2919 | + 'learnpathItem::save() - setting status to '.$value, |
|
2920 | 2920 | 0 |
2921 | 2921 | ); |
2922 | 2922 | } |
@@ -2926,7 +2926,7 @@ discard block |
||
2926 | 2926 | $this->set_time($value); |
2927 | 2927 | if (self::debug > 2) { |
2928 | 2928 | error_log( |
2929 | - 'learnpathItem::save() - setting time to ' . $value, |
|
2929 | + 'learnpathItem::save() - setting time to '.$value, |
|
2930 | 2930 | 0 |
2931 | 2931 | ); |
2932 | 2932 | } |
@@ -2935,7 +2935,7 @@ discard block |
||
2935 | 2935 | $this->current_data = $value; |
2936 | 2936 | if (self::debug > 2) { |
2937 | 2937 | error_log( |
2938 | - 'learnpathItem::save() - setting suspend_data to ' . $value, |
|
2938 | + 'learnpathItem::save() - setting suspend_data to '.$value, |
|
2939 | 2939 | 0 |
2940 | 2940 | ); |
2941 | 2941 | } |
@@ -2944,7 +2944,7 @@ discard block |
||
2944 | 2944 | $this->set_lesson_location($value); |
2945 | 2945 | if (self::debug > 2) { |
2946 | 2946 | error_log( |
2947 | - 'learnpathItem::save() - setting lesson_location to ' . $value, |
|
2947 | + 'learnpathItem::save() - setting lesson_location to '.$value, |
|
2948 | 2948 | 0 |
2949 | 2949 | ); |
2950 | 2950 | } |
@@ -2953,7 +2953,7 @@ discard block |
||
2953 | 2953 | $this->set_core_exit($value); |
2954 | 2954 | if (self::debug > 2) { |
2955 | 2955 | error_log( |
2956 | - 'learnpathItem::save() - setting core_exit to ' . $value, |
|
2956 | + 'learnpathItem::save() - setting core_exit to '.$value, |
|
2957 | 2957 | 0 |
2958 | 2958 | ); |
2959 | 2959 | } |
@@ -3100,7 +3100,7 @@ discard block |
||
3100 | 3100 | public function set_level($int = 0) |
3101 | 3101 | { |
3102 | 3102 | if (self::debug > 0) { |
3103 | - error_log('learnpathItem::set_level(' . $int . ')', 0); |
|
3103 | + error_log('learnpathItem::set_level('.$int.')', 0); |
|
3104 | 3104 | } |
3105 | 3105 | if (!empty($int) AND $int == strval(intval($int))) { |
3106 | 3106 | $this->level = $int; |
@@ -3129,7 +3129,7 @@ discard block |
||
3129 | 3129 | if (empty($lpItemId)) { |
3130 | 3130 | if (self::debug > 0) { |
3131 | 3131 | error_log( |
3132 | - 'learnpathItem::set_lp_view(' . $lp_view_id . ') $lpItemId is empty', |
|
3132 | + 'learnpathItem::set_lp_view('.$lp_view_id.') $lpItemId is empty', |
|
3133 | 3133 | 0 |
3134 | 3134 | ); |
3135 | 3135 | } |
@@ -3140,7 +3140,7 @@ discard block |
||
3140 | 3140 | if (empty($lp_view_id)) { |
3141 | 3141 | if (self::debug > 0) { |
3142 | 3142 | error_log( |
3143 | - 'learnpathItem::set_lp_view(' . $lp_view_id . ') $lp_view_id is empty', |
|
3143 | + 'learnpathItem::set_lp_view('.$lp_view_id.') $lp_view_id is empty', |
|
3144 | 3144 | 0 |
3145 | 3145 | ); |
3146 | 3146 | } |
@@ -3149,7 +3149,7 @@ discard block |
||
3149 | 3149 | } |
3150 | 3150 | |
3151 | 3151 | if (self::debug > 0) { |
3152 | - error_log('learnpathItem::set_lp_view(' . $lp_view_id . ')', 0); |
|
3152 | + error_log('learnpathItem::set_lp_view('.$lp_view_id.')', 0); |
|
3153 | 3153 | } |
3154 | 3154 | |
3155 | 3155 | $this->view_id = $lp_view_id; |
@@ -3159,13 +3159,13 @@ discard block |
||
3159 | 3159 | $sql = "SELECT * FROM $item_view_table |
3160 | 3160 | WHERE |
3161 | 3161 | c_id = $course_id AND |
3162 | - lp_item_id = " . $lpItemId . " AND |
|
3163 | - lp_view_id = " . $lp_view_id . " |
|
3162 | + lp_item_id = ".$lpItemId." AND |
|
3163 | + lp_view_id = " . $lp_view_id." |
|
3164 | 3164 | ORDER BY view_count DESC"; |
3165 | 3165 | |
3166 | 3166 | if (self::debug > 2) { |
3167 | 3167 | error_log( |
3168 | - 'learnpathItem::set_lp_view() - Querying lp_item_view: ' . $sql, |
|
3168 | + 'learnpathItem::set_lp_view() - Querying lp_item_view: '.$sql, |
|
3169 | 3169 | 0 |
3170 | 3170 | ); |
3171 | 3171 | } |
@@ -3197,7 +3197,7 @@ discard block |
||
3197 | 3197 | $sql = "SELECT * FROM $item_view_interaction_table |
3198 | 3198 | WHERE |
3199 | 3199 | c_id = $course_id AND |
3200 | - lp_iv_id = '" . $this->db_item_view_id . "'"; |
|
3200 | + lp_iv_id = '".$this->db_item_view_id."'"; |
|
3201 | 3201 | |
3202 | 3202 | $res = Database::query($sql); |
3203 | 3203 | if ($res !== false) { |
@@ -3212,7 +3212,7 @@ discard block |
||
3212 | 3212 | $sql = "SELECT * FROM $item_view_objective_table |
3213 | 3213 | WHERE |
3214 | 3214 | c_id = $course_id AND |
3215 | - lp_iv_id = '" . $this->db_item_view_id . "'"; |
|
3215 | + lp_iv_id = '".$this->db_item_view_id."'"; |
|
3216 | 3216 | |
3217 | 3217 | $res = Database::query($sql); |
3218 | 3218 | if ($res !== false) { |
@@ -3273,7 +3273,7 @@ discard block |
||
3273 | 3273 | { |
3274 | 3274 | $debug = self::debug; |
3275 | 3275 | if ($debug > 0) { |
3276 | - error_log('learnpathItem::set_score(' . $score . ')', 0); |
|
3276 | + error_log('learnpathItem::set_score('.$score.')', 0); |
|
3277 | 3277 | } |
3278 | 3278 | if (($this->max_score <= 0 || $score <= $this->max_score) && ($score >= $this->min_score)) { |
3279 | 3279 | $this->current_score = $score; |
@@ -3286,9 +3286,9 @@ discard block |
||
3286 | 3286 | } |
3287 | 3287 | |
3288 | 3288 | if ($debug > 0) { |
3289 | - error_log('get_mastery_score: ' . $masteryScore); |
|
3290 | - error_log('current_status: ' . $current_status); |
|
3291 | - error_log('current score : ' . $this->current_score); |
|
3289 | + error_log('get_mastery_score: '.$masteryScore); |
|
3290 | + error_log('current_status: '.$current_status); |
|
3291 | + error_log('current score : '.$this->current_score); |
|
3292 | 3292 | } |
3293 | 3293 | |
3294 | 3294 | // If mastery_score is set AND the current score reaches the mastery |
@@ -3316,15 +3316,15 @@ discard block |
||
3316 | 3316 | public function set_max_score($score) |
3317 | 3317 | { |
3318 | 3318 | if (self::debug > 0) { |
3319 | - error_log('learnpathItem::set_max_score(' . $score . ')', 0); |
|
3319 | + error_log('learnpathItem::set_max_score('.$score.')', 0); |
|
3320 | 3320 | } |
3321 | 3321 | if (is_int($score) || $score == '') { |
3322 | 3322 | $this->view_max_score = $score; |
3323 | 3323 | if (self::debug > 1) { |
3324 | 3324 | error_log( |
3325 | - 'learnpathItem::set_max_score() - ' . |
|
3326 | - 'Updated object score of item ' . $this->db_id . |
|
3327 | - ' to ' . $this->view_max_score, |
|
3325 | + 'learnpathItem::set_max_score() - '. |
|
3326 | + 'Updated object score of item '.$this->db_id. |
|
3327 | + ' to '.$this->view_max_score, |
|
3328 | 3328 | 0 |
3329 | 3329 | ); |
3330 | 3330 | } |
@@ -3342,12 +3342,12 @@ discard block |
||
3342 | 3342 | public function set_status($status) |
3343 | 3343 | { |
3344 | 3344 | if (self::debug > 0) { |
3345 | - error_log('learnpathItem::set_status(' . $status . ')', 0); |
|
3345 | + error_log('learnpathItem::set_status('.$status.')', 0); |
|
3346 | 3346 | } |
3347 | 3347 | |
3348 | 3348 | $found = false; |
3349 | 3349 | foreach ($this->possible_status as $possible) { |
3350 | - if (preg_match('/^' . $possible . '$/i', $status)) { |
|
3350 | + if (preg_match('/^'.$possible.'$/i', $status)) { |
|
3351 | 3351 | $found = true; |
3352 | 3352 | } |
3353 | 3353 | } |
@@ -3357,8 +3357,8 @@ discard block |
||
3357 | 3357 | if (self::debug > 1) { |
3358 | 3358 | error_log( |
3359 | 3359 | 'learnpathItem::set_status() - '. |
3360 | - 'Updated object status of item ' . $this->db_id . |
|
3361 | - ' to ' . $this->status, |
|
3360 | + 'Updated object status of item '.$this->db_id. |
|
3361 | + ' to '.$this->status, |
|
3362 | 3362 | 0 |
3363 | 3363 | ); |
3364 | 3364 | } |
@@ -3380,7 +3380,7 @@ discard block |
||
3380 | 3380 | global $charset; |
3381 | 3381 | $course_id = api_get_course_int_id(); |
3382 | 3382 | $lp_item = Database::get_course_table(TABLE_LP_ITEM); |
3383 | - require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; |
|
3383 | + require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
|
3384 | 3384 | $a_terms = preg_split('/,/', $terms); |
3385 | 3385 | $i_terms = preg_split('/,/', $this->get_terms()); |
3386 | 3386 | foreach ($i_terms as $term) { |
@@ -3397,7 +3397,7 @@ discard block |
||
3397 | 3397 | SET terms = '$terms' |
3398 | 3398 | WHERE |
3399 | 3399 | c_id = $course_id AND |
3400 | - id=" . $this->get_id(); |
|
3400 | + id=".$this->get_id(); |
|
3401 | 3401 | Database::query($sql); |
3402 | 3402 | // Save it to search engine. |
3403 | 3403 | if (api_get_setting('search_enabled') == 'true') { |
@@ -3425,7 +3425,7 @@ discard block |
||
3425 | 3425 | public function set_time($scorm_time, $format = 'scorm') |
3426 | 3426 | { |
3427 | 3427 | if (self::debug > 0) { |
3428 | - error_log('learnpathItem::set_time(' . $scorm_time . ')', 0); |
|
3428 | + error_log('learnpathItem::set_time('.$scorm_time.')', 0); |
|
3429 | 3429 | } |
3430 | 3430 | if ($scorm_time == '0' |
3431 | 3431 | and ($this->type != 'sco') |
@@ -3436,8 +3436,8 @@ discard block |
||
3436 | 3436 | $this->update_time($my_time); |
3437 | 3437 | if (self::debug > 0) { |
3438 | 3438 | error_log( |
3439 | - 'learnpathItem::set_time(' . $scorm_time . ') - ' . |
|
3440 | - 'found asset - set time to ' . $my_time, |
|
3439 | + 'learnpathItem::set_time('.$scorm_time.') - '. |
|
3440 | + 'found asset - set time to '.$my_time, |
|
3441 | 3441 | 0 |
3442 | 3442 | ); |
3443 | 3443 | } |
@@ -3510,10 +3510,10 @@ discard block |
||
3510 | 3510 | { |
3511 | 3511 | if (self::debug > 1) { |
3512 | 3512 | error_log( |
3513 | - 'learnpathItem::status_is(' . print_r( |
|
3513 | + 'learnpathItem::status_is('.print_r( |
|
3514 | 3514 | $list, |
3515 | 3515 | true |
3516 | - ) . ') on item ' . $this->db_id, |
|
3516 | + ).') on item '.$this->db_id, |
|
3517 | 3517 | 0 |
3518 | 3518 | ); |
3519 | 3519 | } |
@@ -3523,11 +3523,11 @@ discard block |
||
3523 | 3523 | } |
3524 | 3524 | $found = false; |
3525 | 3525 | foreach ($list as $status) { |
3526 | - if (preg_match('/^' . $status . '$/i', $currentStatus)) { |
|
3526 | + if (preg_match('/^'.$status.'$/i', $currentStatus)) { |
|
3527 | 3527 | if (self::debug > 2) { |
3528 | 3528 | error_log( |
3529 | - 'New LP - learnpathItem::status_is() - Found status ' . |
|
3530 | - $status . ' corresponding to current status', |
|
3529 | + 'New LP - learnpathItem::status_is() - Found status '. |
|
3530 | + $status.' corresponding to current status', |
|
3531 | 3531 | 0 |
3532 | 3532 | ); |
3533 | 3533 | } |
@@ -3538,8 +3538,8 @@ discard block |
||
3538 | 3538 | } |
3539 | 3539 | if (self::debug > 2) { |
3540 | 3540 | error_log( |
3541 | - 'New LP - learnpathItem::status_is() - Status ' . |
|
3542 | - $currentStatus . ' did not match request', |
|
3541 | + 'New LP - learnpathItem::status_is() - Status '. |
|
3542 | + $currentStatus.' did not match request', |
|
3543 | 3543 | 0 |
3544 | 3544 | ); |
3545 | 3545 | } |
@@ -3556,7 +3556,7 @@ discard block |
||
3556 | 3556 | public function update_time($total_sec = 0) |
3557 | 3557 | { |
3558 | 3558 | if (self::debug > 0) { |
3559 | - error_log('learnpathItem::update_time(' . $total_sec . ')', 0); |
|
3559 | + error_log('learnpathItem::update_time('.$total_sec.')', 0); |
|
3560 | 3560 | } |
3561 | 3561 | if ($total_sec >= 0) { |
3562 | 3562 | // Getting start time from finish time. The only problem in the calculation is it might be |
@@ -3606,12 +3606,12 @@ discard block |
||
3606 | 3606 | $item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW); |
3607 | 3607 | $course_id = api_get_course_int_id(); |
3608 | 3608 | |
3609 | - $sql = 'SELECT total_time, status FROM ' . $item_view_table . ' |
|
3609 | + $sql = 'SELECT total_time, status FROM '.$item_view_table.' |
|
3610 | 3610 | WHERE |
3611 | - c_id = ' . $course_id . ' AND |
|
3612 | - lp_item_id="' . $this->db_id . '" AND |
|
3613 | - lp_view_id="' . $this->view_id . '" AND |
|
3614 | - view_count="' . $this->get_attempt_id() . '"'; |
|
3611 | + c_id = ' . $course_id.' AND |
|
3612 | + lp_item_id="' . $this->db_id.'" AND |
|
3613 | + lp_view_id="' . $this->view_id.'" AND |
|
3614 | + view_count="' . $this->get_attempt_id().'"'; |
|
3615 | 3615 | $result = Database::query($sql); |
3616 | 3616 | $row = Database::fetch_array($result); |
3617 | 3617 | |
@@ -3681,13 +3681,13 @@ discard block |
||
3681 | 3681 | { |
3682 | 3682 | $item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW); |
3683 | 3683 | $course_id = api_get_course_int_id(); |
3684 | - $sql = 'UPDATE ' . $item_view_table . ' |
|
3684 | + $sql = 'UPDATE '.$item_view_table.' |
|
3685 | 3685 | SET total_time = 0, |
3686 | - start_time=' . time() . ' |
|
3687 | - WHERE c_id = ' . $course_id . ' |
|
3688 | - AND lp_item_id="' . $this->db_id . '" |
|
3689 | - AND lp_view_id="' . $this->view_id . '" |
|
3690 | - AND view_count="' . $this->attempt_id . '" ;'; |
|
3686 | + start_time=' . time().' |
|
3687 | + WHERE c_id = ' . $course_id.' |
|
3688 | + AND lp_item_id="' . $this->db_id.'" |
|
3689 | + AND lp_view_id="' . $this->view_id.'" |
|
3690 | + AND view_count="' . $this->attempt_id.'" ;'; |
|
3691 | 3691 | Database::query($sql); |
3692 | 3692 | } |
3693 | 3693 | |
@@ -3709,8 +3709,8 @@ discard block |
||
3709 | 3709 | FROM $tbl |
3710 | 3710 | WHERE |
3711 | 3711 | c_id = $course_id AND |
3712 | - lp_item_id = " . $this->db_id . " AND |
|
3713 | - lp_view_id = " . $this->view_id . " AND |
|
3712 | + lp_item_id = ".$this->db_id." AND |
|
3713 | + lp_view_id = " . $this->view_id." AND |
|
3714 | 3714 | view_count = " . $this->attempt_id; |
3715 | 3715 | $res = Database::query($sql); |
3716 | 3716 | if (Database::num_rows($res) > 0) { |
@@ -3718,8 +3718,8 @@ discard block |
||
3718 | 3718 | $lp_iv_id = $row[0]; |
3719 | 3719 | if (self::debug > 2) { |
3720 | 3720 | error_log( |
3721 | - 'learnpathItem::write_to_db() - Got item_view_id ' . |
|
3722 | - $lp_iv_id . ', now checking objectives ', |
|
3721 | + 'learnpathItem::write_to_db() - Got item_view_id '. |
|
3722 | + $lp_iv_id.', now checking objectives ', |
|
3723 | 3723 | 0 |
3724 | 3724 | ); |
3725 | 3725 | } |
@@ -3731,7 +3731,7 @@ discard block |
||
3731 | 3731 | WHERE |
3732 | 3732 | c_id = $course_id AND |
3733 | 3733 | lp_iv_id = $lp_iv_id AND |
3734 | - objective_id = '" . Database::escape_string($objective[0]) . "'"; |
|
3734 | + objective_id = '".Database::escape_string($objective[0])."'"; |
|
3735 | 3735 | $iva_res = Database::query($iva_sql); |
3736 | 3736 | // id(0), type(1), time(2), weighting(3), |
3737 | 3737 | // correct_responses(4), student_response(5), |
@@ -3740,12 +3740,12 @@ discard block |
||
3740 | 3740 | // Update (or don't). |
3741 | 3741 | $iva_row = Database::fetch_array($iva_res); |
3742 | 3742 | $iva_id = $iva_row[0]; |
3743 | - $ivau_sql = "UPDATE $iva_table " . |
|
3744 | - "SET objective_id = '" . Database::escape_string($objective[0]) . "'," . |
|
3745 | - "status = '" . Database::escape_string($objective[1]) . "'," . |
|
3746 | - "score_raw = '" . Database::escape_string($objective[2]) . "'," . |
|
3747 | - "score_min = '" . Database::escape_string($objective[4]) . "'," . |
|
3748 | - "score_max = '" . Database::escape_string($objective[3]) . "' " . |
|
3743 | + $ivau_sql = "UPDATE $iva_table ". |
|
3744 | + "SET objective_id = '".Database::escape_string($objective[0])."',". |
|
3745 | + "status = '".Database::escape_string($objective[1])."',". |
|
3746 | + "score_raw = '".Database::escape_string($objective[2])."',". |
|
3747 | + "score_min = '".Database::escape_string($objective[4])."',". |
|
3748 | + "score_max = '".Database::escape_string($objective[3])."' ". |
|
3749 | 3749 | "WHERE c_id = $course_id AND id = $iva_id"; |
3750 | 3750 | Database::query($ivau_sql); |
3751 | 3751 | } else { |
@@ -3797,12 +3797,12 @@ discard block |
||
3797 | 3797 | $my_status = ' '; |
3798 | 3798 | |
3799 | 3799 | $item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW); |
3800 | - $sql = 'SELECT status FROM ' . $item_view_table . ' |
|
3800 | + $sql = 'SELECT status FROM '.$item_view_table.' |
|
3801 | 3801 | WHERE |
3802 | - c_id = ' . $course_id . ' AND |
|
3803 | - lp_item_id="' . $this->db_id . '" AND |
|
3804 | - lp_view_id="' . $this->view_id . '" AND |
|
3805 | - view_count="' . $this->get_attempt_id() . '" '; |
|
3802 | + c_id = ' . $course_id.' AND |
|
3803 | + lp_item_id="' . $this->db_id.'" AND |
|
3804 | + lp_view_id="' . $this->view_id.'" AND |
|
3805 | + view_count="' . $this->get_attempt_id().'" '; |
|
3806 | 3806 | $rs_verified = Database::query($sql); |
3807 | 3807 | $row_verified = Database::fetch_array($rs_verified); |
3808 | 3808 | |
@@ -3830,8 +3830,8 @@ discard block |
||
3830 | 3830 | "This info shouldn't be saved as the credit or lesson mode info prevent it" |
3831 | 3831 | ); |
3832 | 3832 | error_log( |
3833 | - 'learnpathItem::write_to_db() - credit(' . $credit . ') or'. |
|
3834 | - ' lesson_mode(' . $mode . ') prevent recording!', |
|
3833 | + 'learnpathItem::write_to_db() - credit('.$credit.') or'. |
|
3834 | + ' lesson_mode('.$mode.') prevent recording!', |
|
3835 | 3835 | 0 |
3836 | 3836 | ); |
3837 | 3837 | } |
@@ -3855,14 +3855,14 @@ discard block |
||
3855 | 3855 | "max_score" => $this->get_max(), |
3856 | 3856 | "lp_item_id" => $this->db_id, |
3857 | 3857 | "lp_view_id" => $this->view_id, |
3858 | - "view_count" => $this->get_attempt_id() , |
|
3858 | + "view_count" => $this->get_attempt_id(), |
|
3859 | 3859 | "suspend_data" => $this->current_data, |
3860 | 3860 | //"max_time_allowed" => , |
3861 | 3861 | "lesson_location" => $this->lesson_location |
3862 | 3862 | ); |
3863 | 3863 | if (self::debug > 2) { |
3864 | 3864 | error_log( |
3865 | - 'learnpathItem::write_to_db() - Inserting into item_view forced: ' . print_r($params, 1), |
|
3865 | + 'learnpathItem::write_to_db() - Inserting into item_view forced: '.print_r($params, 1), |
|
3866 | 3866 | 0 |
3867 | 3867 | ); |
3868 | 3868 | } |
@@ -3870,7 +3870,7 @@ discard block |
||
3870 | 3870 | |
3871 | 3871 | if ($this->db_item_view_id) { |
3872 | 3872 | $sql = "UPDATE $item_view_table SET id = iid |
3873 | - WHERE iid = " . $this->db_item_view_id; |
|
3873 | + WHERE iid = ".$this->db_item_view_id; |
|
3874 | 3874 | Database::query($sql); |
3875 | 3875 | $inserted = true; |
3876 | 3876 | } |
@@ -3880,12 +3880,12 @@ discard block |
||
3880 | 3880 | $sql = "SELECT * FROM $item_view_table |
3881 | 3881 | WHERE |
3882 | 3882 | c_id = $course_id AND |
3883 | - lp_item_id = " . $this->db_id . " AND |
|
3884 | - lp_view_id = " . $this->view_id . " AND |
|
3883 | + lp_item_id = ".$this->db_id." AND |
|
3884 | + lp_view_id = " . $this->view_id." AND |
|
3885 | 3885 | view_count = " . intval($this->get_attempt_id()); |
3886 | 3886 | if (self::debug > 2) { |
3887 | 3887 | error_log( |
3888 | - 'learnpathItem::write_to_db() - Querying item_view: ' . $sql, |
|
3888 | + 'learnpathItem::write_to_db() - Querying item_view: '.$sql, |
|
3889 | 3889 | 0 |
3890 | 3890 | ); |
3891 | 3891 | } |
@@ -3902,7 +3902,7 @@ discard block |
||
3902 | 3902 | "max_score" => $this->get_max(), |
3903 | 3903 | "lp_item_id" => $this->db_id, |
3904 | 3904 | "lp_view_id" => $this->view_id, |
3905 | - "view_count" => $this->get_attempt_id() , |
|
3905 | + "view_count" => $this->get_attempt_id(), |
|
3906 | 3906 | "suspend_data" => $this->current_data, |
3907 | 3907 | //"max_time_allowed" => ,$this->get_max_time_allowed() |
3908 | 3908 | "lesson_location" => $this->lesson_location |
@@ -3910,7 +3910,7 @@ discard block |
||
3910 | 3910 | |
3911 | 3911 | if (self::debug > 2) { |
3912 | 3912 | error_log( |
3913 | - 'learnpathItem::write_to_db() - Inserting into item_view forced: ' . print_r($params, 1), |
|
3913 | + 'learnpathItem::write_to_db() - Inserting into item_view forced: '.print_r($params, 1), |
|
3914 | 3914 | 0 |
3915 | 3915 | ); |
3916 | 3916 | } |
@@ -3919,7 +3919,7 @@ discard block |
||
3919 | 3919 | |
3920 | 3920 | if ($this->db_item_view_id) { |
3921 | 3921 | $sql = "UPDATE $item_view_table SET id = iid |
3922 | - WHERE iid = " . $this->db_item_view_id; |
|
3922 | + WHERE iid = ".$this->db_item_view_id; |
|
3923 | 3923 | Database::query($sql); |
3924 | 3924 | } |
3925 | 3925 | } else { |
@@ -3959,8 +3959,8 @@ discard block |
||
3959 | 3959 | $time_exe_date = convert_sql_date( |
3960 | 3960 | $row_dates['exe_date'] |
3961 | 3961 | ); |
3962 | - $mytime = ((int)$time_exe_date - (int)$time_start_date); |
|
3963 | - $total_time = " total_time = " . $mytime . ", "; |
|
3962 | + $mytime = ((int) $time_exe_date - (int) $time_start_date); |
|
3963 | + $total_time = " total_time = ".$mytime.", "; |
|
3964 | 3964 | } |
3965 | 3965 | } else { |
3966 | 3966 | $my_type_lp = learnpath::get_type_static($this->lp_id); |
@@ -3974,16 +3974,16 @@ discard block |
||
3974 | 3974 | |
3975 | 3975 | // Is not multiple attempts |
3976 | 3976 | if ($this->seriousgame_mode == 1 && $this->type == 'sco') { |
3977 | - $total_time = " total_time = total_time +" . $this->get_total_time() . ", "; |
|
3978 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
3977 | + $total_time = " total_time = total_time +".$this->get_total_time().", "; |
|
3978 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
3979 | 3979 | } elseif ($this->get_prevent_reinit() == 1) { |
3980 | 3980 | // Process of status verified into data base. |
3981 | - $sql = 'SELECT status FROM ' . $item_view_table . ' |
|
3981 | + $sql = 'SELECT status FROM '.$item_view_table.' |
|
3982 | 3982 | WHERE |
3983 | - c_id = ' . $course_id . ' AND |
|
3984 | - lp_item_id="' . $this->db_id . '" AND |
|
3985 | - lp_view_id="' . $this->view_id . '" AND |
|
3986 | - view_count="' . $this->get_attempt_id() . '" |
|
3983 | + c_id = ' . $course_id.' AND |
|
3984 | + lp_item_id="' . $this->db_id.'" AND |
|
3985 | + lp_view_id="' . $this->view_id.'" AND |
|
3986 | + view_count="' . $this->get_attempt_id().'" |
|
3987 | 3987 | '; |
3988 | 3988 | $rs_verified = Database::query($sql); |
3989 | 3989 | $row_verified = Database::fetch_array($rs_verified); |
@@ -3993,26 +3993,26 @@ discard block |
||
3993 | 3993 | if (!in_array($this->get_status(false), $case_completed) && |
3994 | 3994 | $my_type_lp == 2 |
3995 | 3995 | ) { |
3996 | - $total_time = " total_time = total_time +" . $this->get_total_time() . ", "; |
|
3997 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
3996 | + $total_time = " total_time = total_time +".$this->get_total_time().", "; |
|
3997 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
3998 | 3998 | } else { |
3999 | 3999 | // Verified into database. |
4000 | 4000 | if (!in_array($row_verified['status'], $case_completed) && |
4001 | 4001 | $my_type_lp == 2 |
4002 | 4002 | ) { |
4003 | - $total_time = " total_time = total_time +" . $this->get_total_time() . ", "; |
|
4004 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
4005 | - } elseif (in_array($row_verified['status'], $case_completed ) && |
|
4003 | + $total_time = " total_time = total_time +".$this->get_total_time().", "; |
|
4004 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
4005 | + } elseif (in_array($row_verified['status'], $case_completed) && |
|
4006 | 4006 | $my_type_lp == 2 && $this->type != 'sco' |
4007 | 4007 | ) { |
4008 | - $total_time = " total_time = total_time +" . $this->get_total_time() . ", "; |
|
4009 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
4008 | + $total_time = " total_time = total_time +".$this->get_total_time().", "; |
|
4009 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
4010 | 4010 | } else { |
4011 | 4011 | if (($my_type_lp == 3 && $this->type == 'au') || |
4012 | 4012 | ($my_type_lp == 1 && $this->type != 'dir')) { |
4013 | 4013 | // Is AICC or Chamilo LP |
4014 | - $total_time = " total_time = total_time + " . $this->get_total_time() . ", "; |
|
4015 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
4014 | + $total_time = " total_time = total_time + ".$this->get_total_time().", "; |
|
4015 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
4016 | 4016 | } |
4017 | 4017 | } |
4018 | 4018 | } |
@@ -4024,27 +4024,27 @@ discard block |
||
4024 | 4024 | ) && $my_type_lp == 2 |
4025 | 4025 | ) { |
4026 | 4026 | // Reset zero new attempt ? |
4027 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
4027 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
4028 | 4028 | } elseif (!in_array($this->get_status(false), $case_completed) && |
4029 | 4029 | $my_type_lp == 2 |
4030 | 4030 | ) { |
4031 | - $total_time = " total_time = " . $this->get_total_time() . ", "; |
|
4032 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
4031 | + $total_time = " total_time = ".$this->get_total_time().", "; |
|
4032 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
4033 | 4033 | } else { |
4034 | 4034 | // It is chamilo LP. |
4035 | - $total_time = " total_time = total_time +" . $this->get_total_time() . ", "; |
|
4036 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
4035 | + $total_time = " total_time = total_time +".$this->get_total_time().", "; |
|
4036 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
4037 | 4037 | } |
4038 | 4038 | |
4039 | 4039 | // This code line fixes the problem of wrong status. |
4040 | 4040 | if ($my_type_lp == 2) { |
4041 | 4041 | // Verify current status in multiples attempts. |
4042 | - $sql = 'SELECT status FROM ' . $item_view_table . ' |
|
4042 | + $sql = 'SELECT status FROM '.$item_view_table.' |
|
4043 | 4043 | WHERE |
4044 | - c_id = ' . $course_id . ' AND |
|
4045 | - lp_item_id="' . $this->db_id . '" AND |
|
4046 | - lp_view_id="' . $this->view_id . '" AND |
|
4047 | - view_count="' . $this->get_attempt_id() . '" '; |
|
4044 | + c_id = ' . $course_id.' AND |
|
4045 | + lp_item_id="' . $this->db_id.'" AND |
|
4046 | + lp_view_id="' . $this->view_id.'" AND |
|
4047 | + view_count="' . $this->get_attempt_id().'" '; |
|
4048 | 4048 | $rs_status = Database::query($sql); |
4049 | 4049 | $current_status = Database::result( |
4050 | 4050 | $rs_status, |
@@ -4055,7 +4055,7 @@ discard block |
||
4055 | 4055 | $my_status = ''; |
4056 | 4056 | $total_time = ''; |
4057 | 4057 | } else { |
4058 | - $total_time = " total_time = total_time +" . $this->get_total_time() . ", "; |
|
4058 | + $total_time = " total_time = total_time +".$this->get_total_time().", "; |
|
4059 | 4059 | } |
4060 | 4060 | } |
4061 | 4061 | } |
@@ -4066,38 +4066,38 @@ discard block |
||
4066 | 4066 | //" . //start_time = ".$this->get_current_start_time().", " . //scorm_init_time does it |
4067 | 4067 | ////" max_time_allowed = '".$this->get_max_time_allowed()."'," . |
4068 | 4068 | $sql = "UPDATE $item_view_table SET |
4069 | - score = " . $this->get_score() . ", |
|
4069 | + score = ".$this->get_score().", |
|
4070 | 4070 | $my_status |
4071 | - max_score = '" . $this->get_max() . "', |
|
4072 | - suspend_data = '" . Database::escape_string($this->current_data) . "', |
|
4073 | - lesson_location = '" . $this->lesson_location . "' |
|
4071 | + max_score = '".$this->get_max()."', |
|
4072 | + suspend_data = '" . Database::escape_string($this->current_data)."', |
|
4073 | + lesson_location = '" . $this->lesson_location."' |
|
4074 | 4074 | WHERE |
4075 | 4075 | c_id = $course_id AND |
4076 | - lp_item_id = " . $this->db_id . " AND |
|
4077 | - lp_view_id = " . $this->view_id . " AND |
|
4076 | + lp_item_id = ".$this->db_id." AND |
|
4077 | + lp_view_id = " . $this->view_id." AND |
|
4078 | 4078 | view_count = " . $this->get_attempt_id(); |
4079 | 4079 | |
4080 | 4080 | } else { |
4081 | 4081 | //" max_time_allowed = '".$this->get_max_time_allowed()."'," . |
4082 | 4082 | $sql = "UPDATE $item_view_table SET |
4083 | 4083 | $total_time |
4084 | - start_time = " . $this->get_current_start_time() . ", |
|
4085 | - score = " . $this->get_score() . ", |
|
4084 | + start_time = ".$this->get_current_start_time().", |
|
4085 | + score = " . $this->get_score().", |
|
4086 | 4086 | $my_status |
4087 | - max_score = '" . $this->get_max() . "', |
|
4088 | - suspend_data = '" . Database::escape_string($this->current_data) . "', |
|
4089 | - lesson_location = '" . $this->lesson_location . "' |
|
4087 | + max_score = '".$this->get_max()."', |
|
4088 | + suspend_data = '" . Database::escape_string($this->current_data)."', |
|
4089 | + lesson_location = '" . $this->lesson_location."' |
|
4090 | 4090 | WHERE |
4091 | 4091 | c_id = $course_id AND |
4092 | - lp_item_id = " . $this->db_id . " AND |
|
4093 | - lp_view_id = " . $this->view_id . " AND |
|
4092 | + lp_item_id = ".$this->db_id." AND |
|
4093 | + lp_view_id = " . $this->view_id." AND |
|
4094 | 4094 | view_count = " . $this->get_attempt_id(); |
4095 | 4095 | } |
4096 | 4096 | $this->current_start_time = time(); |
4097 | 4097 | } |
4098 | 4098 | if (self::debug > 2) { |
4099 | 4099 | error_log( |
4100 | - 'learnpathItem::write_to_db() - Updating item_view: ' . $sql, |
|
4100 | + 'learnpathItem::write_to_db() - Updating item_view: '.$sql, |
|
4101 | 4101 | 0 |
4102 | 4102 | ); |
4103 | 4103 | } |
@@ -4110,8 +4110,8 @@ discard block |
||
4110 | 4110 | $sql = "SELECT id FROM $tbl |
4111 | 4111 | WHERE |
4112 | 4112 | c_id = $course_id AND |
4113 | - lp_item_id = " . $this->db_id . " AND |
|
4114 | - lp_view_id = " . $this->view_id . " AND |
|
4113 | + lp_item_id = ".$this->db_id." AND |
|
4114 | + lp_view_id = " . $this->view_id." AND |
|
4115 | 4115 | view_count = " . $this->get_attempt_id(); |
4116 | 4116 | $res = Database::query($sql); |
4117 | 4117 | if (Database::num_rows($res) > 0) { |
@@ -4119,16 +4119,16 @@ discard block |
||
4119 | 4119 | $lp_iv_id = $row[0]; |
4120 | 4120 | if (self::debug > 2) { |
4121 | 4121 | error_log( |
4122 | - 'learnpathItem::write_to_db() - Got item_view_id ' . |
|
4123 | - $lp_iv_id . ', now checking interactions ', |
|
4122 | + 'learnpathItem::write_to_db() - Got item_view_id '. |
|
4123 | + $lp_iv_id.', now checking interactions ', |
|
4124 | 4124 | 0 |
4125 | 4125 | ); |
4126 | 4126 | } |
4127 | 4127 | foreach ($this->interactions as $index => $interaction) { |
4128 | 4128 | $correct_resp = ''; |
4129 | - if (is_array($interaction[4] ) && !empty($interaction[4][0])) { |
|
4129 | + if (is_array($interaction[4]) && !empty($interaction[4][0])) { |
|
4130 | 4130 | foreach ($interaction[4] as $resp) { |
4131 | - $correct_resp .= $resp . ','; |
|
4131 | + $correct_resp .= $resp.','; |
|
4132 | 4132 | } |
4133 | 4133 | $correct_resp = substr( |
4134 | 4134 | $correct_resp, |
@@ -4147,7 +4147,7 @@ discard block |
||
4147 | 4147 | lp_iv_id = $lp_iv_id AND |
4148 | 4148 | ( |
4149 | 4149 | order_id = $index OR |
4150 | - interaction_id = '" . Database::escape_string($interaction[0]) . "' |
|
4150 | + interaction_id = '".Database::escape_string($interaction[0])."' |
|
4151 | 4151 | ) |
4152 | 4152 | "; |
4153 | 4153 | $iva_res = Database::query($iva_sql); |
@@ -4229,11 +4229,11 @@ discard block |
||
4229 | 4229 | public function add_audio() |
4230 | 4230 | { |
4231 | 4231 | $course_info = api_get_course_info(); |
4232 | - $filepath = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document/'; |
|
4232 | + $filepath = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/'; |
|
4233 | 4233 | |
4234 | - if (!is_dir($filepath . 'audio')) { |
|
4234 | + if (!is_dir($filepath.'audio')) { |
|
4235 | 4235 | mkdir( |
4236 | - $filepath . 'audio', |
|
4236 | + $filepath.'audio', |
|
4237 | 4237 | api_get_permissions_for_new_directories() |
4238 | 4238 | ); |
4239 | 4239 | $audio_id = add_document( |
@@ -4292,10 +4292,10 @@ discard block |
||
4292 | 4292 | // Store the mp3 file in the lp_item table. |
4293 | 4293 | $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
4294 | 4294 | $sql = "UPDATE $tbl_lp_item SET |
4295 | - audio = '" . Database::escape_string($file_path) . "' |
|
4295 | + audio = '".Database::escape_string($file_path)."' |
|
4296 | 4296 | WHERE |
4297 | 4297 | c_id = {$course_info['real_id']} AND |
4298 | - id = '" . intval($this->db_id) . "'"; |
|
4298 | + id = '".intval($this->db_id)."'"; |
|
4299 | 4299 | Database::query($sql); |
4300 | 4300 | } |
4301 | 4301 | |
@@ -4320,10 +4320,10 @@ discard block |
||
4320 | 4320 | // Store the mp3 file in the lp_item table. |
4321 | 4321 | $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
4322 | 4322 | $sql = "UPDATE $tbl_lp_item SET |
4323 | - audio = '" . Database::escape_string($file_path) . "' |
|
4323 | + audio = '".Database::escape_string($file_path)."' |
|
4324 | 4324 | WHERE |
4325 | 4325 | c_id = {$course_info['real_id']} AND |
4326 | - id = " . intval($this->db_id); |
|
4326 | + id = ".intval($this->db_id); |
|
4327 | 4327 | Database::query($sql); |
4328 | 4328 | } |
4329 | 4329 | return $file_path; |
@@ -4344,7 +4344,7 @@ discard block |
||
4344 | 4344 | } |
4345 | 4345 | $sql = "UPDATE $tbl_lp_item SET |
4346 | 4346 | audio = '' |
4347 | - WHERE c_id = $course_id AND id IN (" . $this->db_id . ")"; |
|
4347 | + WHERE c_id = $course_id AND id IN (".$this->db_id.")"; |
|
4348 | 4348 | Database::query($sql); |
4349 | 4349 | } |
4350 | 4350 | |
@@ -4390,7 +4390,7 @@ discard block |
||
4390 | 4390 | |
4391 | 4391 | if ($type == 'simple') { |
4392 | 4392 | if (in_array($status, array('failed', 'passed', 'browsed'))) { |
4393 | - $myLessonStatus = get_lang('ScormIncomplete');; |
|
4393 | + $myLessonStatus = get_lang('ScormIncomplete'); ; |
|
4394 | 4394 | $classStatus = 'warning'; |
4395 | 4395 | } |
4396 | 4396 | } |
@@ -4539,7 +4539,7 @@ discard block |
||
4539 | 4539 | */ |
4540 | 4540 | public function createForumThread($currentForumId) |
4541 | 4541 | { |
4542 | - require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php'; |
|
4542 | + require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php'; |
|
4543 | 4543 | |
4544 | 4544 | $em = Database::getManager(); |
4545 | 4545 | $threadRepo = $em->getRepository('ChamiloCourseBundle:CForumThread'); |
@@ -60,5 +60,5 @@ |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | Display::display_header(get_lang('SyncDatabaseWithSchema')); |
63 | -echo $content ; |
|
63 | +echo $content; |
|
64 | 64 | Display::display_footer(); |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
30 | 30 | |
31 | 31 | $sql = "SELECT blog_name |
32 | - FROM " . $tbl_blogs . " |
|
33 | - WHERE c_id = $course_id AND blog_id = " . intval($blog_id); |
|
32 | + FROM " . $tbl_blogs." |
|
33 | + WHERE c_id = $course_id AND blog_id = ".intval($blog_id); |
|
34 | 34 | |
35 | 35 | $result = Database::query($sql); |
36 | 36 | $blog = Database::fetch_array($result); |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | ON (blogs_rel_user.user_id = user.user_id) |
83 | 83 | WHERE |
84 | 84 | blogs_rel_user.c_id = $course_id AND |
85 | - blogs_rel_user.blog_id = '" . (int)$blog_id."'"; |
|
85 | + blogs_rel_user.blog_id = '".(int) $blog_id."'"; |
|
86 | 86 | $result = Database::query($sql); |
87 | - $blog_members = array (); |
|
87 | + $blog_members = array(); |
|
88 | 88 | while ($user = Database::fetch_array($result)) { |
89 | 89 | $blog_members[$user['user_id']] = api_get_person_name( |
90 | 90 | $user['firstname'], |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | 'blog_name' => $title, |
129 | 129 | 'blog_subtitle' => $subtitle, |
130 | 130 | 'date_creation' => $current_date, |
131 | - 'visibility' => 1 , |
|
131 | + 'visibility' => 1, |
|
132 | 132 | 'session_id' => $session_id, |
133 | 133 | ]; |
134 | 134 | $this_blog_id = Database::insert($tbl_blogs, $params); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | // Put it on course homepage |
167 | 167 | $sql = "INSERT INTO $tbl_tool (c_id, name, link, image, visibility, admin, address, added_tool, session_id, target) |
168 | - VALUES ($course_id, '".Database::escape_string($title)."','blog/blog.php?blog_id=".(int)$this_blog_id."','blog.gif','1','0','pastillegris.gif',0,'$session_id', '')"; |
|
168 | + VALUES ($course_id, '".Database::escape_string($title)."','blog/blog.php?blog_id=".(int) $this_blog_id."','blog.gif','1','0','pastillegris.gif',0,'$session_id', '')"; |
|
169 | 169 | Database::query($sql); |
170 | 170 | |
171 | 171 | $toolId = Database::insert_id(); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | blog_subtitle = '".Database::escape_string($subtitle)."' |
199 | 199 | WHERE |
200 | 200 | c_id = $course_id AND |
201 | - blog_id ='".Database::escape_string((int)$blog_id)."' |
|
201 | + blog_id ='".Database::escape_string((int) $blog_id)."' |
|
202 | 202 | LIMIT 1"; |
203 | 203 | Database::query($sql); |
204 | 204 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | // Update course homepage link |
215 | 215 | $sql = "UPDATE $tbl_tool SET |
216 | 216 | name = '".Database::escape_string($title)."' |
217 | - WHERE c_id = $course_id AND link = 'blog/blog.php?blog_id=".(int)$blog_id."' |
|
217 | + WHERE c_id = $course_id AND link = 'blog/blog.php?blog_id=".(int) $blog_id."' |
|
218 | 218 | LIMIT 1"; |
219 | 219 | Database::query($sql); |
220 | 220 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | Database::query($sql); |
258 | 258 | |
259 | 259 | // Delete blog |
260 | - $sql ="DELETE FROM $tbl_blogs WHERE c_id = $course_id AND blog_id ='".$blog_id."'"; |
|
260 | + $sql = "DELETE FROM $tbl_blogs WHERE c_id = $course_id AND blog_id ='".$blog_id."'"; |
|
261 | 261 | Database::query($sql); |
262 | 262 | |
263 | 263 | // Delete from course homepage |
@@ -288,13 +288,13 @@ discard block |
||
288 | 288 | $course_id = $_course['real_id']; |
289 | 289 | |
290 | 290 | $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
291 | - $upload_ok=true; |
|
292 | - $has_attachment=false; |
|
291 | + $upload_ok = true; |
|
292 | + $has_attachment = false; |
|
293 | 293 | $current_date = api_get_utc_datetime(); |
294 | 294 | |
295 | 295 | if (!empty($_FILES['user_upload']['name'])) { |
296 | 296 | $upload_ok = process_uploaded_file($_FILES['user_upload']); |
297 | - $has_attachment=true; |
|
297 | + $has_attachment = true; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | if ($upload_ok) { |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | |
304 | 304 | // Create the post |
305 | 305 | $sql = "INSERT INTO $tbl_blogs_posts (c_id, title, full_text, date_creation, blog_id, author_id ) |
306 | - VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."','".$current_date."', '".(int)$blog_id."', '".(int)$_user['user_id']."');"; |
|
306 | + VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."','".$current_date."', '".(int) $blog_id."', '".(int) $_user['user_id']."');"; |
|
307 | 307 | |
308 | 308 | Database::query($sql); |
309 | 309 | $last_post_id = Database::insert_id(); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | } |
315 | 315 | |
316 | 316 | if ($has_attachment) { |
317 | - $courseDir = $_course['path'].'/upload/blog'; |
|
317 | + $courseDir = $_course['path'].'/upload/blog'; |
|
318 | 318 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
319 | 319 | $updir = $sys_course_path.$courseDir; |
320 | 320 | |
@@ -365,9 +365,9 @@ discard block |
||
365 | 365 | |
366 | 366 | // Create the post |
367 | 367 | $sql = "UPDATE $tbl_blogs_posts SET |
368 | - title = '" . Database::escape_string($title)."', |
|
368 | + title = '".Database::escape_string($title)."', |
|
369 | 369 | full_text = '" . Database::escape_string($full_text)."' |
370 | - WHERE c_id = $course_id AND post_id ='".(int)$post_id."' AND blog_id ='".(int)$blog_id."' |
|
370 | + WHERE c_id = $course_id AND post_id ='".(int) $post_id."' AND blog_id ='".(int) $blog_id."' |
|
371 | 371 | LIMIT 1 "; |
372 | 372 | Database::query($sql); |
373 | 373 | } |
@@ -388,17 +388,17 @@ discard block |
||
388 | 388 | |
389 | 389 | // Delete ratings on this comment |
390 | 390 | $sql = "DELETE FROM $tbl_blogs_rating |
391 | - WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND item_id = '".(int)$post_id."' AND rating_type = 'post'"; |
|
391 | + WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."' AND item_id = '".(int) $post_id."' AND rating_type = 'post'"; |
|
392 | 392 | Database::query($sql); |
393 | 393 | |
394 | 394 | // Delete the post |
395 | 395 | $sql = "DELETE FROM $tbl_blogs_posts |
396 | - WHERE c_id = $course_id AND post_id = '".(int)$post_id."'"; |
|
396 | + WHERE c_id = $course_id AND post_id = '".(int) $post_id."'"; |
|
397 | 397 | Database::query($sql); |
398 | 398 | |
399 | 399 | // Delete the comments |
400 | 400 | $sql = "DELETE FROM $tbl_blogs_comments |
401 | - WHERE c_id = $course_id AND post_id = '".(int)$post_id."' AND blog_id = '".(int)$blog_id."'"; |
|
401 | + WHERE c_id = $course_id AND post_id = '".(int) $post_id."' AND blog_id = '".(int) $blog_id."'"; |
|
402 | 402 | Database::query($sql); |
403 | 403 | |
404 | 404 | // Delete posts and attachments |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | ) { |
426 | 426 | $_user = api_get_user_info(); |
427 | 427 | $_course = api_get_course_info(); |
428 | - $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
428 | + $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
429 | 429 | |
430 | 430 | $upload_ok = true; |
431 | 431 | $has_attachment = false; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | |
435 | 435 | if (!empty($_FILES['user_upload']['name'])) { |
436 | 436 | $upload_ok = process_uploaded_file($_FILES['user_upload']); |
437 | - $has_attachment=true; |
|
437 | + $has_attachment = true; |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | if ($upload_ok) { |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | |
444 | 444 | // Create the comment |
445 | 445 | $sql = "INSERT INTO $tbl_blogs_comments (c_id, title, comment, author_id, date_creation, blog_id, post_id, parent_comment_id, task_id ) |
446 | - VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."', '".(int)$_user['user_id']."','".$current_date."', '".(int)$blog_id."', '".(int)$post_id."', '".(int)$parent_id."', '".(int)$task_id."')"; |
|
446 | + VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."', '".(int) $_user['user_id']."','".$current_date."', '".(int) $blog_id."', '".(int) $post_id."', '".(int) $parent_id."', '".(int) $task_id."')"; |
|
447 | 447 | Database::query($sql); |
448 | 448 | |
449 | 449 | // Empty post values, or they are shown on the page again |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | } |
456 | 456 | |
457 | 457 | if ($has_attachment) { |
458 | - $courseDir = $_course['path'].'/upload/blog'; |
|
458 | + $courseDir = $_course['path'].'/upload/blog'; |
|
459 | 459 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
460 | 460 | $updir = $sys_course_path.$courseDir; |
461 | 461 | |
@@ -466,19 +466,19 @@ discard block |
||
466 | 466 | ); |
467 | 467 | |
468 | 468 | // user's file name |
469 | - $file_name =$_FILES['user_upload']['name']; |
|
469 | + $file_name = $_FILES['user_upload']['name']; |
|
470 | 470 | |
471 | 471 | if (!filter_extension($new_file_name)) { |
472 | 472 | Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension')); |
473 | 473 | } else { |
474 | 474 | $new_file_name = uniqid(''); |
475 | - $new_path=$updir.'/'.$new_file_name; |
|
476 | - $result= @move_uploaded_file($_FILES['user_upload']['tmp_name'], $new_path); |
|
475 | + $new_path = $updir.'/'.$new_file_name; |
|
476 | + $result = @move_uploaded_file($_FILES['user_upload']['tmp_name'], $new_path); |
|
477 | 477 | $comment = Database::escape_string($file_comment); |
478 | 478 | |
479 | 479 | // Storing the attachments if any |
480 | 480 | if ($result) { |
481 | - $sql='INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size,blog_id,comment_id) '. |
|
481 | + $sql = 'INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size,blog_id,comment_id) '. |
|
482 | 482 | "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$post_id."', '".$_FILES['user_upload']['size']."', '".$blog_id."', '".$last_id."' )"; |
483 | 483 | Database::query($sql); |
484 | 484 | |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | |
554 | 554 | // Create the task |
555 | 555 | $sql = "INSERT INTO $tbl_blogs_tasks (c_id, blog_id, title, description, color, system_task) |
556 | - VALUES ($course_id , '".(int)$blog_id."', '" . Database::escape_string($title)."', '" . Database::escape_string($description)."', '" . Database::escape_string($color)."', '0');"; |
|
556 | + VALUES ($course_id , '".(int) $blog_id."', '".Database::escape_string($title)."', '".Database::escape_string($description)."', '".Database::escape_string($color)."', '0');"; |
|
557 | 557 | Database::query($sql); |
558 | 558 | |
559 | 559 | $task_id = Database::insert_id(); |
@@ -563,13 +563,13 @@ discard block |
||
563 | 563 | Database::query($sql); |
564 | 564 | } |
565 | 565 | |
566 | - $tool = 'BLOG_' . $blog_id; |
|
566 | + $tool = 'BLOG_'.$blog_id; |
|
567 | 567 | |
568 | 568 | if ($articleDelete == 'on') { |
569 | - $sql = " INSERT INTO " . $tbl_tasks_permissions . " ( c_id, task_id, tool, action) VALUES ( |
|
570 | - '" . (int)$course_id . "', |
|
571 | - '" . (int)$task_id . "', |
|
572 | - '" . Database::escape_string($tool) . "', |
|
569 | + $sql = " INSERT INTO ".$tbl_tasks_permissions." ( c_id, task_id, tool, action) VALUES ( |
|
570 | + '" . (int) $course_id."', |
|
571 | + '" . (int) $task_id."', |
|
572 | + '" . Database::escape_string($tool)."', |
|
573 | 573 | 'article_delete' |
574 | 574 | )"; |
575 | 575 | Database::query($sql); |
@@ -584,10 +584,10 @@ discard block |
||
584 | 584 | |
585 | 585 | if ($articleEdit == 'on') { |
586 | 586 | $sql = " |
587 | - INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action ) VALUES ( |
|
588 | - '" . (int)$course_id . "', |
|
589 | - '" . (int)$task_id . "', |
|
590 | - '" . Database::escape_string($tool) . "', |
|
587 | + INSERT INTO " . $tbl_tasks_permissions." (c_id, task_id, tool, action ) VALUES ( |
|
588 | + '" . (int) $course_id."', |
|
589 | + '" . (int) $task_id."', |
|
590 | + '" . Database::escape_string($tool)."', |
|
591 | 591 | 'article_edit' |
592 | 592 | )"; |
593 | 593 | Database::query($sql); |
@@ -601,10 +601,10 @@ discard block |
||
601 | 601 | |
602 | 602 | if ($commentsDelete == 'on') { |
603 | 603 | $sql = " |
604 | - INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action ) VALUES ( |
|
605 | - '" . (int)$course_id . "', |
|
606 | - '" . (int)$task_id . "', |
|
607 | - '" . Database::escape_string($tool) . "', |
|
604 | + INSERT INTO " . $tbl_tasks_permissions." (c_id, task_id, tool, action ) VALUES ( |
|
605 | + '" . (int) $course_id."', |
|
606 | + '" . (int) $task_id."', |
|
607 | + '" . Database::escape_string($tool)."', |
|
608 | 608 | 'article_comments_delete' |
609 | 609 | )"; |
610 | 610 | Database::query($sql); |
@@ -645,20 +645,20 @@ discard block |
||
645 | 645 | title = '".Database::escape_string($title)."', |
646 | 646 | description = '".Database::escape_string($description)."', |
647 | 647 | color = '".Database::escape_string($color)."' |
648 | - WHERE c_id = $course_id AND task_id ='".(int)$task_id."' LIMIT 1"; |
|
648 | + WHERE c_id = $course_id AND task_id ='".(int) $task_id."' LIMIT 1"; |
|
649 | 649 | Database::query($sql); |
650 | 650 | |
651 | - $tool = 'BLOG_' . $blog_id; |
|
651 | + $tool = 'BLOG_'.$blog_id; |
|
652 | 652 | |
653 | - $sql = "DELETE FROM " . $tbl_tasks_permissions . " |
|
654 | - WHERE c_id = $course_id AND task_id = '" . (int)$task_id."'"; |
|
653 | + $sql = "DELETE FROM ".$tbl_tasks_permissions." |
|
654 | + WHERE c_id = $course_id AND task_id = '".(int) $task_id."'"; |
|
655 | 655 | Database::query($sql); |
656 | 656 | |
657 | 657 | if ($articleDelete == 'on') { |
658 | - $sql = "INSERT INTO " . $tbl_tasks_permissions . " ( c_id, task_id, tool, action) VALUES ( |
|
659 | - '" . (int)$course_id . "', |
|
660 | - '" . (int)$task_id . "', |
|
661 | - '" . Database::escape_string($tool) . "', |
|
658 | + $sql = "INSERT INTO ".$tbl_tasks_permissions." ( c_id, task_id, tool, action) VALUES ( |
|
659 | + '" . (int) $course_id."', |
|
660 | + '" . (int) $task_id."', |
|
661 | + '" . Database::escape_string($tool)."', |
|
662 | 662 | 'article_delete' |
663 | 663 | )"; |
664 | 664 | Database::query($sql); |
@@ -671,10 +671,10 @@ discard block |
||
671 | 671 | } |
672 | 672 | |
673 | 673 | if ($articleEdit == 'on') { |
674 | - $sql = "INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action) VALUES ( |
|
675 | - '" . (int)$course_id . "', |
|
676 | - '" . (int)$task_id . "', |
|
677 | - '" . Database::escape_string($tool) . "', |
|
674 | + $sql = "INSERT INTO ".$tbl_tasks_permissions." (c_id, task_id, tool, action) VALUES ( |
|
675 | + '" . (int) $course_id."', |
|
676 | + '" . (int) $task_id."', |
|
677 | + '" . Database::escape_string($tool)."', |
|
678 | 678 | 'article_edit' |
679 | 679 | )"; |
680 | 680 | Database::query($sql); |
@@ -687,10 +687,10 @@ discard block |
||
687 | 687 | } |
688 | 688 | |
689 | 689 | if ($commentsDelete == 'on') { |
690 | - $sql = " INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action) VALUES ( |
|
691 | - '" . (int)$course_id . "', |
|
692 | - '" . (int)$task_id . "', |
|
693 | - '" . Database::escape_string($tool) . "', |
|
690 | + $sql = " INSERT INTO ".$tbl_tasks_permissions." (c_id, task_id, tool, action) VALUES ( |
|
691 | + '" . (int) $course_id."', |
|
692 | + '" . (int) $task_id."', |
|
693 | + '" . Database::escape_string($tool)."', |
|
694 | 694 | 'article_comments_delete' |
695 | 695 | )"; |
696 | 696 | Database::query($sql); |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | |
716 | 716 | // Delete posts |
717 | 717 | $sql = "DELETE FROM $tbl_blogs_tasks |
718 | - WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND task_id = '".(int)$task_id."'"; |
|
718 | + WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."' AND task_id = '".(int) $task_id."'"; |
|
719 | 719 | Database::query($sql); |
720 | 720 | } |
721 | 721 | |
@@ -732,9 +732,9 @@ discard block |
||
732 | 732 | $sql = "DELETE FROM $tbl_blogs_tasks_rel_user |
733 | 733 | WHERE |
734 | 734 | c_id = $course_id AND |
735 | - blog_id = '".(int)$blog_id."' AND |
|
736 | - task_id = '".(int)$task_id."' AND |
|
737 | - user_id = '".(int)$user_id."'"; |
|
735 | + blog_id = '".(int) $blog_id."' AND |
|
736 | + task_id = '".(int) $task_id."' AND |
|
737 | + user_id = '".(int) $user_id."'"; |
|
738 | 738 | Database::query($sql); |
739 | 739 | } |
740 | 740 | |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | $_user = api_get_user_info(); |
749 | 749 | |
750 | 750 | $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
751 | - $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
751 | + $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
752 | 752 | $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
753 | 753 | |
754 | 754 | $course_id = api_get_course_int_id(); |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | task.c_id = $course_id AND |
766 | 766 | blog.c_id = $course_id AND |
767 | 767 | task_rel_user.c_id = $course_id AND |
768 | - task_rel_user.user_id = ".(int)$_user['user_id']." |
|
768 | + task_rel_user.user_id = ".(int) $_user['user_id']." |
|
769 | 769 | ORDER BY target_date ASC"; |
770 | 770 | |
771 | 771 | $result = Database::query($sql); |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | if (Database::num_rows($result) > 0) { |
774 | 774 | echo '<ul>'; |
775 | 775 | while ($mytask = Database::fetch_array($result)) { |
776 | - echo '<li><a href="blog.php?action=execute_task&blog_id=' . $mytask['blog_id'] . '&task_id='.stripslashes($mytask['task_id']) . '" title="[Blog: '.stripslashes($mytask['blog_name']) . '] ' . get_lang('ExecuteThisTask') . '">'.stripslashes($mytask['title']) . '</a></li>'; |
|
776 | + echo '<li><a href="blog.php?action=execute_task&blog_id='.$mytask['blog_id'].'&task_id='.stripslashes($mytask['task_id']).'" title="[Blog: '.stripslashes($mytask['blog_name']).'] '.get_lang('ExecuteThisTask').'">'.stripslashes($mytask['title']).'</a></li>'; |
|
777 | 777 | } |
778 | 778 | echo '<ul>'; |
779 | 779 | } else { |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | |
798 | 798 | // Get blog properties |
799 | 799 | $sql = "SELECT blog_name, visibility FROM $tbl_blogs |
800 | - WHERE c_id = $course_id AND blog_id='".(int)$blog_id."'"; |
|
800 | + WHERE c_id = $course_id AND blog_id='".(int) $blog_id."'"; |
|
801 | 801 | $result = Database::query($sql); |
802 | 802 | $blog = Database::fetch_array($result); |
803 | 803 | $visibility = $blog['visibility']; |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | if ($visibility == 1) { |
807 | 807 | // Change visibility state, remove from course home. |
808 | 808 | $sql = "UPDATE $tbl_blogs SET visibility = '0' |
809 | - WHERE c_id = $course_id AND blog_id ='".(int)$blog_id."' LIMIT 1"; |
|
809 | + WHERE c_id = $course_id AND blog_id ='".(int) $blog_id."' LIMIT 1"; |
|
810 | 810 | Database::query($sql); |
811 | 811 | |
812 | 812 | $sql = "DELETE FROM $tbl_tool |
@@ -815,11 +815,11 @@ discard block |
||
815 | 815 | } else { |
816 | 816 | // Change visibility state, add to course home. |
817 | 817 | $sql = "UPDATE $tbl_blogs SET visibility = '1' |
818 | - WHERE c_id = $course_id AND blog_id ='".(int)$blog_id."' LIMIT 1"; |
|
818 | + WHERE c_id = $course_id AND blog_id ='".(int) $blog_id."' LIMIT 1"; |
|
819 | 819 | Database::query($sql); |
820 | 820 | |
821 | 821 | $sql = "INSERT INTO $tbl_tool (c_id, name, link, image, visibility, admin, address, added_tool, target ) |
822 | - VALUES ($course_id, '".Database::escape_string($title)."', 'blog/blog.php?blog_id=".(int)$blog_id."', 'blog.gif', '1', '0', 'pastillegris.gif', '0', '_self')"; |
|
822 | + VALUES ($course_id, '".Database::escape_string($title)."', 'blog/blog.php?blog_id=".(int) $blog_id."', 'blog.gif', '1', '0', 'pastillegris.gif', '0', '_self')"; |
|
823 | 823 | Database::query($sql); |
824 | 824 | $id = Database::insert_id(); |
825 | 825 | |
@@ -850,14 +850,14 @@ discard block |
||
850 | 850 | FROM $tbl_blogs_posts post |
851 | 851 | INNER JOIN $tbl_users user |
852 | 852 | ON post.author_id = user.user_id |
853 | - WHERE post.blog_id = '".(int)$blog_id."' AND |
|
853 | + WHERE post.blog_id = '".(int) $blog_id."' AND |
|
854 | 854 | post.c_id = $course_id AND |
855 | 855 | $filter |
856 | - ORDER BY post_id DESC LIMIT 0,".(int)$max_number_of_posts; |
|
856 | + ORDER BY post_id DESC LIMIT 0,".(int) $max_number_of_posts; |
|
857 | 857 | $result = Database::query($sql); |
858 | 858 | |
859 | 859 | // Display |
860 | - if(Database::num_rows($result) > 0) { |
|
860 | + if (Database::num_rows($result) > 0) { |
|
861 | 861 | $limit = 200; |
862 | 862 | while ($blog_post = Database::fetch_array($result)) { |
863 | 863 | // Get number of comments |
@@ -865,8 +865,8 @@ discard block |
||
865 | 865 | FROM $tbl_blogs_comments |
866 | 866 | WHERE |
867 | 867 | c_id = $course_id AND |
868 | - blog_id = '".(int)$blog_id."' AND |
|
869 | - post_id = '" . (int)$blog_post['post_id']."'"; |
|
868 | + blog_id = '".(int) $blog_id."' AND |
|
869 | + post_id = '" . (int) $blog_post['post_id']."'"; |
|
870 | 870 | $tmp = Database::query($sql); |
871 | 871 | $blog_post_comments = Database::fetch_array($tmp); |
872 | 872 | |
@@ -877,11 +877,11 @@ discard block |
||
877 | 877 | |
878 | 878 | // Create an introduction text (but keep FULL sentences) |
879 | 879 | $words = 0; |
880 | - $blog_post_text_cut = cut($blog_post_text, $limit) ; |
|
880 | + $blog_post_text_cut = cut($blog_post_text, $limit); |
|
881 | 881 | $words = strlen($blog_post_text); |
882 | 882 | |
883 | 883 | if ($words >= $limit) { |
884 | - $readMoreLink = ' <div class="link" onclick="document.getElementById(\'blogpost_text_' . $blog_post_id . '\').style.display=\'block\'; document.getElementById(\'blogpost_introduction_' . $blog_post_id . '\').style.display=\'none\'">' . get_lang('ReadMore') . '</div>'; |
|
884 | + $readMoreLink = ' <div class="link" onclick="document.getElementById(\'blogpost_text_'.$blog_post_id.'\').style.display=\'block\'; document.getElementById(\'blogpost_introduction_'.$blog_post_id.'\').style.display=\'none\'">'.get_lang('ReadMore').'</div>'; |
|
885 | 885 | $introduction_text = $blog_post_text_cut; |
886 | 886 | } else { |
887 | 887 | $introduction_text = $blog_post_text; |
@@ -891,27 +891,27 @@ discard block |
||
891 | 891 | $introduction_text = stripslashes($introduction_text); |
892 | 892 | |
893 | 893 | echo '<div class="blogpost">'; |
894 | - echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >'.stripslashes($blog_post['title']) . '</a></span>'; |
|
895 | - echo '<span class="blogpost_date"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >' . $blog_post_date . '</a></span>'; |
|
896 | - echo '<div class="blogpost_introduction" id="blogpost_introduction_'.$blog_post_id.'">' . $introduction_text.$readMoreLink.'</div>'; |
|
897 | - echo '<div class="blogpost_text" id="blogpost_text_' . $blog_post_id . '" style="display: none">' . $blog_post_text . '</div>'; |
|
894 | + echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'#add_comment" title="'.get_lang('ReadPost').'" >'.stripslashes($blog_post['title']).'</a></span>'; |
|
895 | + echo '<span class="blogpost_date"><a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'#add_comment" title="'.get_lang('ReadPost').'" >'.$blog_post_date.'</a></span>'; |
|
896 | + echo '<div class="blogpost_introduction" id="blogpost_introduction_'.$blog_post_id.'">'.$introduction_text.$readMoreLink.'</div>'; |
|
897 | + echo '<div class="blogpost_text" id="blogpost_text_'.$blog_post_id.'" style="display: none">'.$blog_post_text.'</div>'; |
|
898 | 898 | |
899 | - $file_name_array = get_blog_attachment($blog_id,$blog_post_id,0); |
|
899 | + $file_name_array = get_blog_attachment($blog_id, $blog_post_id, 0); |
|
900 | 900 | |
901 | 901 | if (!empty($file_name_array)) { |
902 | 902 | echo '<br /><br />'; |
903 | - echo Display::return_icon('attachment.gif',get_lang('Attachment')); |
|
903 | + echo Display::return_icon('attachment.gif', get_lang('Attachment')); |
|
904 | 904 | echo '<a href="download.php?file='; |
905 | 905 | echo $file_name_array['path']; |
906 | 906 | echo ' "> '.$file_name_array['filename'].' </a><br />'; |
907 | 907 | echo '</span>'; |
908 | 908 | } |
909 | 909 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES); |
910 | - echo '<span class="blogpost_info">' . get_lang('Author') . ': ' . Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)) .' - <a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >' . get_lang('Comments') . ': ' . $blog_post_comments['number_of_comments'] . '</a></span>'; |
|
910 | + echo '<span class="blogpost_info">'.get_lang('Author').': '.Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)).' - <a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'#add_comment" title="'.get_lang('ReadPost').'" >'.get_lang('Comments').': '.$blog_post_comments['number_of_comments'].'</a></span>'; |
|
911 | 911 | echo '</div>'; |
912 | 912 | } |
913 | 913 | } else { |
914 | - if($filter == '1=1') { |
|
914 | + if ($filter == '1=1') { |
|
915 | 915 | echo get_lang('NoArticles'); |
916 | 916 | } else { |
917 | 917 | echo get_lang('NoArticleMatches'); |
@@ -925,19 +925,19 @@ discard block |
||
925 | 925 | * @param Integer $blog_id |
926 | 926 | * @param String $query_string |
927 | 927 | */ |
928 | - public static function display_search_results ($blog_id, $query_string) |
|
928 | + public static function display_search_results($blog_id, $query_string) |
|
929 | 929 | { |
930 | 930 | // Init |
931 | 931 | $query_string = Database::escape_string($query_string); |
932 | - $query_string_parts = explode(' ',$query_string); |
|
932 | + $query_string_parts = explode(' ', $query_string); |
|
933 | 933 | $query_string = array(); |
934 | 934 | foreach ($query_string_parts as $query_part) { |
935 | - $query_string[] = " full_text LIKE '%" . $query_part."%' OR title LIKE '%" . $query_part."%' "; |
|
935 | + $query_string[] = " full_text LIKE '%".$query_part."%' OR title LIKE '%".$query_part."%' "; |
|
936 | 936 | } |
937 | - $query_string = '('.implode('OR',$query_string) . ')'; |
|
937 | + $query_string = '('.implode('OR', $query_string).')'; |
|
938 | 938 | |
939 | 939 | // Display the posts |
940 | - echo '<span class="blogpost_title">' . get_lang('SearchResults') . '</span>'; |
|
940 | + echo '<span class="blogpost_title">'.get_lang('SearchResults').'</span>'; |
|
941 | 941 | Blog::display_blog_posts($blog_id, $query_string); |
942 | 942 | } |
943 | 943 | |
@@ -950,14 +950,14 @@ discard block |
||
950 | 950 | public static function display_day_results($blog_id, $query_string) |
951 | 951 | { |
952 | 952 | $date_output = $query_string; |
953 | - $date = explode('-',$query_string); |
|
954 | - $query_string = ' DAYOFMONTH(date_creation) =' . intval($date[2]) . ' AND MONTH(date_creation) =' . intval($date[1]) . ' AND YEAR(date_creation) =' . intval($date[0]); |
|
953 | + $date = explode('-', $query_string); |
|
954 | + $query_string = ' DAYOFMONTH(date_creation) ='.intval($date[2]).' AND MONTH(date_creation) ='.intval($date[1]).' AND YEAR(date_creation) ='.intval($date[0]); |
|
955 | 955 | |
956 | 956 | // Put date in correct output format |
957 | 957 | $date_output = api_format_date($date_output, DATE_FORMAT_LONG); |
958 | 958 | |
959 | 959 | // Display the posts |
960 | - echo '<span class="blogpost_title">' . get_lang('PostsOf') . ': ' . $date_output . '</span>'; |
|
960 | + echo '<span class="blogpost_title">'.get_lang('PostsOf').': '.$date_output.'</span>'; |
|
961 | 961 | Blog::display_blog_posts($blog_id, $query_string); |
962 | 962 | } |
963 | 963 | |
@@ -984,8 +984,8 @@ discard block |
||
984 | 984 | ON post.author_id = user.user_id |
985 | 985 | WHERE |
986 | 986 | post.c_id = $course_id AND |
987 | - post.blog_id = '".(int)$blog_id."' AND |
|
988 | - post.post_id = '".(int)$post_id."' |
|
987 | + post.blog_id = '".(int) $blog_id."' AND |
|
988 | + post.post_id = '".(int) $post_id."' |
|
989 | 989 | ORDER BY post_id DESC"; |
990 | 990 | $result = Database::query($sql); |
991 | 991 | $blog_post = Database::fetch_array($result); |
@@ -993,7 +993,7 @@ discard block |
||
993 | 993 | // Get number of comments |
994 | 994 | $sql = "SELECT COUNT(1) as number_of_comments |
995 | 995 | FROM $tbl_blogs_comments |
996 | - WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND post_id = '".(int)$post_id."'"; |
|
996 | + WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."' AND post_id = '".(int) $post_id."'"; |
|
997 | 997 | $result = Database::query($sql); |
998 | 998 | $blog_post_comments = Database::fetch_array($result); |
999 | 999 | |
@@ -1004,34 +1004,34 @@ discard block |
||
1004 | 1004 | |
1005 | 1005 | $task_id = (isset($_GET['task_id']) && is_numeric($_GET['task_id'])) ? intval($_GET['task_id']) : 0; |
1006 | 1006 | |
1007 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_edit', $task_id)) { |
|
1008 | - $blog_post_actions .= '<a href="blog.php?action=edit_post&blog_id=' . $blog_id . '&post_id=' . $post_id . '&article_id=' . $blog_post['post_id'] . '&task_id=' . $task_id . '" title="' . get_lang('EditThisPost') . '">'; |
|
1009 | - $blog_post_actions .= Display::return_icon('edit.png'); |
|
1007 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id)) { |
|
1008 | + $blog_post_actions .= '<a href="blog.php?action=edit_post&blog_id='.$blog_id.'&post_id='.$post_id.'&article_id='.$blog_post['post_id'].'&task_id='.$task_id.'" title="'.get_lang('EditThisPost').'">'; |
|
1009 | + $blog_post_actions .= Display::return_icon('edit.png'); |
|
1010 | 1010 | $blog_post_actions .= '</a>'; |
1011 | 1011 | } |
1012 | 1012 | |
1013 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_delete', $task_id)) { |
|
1014 | - $blog_post_actions .= '<a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $post_id . '&do=delete_article&article_id=' . $blog_post['post_id'] . '&task_id=' . $task_id . '" title="' . get_lang('DeleteThisArticle') . '" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;">'; |
|
1013 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) { |
|
1014 | + $blog_post_actions .= '<a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$post_id.'&do=delete_article&article_id='.$blog_post['post_id'].'&task_id='.$task_id.'" title="'.get_lang('DeleteThisArticle').'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;">'; |
|
1015 | 1015 | $blog_post_actions .= Display::return_icon('delete.png'); |
1016 | 1016 | $blog_post_actions .= '</a>'; |
1017 | 1017 | } |
1018 | 1018 | |
1019 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_rate')) |
|
1020 | - $rating_select = Blog::display_rating_form('post',$blog_id,$post_id); |
|
1019 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) |
|
1020 | + $rating_select = Blog::display_rating_form('post', $blog_id, $post_id); |
|
1021 | 1021 | |
1022 | - $blog_post_text=stripslashes($blog_post_text); |
|
1022 | + $blog_post_text = stripslashes($blog_post_text); |
|
1023 | 1023 | |
1024 | 1024 | // Display post |
1025 | 1025 | echo '<div class="blogpost">'; |
1026 | - echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '" title="' . get_lang('ReadPost') . '" >'.stripslashes($blog_post['title']) . '</a></span>'; |
|
1027 | - echo '<span class="blogpost_date">' . $blog_post_date . '</span>'; |
|
1028 | - echo '<span class="blogpost_text">' . $blog_post_text . '</span><br />'; |
|
1026 | + echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'" title="'.get_lang('ReadPost').'" >'.stripslashes($blog_post['title']).'</a></span>'; |
|
1027 | + echo '<span class="blogpost_date">'.$blog_post_date.'</span>'; |
|
1028 | + echo '<span class="blogpost_text">'.$blog_post_text.'</span><br />'; |
|
1029 | 1029 | |
1030 | 1030 | $file_name_array = get_blog_attachment($blog_id, $post_id); |
1031 | 1031 | |
1032 | 1032 | if (!empty($file_name_array)) { |
1033 | 1033 | echo ' <br />'; |
1034 | - echo Display::return_icon('attachment.gif',get_lang('Attachment')); |
|
1034 | + echo Display::return_icon('attachment.gif', get_lang('Attachment')); |
|
1035 | 1035 | echo '<a href="download.php?file='; |
1036 | 1036 | echo $file_name_array['path']; |
1037 | 1037 | echo ' "> '.$file_name_array['filename'].' </a>'; |
@@ -1042,20 +1042,20 @@ discard block |
||
1042 | 1042 | echo '<br />'; |
1043 | 1043 | } |
1044 | 1044 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES); |
1045 | - echo '<span class="blogpost_info">'.get_lang('Author').': ' .Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)).' - '.get_lang('Comments').': '.$blog_post_comments['number_of_comments'].' - '.get_lang('Rating').': '.Blog::display_rating('post',$blog_id,$post_id).$rating_select.'</span>'; |
|
1046 | - echo '<span class="blogpost_actions">' . $blog_post_actions . '</span>'; |
|
1045 | + echo '<span class="blogpost_info">'.get_lang('Author').': '.Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)).' - '.get_lang('Comments').': '.$blog_post_comments['number_of_comments'].' - '.get_lang('Rating').': '.Blog::display_rating('post', $blog_id, $post_id).$rating_select.'</span>'; |
|
1046 | + echo '<span class="blogpost_actions">'.$blog_post_actions.'</span>'; |
|
1047 | 1047 | echo '</div>'; |
1048 | 1048 | |
1049 | 1049 | // Display comments if there are any |
1050 | - if($blog_post_comments['number_of_comments'] > 0) { |
|
1050 | + if ($blog_post_comments['number_of_comments'] > 0) { |
|
1051 | 1051 | echo '<div class="comments">'; |
1052 | - echo '<span class="blogpost_title">' . get_lang('Comments') . '</span><br />'; |
|
1052 | + echo '<span class="blogpost_title">'.get_lang('Comments').'</span><br />'; |
|
1053 | 1053 | Blog::get_threaded_comments(0, 0, $blog_id, $post_id, $task_id); |
1054 | 1054 | echo '</div>'; |
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | // Display comment form |
1058 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_comments_add')) { |
|
1058 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) { |
|
1059 | 1059 | Blog::display_new_comment_form($blog_id, $post_id, $blog_post['title']); |
1060 | 1060 | } |
1061 | 1061 | } |
@@ -1083,16 +1083,16 @@ discard block |
||
1083 | 1083 | $sql = "SELECT rating_id FROM $tbl_blogs_rating |
1084 | 1084 | WHERE |
1085 | 1085 | c_id = $course_id AND |
1086 | - blog_id = '".(int)$blog_id."' AND |
|
1087 | - item_id = '".(int)$item_id."' AND |
|
1086 | + blog_id = '".(int) $blog_id."' AND |
|
1087 | + item_id = '".(int) $item_id."' AND |
|
1088 | 1088 | rating_type = '".Database::escape_string($type)."' AND |
1089 | - user_id = '".(int)$_user['user_id']."'"; |
|
1089 | + user_id = '".(int) $_user['user_id']."'"; |
|
1090 | 1090 | $result = Database::query($sql); |
1091 | 1091 | |
1092 | 1092 | // Add rating |
1093 | 1093 | if (Database::num_rows($result) == 0) { |
1094 | 1094 | $sql = "INSERT INTO $tbl_blogs_rating (c_id, blog_id, rating_type, item_id, user_id, rating ) |
1095 | - VALUES ($course_id, '".(int)$blog_id."', '".Database::escape_string($type)."', '".(int)$item_id."', '".(int)$_user['user_id']."', '".Database::escape_string($rating)."')"; |
|
1095 | + VALUES ($course_id, '".(int) $blog_id."', '".Database::escape_string($type)."', '".(int) $item_id."', '".(int) $_user['user_id']."', '".Database::escape_string($rating)."')"; |
|
1096 | 1096 | Database::query($sql); |
1097 | 1097 | |
1098 | 1098 | $id = Database::insert_id(); |
@@ -1123,8 +1123,8 @@ discard block |
||
1123 | 1123 | $sql = "SELECT AVG(rating) as rating FROM $tbl_blogs_rating |
1124 | 1124 | WHERE |
1125 | 1125 | c_id = $course_id AND |
1126 | - blog_id = '".(int)$blog_id."' AND |
|
1127 | - item_id = '".(int)$item_id."' AND |
|
1126 | + blog_id = '".(int) $blog_id."' AND |
|
1127 | + item_id = '".(int) $item_id."' AND |
|
1128 | 1128 | rating_type = '".Database::escape_string($type)."' "; |
1129 | 1129 | $result = Database::query($sql); |
1130 | 1130 | $result = Database::fetch_array($result); |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | * @param Integer $blog_id |
1140 | 1140 | * @param integer $post_id |
1141 | 1141 | */ |
1142 | - public static function display_rating_form ($type, $blog_id, $post_id, $comment_id = NULL) |
|
1142 | + public static function display_rating_form($type, $blog_id, $post_id, $comment_id = NULL) |
|
1143 | 1143 | { |
1144 | 1144 | $_user = api_get_user_info(); |
1145 | 1145 | $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); |
@@ -1149,14 +1149,14 @@ discard block |
||
1149 | 1149 | // Check if the user has already rated this post |
1150 | 1150 | $sql = "SELECT rating_id FROM $tbl_blogs_rating |
1151 | 1151 | WHERE c_id = $course_id AND |
1152 | - blog_id = '".(int)$blog_id."' |
|
1153 | - AND item_id = '".(int)$post_id."' |
|
1152 | + blog_id = '".(int) $blog_id."' |
|
1153 | + AND item_id = '".(int) $post_id."' |
|
1154 | 1154 | AND rating_type = '".Database::escape_string($type)."' |
1155 | - AND user_id = '".(int)$_user['user_id']."'"; |
|
1155 | + AND user_id = '".(int) $_user['user_id']."'"; |
|
1156 | 1156 | $result = Database::query($sql); |
1157 | 1157 | // Add rating |
1158 | 1158 | if (Database::num_rows($result) == 0) { |
1159 | - return ' - ' . get_lang('RateThis') . ': <form method="get" action="blog.php" style="display: inline" id="frm_rating_' . $type . '_' . $post_id . '" name="frm_rating_' . $type . '_' . $post_id . '"><select name="rating" onchange="document.forms[\'frm_rating_' . $type . '_' . $post_id . '\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="' . $type . '" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="' . $blog_id . '" /><input type="hidden" name="post_id" value="' . $post_id . '" /></form>'; |
|
1159 | + return ' - '.get_lang('RateThis').': <form method="get" action="blog.php" style="display: inline" id="frm_rating_'.$type.'_'.$post_id.'" name="frm_rating_'.$type.'_'.$post_id.'"><select name="rating" onchange="document.forms[\'frm_rating_'.$type.'_'.$post_id.'\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="'.$type.'" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="'.$blog_id.'" /><input type="hidden" name="post_id" value="'.$post_id.'" /></form>'; |
|
1160 | 1160 | } else { |
1161 | 1161 | return ''; |
1162 | 1162 | } |
@@ -1165,14 +1165,14 @@ discard block |
||
1165 | 1165 | if ($type = 'comment') { |
1166 | 1166 | // Check if the user has already rated this comment |
1167 | 1167 | $sql = "SELECT rating_id FROM $tbl_blogs_rating |
1168 | - WHERE c_id = $course_id AND blog_id = '".(int)$blog_id ."' |
|
1169 | - AND item_id = '".(int)$comment_id."' |
|
1168 | + WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."' |
|
1169 | + AND item_id = '".(int) $comment_id."' |
|
1170 | 1170 | AND rating_type = '".Database::escape_string($type)."' |
1171 | - AND user_id = '".(int)$_user['user_id']."'"; |
|
1171 | + AND user_id = '".(int) $_user['user_id']."'"; |
|
1172 | 1172 | $result = Database::query($sql); |
1173 | 1173 | |
1174 | 1174 | if (Database::num_rows($result) == 0) { |
1175 | - return ' - ' . get_lang('RateThis') . ': <form method="get" action="blog.php" style="display: inline" id="frm_rating_' . $type . '_' . $comment_id . '" name="frm_rating_' . $type . '_' . $comment_id . '"><select name="rating" onchange="document.forms[\'frm_rating_' . $type . '_' . $comment_id . '\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="' . $type . '" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="' . $blog_id . '" /><input type="hidden" name="post_id" value="' . $post_id . '" /><input type="hidden" name="comment_id" value="' . $comment_id . '" /></form>'; |
|
1175 | + return ' - '.get_lang('RateThis').': <form method="get" action="blog.php" style="display: inline" id="frm_rating_'.$type.'_'.$comment_id.'" name="frm_rating_'.$type.'_'.$comment_id.'"><select name="rating" onchange="document.forms[\'frm_rating_'.$type.'_'.$comment_id.'\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="'.$type.'" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="'.$blog_id.'" /><input type="hidden" name="post_id" value="'.$post_id.'" /><input type="hidden" name="comment_id" value="'.$comment_id.'" /></form>'; |
|
1176 | 1176 | } else { |
1177 | 1177 | return ''; |
1178 | 1178 | } |
@@ -1207,11 +1207,11 @@ discard block |
||
1207 | 1207 | WHERE |
1208 | 1208 | comments.c_id = $course_id AND |
1209 | 1209 | parent_comment_id = $current AND |
1210 | - comments.blog_id = '".(int)$blog_id."' AND |
|
1211 | - comments.post_id = '".(int)$post_id."'"; |
|
1210 | + comments.blog_id = '".(int) $blog_id."' AND |
|
1211 | + comments.post_id = '".(int) $post_id."'"; |
|
1212 | 1212 | $result = Database::query($sql); |
1213 | 1213 | |
1214 | - while($comment = Database::fetch_array($result)) { |
|
1214 | + while ($comment = Database::fetch_array($result)) { |
|
1215 | 1215 | // Select the children recursivly |
1216 | 1216 | $tmp = "SELECT comments.*, user.lastname, user.firstname, user.username |
1217 | 1217 | FROM $tbl_blogs_comments comments |
@@ -1220,8 +1220,8 @@ discard block |
||
1220 | 1220 | WHERE |
1221 | 1221 | comments.c_id = $course_id AND |
1222 | 1222 | comment_id = $current |
1223 | - AND blog_id = '".(int)$blog_id."' |
|
1224 | - AND post_id = '".(int)$post_id."'"; |
|
1223 | + AND blog_id = '".(int) $blog_id."' |
|
1224 | + AND post_id = '".(int) $post_id."'"; |
|
1225 | 1225 | $tmp = Database::query($tmp); |
1226 | 1226 | $tmp = Database::fetch_array($tmp); |
1227 | 1227 | $parent_cat = $tmp['parent_comment_id']; |
@@ -1246,22 +1246,22 @@ discard block |
||
1246 | 1246 | } |
1247 | 1247 | |
1248 | 1248 | if (!is_null($comment['task_id'])) { |
1249 | - $border_color = ' border-left: 3px solid #' . $comment['color']; |
|
1249 | + $border_color = ' border-left: 3px solid #'.$comment['color']; |
|
1250 | 1250 | } |
1251 | 1251 | |
1252 | 1252 | $comment_text = stripslashes($comment_text); |
1253 | 1253 | |
1254 | 1254 | // Output... |
1255 | 1255 | $margin = $current_level * 30; |
1256 | - echo '<div class="blogpost_comment" style="margin-left: ' . $margin . 'px;' . $border_color . '">'; |
|
1257 | - echo '<span class="blogpost_comment_title"><a href="#add_comment" onclick="document.getElementById(\'comment_parent_id\').value=\'' . $comment['comment_id'] . '\'; document.getElementById(\'comment_title\').value=\'Re: '.addslashes($comment['title']) . '\'" title="' . get_lang('ReplyToThisComment') . '" >'.stripslashes($comment['title']) . '</a></span>'; |
|
1258 | - echo '<span class="blogpost_comment_date">' . $blog_comment_date . '</span>'; |
|
1259 | - echo '<span class="blogpost_text">' . $comment_text . '</span>'; |
|
1256 | + echo '<div class="blogpost_comment" style="margin-left: '.$margin.'px;'.$border_color.'">'; |
|
1257 | + echo '<span class="blogpost_comment_title"><a href="#add_comment" onclick="document.getElementById(\'comment_parent_id\').value=\''.$comment['comment_id'].'\'; document.getElementById(\'comment_title\').value=\'Re: '.addslashes($comment['title']).'\'" title="'.get_lang('ReplyToThisComment').'" >'.stripslashes($comment['title']).'</a></span>'; |
|
1258 | + echo '<span class="blogpost_comment_date">'.$blog_comment_date.'</span>'; |
|
1259 | + echo '<span class="blogpost_text">'.$comment_text.'</span>'; |
|
1260 | 1260 | |
1261 | - $file_name_array = get_blog_attachment($blog_id,$post_id, $comment['comment_id']); |
|
1261 | + $file_name_array = get_blog_attachment($blog_id, $post_id, $comment['comment_id']); |
|
1262 | 1262 | if (!empty($file_name_array)) { |
1263 | 1263 | echo '<br /><br />'; |
1264 | - echo Display::return_icon('attachment.gif',get_lang('Attachment')); |
|
1264 | + echo Display::return_icon('attachment.gif', get_lang('Attachment')); |
|
1265 | 1265 | echo '<a href="download.php?file='; |
1266 | 1266 | echo $file_name_array['path']; |
1267 | 1267 | echo ' "> '.$file_name_array['filename'].' </a>'; |
@@ -1271,7 +1271,7 @@ discard block |
||
1271 | 1271 | } |
1272 | 1272 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $comment['username']), ENT_QUOTES); |
1273 | 1273 | echo '<span class="blogpost_comment_info">'.get_lang('Author').': '.Display::tag('span', api_get_person_name($comment['firstname'], $comment['lastname']), array('title'=>$username)).' - '.get_lang('Rating').': '.Blog::display_rating('comment', $blog_id, $comment['comment_id']).$rating_select.'</span>'; |
1274 | - echo '<span class="blogpost_actions">' . $blog_comment_actions . '</span>'; |
|
1274 | + echo '<span class="blogpost_actions">'.$blog_comment_actions.'</span>'; |
|
1275 | 1275 | echo '</div>'; |
1276 | 1276 | |
1277 | 1277 | // Go further down the tree. |
@@ -1287,11 +1287,11 @@ discard block |
||
1287 | 1287 | */ |
1288 | 1288 | public static function display_form_new_post($blog_id) |
1289 | 1289 | { |
1290 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_add')) { |
|
1290 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_add')) { |
|
1291 | 1291 | $form = new FormValidator( |
1292 | 1292 | 'add_post', |
1293 | 1293 | 'post', |
1294 | - api_get_path(WEB_CODE_PATH)."blog/blog.php?action=new_post&blog_id=" . $blog_id . "&" . api_get_cidreq(), |
|
1294 | + api_get_path(WEB_CODE_PATH)."blog/blog.php?action=new_post&blog_id=".$blog_id."&".api_get_cidreq(), |
|
1295 | 1295 | null, |
1296 | 1296 | array('enctype' => 'multipart/form-data') |
1297 | 1297 | ); |
@@ -1335,8 +1335,8 @@ discard block |
||
1335 | 1335 | INNER JOIN $tbl_users user ON post.author_id = user.user_id |
1336 | 1336 | WHERE |
1337 | 1337 | post.c_id = $course_id AND |
1338 | - post.blog_id = '".(int)$blog_id ."' |
|
1339 | - AND post.post_id = '".(int)$post_id."' |
|
1338 | + post.blog_id = '".(int) $blog_id."' |
|
1339 | + AND post.post_id = '".(int) $post_id."' |
|
1340 | 1340 | ORDER BY post_id DESC"; |
1341 | 1341 | $result = Database::query($sql); |
1342 | 1342 | $blog_post = Database::fetch_array($result); |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | $form = new FormValidator( |
1346 | 1346 | 'edit_post', |
1347 | 1347 | 'post', |
1348 | - api_get_path(WEB_CODE_PATH).'blog/blog.php?action=edit_post&post_id=' . intval($_GET['post_id']) . '&blog_id=' . intval($blog_id) . '&article_id='.intval($_GET['article_id']).'&task_id='.intval($_GET['task_id']) |
|
1348 | + api_get_path(WEB_CODE_PATH).'blog/blog.php?action=edit_post&post_id='.intval($_GET['post_id']).'&blog_id='.intval($blog_id).'&article_id='.intval($_GET['article_id']).'&task_id='.intval($_GET['task_id']) |
|
1349 | 1349 | ); |
1350 | 1350 | |
1351 | 1351 | $form->addHeader(get_lang('EditPost')); |
@@ -1377,31 +1377,31 @@ discard block |
||
1377 | 1377 | global $charset; |
1378 | 1378 | $course_id = api_get_course_int_id(); |
1379 | 1379 | |
1380 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_add')) { |
|
1380 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_add')) { |
|
1381 | 1381 | $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
1382 | 1382 | $counter = 0; |
1383 | 1383 | global $color2; |
1384 | 1384 | |
1385 | 1385 | echo '<div class="actions">'; |
1386 | - echo '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $blog_id . '&do=add">'; |
|
1386 | + echo '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$blog_id.'&do=add">'; |
|
1387 | 1387 | echo Display::return_icon('blog_newtasks.gif', get_lang('AddTasks')); |
1388 | - echo get_lang('AddTasks') . '</a> '; |
|
1389 | - echo '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $blog_id . '&do=assign">'; |
|
1388 | + echo get_lang('AddTasks').'</a> '; |
|
1389 | + echo '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$blog_id.'&do=assign">'; |
|
1390 | 1390 | echo Display::return_icon('blog_task.gif', get_lang('AssignTasks')); |
1391 | - echo get_lang('AssignTasks') . '</a>'; |
|
1391 | + echo get_lang('AssignTasks').'</a>'; |
|
1392 | 1392 | ?> |
1393 | 1393 | <a href="<?php echo api_get_self(); ?>?action=manage_rights&blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageRights') ?>"> |
1394 | - <?php echo Display::return_icon('blog_admin_users.png', get_lang('RightsManager'),'',ICON_SIZE_SMALL). get_lang('RightsManager') ?></a> |
|
1394 | + <?php echo Display::return_icon('blog_admin_users.png', get_lang('RightsManager'), '', ICON_SIZE_SMALL).get_lang('RightsManager') ?></a> |
|
1395 | 1395 | <?php |
1396 | 1396 | echo '</div>'; |
1397 | 1397 | |
1398 | - echo '<span class="blogpost_title">' . get_lang('TaskList') . '</span><br />'; |
|
1398 | + echo '<span class="blogpost_title">'.get_lang('TaskList').'</span><br />'; |
|
1399 | 1399 | echo "<table class=\"data_table\">"; |
1400 | 1400 | echo "<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">", |
1401 | - "<th width='240'><b>",get_lang('Title'),"</b></th>", |
|
1402 | - "<th><b>",get_lang('Description'),"</b></th>", |
|
1403 | - "<th><b>",get_lang('Color'),"</b></th>", |
|
1404 | - "<th width='50'><b>",get_lang('Modify'),"</b></th>", |
|
1401 | + "<th width='240'><b>", get_lang('Title'), "</b></th>", |
|
1402 | + "<th><b>", get_lang('Description'), "</b></th>", |
|
1403 | + "<th><b>", get_lang('Color'), "</b></th>", |
|
1404 | + "<th width='50'><b>", get_lang('Modify'), "</b></th>", |
|
1405 | 1405 | "</tr>"; |
1406 | 1406 | |
1407 | 1407 | |
@@ -1413,8 +1413,8 @@ discard block |
||
1413 | 1413 | description, |
1414 | 1414 | color, |
1415 | 1415 | system_task |
1416 | - FROM " . $tbl_blogs_tasks . " |
|
1417 | - WHERE c_id = $course_id AND blog_id = " . (int)$blog_id . " |
|
1416 | + FROM " . $tbl_blogs_tasks." |
|
1417 | + WHERE c_id = $course_id AND blog_id = ".(int) $blog_id." |
|
1418 | 1418 | ORDER BY system_task, title"; |
1419 | 1419 | $result = Database::query($sql); |
1420 | 1420 | |
@@ -1423,10 +1423,10 @@ discard block |
||
1423 | 1423 | $css_class = (($counter % 2) == 0) ? "row_odd" : "row_even"; |
1424 | 1424 | $delete_icon = ($task['system_task'] == '1') ? "delete_na.png" : "delete.png"; |
1425 | 1425 | $delete_title = ($task['system_task'] == '1') ? get_lang('DeleteSystemTask') : get_lang('DeleteTask'); |
1426 | - $delete_link = ($task['system_task'] == '1') ? '#' : api_get_self() . '?action=manage_tasks&blog_id=' . $task['blog_id'] . '&do=delete&task_id=' . $task['task_id']; |
|
1427 | - $delete_confirm = ($task['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"'; |
|
1426 | + $delete_link = ($task['system_task'] == '1') ? '#' : api_get_self().'?action=manage_tasks&blog_id='.$task['blog_id'].'&do=delete&task_id='.$task['task_id']; |
|
1427 | + $delete_confirm = ($task['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;"'; |
|
1428 | 1428 | |
1429 | - echo '<tr class="' . $css_class . '" valign="top">'; |
|
1429 | + echo '<tr class="'.$css_class.'" valign="top">'; |
|
1430 | 1430 | echo '<td width="240">'.Security::remove_XSS($task['title']).'</td>'; |
1431 | 1431 | echo '<td>'.Security::remove_XSS($task['description']).'</td>'; |
1432 | 1432 | echo '<td><span style="background-color: #'.$task['color'].'"> </span></td>'; |
@@ -1452,23 +1452,23 @@ discard block |
||
1452 | 1452 | * |
1453 | 1453 | * @param Integer $blog_id |
1454 | 1454 | */ |
1455 | - public static function display_assigned_task_list ($blog_id) |
|
1455 | + public static function display_assigned_task_list($blog_id) |
|
1456 | 1456 | { |
1457 | 1457 | // Init |
1458 | 1458 | $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
1459 | 1459 | $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
1460 | 1460 | $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
1461 | 1461 | $counter = 0; |
1462 | - global $charset,$color2; |
|
1462 | + global $charset, $color2; |
|
1463 | 1463 | |
1464 | - echo '<span class="blogpost_title">' . get_lang('AssignedTasks') . '</span><br />'; |
|
1464 | + echo '<span class="blogpost_title">'.get_lang('AssignedTasks').'</span><br />'; |
|
1465 | 1465 | echo "<table class=\"data_table\">"; |
1466 | 1466 | echo "<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">", |
1467 | - "<th width='240'><b>",get_lang('Member'),"</b></th>", |
|
1468 | - "<th><b>",get_lang('Task'),"</b></th>", |
|
1469 | - "<th><b>",get_lang('Description'),"</b></th>", |
|
1470 | - "<th><b>",get_lang('TargetDate'),"</b></th>", |
|
1471 | - "<th width='50'><b>",get_lang('Modify'),"</b></th>", |
|
1467 | + "<th width='240'><b>", get_lang('Member'), "</b></th>", |
|
1468 | + "<th><b>", get_lang('Task'), "</b></th>", |
|
1469 | + "<th><b>", get_lang('Description'), "</b></th>", |
|
1470 | + "<th><b>", get_lang('TargetDate'), "</b></th>", |
|
1471 | + "<th width='50'><b>", get_lang('Modify'), "</b></th>", |
|
1472 | 1472 | "</tr>"; |
1473 | 1473 | |
1474 | 1474 | $course_id = api_get_course_int_id(); |
@@ -1480,17 +1480,17 @@ discard block |
||
1480 | 1480 | WHERE |
1481 | 1481 | task_rel_user.c_id = $course_id AND |
1482 | 1482 | task.c_id = $course_id AND |
1483 | - task_rel_user.blog_id = '".(int)$blog_id."' |
|
1483 | + task_rel_user.blog_id = '".(int) $blog_id."' |
|
1484 | 1484 | ORDER BY target_date ASC"; |
1485 | 1485 | $result = Database::query($sql); |
1486 | 1486 | |
1487 | 1487 | while ($assignment = Database::fetch_array($result)) { |
1488 | 1488 | $counter++; |
1489 | - $css_class = (($counter % 2)==0) ? "row_odd" : "row_even"; |
|
1489 | + $css_class = (($counter % 2) == 0) ? "row_odd" : "row_even"; |
|
1490 | 1490 | $delete_icon = ($assignment['system_task'] == '1') ? "delete_na.png" : "delete.png"; |
1491 | 1491 | $delete_title = ($assignment['system_task'] == '1') ? get_lang('DeleteSystemTask') : get_lang('DeleteTask'); |
1492 | - $delete_link = ($assignment['system_task'] == '1') ? '#' : api_get_self() . '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=delete&task_id=' . $assignment['task_id']; |
|
1493 | - $delete_confirm = ($assignment['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"'; |
|
1492 | + $delete_link = ($assignment['system_task'] == '1') ? '#' : api_get_self().'?action=manage_tasks&blog_id='.$assignment['blog_id'].'&do=delete&task_id='.$assignment['task_id']; |
|
1493 | + $delete_confirm = ($assignment['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;"'; |
|
1494 | 1494 | |
1495 | 1495 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $assignment['username']), ENT_QUOTES); |
1496 | 1496 | |
@@ -1522,7 +1522,7 @@ discard block |
||
1522 | 1522 | * @author Toon Keppens |
1523 | 1523 | * |
1524 | 1524 | */ |
1525 | - public static function display_new_task_form ($blog_id) |
|
1525 | + public static function display_new_task_form($blog_id) |
|
1526 | 1526 | { |
1527 | 1527 | // Init |
1528 | 1528 | $colors = array( |
@@ -1544,7 +1544,7 @@ discard block |
||
1544 | 1544 | ); |
1545 | 1545 | |
1546 | 1546 | // form |
1547 | - echo '<form name="add_task" method="post" action="blog.php?action=manage_tasks&blog_id=' . $blog_id . '">'; |
|
1547 | + echo '<form name="add_task" method="post" action="blog.php?action=manage_tasks&blog_id='.$blog_id.'">'; |
|
1548 | 1548 | |
1549 | 1549 | // form title |
1550 | 1550 | echo '<legend>'.get_lang('AddTask').'</legend>'; |
@@ -1552,7 +1552,7 @@ discard block |
||
1552 | 1552 | // task title |
1553 | 1553 | echo ' <div class="control-group"> |
1554 | 1554 | <label class="control-label"> |
1555 | - <span class="form_required">*</span>' . get_lang('Title') . ' |
|
1555 | + <span class="form_required">*</span>' . get_lang('Title').' |
|
1556 | 1556 | </label> |
1557 | 1557 | <div class="controls"> |
1558 | 1558 | <input name="task_name" type="text" size="70" /> |
@@ -1562,7 +1562,7 @@ discard block |
||
1562 | 1562 | // task comment |
1563 | 1563 | echo ' <div class="control-group"> |
1564 | 1564 | <label class="control-label"> |
1565 | - ' . get_lang('Description') . ' |
|
1565 | + ' . get_lang('Description').' |
|
1566 | 1566 | </label> |
1567 | 1567 | <div class="controls"> |
1568 | 1568 | <textarea name="task_description" cols="45"></textarea> |
@@ -1572,18 +1572,18 @@ discard block |
||
1572 | 1572 | // task management |
1573 | 1573 | echo ' <div class="control-group"> |
1574 | 1574 | <label class="control-label"> |
1575 | - ' . get_lang('TaskManager') . ' |
|
1575 | + ' . get_lang('TaskManager').' |
|
1576 | 1576 | </label> |
1577 | 1577 | <div class="controls">'; |
1578 | 1578 | echo '<table class="data_table" cellspacing="0" style="border-collapse:collapse; width:446px;">'; |
1579 | 1579 | echo '<tr>'; |
1580 | - echo '<th colspan="2" style="width:223px;">' . get_lang('ArticleManager') . '</th>'; |
|
1581 | - echo '<th width:223px;>' . get_lang('CommentManager') . '</th>'; |
|
1580 | + echo '<th colspan="2" style="width:223px;">'.get_lang('ArticleManager').'</th>'; |
|
1581 | + echo '<th width:223px;>'.get_lang('CommentManager').'</th>'; |
|
1582 | 1582 | echo '</tr>'; |
1583 | 1583 | echo '<tr>'; |
1584 | - echo '<th style="width:111px;"><label for="articleDelete">' . get_lang('Delete') . '</label></th>'; |
|
1585 | - echo '<th style="width:112px;"><label for="articleEdit">' . get_lang('Edit') . '</label></th>'; |
|
1586 | - echo '<th style="width:223px;"><label for="commentsDelete">' . get_lang('Delete') . '</label></th>'; |
|
1584 | + echo '<th style="width:111px;"><label for="articleDelete">'.get_lang('Delete').'</label></th>'; |
|
1585 | + echo '<th style="width:112px;"><label for="articleEdit">'.get_lang('Edit').'</label></th>'; |
|
1586 | + echo '<th style="width:223px;"><label for="commentsDelete">'.get_lang('Delete').'</label></th>'; |
|
1587 | 1587 | echo '</tr>'; |
1588 | 1588 | echo '<tr>'; |
1589 | 1589 | echo '<td style="text-align:center;"><input id="articleDelete" name="chkArticleDelete" type="checkbox" /></td>'; |
@@ -1598,13 +1598,13 @@ discard block |
||
1598 | 1598 | // task color |
1599 | 1599 | echo ' <div class="control-group"> |
1600 | 1600 | <label class="control-label"> |
1601 | - ' . get_lang('Color') . ' |
|
1601 | + ' . get_lang('Color').' |
|
1602 | 1602 | </label> |
1603 | 1603 | <div class="controls">'; |
1604 | 1604 | echo '<select name="task_color" id="color" style="width: 150px; background-color: #eeeeee" onchange="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value" onkeypress="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value">'; |
1605 | 1605 | foreach ($colors as $color) { |
1606 | - $style = 'style="background-color: #' . $color . '"'; |
|
1607 | - echo '<option value="' . $color . '" ' . $style . '> </option>'; |
|
1606 | + $style = 'style="background-color: #'.$color.'"'; |
|
1607 | + echo '<option value="'.$color.'" '.$style.'> </option>'; |
|
1608 | 1608 | } |
1609 | 1609 | echo '</select>'; |
1610 | 1610 | echo ' </div> |
@@ -1615,7 +1615,7 @@ discard block |
||
1615 | 1615 | <div class="controls"> |
1616 | 1616 | <input type="hidden" name="action" value="" /> |
1617 | 1617 | <input type="hidden" name="new_task_submit" value="true" /> |
1618 | - <button class="save" type="submit" name="Submit">' . get_lang('Save') . '</button> |
|
1618 | + <button class="save" type="submit" name="Submit">' . get_lang('Save').'</button> |
|
1619 | 1619 | </div> |
1620 | 1620 | </div>'; |
1621 | 1621 | echo '</form>'; |
@@ -1629,34 +1629,34 @@ discard block |
||
1629 | 1629 | * @author Toon Keppens |
1630 | 1630 | * |
1631 | 1631 | */ |
1632 | - public static function display_edit_task_form ($blog_id, $task_id) { |
|
1632 | + public static function display_edit_task_form($blog_id, $task_id) { |
|
1633 | 1633 | $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
1634 | 1634 | $course_id = api_get_course_int_id(); |
1635 | 1635 | |
1636 | - $colors = array('FFFFFF','FFFF99','FFCC99','FF9933','FF6699','CCFF99','CC9966','66FF00', '9966FF', 'CF3F3F', '990033','669933','0033FF','003366','000000'); |
|
1636 | + $colors = array('FFFFFF', 'FFFF99', 'FFCC99', 'FF9933', 'FF6699', 'CCFF99', 'CC9966', '66FF00', '9966FF', 'CF3F3F', '990033', '669933', '0033FF', '003366', '000000'); |
|
1637 | 1637 | |
1638 | - $sql = "SELECT blog_id, task_id, title, description, color FROM $tbl_blogs_tasks WHERE c_id = $course_id AND task_id = '".(int)$task_id."'"; |
|
1638 | + $sql = "SELECT blog_id, task_id, title, description, color FROM $tbl_blogs_tasks WHERE c_id = $course_id AND task_id = '".(int) $task_id."'"; |
|
1639 | 1639 | $result = Database::query($sql); |
1640 | 1640 | $task = Database::fetch_array($result); |
1641 | 1641 | |
1642 | 1642 | // Display |
1643 | - echo '<form name="edit_task" method="post" action="blog.php?action=manage_tasks&blog_id=' . $blog_id . '"> |
|
1644 | - <legend>' . get_lang('EditTask') . '</legend> |
|
1643 | + echo '<form name="edit_task" method="post" action="blog.php?action=manage_tasks&blog_id='.$blog_id.'"> |
|
1644 | + <legend>' . get_lang('EditTask').'</legend> |
|
1645 | 1645 | <table width="100%" border="0" cellspacing="2"> |
1646 | 1646 | <tr> |
1647 | - <td align="right">' . get_lang('Title') . ': </td> |
|
1648 | - <td><input name="task_name" type="text" size="70" value="'.Security::remove_XSS($task['title']) . '" /></td> |
|
1647 | + <td align="right">' . get_lang('Title').': </td> |
|
1648 | + <td><input name="task_name" type="text" size="70" value="'.Security::remove_XSS($task['title']).'" /></td> |
|
1649 | 1649 | </tr> |
1650 | 1650 | <tr> |
1651 | - <td align="right">' . get_lang('Description') . ': </td> |
|
1651 | + <td align="right">' . get_lang('Description').': </td> |
|
1652 | 1652 | <td><textarea name="task_description" cols="45">'.Security::remove_XSS($task['description']).'</textarea></td> |
1653 | 1653 | </tr>'; |
1654 | 1654 | |
1655 | 1655 | /* edit by Kevin Van Den Haute ([email protected]) */ |
1656 | 1656 | $tbl_tasks_permissions = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
1657 | 1657 | |
1658 | - $sql = " SELECT id, action FROM " . $tbl_tasks_permissions . " |
|
1659 | - WHERE c_id = $course_id AND task_id = '" . (int)$task_id."'"; |
|
1658 | + $sql = " SELECT id, action FROM ".$tbl_tasks_permissions." |
|
1659 | + WHERE c_id = $course_id AND task_id = '".(int) $task_id."'"; |
|
1660 | 1660 | $result = Database::query($sql); |
1661 | 1661 | |
1662 | 1662 | $arrPermissions = array(); |
@@ -1665,22 +1665,22 @@ discard block |
||
1665 | 1665 | $arrPermissions[] = $row['action']; |
1666 | 1666 | |
1667 | 1667 | echo '<tr>'; |
1668 | - echo '<td style="text-align:right; vertical-align:top;">' . get_lang('TaskManager') . ': </td>'; |
|
1668 | + echo '<td style="text-align:right; vertical-align:top;">'.get_lang('TaskManager').': </td>'; |
|
1669 | 1669 | echo '<td>'; |
1670 | 1670 | echo '<table class="data_table" cellspacing="0" style="border-collapse:collapse; width:446px;">'; |
1671 | 1671 | echo '<tr>'; |
1672 | - echo '<th colspan="2" style="width:223px;">' . get_lang('ArticleManager') . '</th>'; |
|
1673 | - echo '<th width:223px;>' . get_lang('CommentManager') . '</th>'; |
|
1672 | + echo '<th colspan="2" style="width:223px;">'.get_lang('ArticleManager').'</th>'; |
|
1673 | + echo '<th width:223px;>'.get_lang('CommentManager').'</th>'; |
|
1674 | 1674 | echo '</tr>'; |
1675 | 1675 | echo '<tr>'; |
1676 | - echo '<th style="width:111px;"><label for="articleDelete">' . get_lang('Delete') . '</label></th>'; |
|
1677 | - echo '<th style="width:112px;"><label for="articleEdit">' . get_lang('Edit') . '</label></th>'; |
|
1678 | - echo '<th style="width:223px;"><label for="commentsDelete">' . get_lang('Delete') . '</label></th>'; |
|
1676 | + echo '<th style="width:111px;"><label for="articleDelete">'.get_lang('Delete').'</label></th>'; |
|
1677 | + echo '<th style="width:112px;"><label for="articleEdit">'.get_lang('Edit').'</label></th>'; |
|
1678 | + echo '<th style="width:223px;"><label for="commentsDelete">'.get_lang('Delete').'</label></th>'; |
|
1679 | 1679 | echo '</tr>'; |
1680 | 1680 | echo '<tr>'; |
1681 | - echo '<td style="text-align:center;"><input ' . ((in_array('article_delete', $arrPermissions)) ? 'checked ' : '') . 'id="articleDelete" name="chkArticleDelete" type="checkbox" /></td>'; |
|
1682 | - echo '<td style="text-align:center;"><input ' . ((in_array('article_edit', $arrPermissions)) ? 'checked ' : '') . 'id="articleEdit" name="chkArticleEdit" type="checkbox" /></td>'; |
|
1683 | - echo '<td style="text-align:center;"><input ' . ((in_array('article_comments_delete', $arrPermissions)) ? 'checked ' : '') . 'id="commentsDelete" name="chkCommentsDelete" type="checkbox" /></td>'; |
|
1681 | + echo '<td style="text-align:center;"><input '.((in_array('article_delete', $arrPermissions)) ? 'checked ' : '').'id="articleDelete" name="chkArticleDelete" type="checkbox" /></td>'; |
|
1682 | + echo '<td style="text-align:center;"><input '.((in_array('article_edit', $arrPermissions)) ? 'checked ' : '').'id="articleEdit" name="chkArticleEdit" type="checkbox" /></td>'; |
|
1683 | + echo '<td style="text-align:center;"><input '.((in_array('article_comments_delete', $arrPermissions)) ? 'checked ' : '').'id="commentsDelete" name="chkCommentsDelete" type="checkbox" /></td>'; |
|
1684 | 1684 | echo '</tr>'; |
1685 | 1685 | echo '</table>'; |
1686 | 1686 | echo '</td>'; |
@@ -1688,13 +1688,13 @@ discard block |
||
1688 | 1688 | /* end of edit */ |
1689 | 1689 | |
1690 | 1690 | echo '<tr> |
1691 | - <td align="right">' . get_lang('Color') . ': </td> |
|
1691 | + <td align="right">' . get_lang('Color').': </td> |
|
1692 | 1692 | <td> |
1693 | - <select name="task_color" id="color" style="width: 150px; background-color: #' . $task['color'] . '" onchange="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value" onkeypress="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value">'; |
|
1693 | + <select name="task_color" id="color" style="width: 150px; background-color: #' . $task['color'].'" onchange="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value" onkeypress="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value">'; |
|
1694 | 1694 | foreach ($colors as $color) { |
1695 | 1695 | $selected = ($color == $task['color']) ? ' selected' : ''; |
1696 | - $style = 'style="background-color: #' . $color . '"'; |
|
1697 | - echo '<option value="' . $color . '" ' . $style . ' ' . $selected . ' > </option>'; |
|
1696 | + $style = 'style="background-color: #'.$color.'"'; |
|
1697 | + echo '<option value="'.$color.'" '.$style.' '.$selected.' > </option>'; |
|
1698 | 1698 | } |
1699 | 1699 | echo ' </select> |
1700 | 1700 | </td> |
@@ -1703,9 +1703,9 @@ discard block |
||
1703 | 1703 | <td align="right"> </td> |
1704 | 1704 | <td><br /><input type="hidden" name="action" value="" /> |
1705 | 1705 | <input type="hidden" name="edit_task_submit" value="true" /> |
1706 | - <input type="hidden" name="task_id" value="' . $task['task_id'] . '" /> |
|
1707 | - <input type="hidden" name="blog_id" value="' . $task['blog_id'] . '" /> |
|
1708 | - <button class="save" type="submit" name="Submit">' . get_lang('Save') . '</button></td> |
|
1706 | + <input type="hidden" name="task_id" value="' . $task['task_id'].'" /> |
|
1707 | + <input type="hidden" name="blog_id" value="' . $task['blog_id'].'" /> |
|
1708 | + <button class="save" type="submit" name="Submit">' . get_lang('Save').'</button></td> |
|
1709 | 1709 | </tr> |
1710 | 1710 | </table> |
1711 | 1711 | </form>'; |
@@ -1727,7 +1727,7 @@ discard block |
||
1727 | 1727 | FROM $tbl_users user |
1728 | 1728 | INNER JOIN $tbl_blogs_rel_user blogs_rel_user |
1729 | 1729 | ON user.user_id = blogs_rel_user.user_id |
1730 | - WHERE blogs_rel_user.c_id = $course_id AND blogs_rel_user.blog_id = '".(int)$blog_id."'"; |
|
1730 | + WHERE blogs_rel_user.c_id = $course_id AND blogs_rel_user.blog_id = '".(int) $blog_id."'"; |
|
1731 | 1731 | $result = Database::query($sql); |
1732 | 1732 | |
1733 | 1733 | $options = array(); |
@@ -1746,7 +1746,7 @@ discard block |
||
1746 | 1746 | color, |
1747 | 1747 | system_task |
1748 | 1748 | FROM $tbl_blogs_tasks |
1749 | - WHERE c_id = $course_id AND blog_id = " . (int)$blog_id . " |
|
1749 | + WHERE c_id = $course_id AND blog_id = ".(int) $blog_id." |
|
1750 | 1750 | ORDER BY system_task, title"; |
1751 | 1751 | $result = Database::query($sql); |
1752 | 1752 | |
@@ -1794,7 +1794,7 @@ discard block |
||
1794 | 1794 | */ |
1795 | 1795 | public static function display_edit_assigned_task_form($blog_id, $task_id, $user_id) |
1796 | 1796 | { |
1797 | - $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
1797 | + $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
1798 | 1798 | |
1799 | 1799 | $course_id = api_get_course_int_id(); |
1800 | 1800 | |
@@ -1803,9 +1803,9 @@ discard block |
||
1803 | 1803 | SELECT target_date |
1804 | 1804 | FROM $tbl_blogs_tasks_rel_user |
1805 | 1805 | WHERE c_id = $course_id AND |
1806 | - blog_id = '".(int)$blog_id."' AND |
|
1807 | - user_id = '".(int)$user_id."' AND |
|
1808 | - task_id = '".(int)$task_id."'"; |
|
1806 | + blog_id = '".(int) $blog_id."' AND |
|
1807 | + user_id = '".(int) $user_id."' AND |
|
1808 | + task_id = '".(int) $task_id."'"; |
|
1809 | 1809 | $result = Database::query($sql); |
1810 | 1810 | $row = Database::fetch_assoc($result); |
1811 | 1811 | |
@@ -1840,11 +1840,11 @@ discard block |
||
1840 | 1840 | |
1841 | 1841 | $sql = " |
1842 | 1842 | SELECT COUNT(*) as 'number' |
1843 | - FROM " . $tbl_blogs_tasks_rel_user . " |
|
1843 | + FROM " . $tbl_blogs_tasks_rel_user." |
|
1844 | 1844 | WHERE c_id = $course_id AND |
1845 | - blog_id = " . (int)$blog_id . " |
|
1846 | - AND user_id = " . (int)$user_id . " |
|
1847 | - AND task_id = " . (int)$task_id . " |
|
1845 | + blog_id = ".(int) $blog_id." |
|
1846 | + AND user_id = " . (int) $user_id." |
|
1847 | + AND task_id = " . (int) $task_id." |
|
1848 | 1848 | "; |
1849 | 1849 | |
1850 | 1850 | $result = Database::query($sql); |
@@ -1852,18 +1852,18 @@ discard block |
||
1852 | 1852 | |
1853 | 1853 | if ($row['number'] == 0) { |
1854 | 1854 | $sql = " |
1855 | - INSERT INTO " . $tbl_blogs_tasks_rel_user . " ( |
|
1855 | + INSERT INTO " . $tbl_blogs_tasks_rel_user." ( |
|
1856 | 1856 | c_id, |
1857 | 1857 | blog_id, |
1858 | 1858 | user_id, |
1859 | 1859 | task_id, |
1860 | 1860 | target_date |
1861 | 1861 | ) VALUES ( |
1862 | - '" . (int)$course_id . "', |
|
1863 | - '" . (int)$blog_id . "', |
|
1864 | - '" . (int)$user_id . "', |
|
1865 | - '" . (int)$task_id . "', |
|
1866 | - '" . Database::escape_string($target_date) . "' |
|
1862 | + '" . (int) $course_id."', |
|
1863 | + '" . (int) $blog_id."', |
|
1864 | + '" . (int) $user_id."', |
|
1865 | + '" . (int) $task_id."', |
|
1866 | + '" . Database::escape_string($target_date)."' |
|
1867 | 1867 | )"; |
1868 | 1868 | |
1869 | 1869 | Database::query($sql); |
@@ -1893,12 +1893,12 @@ discard block |
||
1893 | 1893 | $course_id = api_get_course_int_id(); |
1894 | 1894 | |
1895 | 1895 | $sql = "SELECT COUNT(*) as 'number' |
1896 | - FROM " . $tbl_blogs_tasks_rel_user . " |
|
1896 | + FROM " . $tbl_blogs_tasks_rel_user." |
|
1897 | 1897 | WHERE |
1898 | 1898 | c_id = $course_id AND |
1899 | - blog_id = " . (int)$blog_id . " AND |
|
1900 | - user_id = " . (int)$user_id . " AND |
|
1901 | - task_id = " . (int)$task_id . " |
|
1899 | + blog_id = ".(int) $blog_id." AND |
|
1900 | + user_id = " . (int) $user_id." AND |
|
1901 | + task_id = " . (int) $task_id." |
|
1902 | 1902 | "; |
1903 | 1903 | |
1904 | 1904 | $result = Database::query($sql); |
@@ -1906,17 +1906,17 @@ discard block |
||
1906 | 1906 | |
1907 | 1907 | if ($row['number'] == 0 || ($row['number'] != 0 && $task_id == $old_task_id && $user_id == $old_user_id)) { |
1908 | 1908 | $sql = " |
1909 | - UPDATE " . $tbl_blogs_tasks_rel_user . " |
|
1909 | + UPDATE " . $tbl_blogs_tasks_rel_user." |
|
1910 | 1910 | SET |
1911 | - user_id = " . (int)$user_id . ", |
|
1912 | - task_id = " . (int)$task_id . ", |
|
1913 | - target_date = '" . Database::escape_string($target_date) . "' |
|
1911 | + user_id = " . (int) $user_id.", |
|
1912 | + task_id = " . (int) $task_id.", |
|
1913 | + target_date = '" . Database::escape_string($target_date)."' |
|
1914 | 1914 | WHERE |
1915 | 1915 | c_id = $course_id AND |
1916 | - blog_id = " . (int)$blog_id . " AND |
|
1917 | - user_id = " . (int)$old_user_id . " AND |
|
1918 | - task_id = " . (int)$old_task_id . " AND |
|
1919 | - target_date = '" . Database::escape_string($old_target_date) . "' |
|
1916 | + blog_id = ".(int) $blog_id." AND |
|
1917 | + user_id = " . (int) $old_user_id." AND |
|
1918 | + task_id = " . (int) $old_task_id." AND |
|
1919 | + target_date = '" . Database::escape_string($old_target_date)."' |
|
1920 | 1920 | "; |
1921 | 1921 | Database::query($sql); |
1922 | 1922 | } |
@@ -1937,7 +1937,7 @@ discard block |
||
1937 | 1937 | |
1938 | 1938 | |
1939 | 1939 | $sql = "SELECT title, description FROM $tbl_blogs_tasks |
1940 | - WHERE task_id = '".(int)$task_id."' |
|
1940 | + WHERE task_id = '".(int) $task_id."' |
|
1941 | 1941 | AND c_id = $course_id"; |
1942 | 1942 | $result = Database::query($sql); |
1943 | 1943 | $row = Database::fetch_assoc($result); |
@@ -1945,19 +1945,19 @@ discard block |
||
1945 | 1945 | $sql = "SELECT post.*, user.lastname, user.firstname, user.username |
1946 | 1946 | FROM $tbl_blogs_posts post |
1947 | 1947 | INNER JOIN $tbl_users user ON post.author_id = user.user_id |
1948 | - WHERE post.blog_id = '".(int)$blog_id."' AND post.c_id = $course_id |
|
1948 | + WHERE post.blog_id = '".(int) $blog_id."' AND post.c_id = $course_id |
|
1949 | 1949 | ORDER BY post_id DESC |
1950 | 1950 | LIMIT 0, 100"; |
1951 | 1951 | $result = Database::query($sql); |
1952 | 1952 | |
1953 | 1953 | // Display |
1954 | - echo '<span class="blogpost_title">' . get_lang('SelectTaskArticle') . ' "' . stripslashes($row['title']) . '"</span>'; |
|
1955 | - echo '<span style="font-style: italic;"">'.stripslashes($row['description']) . '</span><br><br>'; |
|
1954 | + echo '<span class="blogpost_title">'.get_lang('SelectTaskArticle').' "'.stripslashes($row['title']).'"</span>'; |
|
1955 | + echo '<span style="font-style: italic;"">'.stripslashes($row['description']).'</span><br><br>'; |
|
1956 | 1956 | |
1957 | 1957 | if (Database::num_rows($result) > 0) { |
1958 | - while($blog_post = Database::fetch_array($result)) { |
|
1958 | + while ($blog_post = Database::fetch_array($result)) { |
|
1959 | 1959 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES); |
1960 | - echo '<a href="blog.php?action=execute_task&blog_id=' . $blog_id . '&task_id=' . $task_id . '&post_id=' . $blog_post['post_id'] . '#add_comment">'.stripslashes($blog_post['title']) . '</a>, ' . get_lang('WrittenBy') . ' ' . stripslashes(Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username))) . '<br />'; |
|
1960 | + echo '<a href="blog.php?action=execute_task&blog_id='.$blog_id.'&task_id='.$task_id.'&post_id='.$blog_post['post_id'].'#add_comment">'.stripslashes($blog_post['title']).'</a>, '.get_lang('WrittenBy').' '.stripslashes(Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username))).'<br />'; |
|
1961 | 1961 | } |
1962 | 1962 | } else { |
1963 | 1963 | echo get_lang('NoArticles'); |
@@ -1981,12 +1981,12 @@ discard block |
||
1981 | 1981 | |
1982 | 1982 | // Subscribe the user |
1983 | 1983 | $sql = "INSERT INTO $tbl_blogs_rel_user (c_id, blog_id, user_id ) |
1984 | - VALUES ($course_id, '".(int)$blog_id."', '".(int)$user_id."');"; |
|
1984 | + VALUES ($course_id, '".(int) $blog_id."', '".(int) $user_id."');"; |
|
1985 | 1985 | Database::query($sql); |
1986 | 1986 | |
1987 | 1987 | // Give this user basic rights |
1988 | 1988 | $sql = "INSERT INTO $tbl_user_permissions (c_id, user_id,tool,action) |
1989 | - VALUES ($course_id, '".(int)$user_id."','BLOG_" . (int)$blog_id."','article_add')"; |
|
1989 | + VALUES ($course_id, '".(int) $user_id."','BLOG_".(int) $blog_id."','article_add')"; |
|
1990 | 1990 | Database::query($sql); |
1991 | 1991 | |
1992 | 1992 | $id = Database::insert_id(); |
@@ -1996,7 +1996,7 @@ discard block |
||
1996 | 1996 | } |
1997 | 1997 | |
1998 | 1998 | $sql = "INSERT INTO $tbl_user_permissions (c_id, user_id,tool,action) |
1999 | - VALUES ($course_id, '".(int)$user_id."','BLOG_" . (int)$blog_id."','article_comments_add')"; |
|
1999 | + VALUES ($course_id, '".(int) $user_id."','BLOG_".(int) $blog_id."','article_comments_add')"; |
|
2000 | 2000 | Database::query($sql); |
2001 | 2001 | |
2002 | 2002 | $id = Database::insert_id(); |
@@ -2022,12 +2022,12 @@ discard block |
||
2022 | 2022 | |
2023 | 2023 | // Unsubscribe the user |
2024 | 2024 | $sql = "DELETE FROM $tbl_blogs_rel_user |
2025 | - WHERE blog_id = '".(int)$blog_id."' AND user_id = '".(int)$user_id."'"; |
|
2025 | + WHERE blog_id = '".(int) $blog_id."' AND user_id = '".(int) $user_id."'"; |
|
2026 | 2026 | Database::query($sql); |
2027 | 2027 | |
2028 | 2028 | // Remove this user's permissions. |
2029 | 2029 | $sql = "DELETE FROM $tbl_user_permissions |
2030 | - WHERE user_id = '".(int)$user_id."'"; |
|
2030 | + WHERE user_id = '".(int) $user_id."'"; |
|
2031 | 2031 | Database::query($sql); |
2032 | 2032 | } |
2033 | 2033 | |
@@ -2048,7 +2048,7 @@ discard block |
||
2048 | 2048 | $course_id = $_course['real_id']; |
2049 | 2049 | |
2050 | 2050 | $currentCourse = $_course['code']; |
2051 | - $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
2051 | + $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
2052 | 2052 | $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); |
2053 | 2053 | |
2054 | 2054 | echo '<legend>'.get_lang('SubscribeMembers').'</legend>'; |
@@ -2063,12 +2063,12 @@ discard block |
||
2063 | 2063 | $result = Database::query($sql); |
2064 | 2064 | |
2065 | 2065 | $blog_member_ids = array(); |
2066 | - while($user = Database::fetch_array($result)) { |
|
2066 | + while ($user = Database::fetch_array($result)) { |
|
2067 | 2067 | $blog_member_ids[] = $user['user_id']; |
2068 | 2068 | } |
2069 | 2069 | |
2070 | 2070 | // Set table headers |
2071 | - $column_header[] = array ('', false, ''); |
|
2071 | + $column_header[] = array('', false, ''); |
|
2072 | 2072 | if ($is_western_name_order) { |
2073 | 2073 | $column_header[] = array(get_lang('FirstName'), true, ''); |
2074 | 2074 | $column_header[] = array(get_lang('LastName'), true, ''); |
@@ -2088,13 +2088,13 @@ discard block |
||
2088 | 2088 | |
2089 | 2089 | // Add users that are not in this blog to the list. |
2090 | 2090 | foreach ($student_list as $key=>$user) { |
2091 | - if(isset($user['id_user'])) { |
|
2091 | + if (isset($user['id_user'])) { |
|
2092 | 2092 | $user['user_id'] = $user['id_user']; |
2093 | 2093 | } |
2094 | - if(!in_array($user['user_id'],$blog_member_ids)) { |
|
2094 | + if (!in_array($user['user_id'], $blog_member_ids)) { |
|
2095 | 2095 | $a_infosUser = api_get_user_info($user['user_id']); |
2096 | - $row = array (); |
|
2097 | - $row[] = '<input type="checkbox" name="user[]" value="' . $a_infosUser['user_id'] . '" '.((isset($_GET['selectall']) && $_GET['selectall'] == "subscribe") ? ' checked="checked" ' : '') . '/>'; |
|
2096 | + $row = array(); |
|
2097 | + $row[] = '<input type="checkbox" name="user[]" value="'.$a_infosUser['user_id'].'" '.((isset($_GET['selectall']) && $_GET['selectall'] == "subscribe") ? ' checked="checked" ' : '').'/>'; |
|
2098 | 2098 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $a_infosUser["username"]), ENT_QUOTES); |
2099 | 2099 | if ($is_western_name_order) { |
2100 | 2100 | $row[] = $a_infosUser["firstname"]; |
@@ -2106,8 +2106,8 @@ discard block |
||
2106 | 2106 | $row[] = Display::icon_mailto_link($a_infosUser["email"]); |
2107 | 2107 | |
2108 | 2108 | //Link to register users |
2109 | - if ($a_infosUser["user_id"] != $_SESSION['_user']['user_id']){ |
|
2110 | - $row[] = "<a class=\"btn btn-primary \" href=\"" .api_get_self()."?action=manage_members&blog_id=$blog_id®ister=yes&user_id=" . $a_infosUser["user_id"]."\">" . get_lang('Register')."</a>"; |
|
2109 | + if ($a_infosUser["user_id"] != $_SESSION['_user']['user_id']) { |
|
2110 | + $row[] = "<a class=\"btn btn-primary \" href=\"".api_get_self()."?action=manage_members&blog_id=$blog_id®ister=yes&user_id=".$a_infosUser["user_id"]."\">".get_lang('Register')."</a>"; |
|
2111 | 2111 | } else { |
2112 | 2112 | $row[] = ''; |
2113 | 2113 | } |
@@ -2118,20 +2118,20 @@ discard block |
||
2118 | 2118 | // Display |
2119 | 2119 | $query_vars['action'] = 'manage_members'; |
2120 | 2120 | $query_vars['blog_id'] = $blog_id; |
2121 | - echo '<form method="post" action="blog.php?action=manage_members&blog_id=' . $blog_id . '">'; |
|
2122 | - Display::display_sortable_table($column_header, $user_data,null,null,$query_vars); |
|
2121 | + echo '<form method="post" action="blog.php?action=manage_members&blog_id='.$blog_id.'">'; |
|
2122 | + Display::display_sortable_table($column_header, $user_data, null, null, $query_vars); |
|
2123 | 2123 | $link = ''; |
2124 | - $link .= isset ($_GET['action']) ? 'action=' . Security::remove_XSS($_GET['action']) . '&' : ''; |
|
2124 | + $link .= isset ($_GET['action']) ? 'action='.Security::remove_XSS($_GET['action']).'&' : ''; |
|
2125 | 2125 | $link .= "blog_id=$blog_id&"; |
2126 | 2126 | |
2127 | - echo '<a href="blog.php?' . $link . 'selectall=subscribe">' . get_lang('SelectAll') . '</a> - '; |
|
2128 | - echo '<a href="blog.php?' . $link . '">' . get_lang('UnSelectAll') . '</a> '; |
|
2129 | - echo get_lang('WithSelected') . ' : '; |
|
2127 | + echo '<a href="blog.php?'.$link.'selectall=subscribe">'.get_lang('SelectAll').'</a> - '; |
|
2128 | + echo '<a href="blog.php?'.$link.'">'.get_lang('UnSelectAll').'</a> '; |
|
2129 | + echo get_lang('WithSelected').' : '; |
|
2130 | 2130 | echo '<select name="action">'; |
2131 | - echo '<option value="select_subscribe">' . get_lang('Register') . '</option>'; |
|
2131 | + echo '<option value="select_subscribe">'.get_lang('Register').'</option>'; |
|
2132 | 2132 | echo '</select>'; |
2133 | 2133 | echo '<input type="hidden" name="register" value="true" />'; |
2134 | - echo '<button class="save" type="submit">' . get_lang('Ok') . '</button>'; |
|
2134 | + echo '<button class="save" type="submit">'.get_lang('Ok').'</button>'; |
|
2135 | 2135 | echo '</form>'; |
2136 | 2136 | } |
2137 | 2137 | |
@@ -2144,7 +2144,7 @@ discard block |
||
2144 | 2144 | * |
2145 | 2145 | * @return false|null Form with sortable table with users to unsubcribe from a blog. |
2146 | 2146 | */ |
2147 | - public static function display_form_user_unsubscribe ($blog_id) |
|
2147 | + public static function display_form_user_unsubscribe($blog_id) |
|
2148 | 2148 | { |
2149 | 2149 | $_user = api_get_user_info(); |
2150 | 2150 | $is_western_name_order = api_is_western_name_order(); |
@@ -2157,34 +2157,34 @@ discard block |
||
2157 | 2157 | |
2158 | 2158 | $properties["width"] = "100%"; |
2159 | 2159 | //table column titles |
2160 | - $column_header[] = array ('', false, ''); |
|
2160 | + $column_header[] = array('', false, ''); |
|
2161 | 2161 | if ($is_western_name_order) { |
2162 | - $column_header[] = array (get_lang('FirstName'), true, ''); |
|
2163 | - $column_header[] = array (get_lang('LastName'), true, ''); |
|
2162 | + $column_header[] = array(get_lang('FirstName'), true, ''); |
|
2163 | + $column_header[] = array(get_lang('LastName'), true, ''); |
|
2164 | 2164 | } else { |
2165 | - $column_header[] = array (get_lang('LastName'), true, ''); |
|
2166 | - $column_header[] = array (get_lang('FirstName'), true, ''); |
|
2165 | + $column_header[] = array(get_lang('LastName'), true, ''); |
|
2166 | + $column_header[] = array(get_lang('FirstName'), true, ''); |
|
2167 | 2167 | } |
2168 | - $column_header[] = array (get_lang('Email'), false, ''); |
|
2169 | - $column_header[] = array (get_lang('TaskManager'), true, ''); |
|
2170 | - $column_header[] = array (get_lang('UnRegister'), false, ''); |
|
2168 | + $column_header[] = array(get_lang('Email'), false, ''); |
|
2169 | + $column_header[] = array(get_lang('TaskManager'), true, ''); |
|
2170 | + $column_header[] = array(get_lang('UnRegister'), false, ''); |
|
2171 | 2171 | |
2172 | 2172 | $course_id = api_get_course_int_id(); |
2173 | 2173 | |
2174 | 2174 | $sql = "SELECT user.user_id, user.lastname, user.firstname, user.email, user.username |
2175 | 2175 | FROM $tbl_users user INNER JOIN $tbl_blogs_rel_user blogs_rel_user |
2176 | 2176 | ON user.user_id = blogs_rel_user.user_id |
2177 | - WHERE blogs_rel_user.c_id = $course_id AND blogs_rel_user.blog_id = '".(int)$blog_id."'"; |
|
2177 | + WHERE blogs_rel_user.c_id = $course_id AND blogs_rel_user.blog_id = '".(int) $blog_id."'"; |
|
2178 | 2178 | |
2179 | 2179 | if (!($sql_result = Database::query($sql))) { |
2180 | 2180 | return false; |
2181 | 2181 | } |
2182 | 2182 | |
2183 | - $user_data = array (); |
|
2183 | + $user_data = array(); |
|
2184 | 2184 | |
2185 | 2185 | while ($myrow = Database::fetch_array($sql_result)) { |
2186 | - $row = array (); |
|
2187 | - $row[] = '<input type="checkbox" name="user[]" value="' . $myrow['user_id'] . '" '.((isset($_GET['selectall']) && $_GET['selectall'] == "unsubscribe") ? ' checked="checked" ' : '') . '/>'; |
|
2186 | + $row = array(); |
|
2187 | + $row[] = '<input type="checkbox" name="user[]" value="'.$myrow['user_id'].'" '.((isset($_GET['selectall']) && $_GET['selectall'] == "unsubscribe") ? ' checked="checked" ' : '').'/>'; |
|
2188 | 2188 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $myrow["username"]), ENT_QUOTES); |
2189 | 2189 | if ($is_western_name_order) { |
2190 | 2190 | $row[] = $myrow["firstname"]; |
@@ -2196,19 +2196,19 @@ discard block |
||
2196 | 2196 | $row[] = Display::icon_mailto_link($myrow["email"]); |
2197 | 2197 | |
2198 | 2198 | $sql = "SELECT bt.title task |
2199 | - FROM " . Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER) . " btu |
|
2200 | - INNER JOIN " . Database::get_course_table(TABLE_BLOGS_TASKS) . " bt |
|
2199 | + FROM " . Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER)." btu |
|
2200 | + INNER JOIN " . Database::get_course_table(TABLE_BLOGS_TASKS)." bt |
|
2201 | 2201 | ON btu.task_id = bt.task_id |
2202 | 2202 | WHERE btu.c_id = $course_id AND |
2203 | 2203 | bt.c_id = $course_id AND |
2204 | 2204 | btu.blog_id = $blog_id AND |
2205 | - btu.user_id = " . $myrow['user_id']; |
|
2205 | + btu.user_id = ".$myrow['user_id']; |
|
2206 | 2206 | $sql_res = Database::query($sql); |
2207 | 2207 | |
2208 | 2208 | $task = ''; |
2209 | 2209 | |
2210 | - while($r = Database::fetch_array($sql_res)) { |
|
2211 | - $task .= stripslashes($r['task']) . ', '; |
|
2210 | + while ($r = Database::fetch_array($sql_res)) { |
|
2211 | + $task .= stripslashes($r['task']).', '; |
|
2212 | 2212 | } |
2213 | 2213 | //echo $task; |
2214 | 2214 | $task = (api_strlen(trim($task)) != 0) ? api_substr($task, 0, api_strlen($task) - 2) : get_lang('Reader'); |
@@ -2216,7 +2216,7 @@ discard block |
||
2216 | 2216 | //Link to register users |
2217 | 2217 | |
2218 | 2218 | if ($myrow["user_id"] != $_user['user_id']) { |
2219 | - $row[] = "<a class=\"btn btn-primary\" href=\"" .api_get_self()."?action=manage_members&blog_id=$blog_id&unregister=yes&user_id=" . $myrow['user_id']."\">" . get_lang('UnRegister')."</a>"; |
|
2219 | + $row[] = "<a class=\"btn btn-primary\" href=\"".api_get_self()."?action=manage_members&blog_id=$blog_id&unregister=yes&user_id=".$myrow['user_id']."\">".get_lang('UnRegister')."</a>"; |
|
2220 | 2220 | } else { |
2221 | 2221 | $row[] = ''; |
2222 | 2222 | } |
@@ -2226,20 +2226,20 @@ discard block |
||
2226 | 2226 | |
2227 | 2227 | $query_vars['action'] = 'manage_members'; |
2228 | 2228 | $query_vars['blog_id'] = $blog_id; |
2229 | - echo '<form method="post" action="blog.php?action=manage_members&blog_id=' . $blog_id . '">'; |
|
2230 | - Display::display_sortable_table($column_header, $user_data,null,null,$query_vars); |
|
2229 | + echo '<form method="post" action="blog.php?action=manage_members&blog_id='.$blog_id.'">'; |
|
2230 | + Display::display_sortable_table($column_header, $user_data, null, null, $query_vars); |
|
2231 | 2231 | $link = ''; |
2232 | - $link .= isset ($_GET['action']) ? 'action=' . Security::remove_XSS($_GET['action']). '&' : ''; |
|
2232 | + $link .= isset ($_GET['action']) ? 'action='.Security::remove_XSS($_GET['action']).'&' : ''; |
|
2233 | 2233 | $link .= "blog_id=$blog_id&"; |
2234 | 2234 | |
2235 | - echo '<a href="blog.php?' . $link . 'selectall=unsubscribe">' . get_lang('SelectAll') . '</a> - '; |
|
2236 | - echo '<a href="blog.php?' . $link . '">' . get_lang('UnSelectAll') . '</a> '; |
|
2237 | - echo get_lang('WithSelected') . ' : '; |
|
2235 | + echo '<a href="blog.php?'.$link.'selectall=unsubscribe">'.get_lang('SelectAll').'</a> - '; |
|
2236 | + echo '<a href="blog.php?'.$link.'">'.get_lang('UnSelectAll').'</a> '; |
|
2237 | + echo get_lang('WithSelected').' : '; |
|
2238 | 2238 | echo '<select name="action">'; |
2239 | - echo '<option value="select_unsubscribe">' . get_lang('UnRegister') . '</option>'; |
|
2239 | + echo '<option value="select_unsubscribe">'.get_lang('UnRegister').'</option>'; |
|
2240 | 2240 | echo '</select>'; |
2241 | 2241 | echo '<input type="hidden" name="unregister" value="true" />'; |
2242 | - echo '<button class="save" type="submit">' . get_lang('Ok') . '</button>'; |
|
2242 | + echo '<button class="save" type="submit">'.get_lang('Ok').'</button>'; |
|
2243 | 2243 | echo '</form>'; |
2244 | 2244 | } |
2245 | 2245 | |
@@ -2249,7 +2249,7 @@ discard block |
||
2249 | 2249 | * |
2250 | 2250 | * @param Integer $blog_id |
2251 | 2251 | */ |
2252 | - public static function display_form_user_rights ($blog_id) |
|
2252 | + public static function display_form_user_rights($blog_id) |
|
2253 | 2253 | { |
2254 | 2254 | echo '<legend>'.get_lang('RightsManager').'</legend>'; |
2255 | 2255 | echo '<br />'; |
@@ -2270,7 +2270,7 @@ discard block |
||
2270 | 2270 | $form = new FormValidator( |
2271 | 2271 | 'add_post', |
2272 | 2272 | 'post', |
2273 | - api_get_path(WEB_CODE_PATH)."blog/blog.php?action=view_post&blog_id=" . intval($blog_id) . "&post_id=".intval($post_id)."&".api_get_cidreq(), |
|
2273 | + api_get_path(WEB_CODE_PATH)."blog/blog.php?action=view_post&blog_id=".intval($blog_id)."&post_id=".intval($post_id)."&".api_get_cidreq(), |
|
2274 | 2274 | null, |
2275 | 2275 | array('enctype' => 'multipart/form-data') |
2276 | 2276 | ); |
@@ -2336,21 +2336,21 @@ discard block |
||
2336 | 2336 | $course_id = api_get_course_int_id(); |
2337 | 2337 | |
2338 | 2338 | //Handle leap year |
2339 | - $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
2339 | + $numberofdays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
2340 | 2340 | |
2341 | - if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) |
|
2341 | + if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) |
|
2342 | 2342 | $numberofdays[2] = 29; |
2343 | 2343 | |
2344 | 2344 | //Get the first day of the month |
2345 | 2345 | $dayone = getdate(mktime(0, 0, 0, $month, 1, $year)); |
2346 | - $monthName = $MonthsLong[$month-1]; |
|
2346 | + $monthName = $MonthsLong[$month - 1]; |
|
2347 | 2347 | |
2348 | 2348 | //Start the week on monday |
2349 | 2349 | $startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6; |
2350 | 2350 | $blogId = isset($_GET['blog_id']) ? intval($_GET['blog_id']) : null; |
2351 | 2351 | $filter = isset($_GET['filter']) ? Security::remove_XSS($_GET['filter']) : null; |
2352 | - $backwardsURL = api_get_self()."?blog_id=" . $blogId."&filter=" . $filter."&month=". ($month == 1 ? 12 : $month -1)."&year=". ($month == 1 ? $year -1 : $year); |
|
2353 | - $forewardsURL = api_get_self()."?blog_id=" . $blogId."&filter=" . $filter."&month=". ($month == 12 ? 1 : $month +1)."&year=". ($month == 12 ? $year +1 : $year); |
|
2352 | + $backwardsURL = api_get_self()."?blog_id=".$blogId."&filter=".$filter."&month=".($month == 1 ? 12 : $month - 1)."&year=".($month == 1 ? $year - 1 : $year); |
|
2353 | + $forewardsURL = api_get_self()."?blog_id=".$blogId."&filter=".$filter."&month=".($month == 12 ? 1 : $month + 1)."&year=".($month == 12 ? $year + 1 : $year); |
|
2354 | 2354 | |
2355 | 2355 | // Get posts for this month |
2356 | 2356 | $sql = "SELECT post.*, DAYOFMONTH(date_creation) as post_day, user.lastname, user.firstname |
@@ -2359,15 +2359,15 @@ discard block |
||
2359 | 2359 | ON post.author_id = user.user_id |
2360 | 2360 | WHERE |
2361 | 2361 | post.c_id = $course_id AND |
2362 | - post.blog_id = '".(int)$blog_id."' AND |
|
2363 | - MONTH(date_creation) = '".(int)$month."' AND |
|
2364 | - YEAR(date_creation) = '".(int)$year."' |
|
2362 | + post.blog_id = '".(int) $blog_id."' AND |
|
2363 | + MONTH(date_creation) = '".(int) $month."' AND |
|
2364 | + YEAR(date_creation) = '".(int) $year."' |
|
2365 | 2365 | ORDER BY date_creation"; |
2366 | 2366 | $result = Database::query($sql); |
2367 | 2367 | |
2368 | 2368 | // We will create an array of days on which there are posts. |
2369 | - if( Database::num_rows($result) > 0) { |
|
2370 | - while($blog_post = Database::fetch_array($result)) { |
|
2369 | + if (Database::num_rows($result) > 0) { |
|
2370 | + while ($blog_post = Database::fetch_array($result)) { |
|
2371 | 2371 | // If the day of this post is not yet in the array, add it. |
2372 | 2372 | if (!in_array($blog_post['post_day'], $posts)) |
2373 | 2373 | $posts[] = $blog_post['post_day']; |
@@ -2384,9 +2384,9 @@ discard block |
||
2384 | 2384 | task_rel_user.c_id = $course_id AND |
2385 | 2385 | task.c_id = $course_id AND |
2386 | 2386 | blog.c_id = $course_id AND |
2387 | - task_rel_user.user_id = '".(int)$_user['user_id']."' AND |
|
2388 | - MONTH(target_date) = '".(int)$month."' AND |
|
2389 | - YEAR(target_date) = '".(int)$year."' |
|
2387 | + task_rel_user.user_id = '".(int) $_user['user_id']."' AND |
|
2388 | + MONTH(target_date) = '".(int) $month."' AND |
|
2389 | + YEAR(target_date) = '".(int) $year."' |
|
2390 | 2390 | ORDER BY target_date ASC"; |
2391 | 2391 | $result = Database::query($sql); |
2392 | 2392 | |
@@ -2409,7 +2409,7 @@ discard block |
||
2409 | 2409 | |
2410 | 2410 | echo "<tr>"; |
2411 | 2411 | |
2412 | - for($ii = 1; $ii < 8; $ii ++) |
|
2412 | + for ($ii = 1; $ii < 8; $ii++) |
|
2413 | 2413 | echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>"; |
2414 | 2414 | |
2415 | 2415 | echo "</tr>"; |
@@ -2419,24 +2419,24 @@ discard block |
||
2419 | 2419 | |
2420 | 2420 | while ($curday <= $numberofdays[$month]) { |
2421 | 2421 | echo "<tr>"; |
2422 | - for ($ii = 0; $ii < 7; $ii ++) { |
|
2422 | + for ($ii = 0; $ii < 7; $ii++) { |
|
2423 | 2423 | if (($curday == -1) && ($ii == $startdayofweek)) |
2424 | 2424 | $curday = 1; |
2425 | 2425 | |
2426 | 2426 | if (($curday > 0) && ($curday <= $numberofdays[$month])) { |
2427 | - $bgcolor = $ii < 5 ? $class="class=\"days_week\"" : $class="class=\"days_weekend\""; |
|
2427 | + $bgcolor = $ii < 5 ? $class = "class=\"days_week\"" : $class = "class=\"days_weekend\""; |
|
2428 | 2428 | $dayheader = "$curday"; |
2429 | 2429 | |
2430 | - if(($curday == $today['mday']) && ($year == $today['year']) && ($month == $today['mon'])) { |
|
2430 | + if (($curday == $today['mday']) && ($year == $today['year']) && ($month == $today['mon'])) { |
|
2431 | 2431 | $dayheader = "$curday"; |
2432 | 2432 | $class = "class=\"days_today\""; |
2433 | 2433 | } |
2434 | 2434 | |
2435 | - echo "<td " . $class.">"; |
|
2435 | + echo "<td ".$class.">"; |
|
2436 | 2436 | |
2437 | 2437 | // If there are posts on this day, create a filter link. |
2438 | - if(in_array($curday, $posts)) |
|
2439 | - echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>'; |
|
2438 | + if (in_array($curday, $posts)) |
|
2439 | + echo '<a href="blog.php?blog_id='.$blog_id.'&filter='.$year.'-'.$month.'-'.$curday.'&month='.$month.'&year='.$year.'" title="'.get_lang('ViewPostsOfThisDay').'">'.$curday.'</a>'; |
|
2440 | 2440 | else |
2441 | 2441 | echo $dayheader; |
2442 | 2442 | |
@@ -2444,7 +2444,7 @@ discard block |
||
2444 | 2444 | if (isset($tasks[$curday]) && is_array($tasks[$curday])) { |
2445 | 2445 | // Add tasks to calendar |
2446 | 2446 | foreach ($tasks[$curday] as $task) { |
2447 | - echo '<a href="blog.php?action=execute_task&blog_id=' . $task['blog_id'] . '&task_id='.stripslashes($task['task_id']) . '" title="' . $task['title'] . ' : ' . get_lang('InBlog') . ' : ' . $task['blog_name'] . ' - ' . get_lang('ExecuteThisTask') . '">'; |
|
2447 | + echo '<a href="blog.php?action=execute_task&blog_id='.$task['blog_id'].'&task_id='.stripslashes($task['task_id']).'" title="'.$task['title'].' : '.get_lang('InBlog').' : '.$task['blog_name'].' - '.get_lang('ExecuteThisTask').'">'; |
|
2448 | 2448 | echo Display::return_icon('blog_task.gif', get_lang('ExecuteThisTask')); |
2449 | 2449 | echo '</a>'; |
2450 | 2450 | } |
@@ -2452,7 +2452,7 @@ discard block |
||
2452 | 2452 | } |
2453 | 2453 | |
2454 | 2454 | echo "</td>"; |
2455 | - $curday ++; |
|
2455 | + $curday++; |
|
2456 | 2456 | } else |
2457 | 2457 | echo "<td> </td>"; |
2458 | 2458 | } |
@@ -2490,7 +2490,7 @@ discard block |
||
2490 | 2490 | public static function display_edit_blog_form($blog_id) |
2491 | 2491 | { |
2492 | 2492 | $course_id = api_get_course_int_id(); |
2493 | - $blog_id= intval($blog_id); |
|
2493 | + $blog_id = intval($blog_id); |
|
2494 | 2494 | $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
2495 | 2495 | |
2496 | 2496 | $sql = "SELECT blog_id, blog_name, blog_subtitle |
@@ -2505,7 +2505,7 @@ discard block |
||
2505 | 2505 | $blog['blog_subtitle'] = Security::remove_XSS($_POST['blog_subtitle']); |
2506 | 2506 | } |
2507 | 2507 | |
2508 | - $form = new FormValidator('edit_blog', 'post','blog_admin.php?action=edit&blog_id='.intval($_GET['blog_id'])); |
|
2508 | + $form = new FormValidator('edit_blog', 'post', 'blog_admin.php?action=edit&blog_id='.intval($_GET['blog_id'])); |
|
2509 | 2509 | $form->addElement('header', get_lang('EditBlog')); |
2510 | 2510 | $form->addElement('text', 'blog_name', get_lang('Title')); |
2511 | 2511 | $form->addElement('textarea', 'blog_subtitle', get_lang('SubTitle')); |
@@ -2541,8 +2541,8 @@ discard block |
||
2541 | 2541 | $result = Database::query($sql); |
2542 | 2542 | $list_info = array(); |
2543 | 2543 | if (Database::num_rows($result)) { |
2544 | - while ($row_project=Database::fetch_row($result)) { |
|
2545 | - $list_info[]=$row_project; |
|
2544 | + while ($row_project = Database::fetch_row($result)) { |
|
2545 | + $list_info[] = $row_project; |
|
2546 | 2546 | } |
2547 | 2547 | } |
2548 | 2548 | |
@@ -2554,35 +2554,35 @@ discard block |
||
2554 | 2554 | // Validation when belongs to a session |
2555 | 2555 | $session_img = api_get_session_image($info_log[4], $_user['status']); |
2556 | 2556 | |
2557 | - $url_start_blog = 'blog.php' ."?". "blog_id=".$info_log[3]. "&".api_get_cidreq(); |
|
2557 | + $url_start_blog = 'blog.php'."?"."blog_id=".$info_log[3]."&".api_get_cidreq(); |
|
2558 | 2558 | $title = $info_log[0]; |
2559 | 2559 | $image = Display::return_icon('blog.png', $title); |
2560 | - $list_name = '<div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_blog.'">' . $image . '</a></div><a href="'.$url_start_blog.'">' .$title. '</a>' . $session_img; |
|
2560 | + $list_name = '<div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_blog.'">'.$image.'</a></div><a href="'.$url_start_blog.'">'.$title.'</a>'.$session_img; |
|
2561 | 2561 | |
2562 | 2562 | $list_body_blog[] = $list_name; |
2563 | 2563 | $list_body_blog[] = $info_log[1]; |
2564 | 2564 | |
2565 | - $visibility_icon=($info_log[2]==0) ? 'invisible' : 'visible'; |
|
2566 | - $visibility_info=($info_log[2]==0) ? 'Visible' : 'Invisible'; |
|
2567 | - $my_image = '<a href="' .api_get_self(). '?action=edit&blog_id=' . $info_log[3] . '">'; |
|
2568 | - $my_image.= Display::return_icon('edit.png', get_lang('EditBlog')); |
|
2565 | + $visibility_icon = ($info_log[2] == 0) ? 'invisible' : 'visible'; |
|
2566 | + $visibility_info = ($info_log[2] == 0) ? 'Visible' : 'Invisible'; |
|
2567 | + $my_image = '<a href="'.api_get_self().'?action=edit&blog_id='.$info_log[3].'">'; |
|
2568 | + $my_image .= Display::return_icon('edit.png', get_lang('EditBlog')); |
|
2569 | 2569 | |
2570 | - $my_image.= "</a>"; |
|
2571 | - $my_image.= '<a href="' .api_get_self(). '?action=delete&blog_id=' . $info_log[3] . '" '; |
|
2572 | - $my_image.= 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;" >'; |
|
2573 | - $my_image.= Display::return_icon('delete.png', get_lang('DeleteBlog')); |
|
2570 | + $my_image .= "</a>"; |
|
2571 | + $my_image .= '<a href="'.api_get_self().'?action=delete&blog_id='.$info_log[3].'" '; |
|
2572 | + $my_image .= 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;" >'; |
|
2573 | + $my_image .= Display::return_icon('delete.png', get_lang('DeleteBlog')); |
|
2574 | 2574 | |
2575 | - $my_image.= "</a>"; |
|
2576 | - $my_image.= '<a href="' .api_get_self(). '?action=visibility&blog_id=' . $info_log[3] . '">'; |
|
2577 | - $my_image.= Display::return_icon($visibility_icon . '.gif', get_lang($visibility_info)); |
|
2575 | + $my_image .= "</a>"; |
|
2576 | + $my_image .= '<a href="'.api_get_self().'?action=visibility&blog_id='.$info_log[3].'">'; |
|
2577 | + $my_image .= Display::return_icon($visibility_icon.'.gif', get_lang($visibility_info)); |
|
2578 | 2578 | |
2579 | - $my_image.= "</a>"; |
|
2580 | - $list_body_blog[]=$my_image; |
|
2581 | - $list_content_blog[]=$list_body_blog; |
|
2579 | + $my_image .= "</a>"; |
|
2580 | + $list_body_blog[] = $my_image; |
|
2581 | + $list_content_blog[] = $list_body_blog; |
|
2582 | 2582 | $list_body_blog = array(); |
2583 | 2583 | } |
2584 | 2584 | |
2585 | - $table = new SortableTableFromArrayConfig($list_content_blog, 1,20,'project'); |
|
2585 | + $table = new SortableTableFromArrayConfig($list_content_blog, 1, 20, 'project'); |
|
2586 | 2586 | $table->set_header(0, get_lang('Title')); |
2587 | 2587 | $table->set_header(1, get_lang('SubTitle')); |
2588 | 2588 | $table->set_header(2, get_lang('Modify')); |
@@ -2607,34 +2607,34 @@ discard block |
||
2607 | 2607 | * @author Julio Montoya |
2608 | 2608 | * @version avril 2008, dokeos 1.8.5 |
2609 | 2609 | */ |
2610 | -function get_blog_attachment($blog_id, $post_id=null,$comment_id=null) |
|
2610 | +function get_blog_attachment($blog_id, $post_id = null, $comment_id = null) |
|
2611 | 2611 | { |
2612 | 2612 | $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
2613 | 2613 | |
2614 | 2614 | $blog_id = intval($blog_id); |
2615 | 2615 | $comment_id = intval($comment_id); |
2616 | 2616 | $post_id = intval($post_id); |
2617 | - $row=array(); |
|
2618 | - $where=''; |
|
2617 | + $row = array(); |
|
2618 | + $where = ''; |
|
2619 | 2619 | if (!empty ($post_id) && is_numeric($post_id)) { |
2620 | - $where.=' AND post_id ="'.$post_id.'" '; |
|
2620 | + $where .= ' AND post_id ="'.$post_id.'" '; |
|
2621 | 2621 | } |
2622 | 2622 | |
2623 | 2623 | if (!empty ($comment_id) && is_numeric($comment_id)) { |
2624 | 2624 | if (!empty ($post_id)) { |
2625 | - $where.= ' AND '; |
|
2625 | + $where .= ' AND '; |
|
2626 | 2626 | } |
2627 | - $where.=' comment_id ="'.$comment_id.'" '; |
|
2627 | + $where .= ' comment_id ="'.$comment_id.'" '; |
|
2628 | 2628 | } |
2629 | 2629 | |
2630 | 2630 | $course_id = api_get_course_int_id(); |
2631 | 2631 | |
2632 | - $sql = 'SELECT path, filename, comment FROM '. $blog_table_attachment.' |
|
2632 | + $sql = 'SELECT path, filename, comment FROM '.$blog_table_attachment.' |
|
2633 | 2633 | WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'" '.$where; |
2634 | 2634 | |
2635 | - $result=Database::query($sql); |
|
2636 | - if (Database::num_rows($result)!=0) { |
|
2637 | - $row=Database::fetch_array($result); |
|
2635 | + $result = Database::query($sql); |
|
2636 | + if (Database::num_rows($result) != 0) { |
|
2637 | + $row = Database::fetch_array($result); |
|
2638 | 2638 | } |
2639 | 2639 | return $row; |
2640 | 2640 | } |
@@ -2674,22 +2674,22 @@ discard block |
||
2674 | 2674 | } |
2675 | 2675 | |
2676 | 2676 | // delete all files in directory |
2677 | - $courseDir = $_course['path'].'/upload/blog'; |
|
2677 | + $courseDir = $_course['path'].'/upload/blog'; |
|
2678 | 2678 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
2679 | 2679 | $updir = $sys_course_path.$courseDir; |
2680 | 2680 | |
2681 | 2681 | $sql = 'SELECT path FROM '.$blog_table_attachment.' |
2682 | 2682 | WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'" '.$where; |
2683 | - $result=Database::query($sql); |
|
2683 | + $result = Database::query($sql); |
|
2684 | 2684 | |
2685 | - while ($row=Database::fetch_row($result)) { |
|
2686 | - $file=$updir.'/'.$row[0]; |
|
2687 | - if (Security::check_abs_path($file,$updir) ) |
|
2685 | + while ($row = Database::fetch_row($result)) { |
|
2686 | + $file = $updir.'/'.$row[0]; |
|
2687 | + if (Security::check_abs_path($file, $updir)) |
|
2688 | 2688 | { |
2689 | 2689 | @ unlink($file); |
2690 | 2690 | } |
2691 | 2691 | } |
2692 | - $sql = 'DELETE FROM '. $blog_table_attachment.' |
|
2692 | + $sql = 'DELETE FROM '.$blog_table_attachment.' |
|
2693 | 2693 | WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'" '.$where; |
2694 | 2694 | Database::query($sql); |
2695 | 2695 | } |
@@ -2719,13 +2719,13 @@ discard block |
||
2719 | 2719 | $result = Database::query($sql); |
2720 | 2720 | $return_data = ''; |
2721 | 2721 | |
2722 | - if (Database::num_rows($result)!=0) { |
|
2723 | - while ($row=Database::fetch_array($result)) { |
|
2724 | - $return_data.= '<div class="clear"></div><br />'; |
|
2725 | - $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png',get_lang('BlogPosts')).' '.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
2726 | - $return_data.= '<br / >'; |
|
2727 | - $return_data.= $row['full_text']; |
|
2728 | - $return_data.= '<br /><br />'; |
|
2722 | + if (Database::num_rows($result) != 0) { |
|
2723 | + while ($row = Database::fetch_array($result)) { |
|
2724 | + $return_data .= '<div class="clear"></div><br />'; |
|
2725 | + $return_data .= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png', get_lang('BlogPosts')).' '.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
2726 | + $return_data .= '<br / >'; |
|
2727 | + $return_data .= $row['full_text']; |
|
2728 | + $return_data .= '<br /><br />'; |
|
2729 | 2729 | } |
2730 | 2730 | } |
2731 | 2731 | return $return_data; |
@@ -2755,13 +2755,13 @@ discard block |
||
2755 | 2755 | ORDER BY blog_name"; |
2756 | 2756 | $result = Database::query($sql); |
2757 | 2757 | $return_data = ''; |
2758 | - if (Database::num_rows($result)!=0) { |
|
2759 | - while ($row=Database::fetch_array($result)) { |
|
2760 | - $return_data.= '<div class="clear"></div><br />'; |
|
2761 | - $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
2762 | - $return_data.= '<br / >'; |
|
2763 | - $return_data.= $row['comment']; |
|
2764 | - $return_data.= '<br />'; |
|
2758 | + if (Database::num_rows($result) != 0) { |
|
2759 | + while ($row = Database::fetch_array($result)) { |
|
2760 | + $return_data .= '<div class="clear"></div><br />'; |
|
2761 | + $return_data .= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
2762 | + $return_data .= '<br / >'; |
|
2763 | + $return_data .= $row['comment']; |
|
2764 | + $return_data .= '<br />'; |
|
2765 | 2765 | } |
2766 | 2766 | } |
2767 | 2767 | return $return_data; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $result = Database::query($sql); |
36 | 36 | if (Database::num_rows($result)) { |
37 | 37 | $num++; |
38 | - $new_code = $code . $num; |
|
38 | + $new_code = $code.$num; |
|
39 | 39 | } else { |
40 | 40 | break; |
41 | 41 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $sql = "SELECT survey_invitation_id, survey_code |
64 | 64 | FROM $table_survey_invitation WHERE user = '$user_id' AND c_id <> 0 "; |
65 | 65 | $result = Database::query($sql); |
66 | - while ($row = Database::fetch_array($result ,'ASSOC')){ |
|
66 | + while ($row = Database::fetch_array($result, 'ASSOC')) { |
|
67 | 67 | $survey_invitation_id = $row['survey_invitation_id']; |
68 | 68 | $survey_code = $row['survey_code']; |
69 | 69 | $sql2 = "DELETE FROM $table_survey_invitation |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $table_survey = Database :: get_course_table(TABLE_SURVEY); |
130 | 130 | |
131 | 131 | if ($shared != 0) { |
132 | - $table_survey = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION); |
|
132 | + $table_survey = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION); |
|
133 | 133 | $sql = "SELECT * FROM $table_survey |
134 | 134 | WHERE survey_id='".intval($survey_id)."' "; |
135 | 135 | } else { |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | $result = Database::query($sql); |
143 | 143 | $return = array(); |
144 | 144 | |
145 | - if (Database::num_rows($result)> 0) { |
|
146 | - $return = Database::fetch_array($result,'ASSOC'); |
|
145 | + if (Database::num_rows($result) > 0) { |
|
146 | + $return = Database::fetch_array($result, 'ASSOC'); |
|
147 | 147 | if ($simple_return) { |
148 | 148 | return $return; |
149 | 149 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $course_id = api_get_course_int_id(); |
188 | 188 | $session_id = api_get_session_id(); |
189 | 189 | $courseCode = api_get_course_id(); |
190 | - $table_survey = Database :: get_course_table(TABLE_SURVEY); |
|
190 | + $table_survey = Database :: get_course_table(TABLE_SURVEY); |
|
191 | 191 | $shared_survey_id = 0; |
192 | 192 | |
193 | 193 | if (!isset($values['survey_id'])) { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | if ($values[$field] == '') { |
234 | 234 | $values[$field] = 0; |
235 | 235 | } |
236 | - $field_values.= $field.':'.$values[$field].'@'; |
|
236 | + $field_values .= $field.':'.$values[$field].'@'; |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | $extraParams['form_fields'] = $field_values; |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | if ($values['anonymous'] == 0) { |
386 | 386 | $extraParams['show_form_profile'] = $values['show_form_profile']; |
387 | 387 | if ($values['show_form_profile'] == 1) { |
388 | - $fields = explode(',',$values['input_name_list']); |
|
388 | + $fields = explode(',', $values['input_name_list']); |
|
389 | 389 | $field_values = ''; |
390 | 390 | foreach ($fields as &$field) { |
391 | 391 | if ($field != '') { |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | ) { |
395 | 395 | $values[$field] = 0; |
396 | 396 | } |
397 | - $field_values.= $field.':'.$values[$field].'@'; |
|
397 | + $field_values .= $field.':'.$values[$field].'@'; |
|
398 | 398 | } |
399 | 399 | } |
400 | 400 | $extraParams['form_fields'] = $field_values; |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | $_course = api_get_course_info(); |
527 | 527 | |
528 | 528 | // Table definitions |
529 | - $table_survey = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY); |
|
529 | + $table_survey = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY); |
|
530 | 530 | |
531 | 531 | if (!$values['survey_id'] || |
532 | 532 | !is_numeric($values['survey_id']) || |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | '".api_get_utc_datetime()."', |
545 | 545 | '".$_course['id']."')"; |
546 | 546 | Database::query($sql); |
547 | - $return = Database::insert_id(); |
|
547 | + $return = Database::insert_id(); |
|
548 | 548 | |
549 | 549 | $sql = "UPDATE $table_survey SET survey_id = $return WHERE iid = $return"; |
550 | 550 | Database::query($sql); |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | surveythanks = '".Database::escape_string($values['survey_thanks'])."' |
562 | 562 | WHERE survey_id = '".Database::escape_string($values['survey_share']['survey_share'])."'"; |
563 | 563 | Database::query($sql); |
564 | - $return = $values['survey_share']['survey_share']; |
|
564 | + $return = $values['survey_share']['survey_share']; |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | return $return; |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | $params['c_id'] = $targetCourseId; |
660 | 660 | unset($params['survey_id']); |
661 | 661 | $params['session_id'] = api_get_session_id(); |
662 | - $params['title'] = $params['title'] . ' ' . get_lang('Copy'); |
|
662 | + $params['title'] = $params['title'].' '.get_lang('Copy'); |
|
663 | 663 | unset($params['iid']); |
664 | 664 | Database::insert($table_survey, $params); |
665 | 665 | $new_survey_id = Database::insert_id(); |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | $sql = "SELECT * FROM $table_survey_question_group |
686 | 686 | WHERE c_id = $course_id AND survey_id='".$survey_id."'"; |
687 | 687 | $res = Database::query($sql); |
688 | - while($row = Database::fetch_array($res, 'ASSOC')) { |
|
688 | + while ($row = Database::fetch_array($res, 'ASSOC')) { |
|
689 | 689 | $params = array( |
690 | 690 | 'c_id' => $targetCourseId, |
691 | 691 | 'name' => $row['name'], |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | WHERE c_id = $course_id AND survey_id='".$survey_id."'"; |
733 | 733 | |
734 | 734 | $res = Database::query($sql); |
735 | - while ($row = Database::fetch_array($res ,'ASSOC')) { |
|
735 | + while ($row = Database::fetch_array($res, 'ASSOC')) { |
|
736 | 736 | $params = array( |
737 | 737 | 'c_id' => $targetCourseId, |
738 | 738 | 'question_id' => $question_id[$row['question_id']], |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | { |
898 | 898 | // Table definitions |
899 | 899 | $tbl_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
900 | - $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
900 | + $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
901 | 901 | $course_id = api_get_course_int_id(); |
902 | 902 | |
903 | 903 | $sql = "SELECT * FROM $tbl_survey_question |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | // Getting the information of the question |
924 | 924 | |
925 | 925 | $result = Database::query($sql); |
926 | - $row = Database::fetch_array($result,'ASSOC'); |
|
926 | + $row = Database::fetch_array($result, 'ASSOC'); |
|
927 | 927 | |
928 | 928 | $return['survey_id'] = $row['survey_id']; |
929 | 929 | $return['question_id'] = $row['question_id']; |
@@ -971,8 +971,8 @@ discard block |
||
971 | 971 | public static function get_questions($survey_id, $course_id = '') |
972 | 972 | { |
973 | 973 | // Table definitions |
974 | - $tbl_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
975 | - $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
974 | + $tbl_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
975 | + $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
976 | 976 | |
977 | 977 | if (empty($course_id)) { |
978 | 978 | $course_id = api_get_course_int_id(); |
@@ -1076,7 +1076,7 @@ discard block |
||
1076 | 1076 | FROM $tbl_survey_question |
1077 | 1077 | WHERE c_id = $course_id AND survey_id='".intval($form_content['survey_id'])."'"; |
1078 | 1078 | $result = Database::query($sql); |
1079 | - $row = Database::fetch_array($result,'ASSOC'); |
|
1079 | + $row = Database::fetch_array($result, 'ASSOC'); |
|
1080 | 1080 | $max_sort = $row['max_sort']; |
1081 | 1081 | |
1082 | 1082 | // Some variables defined for survey-test type |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | WHERE survey_id='".intval($survey_data['survey_share'])."' |
1214 | 1214 | AND code='".Database::escape_string($_course['id'])."'"; |
1215 | 1215 | $result = Database::query($sql); |
1216 | - $row = Database::fetch_array($result,'ASSOC'); |
|
1216 | + $row = Database::fetch_array($result, 'ASSOC'); |
|
1217 | 1217 | $max_sort = $row['max_sort']; |
1218 | 1218 | |
1219 | 1219 | // Adding the question to the survey_question table |
@@ -1223,11 +1223,11 @@ discard block |
||
1223 | 1223 | '".Database::escape_string($form_content['question_comment'])."', |
1224 | 1224 | '".Database::escape_string($form_content['type'])."', |
1225 | 1225 | '".Database::escape_string($form_content['horizontalvertical'])."', |
1226 | - '".Database::escape_string($max_sort+1)."', |
|
1226 | + '".Database::escape_string($max_sort + 1)."', |
|
1227 | 1227 | '".Database::escape_string($_course['id'])."')"; |
1228 | 1228 | Database::query($sql); |
1229 | 1229 | $shared_question_id = Database::insert_id(); |
1230 | - } else { |
|
1230 | + } else { |
|
1231 | 1231 | // Updating an existing question |
1232 | 1232 | // adding the question to the survey_question table |
1233 | 1233 | $sql = "UPDATE $tbl_survey_question SET |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | public static function move_survey_question($direction, $survey_question_id, $survey_id) |
1258 | 1258 | { |
1259 | 1259 | // Table definition |
1260 | - $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
1260 | + $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
1261 | 1261 | $course_id = api_get_course_int_id(); |
1262 | 1262 | |
1263 | 1263 | if ($direction == 'moveup') { |
@@ -1309,11 +1309,11 @@ discard block |
||
1309 | 1309 | $course_id = api_get_course_int_id(); |
1310 | 1310 | |
1311 | 1311 | // Table definitions |
1312 | - $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
1312 | + $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
1313 | 1313 | $course_condition = " c_id = $course_id AND "; |
1314 | 1314 | if ($shared) { |
1315 | 1315 | $course_condition = ""; |
1316 | - $table_survey_question = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION); |
|
1316 | + $table_survey_question = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION); |
|
1317 | 1317 | } |
1318 | 1318 | |
1319 | 1319 | $sql = "DELETE FROM $table_survey_question |
@@ -1346,7 +1346,7 @@ discard block |
||
1346 | 1346 | { |
1347 | 1347 | $course_id = api_get_course_int_id(); |
1348 | 1348 | // Table definitions |
1349 | - $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
1349 | + $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
1350 | 1350 | if ($shared) { |
1351 | 1351 | SurveyManager::delete_shared_survey_question($survey_id, $question_id); |
1352 | 1352 | } |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | $course_id = api_get_course_int_id(); |
1409 | 1409 | // A percentage question type has options 1 -> 100 |
1410 | 1410 | if ($form_content['type'] == 'percentage') { |
1411 | - for($i = 1; $i < 101; $i++) { |
|
1411 | + for ($i = 1; $i < 101; $i++) { |
|
1412 | 1412 | $form_content['answers'][] = $i; |
1413 | 1413 | } |
1414 | 1414 | } |
@@ -1589,7 +1589,7 @@ discard block |
||
1589 | 1589 | { |
1590 | 1590 | $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
1591 | 1591 | |
1592 | - $user_id = intval($user_id); |
|
1592 | + $user_id = intval($user_id); |
|
1593 | 1593 | $course_id = intval($course_id); |
1594 | 1594 | $survey_id = intval($survey_id); |
1595 | 1595 | |
@@ -1774,7 +1774,7 @@ discard block |
||
1774 | 1774 | public static function remove_answer($user, $survey_id, $question_id, $course_id) { |
1775 | 1775 | $course_id = intval($course_id); |
1776 | 1776 | // table definition |
1777 | - $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
|
1777 | + $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
|
1778 | 1778 | $sql = "DELETE FROM $table_survey_answer |
1779 | 1779 | WHERE |
1780 | 1780 | c_id = $course_id AND |
@@ -2009,19 +2009,19 @@ discard block |
||
2009 | 2009 | // Actions bar |
2010 | 2010 | echo '<div class="actions">'; |
2011 | 2011 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq().'">'. |
2012 | - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
2012 | + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
2013 | 2013 | if (isset($_GET['user'])) { |
2014 | 2014 | if (api_is_allowed_to_edit()) { |
2015 | 2015 | // The delete link |
2016 | 2016 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=deleteuserreport&survey_id='.$surveyId.'&'.api_get_cidreq().'&user='.Security::remove_XSS($_GET['user']).'" >'. |
2017 | - Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
2017 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
2018 | 2018 | } |
2019 | 2019 | |
2020 | 2020 | // Export the user report |
2021 | 2021 | echo '<a href="javascript: void(0);" onclick="document.form1a.submit();">'. |
2022 | - Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
2022 | + Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
2023 | 2023 | echo '<a href="javascript: void(0);" onclick="document.form1b.submit();">'. |
2024 | - Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
2024 | + Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
2025 | 2025 | echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.$surveyId.'&'.api_get_cidreq().'&user_id='.Security::remove_XSS($_GET['user']).'">'; |
2026 | 2026 | echo '<input type="hidden" name="export_report" value="export_report">'; |
2027 | 2027 | echo '<input type="hidden" name="export_format" value="csv">'; |
@@ -2054,7 +2054,7 @@ discard block |
||
2054 | 2054 | $name = $person['invited_user']; |
2055 | 2055 | } |
2056 | 2056 | } else { |
2057 | - $name = get_lang('Anonymous') . ' ' . ($key + 1); |
|
2057 | + $name = get_lang('Anonymous').' '.($key + 1); |
|
2058 | 2058 | $id = $person; |
2059 | 2059 | } |
2060 | 2060 | echo '<option value="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'&user='.Security::remove_XSS($id).'" '; |
@@ -2197,7 +2197,7 @@ discard block |
||
2197 | 2197 | |
2198 | 2198 | echo '<div class="actions">'; |
2199 | 2199 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'">'. |
2200 | - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
2200 | + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
2201 | 2201 | echo '</div>'; |
2202 | 2202 | |
2203 | 2203 | if ($survey_data['number_of_questions'] > 0) { |
@@ -2205,18 +2205,18 @@ discard block |
||
2205 | 2205 | if (!$singlePage) { |
2206 | 2206 | echo '<div id="question_report_questionnumbers" class="pagination">'; |
2207 | 2207 | if ($currentQuestion != 0) { |
2208 | - echo '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&' . api_get_cidreq() . '&survey_id=' . $surveyId . '&question=' . ($offset - 1) . '">' . get_lang('PreviousQuestion') . '</a></li>'; |
|
2208 | + echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&'.api_get_cidreq().'&survey_id='.$surveyId.'&question='.($offset - 1).'">'.get_lang('PreviousQuestion').'</a></li>'; |
|
2209 | 2209 | } |
2210 | 2210 | |
2211 | 2211 | for ($i = 1; $i <= $survey_data['number_of_questions']; $i++) { |
2212 | 2212 | if ($offset != $i - 1) { |
2213 | - echo '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&' . api_get_cidreq() . '&survey_id=' . $surveyId . '&question=' . ($i - 1) . '">' . $i . '</a></li>'; |
|
2213 | + echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&'.api_get_cidreq().'&survey_id='.$surveyId.'&question='.($i - 1).'">'.$i.'</a></li>'; |
|
2214 | 2214 | } else { |
2215 | - echo '<li class="disabled"s><a href="#">' . $i . '</a></li>'; |
|
2215 | + echo '<li class="disabled"s><a href="#">'.$i.'</a></li>'; |
|
2216 | 2216 | } |
2217 | 2217 | } |
2218 | 2218 | if ($currentQuestion < ($survey_data['number_of_questions'] - 1)) { |
2219 | - echo '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&' . api_get_cidreq() . '&survey_id=' . $surveyId . '&question=' . ($offset + 1) . '">' . get_lang('NextQuestion') . '</li></a>'; |
|
2219 | + echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&'.api_get_cidreq().'&survey_id='.$surveyId.'&question='.($offset + 1).'">'.get_lang('NextQuestion').'</li></a>'; |
|
2220 | 2220 | } |
2221 | 2221 | echo '</ul>'; |
2222 | 2222 | echo '</div>'; |
@@ -2254,19 +2254,19 @@ discard block |
||
2254 | 2254 | $sql = "SELECT * FROM $table_survey_answer |
2255 | 2255 | WHERE |
2256 | 2256 | c_id = $course_id AND |
2257 | - survey_id='" . intval($_GET['survey_id']) . "' AND |
|
2258 | - question_id = '" . intval($question['question_id']) . "'"; |
|
2257 | + survey_id='".intval($_GET['survey_id'])."' AND |
|
2258 | + question_id = '" . intval($question['question_id'])."'"; |
|
2259 | 2259 | $result = Database::query($sql); |
2260 | 2260 | while ($row = Database::fetch_array($result, 'ASSOC')) { |
2261 | - echo $row['option_id'] . '<hr noshade="noshade" size="1" />'; |
|
2261 | + echo $row['option_id'].'<hr noshade="noshade" size="1" />'; |
|
2262 | 2262 | } |
2263 | 2263 | } else { |
2264 | 2264 | // Getting the options ORDER BY sort ASC |
2265 | 2265 | $sql = "SELECT * FROM $table_survey_question_option |
2266 | 2266 | WHERE |
2267 | 2267 | c_id = $course_id AND |
2268 | - survey_id='" . intval($_GET['survey_id']) . "' |
|
2269 | - AND question_id = '" . intval($question['question_id']) . "' |
|
2268 | + survey_id='".intval($_GET['survey_id'])."' |
|
2269 | + AND question_id = '" . intval($question['question_id'])."' |
|
2270 | 2270 | ORDER BY sort ASC"; |
2271 | 2271 | $result = Database::query($sql); |
2272 | 2272 | while ($row = Database::fetch_array($result, 'ASSOC')) { |
@@ -2276,8 +2276,8 @@ discard block |
||
2276 | 2276 | $sql = "SELECT *, count(answer_id) as total FROM $table_survey_answer |
2277 | 2277 | WHERE |
2278 | 2278 | c_id = $course_id AND |
2279 | - survey_id='" . intval($_GET['survey_id']) . "' |
|
2280 | - AND question_id = '" . intval($question['question_id']) . "' |
|
2279 | + survey_id='".intval($_GET['survey_id'])."' |
|
2280 | + AND question_id = '" . intval($question['question_id'])."' |
|
2281 | 2281 | GROUP BY option_id, value"; |
2282 | 2282 | $result = Database::query($sql); |
2283 | 2283 | $number_of_answers = array(); |
@@ -2294,8 +2294,7 @@ discard block |
||
2294 | 2294 | $optionText = strip_tags($option['option_text']); |
2295 | 2295 | $optionText = html_entity_decode($optionText); |
2296 | 2296 | $votes = isset($data[$option['question_option_id']]['total']) ? |
2297 | - $data[$option['question_option_id']]['total'] : |
|
2298 | - '0'; |
|
2297 | + $data[$option['question_option_id']]['total'] : '0'; |
|
2299 | 2298 | array_push($chartData, array('option' => $optionText, 'votes' => $votes)); |
2300 | 2299 | } |
2301 | 2300 | $chartContainerId = 'chartContainer'.$question['question_id']; |
@@ -2307,9 +2306,9 @@ discard block |
||
2307 | 2306 | echo '<table class="display-survey table">'; |
2308 | 2307 | echo ' <tr>'; |
2309 | 2308 | echo ' <th> </th>'; |
2310 | - echo ' <th>' . get_lang('AbsoluteTotal') . '</th>'; |
|
2311 | - echo ' <th>' . get_lang('Percentage') . '</th>'; |
|
2312 | - echo ' <th>' . get_lang('VisualRepresentation') . '</th>'; |
|
2309 | + echo ' <th>'.get_lang('AbsoluteTotal').'</th>'; |
|
2310 | + echo ' <th>'.get_lang('Percentage').'</th>'; |
|
2311 | + echo ' <th>'.get_lang('VisualRepresentation').'</th>'; |
|
2313 | 2312 | echo ' <tr>'; |
2314 | 2313 | |
2315 | 2314 | // Displaying the table: the content |
@@ -2329,22 +2328,22 @@ discard block |
||
2329 | 2328 | $answers_number = $absolute_number / $number_of_answers[$option['question_id']] * 100; |
2330 | 2329 | } |
2331 | 2330 | echo ' <tr>'; |
2332 | - echo ' <td class="center">' . $value['option_text'] . '</td>'; |
|
2331 | + echo ' <td class="center">'.$value['option_text'].'</td>'; |
|
2333 | 2332 | echo ' <td class="center">'; |
2334 | 2333 | if ($absolute_number != 0) { |
2335 | - echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&survey_id=' . $surveyId . '&question=' . $offset . '&viewoption=' . $value['question_option_id'] . '">' . $absolute_number . '</a>'; |
|
2334 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&survey_id='.$surveyId.'&question='.$offset.'&viewoption='.$value['question_option_id'].'">'.$absolute_number.'</a>'; |
|
2336 | 2335 | } else { |
2337 | 2336 | echo '0'; |
2338 | 2337 | } |
2339 | 2338 | |
2340 | 2339 | echo ' </td>'; |
2341 | - echo ' <td class="center">' . round($answers_number, 2) . ' %</td>'; |
|
2340 | + echo ' <td class="center">'.round($answers_number, 2).' %</td>'; |
|
2342 | 2341 | echo ' <td class="center">'; |
2343 | 2342 | $size = $answers_number * 2; |
2344 | 2343 | if ($size > 0) { |
2345 | - echo '<div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:' . $size . 'px"> </div>'; |
|
2344 | + echo '<div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:'.$size.'px"> </div>'; |
|
2346 | 2345 | } else { |
2347 | - echo '<div style="text-align: left;">' . get_lang("NoDataAvailable") . '</div>'; |
|
2346 | + echo '<div style="text-align: left;">'.get_lang("NoDataAvailable").'</div>'; |
|
2348 | 2347 | } |
2349 | 2348 | echo ' </td>'; |
2350 | 2349 | echo ' </tr>'; |
@@ -2352,8 +2351,8 @@ discard block |
||
2352 | 2351 | } |
2353 | 2352 | // displaying the table: footer (totals) |
2354 | 2353 | echo ' <tr>'; |
2355 | - echo ' <td class="total"><b>' . get_lang('Total') . '</b></td>'; |
|
2356 | - echo ' <td class="total"><b>' . ($number_of_answers[$option['question_id']] == 0 ? '0' : $number_of_answers[$option['question_id']]) . '</b></td>'; |
|
2354 | + echo ' <td class="total"><b>'.get_lang('Total').'</b></td>'; |
|
2355 | + echo ' <td class="total"><b>'.($number_of_answers[$option['question_id']] == 0 ? '0' : $number_of_answers[$option['question_id']]).'</b></td>'; |
|
2357 | 2356 | echo ' <td class="total"> </td>'; |
2358 | 2357 | echo ' <td class="total"> </td>'; |
2359 | 2358 | echo ' </tr>'; |
@@ -2397,8 +2396,8 @@ discard block |
||
2397 | 2396 | public static function display_question_report_score($survey_data, $question, $offset) |
2398 | 2397 | { |
2399 | 2398 | // Database table definitions |
2400 | - $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
2401 | - $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
|
2399 | + $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
2400 | + $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
|
2402 | 2401 | |
2403 | 2402 | $course_id = api_get_course_int_id(); |
2404 | 2403 | |
@@ -2468,9 +2467,9 @@ discard block |
||
2468 | 2467 | echo ' <td>'.$value['option_text'].'</td>'; |
2469 | 2468 | echo ' <td>'.$i.'</td>'; |
2470 | 2469 | echo ' <td><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&survey_id='.Security::remove_XSS($_GET['survey_id']).'&question='.Security::remove_XSS($offset).'&viewoption='.$value['question_option_id'].'&value='.$i.'">'.$absolute_number.'</a></td>'; |
2471 | - echo ' <td>'.round($absolute_number/$number_of_answers*100, 2).' %</td>'; |
|
2470 | + echo ' <td>'.round($absolute_number / $number_of_answers * 100, 2).' %</td>'; |
|
2472 | 2471 | echo ' <td>'; |
2473 | - $size = ($absolute_number/$number_of_answers*100*2); |
|
2472 | + $size = ($absolute_number / $number_of_answers * 100 * 2); |
|
2474 | 2473 | if ($size > 0) { |
2475 | 2474 | echo ' <div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:'.$size.'px"> </div>'; |
2476 | 2475 | } |
@@ -2510,11 +2509,11 @@ discard block |
||
2510 | 2509 | // Actions bar |
2511 | 2510 | echo '<div class="actions">'; |
2512 | 2511 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'"> |
2513 | - '.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
2512 | + '.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
2514 | 2513 | echo '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1a.submit();"> |
2515 | - '.Display::return_icon('export_csv.png',get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
2514 | + '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
2516 | 2515 | echo '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1b.submit();"> |
2517 | - '.Display::return_icon('export_excel.png',get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
2516 | + '.Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
2518 | 2517 | echo '</div>'; |
2519 | 2518 | |
2520 | 2519 | // The form |
@@ -2549,8 +2548,8 @@ discard block |
||
2549 | 2548 | // Show user fields section with a big th colspan that spans over all fields |
2550 | 2549 | $extra_user_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', false, true); |
2551 | 2550 | $num = count($extra_user_fields); |
2552 | - if ($num > 0 ) { |
|
2553 | - echo '<th '.($num>0?' colspan="'.$num.'"':'').'>'; |
|
2551 | + if ($num > 0) { |
|
2552 | + echo '<th '.($num > 0 ? ' colspan="'.$num.'"' : '').'>'; |
|
2554 | 2553 | echo '<label><input type="checkbox" name="fields_filter" value="1" checked="checked"/> '; |
2555 | 2554 | echo get_lang('UserFields'); |
2556 | 2555 | echo '</label>'; |
@@ -2606,7 +2605,7 @@ discard block |
||
2606 | 2605 | if (!(isset($_POST['submit_question_filter']) && $_POST['submit_question_filter'] || |
2607 | 2606 | isset($_POST['export_report']) && $_POST['export_report']) || !empty($_POST['fields_filter'])) { |
2608 | 2607 | //show the fields names for user fields |
2609 | - foreach($extra_user_fields as & $field) { |
|
2608 | + foreach ($extra_user_fields as & $field) { |
|
2610 | 2609 | echo '<th>'.$field[3].'</th>'; |
2611 | 2610 | } |
2612 | 2611 | } |
@@ -2689,7 +2688,7 @@ discard block |
||
2689 | 2688 | $questions, |
2690 | 2689 | $display_extra_user_fields |
2691 | 2690 | ); |
2692 | - $answers_of_user=array(); |
|
2691 | + $answers_of_user = array(); |
|
2693 | 2692 | } |
2694 | 2693 | if (isset($questions[$row['question_id']]) && $questions[$row['question_id']]['type'] != 'open') { |
2695 | 2694 | $answers_of_user[$row['question_id']][$row['option_id']] = $row; |
@@ -2751,7 +2750,7 @@ discard block |
||
2751 | 2750 | echo '<th>'.$user.'</th>'; // the user column |
2752 | 2751 | } |
2753 | 2752 | } else { |
2754 | - echo '<th>' . get_lang('Anonymous') . ' ' . $user . '</th>'; |
|
2753 | + echo '<th>'.get_lang('Anonymous').' '.$user.'</th>'; |
|
2755 | 2754 | } |
2756 | 2755 | |
2757 | 2756 | if ($display_extra_user_fields) { |
@@ -2847,10 +2846,10 @@ discard block |
||
2847 | 2846 | // We do not show comment and pagebreak question types |
2848 | 2847 | if ($row['type'] != 'comment' && $row['type'] != 'pagebreak') { |
2849 | 2848 | if ($row['number_of_options'] == 0 && $row['type'] == 'open') { |
2850 | - $return .= str_replace("\r\n",' ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';'; |
|
2849 | + $return .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';'; |
|
2851 | 2850 | } else { |
2852 | 2851 | for ($ii = 0; $ii < $row['number_of_options']; $ii++) { |
2853 | - $return .= str_replace("\r\n",' ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';'; |
|
2852 | + $return .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';'; |
|
2854 | 2853 | } |
2855 | 2854 | } |
2856 | 2855 | } |
@@ -2864,7 +2863,7 @@ discard block |
||
2864 | 2863 | // Show the fields names for user fields |
2865 | 2864 | if (!empty($extra_user_fields)) { |
2866 | 2865 | foreach ($extra_user_fields as & $field) { |
2867 | - $return .= '"'.str_replace("\r\n",' ',api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES)).'";'; |
|
2866 | + $return .= '"'.str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES)).'";'; |
|
2868 | 2867 | } |
2869 | 2868 | } |
2870 | 2869 | |
@@ -2900,7 +2899,7 @@ discard block |
||
2900 | 2899 | ) { |
2901 | 2900 | // We do not show comment and pagebreak question types |
2902 | 2901 | if ($row['type'] != 'comment' && $row['type'] != 'pagebreak') { |
2903 | - $row['option_text'] = str_replace(array("\r","\n"),array('',''),$row['option_text']); |
|
2902 | + $row['option_text'] = str_replace(array("\r", "\n"), array('', ''), $row['option_text']); |
|
2904 | 2903 | $return .= api_html_entity_decode(strip_tags($row['option_text']), ENT_QUOTES).';'; |
2905 | 2904 | $possible_answers[$row['question_id']][$row['question_option_id']] = $row['question_option_id']; |
2906 | 2905 | $possible_answers_type[$row['question_id']] = $row['type']; |
@@ -2930,9 +2929,9 @@ discard block |
||
2930 | 2929 | $old_user, |
2931 | 2930 | true |
2932 | 2931 | ); |
2933 | - $answers_of_user=array(); |
|
2932 | + $answers_of_user = array(); |
|
2934 | 2933 | } |
2935 | - if($possible_answers_type[$row['question_id']] == 'open') { |
|
2934 | + if ($possible_answers_type[$row['question_id']] == 'open') { |
|
2936 | 2935 | $temp_id = 'open'.$open_question_iterator; |
2937 | 2936 | $answers_of_user[$row['question_id']][$temp_id] = $row; |
2938 | 2937 | $open_question_iterator++; |
@@ -2991,7 +2990,7 @@ discard block |
||
2991 | 2990 | |
2992 | 2991 | if ($display_extra_user_fields) { |
2993 | 2992 | // Show user fields data, if any, for this user |
2994 | - $user_fields_values = UserManager::get_extra_user_data($user,false,false, false, true); |
|
2993 | + $user_fields_values = UserManager::get_extra_user_data($user, false, false, false, true); |
|
2995 | 2994 | foreach ($user_fields_values as & $value) { |
2996 | 2995 | $return .= '"'.str_replace('"', '""', api_html_entity_decode(strip_tags($value), ENT_QUOTES)).'";'; |
2997 | 2996 | } |
@@ -3104,7 +3103,7 @@ discard block |
||
3104 | 3103 | ); |
3105 | 3104 | $column++; |
3106 | 3105 | } else { |
3107 | - for ($ii = 0; $ii < $row['number_of_options']; $ii ++) { |
|
3106 | + for ($ii = 0; $ii < $row['number_of_options']; $ii++) { |
|
3108 | 3107 | $worksheet->setCellValueByColumnAndRow( |
3109 | 3108 | $column, |
3110 | 3109 | $line, |
@@ -3185,7 +3184,7 @@ discard block |
||
3185 | 3184 | } |
3186 | 3185 | |
3187 | 3186 | // Getting all the answers of the users |
3188 | - $line ++; |
|
3187 | + $line++; |
|
3189 | 3188 | $column = 0; |
3190 | 3189 | $old_user = ''; |
3191 | 3190 | $answers_of_user = array(); |
@@ -3194,7 +3193,7 @@ discard block |
||
3194 | 3193 | if ($user_id != 0) { |
3195 | 3194 | $sql .= " AND user='".intval($user_id)."' "; |
3196 | 3195 | } |
3197 | - $sql .= " ORDER BY user ASC"; |
|
3196 | + $sql .= " ORDER BY user ASC"; |
|
3198 | 3197 | |
3199 | 3198 | $open_question_iterator = 1; |
3200 | 3199 | $result = Database::query($sql); |
@@ -3270,7 +3269,7 @@ discard block |
||
3270 | 3269 | FROM '.Database::get_main_table(TABLE_MAIN_USER).' |
3271 | 3270 | WHERE user_id='.intval($user); |
3272 | 3271 | $rs = Database::query($sql); |
3273 | - if($row = Database::fetch_array($rs)) { |
|
3272 | + if ($row = Database::fetch_array($rs)) { |
|
3274 | 3273 | $user_displayed = api_get_person_name($row['firstname'], $row['lastname']); |
3275 | 3274 | } else { |
3276 | 3275 | $user_displayed = '-'; |
@@ -3285,7 +3284,7 @@ discard block |
||
3285 | 3284 | |
3286 | 3285 | if ($display_extra_user_fields) { |
3287 | 3286 | //show user fields data, if any, for this user |
3288 | - $user_fields_values = UserManager::get_extra_user_data(intval($user),false,false, false, true); |
|
3287 | + $user_fields_values = UserManager::get_extra_user_data(intval($user), false, false, false, true); |
|
3289 | 3288 | foreach ($user_fields_values as $value) { |
3290 | 3289 | $return[] = api_html_entity_decode(strip_tags($value), ENT_QUOTES); |
3291 | 3290 | } |
@@ -3346,7 +3345,7 @@ discard block |
||
3346 | 3345 | // Actions bar |
3347 | 3346 | echo '<div class="actions">'; |
3348 | 3347 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'&'.api_get_cidreq().'">'. |
3349 | - Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
3348 | + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
3350 | 3349 | echo '</div>'; |
3351 | 3350 | |
3352 | 3351 | // Displaying an information message that only the questions with predefined answers can be used in a comparative report |
@@ -3411,17 +3410,17 @@ discard block |
||
3411 | 3410 | $tableHtml .= '<tr>'; |
3412 | 3411 | for ($ii = 0; $ii <= count($question_x['answers']); $ii++) { |
3413 | 3412 | if ($ii == 0) { |
3414 | - $tableHtml .= '<th> </th>'; |
|
3413 | + $tableHtml .= '<th> </th>'; |
|
3415 | 3414 | } else { |
3416 | 3415 | if ($question_x['type'] == 'score') { |
3417 | 3416 | for ($x = 1; $x <= $question_x['maximum_score']; $x++) { |
3418 | - $tableHtml .= '<th>'.$question_x['answers'][($ii-1)].'<br />'.$x.'</th>'; |
|
3417 | + $tableHtml .= '<th>'.$question_x['answers'][($ii - 1)].'<br />'.$x.'</th>'; |
|
3419 | 3418 | } |
3420 | 3419 | $x = ''; |
3421 | 3420 | } else { |
3422 | - $tableHtml .= '<th>'.$question_x['answers'][($ii-1)].'</th>'; |
|
3421 | + $tableHtml .= '<th>'.$question_x['answers'][($ii - 1)].'</th>'; |
|
3423 | 3422 | } |
3424 | - $optionText = strip_tags($question_x['answers'][$ii-1]); |
|
3423 | + $optionText = strip_tags($question_x['answers'][$ii - 1]); |
|
3425 | 3424 | $optionText = html_entity_decode($optionText); |
3426 | 3425 | array_push($xOptions, trim($optionText)); |
3427 | 3426 | } |
@@ -3436,15 +3435,15 @@ discard block |
||
3436 | 3435 | // The Y axis is a scoring question type so we have more rows than the options (actually options * maximum score) |
3437 | 3436 | if ($question_y['type'] == 'score') { |
3438 | 3437 | for ($y = 1; $y <= $question_y['maximum_score']; $y++) { |
3439 | - $tableHtml .= '<tr>'; |
|
3438 | + $tableHtml .= '<tr>'; |
|
3440 | 3439 | for ($ii = 0; $ii <= count($question_x['answers']); $ii++) { |
3441 | 3440 | if ($question_x['type'] == 'score') { |
3442 | 3441 | for ($x = 1; $x <= $question_x['maximum_score']; $x++) { |
3443 | 3442 | if ($ii == 0) { |
3444 | - $tableHtml .= '<th>'.$question_y['answers'][($ij)].' '.$y.'</th>'; |
|
3443 | + $tableHtml .= '<th>'.$question_y['answers'][($ij)].' '.$y.'</th>'; |
|
3445 | 3444 | break; |
3446 | 3445 | } else { |
3447 | - $tableHtml .= '<td align="center">'; |
|
3446 | + $tableHtml .= '<td align="center">'; |
|
3448 | 3447 | $votes = SurveyUtil::comparative_check( |
3449 | 3448 | $answers_x, |
3450 | 3449 | $answers_y, |
@@ -3453,16 +3452,16 @@ discard block |
||
3453 | 3452 | $x, |
3454 | 3453 | $y |
3455 | 3454 | ); |
3456 | - $tableHtml .= $votes; |
|
3455 | + $tableHtml .= $votes; |
|
3457 | 3456 | array_push( |
3458 | 3457 | $chartData, |
3459 | 3458 | array( |
3460 | - 'serie' => array($currentYQuestion, $xOptions[$ii-1]), |
|
3459 | + 'serie' => array($currentYQuestion, $xOptions[$ii - 1]), |
|
3461 | 3460 | 'option' => $x, |
3462 | 3461 | 'votes' => $votes |
3463 | 3462 | ) |
3464 | 3463 | ); |
3465 | - $tableHtml .= '</td>'; |
|
3464 | + $tableHtml .= '</td>'; |
|
3466 | 3465 | } |
3467 | 3466 | } |
3468 | 3467 | } else { |
@@ -3482,33 +3481,33 @@ discard block |
||
3482 | 3481 | array_push( |
3483 | 3482 | $chartData, |
3484 | 3483 | array( |
3485 | - 'serie' => array($currentYQuestion, $xOptions[$ii-1]), |
|
3484 | + 'serie' => array($currentYQuestion, $xOptions[$ii - 1]), |
|
3486 | 3485 | 'option' => $y, |
3487 | 3486 | 'votes' => $votes |
3488 | 3487 | ) |
3489 | 3488 | ); |
3490 | - $tableHtml .= '</td>'; |
|
3489 | + $tableHtml .= '</td>'; |
|
3491 | 3490 | } |
3492 | 3491 | } |
3493 | 3492 | } |
3494 | - $tableHtml .= '</tr>'; |
|
3493 | + $tableHtml .= '</tr>'; |
|
3495 | 3494 | } |
3496 | 3495 | } |
3497 | 3496 | // The Y axis is NOT a score question type so the number of rows = the number of options |
3498 | 3497 | else { |
3499 | - $tableHtml .= '<tr>'; |
|
3498 | + $tableHtml .= '<tr>'; |
|
3500 | 3499 | for ($ii = 0; $ii <= count($question_x['answers']); $ii++) { |
3501 | 3500 | if ($question_x['type'] == 'score') { |
3502 | 3501 | for ($x = 1; $x <= $question_x['maximum_score']; $x++) { |
3503 | 3502 | if ($ii == 0) { |
3504 | - $tableHtml .= '<th>'.$question_y['answers'][$ij].'</th>'; |
|
3503 | + $tableHtml .= '<th>'.$question_y['answers'][$ij].'</th>'; |
|
3505 | 3504 | break; |
3506 | 3505 | } else { |
3507 | - $tableHtml .= '<td align="center">'; |
|
3508 | - $votes = SurveyUtil::comparative_check( |
|
3506 | + $tableHtml .= '<td align="center">'; |
|
3507 | + $votes = SurveyUtil::comparative_check( |
|
3509 | 3508 | $answers_x, |
3510 | 3509 | $answers_y, |
3511 | - $question_x['answersid'][($ii-1)], |
|
3510 | + $question_x['answersid'][($ii - 1)], |
|
3512 | 3511 | $question_y['answersid'][($ij)], |
3513 | 3512 | $x, |
3514 | 3513 | 0 |
@@ -3517,25 +3516,25 @@ discard block |
||
3517 | 3516 | array_push( |
3518 | 3517 | $chartData, |
3519 | 3518 | array( |
3520 | - 'serie' => array($currentYQuestion, $xOptions[$ii-1]), |
|
3519 | + 'serie' => array($currentYQuestion, $xOptions[$ii - 1]), |
|
3521 | 3520 | 'option' => $x, |
3522 | 3521 | 'votes' => $votes |
3523 | 3522 | ) |
3524 | 3523 | ); |
3525 | - $tableHtml .= '</td>'; |
|
3524 | + $tableHtml .= '</td>'; |
|
3526 | 3525 | } |
3527 | 3526 | } |
3528 | 3527 | } else { |
3529 | 3528 | if ($ii == 0) { |
3530 | - $tableHtml .= '<th>'.$question_y['answers'][($ij)].'</th>'; |
|
3529 | + $tableHtml .= '<th>'.$question_y['answers'][($ij)].'</th>'; |
|
3531 | 3530 | } else { |
3532 | - $tableHtml .= '<td align="center">'; |
|
3533 | - $votes = SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)]); |
|
3531 | + $tableHtml .= '<td align="center">'; |
|
3532 | + $votes = SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii - 1)], $question_y['answersid'][($ij)]); |
|
3534 | 3533 | $tableHtml .= $votes; |
3535 | 3534 | array_push( |
3536 | 3535 | $chartData, |
3537 | 3536 | array( |
3538 | - 'serie' => $xOptions[$ii-1], |
|
3537 | + 'serie' => $xOptions[$ii - 1], |
|
3539 | 3538 | 'option' => $currentYQuestion, |
3540 | 3539 | 'votes' => $votes |
3541 | 3540 | ) |
@@ -3547,7 +3546,7 @@ discard block |
||
3547 | 3546 | $tableHtml .= '</tr>'; |
3548 | 3547 | } |
3549 | 3548 | } |
3550 | - $tableHtml .= '</table>'; |
|
3549 | + $tableHtml .= '</table>'; |
|
3551 | 3550 | echo '<div id="chartContainer" class="col-md-12">'; |
3552 | 3551 | echo self::drawChart($chartData, true); |
3553 | 3552 | echo '</div>'; |
@@ -3690,7 +3689,7 @@ discard block |
||
3690 | 3689 | survey_id='".intval($_GET['survey_id'])."' AND |
3691 | 3690 | session_id='".api_get_session_id()."' "; |
3692 | 3691 | $res = Database::query($sql); |
3693 | - $row = Database::fetch_array($res,'ASSOC'); |
|
3692 | + $row = Database::fetch_array($res, 'ASSOC'); |
|
3694 | 3693 | |
3695 | 3694 | return $row['total']; |
3696 | 3695 | } |
@@ -3764,7 +3763,7 @@ discard block |
||
3764 | 3763 | $exclude_users = SurveyManager::get_people_who_filled_survey($_GET['survey_id']); |
3765 | 3764 | } |
3766 | 3765 | |
3767 | - $counter = 0; // Nr of invitations "sent" (if sendmail option) |
|
3766 | + $counter = 0; // Nr of invitations "sent" (if sendmail option) |
|
3768 | 3767 | $course_id = api_get_course_int_id(); |
3769 | 3768 | $session_id = api_get_session_id(); |
3770 | 3769 | |
@@ -3920,7 +3919,7 @@ discard block |
||
3920 | 3919 | $text_link = '<a href="'.$survey_link.'">'.get_lang('ClickHereToAnswerTheSurvey')."</a><br />\r\n<br />\r\n".get_lang('OrCopyPasteTheFollowingUrl')." <br />\r\n ".$survey_link; |
3921 | 3920 | |
3922 | 3921 | $replace_count = 0; |
3923 | - $full_invitation_text = api_str_ireplace('**link**', $text_link ,$invitation_text, $replace_count); |
|
3922 | + $full_invitation_text = api_str_ireplace('**link**', $text_link, $invitation_text, $replace_count); |
|
3924 | 3923 | if ($replace_count < 1) { |
3925 | 3924 | $full_invitation_text = $full_invitation_text."<br />\r\n<br />\r\n".$text_link; |
3926 | 3925 | } |
@@ -3992,8 +3991,8 @@ discard block |
||
3992 | 3991 | $course_id = api_get_course_int_id(); |
3993 | 3992 | |
3994 | 3993 | // Database table definition |
3995 | - $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); |
|
3996 | - $table_survey = Database :: get_course_table(TABLE_SURVEY); |
|
3994 | + $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); |
|
3995 | + $table_survey = Database :: get_course_table(TABLE_SURVEY); |
|
3997 | 3996 | |
3998 | 3997 | // Counting the number of people that are invited |
3999 | 3998 | $sql = "SELECT count(user) as total |
@@ -4107,7 +4106,7 @@ discard block |
||
4107 | 4106 | { |
4108 | 4107 | $course_id = api_get_course_int_id(); |
4109 | 4108 | // Database table definition |
4110 | - $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); |
|
4109 | + $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); |
|
4111 | 4110 | |
4112 | 4111 | $sql = "SELECT * FROM $table_survey_invitation |
4113 | 4112 | WHERE |
@@ -4216,7 +4215,7 @@ discard block |
||
4216 | 4215 | public static function display_survey_list_for_coach() |
4217 | 4216 | { |
4218 | 4217 | $parameters = array(); |
4219 | - $parameters['cidReq']=api_get_course_id(); |
|
4218 | + $parameters['cidReq'] = api_get_course_id(); |
|
4220 | 4219 | if (isset($_GET['do_search'])) { |
4221 | 4220 | $message = get_lang('DisplaySearchResults').'<br />'; |
4222 | 4221 | $message .= '<a href="'.api_get_self().'?'.api_get_cidreq().'">'.get_lang('DisplayAll').'</a>'; |
@@ -4260,17 +4259,17 @@ discard block |
||
4260 | 4259 | |
4261 | 4260 | if ($drh) { |
4262 | 4261 | return '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'. |
4263 | - Display::return_icon('stats.png', get_lang('Reporting'),'',ICON_SIZE_SMALL).'</a>'; |
|
4262 | + Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL).'</a>'; |
|
4264 | 4263 | } |
4265 | 4264 | |
4266 | 4265 | // Coach can see that only if the survey is in his session |
4267 | 4266 | if (api_is_allowed_to_edit() || |
4268 | 4267 | api_is_element_in_the_session(TOOL_SURVEY, $survey_id) |
4269 | 4268 | ) { |
4270 | - $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_new_survey.php?'.api_get_cidreq().'&action=edit&survey_id='.$survey_id.'">'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'; |
|
4269 | + $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_new_survey.php?'.api_get_cidreq().'&action=edit&survey_id='.$survey_id.'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'; |
|
4271 | 4270 | if (SurveyManager::survey_generation_hash_available()) { |
4272 | - $return .= Display::url( |
|
4273 | - Display::return_icon('new_link.png', get_lang('GenerateSurveyAccessLink'),'',ICON_SIZE_SMALL), |
|
4271 | + $return .= Display::url( |
|
4272 | + Display::return_icon('new_link.png', get_lang('GenerateSurveyAccessLink'), '', ICON_SIZE_SMALL), |
|
4274 | 4273 | api_get_path(WEB_CODE_PATH).'survey/generate_link.php?survey_id='.$survey_id.'&'.api_get_cidreq() |
4275 | 4274 | ); |
4276 | 4275 | } |
@@ -4280,20 +4279,20 @@ discard block |
||
4280 | 4279 | ); |
4281 | 4280 | |
4282 | 4281 | $return .= ' <a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=empty&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("EmptySurvey").'?')).'\')) return false;">'. |
4283 | - Display::return_icon('clean.png', get_lang('EmptySurvey'),'',ICON_SIZE_SMALL).'</a> '; |
|
4282 | + Display::return_icon('clean.png', get_lang('EmptySurvey'), '', ICON_SIZE_SMALL).'</a> '; |
|
4284 | 4283 | } |
4285 | 4284 | $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'. |
4286 | - Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_SMALL).'</a> '; |
|
4285 | + Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_SMALL).'</a> '; |
|
4287 | 4286 | $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'. |
4288 | - Display::return_icon('mail_send.png', get_lang('Publish'),'',ICON_SIZE_SMALL).'</a> '; |
|
4287 | + Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_SMALL).'</a> '; |
|
4289 | 4288 | $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'. |
4290 | - Display::return_icon('stats.png', get_lang('Reporting'),'',ICON_SIZE_SMALL).'</a>'; |
|
4289 | + Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL).'</a>'; |
|
4291 | 4290 | |
4292 | 4291 | if (api_is_allowed_to_edit() || |
4293 | 4292 | api_is_element_in_the_session(TOOL_SURVEY, $survey_id) |
4294 | 4293 | ) { |
4295 | 4294 | $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=delete&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurvey").'?', ENT_QUOTES)).'\')) return false;">'. |
4296 | - Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a> '; |
|
4295 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a> '; |
|
4297 | 4296 | } |
4298 | 4297 | |
4299 | 4298 | return $return; |
@@ -4306,9 +4305,9 @@ discard block |
||
4306 | 4305 | //$return .= '<a href="survey_list.php?'.api_get_cidreq().'&action=delete&survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurvey").'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>'; |
4307 | 4306 | //$return .= '<a href="create_survey_in_another_language.php?id_survey='.$survey_id.'">'.Display::return_icon('copy.gif', get_lang('Copy')).'</a>'; |
4308 | 4307 | //$return .= '<a href="survey.php?survey_id='.$survey_id.'">'.Display::return_icon('add.gif', get_lang('Add')).'</a>'; |
4309 | - $return = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_SMALL).'</a> '; |
|
4310 | - $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('mail_send.png', get_lang('Publish'),'',ICON_SIZE_SMALL).'</a> '; |
|
4311 | - $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=empty&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("EmptySurvey").'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('clean.png', get_lang('EmptySurvey'),'',ICON_SIZE_SMALL).'</a> '; |
|
4308 | + $return = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_SMALL).'</a> '; |
|
4309 | + $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_SMALL).'</a> '; |
|
4310 | + $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=empty&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("EmptySurvey").'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('clean.png', get_lang('EmptySurvey'), '', ICON_SIZE_SMALL).'</a> '; |
|
4312 | 4311 | |
4313 | 4312 | return $return; |
4314 | 4313 | } |
@@ -4463,7 +4462,7 @@ discard block |
||
4463 | 4462 | |
4464 | 4463 | // Validation when belonging to a session |
4465 | 4464 | $session_img = api_get_session_image($survey['session_id'], $_user['status']); |
4466 | - $array[2] = $survey[2] . $session_img; |
|
4465 | + $array[2] = $survey[2].$session_img; |
|
4467 | 4466 | $array[3] = $survey[3]; |
4468 | 4467 | $array[4] = $survey[4]; |
4469 | 4468 | $array[5] = $survey[5]; |
@@ -4505,10 +4504,10 @@ discard block |
||
4505 | 4504 | $last_version_surveys = $survey_tree->surveylist; |
4506 | 4505 | $list = array(); |
4507 | 4506 | foreach ($last_version_surveys as & $survey) { |
4508 | - $list[]=$survey['id']; |
|
4507 | + $list[] = $survey['id']; |
|
4509 | 4508 | } |
4510 | 4509 | if (count($list) > 0) { |
4511 | - $list_condition = " AND survey.survey_id IN (".implode(',',$list).") "; |
|
4510 | + $list_condition = " AND survey.survey_id IN (".implode(',', $list).") "; |
|
4512 | 4511 | } else { |
4513 | 4512 | $list_condition = ''; |
4514 | 4513 | } |
@@ -4636,11 +4635,11 @@ discard block |
||
4636 | 4635 | echo '<tr>'; |
4637 | 4636 | if ($row['answered'] == 0) { |
4638 | 4637 | echo '<td>'; |
4639 | - echo Display::return_icon('statistics.png', get_lang('CreateNewSurvey'), array(),ICON_SIZE_TINY); |
|
4638 | + echo Display::return_icon('statistics.png', get_lang('CreateNewSurvey'), array(), ICON_SIZE_TINY); |
|
4640 | 4639 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/fillsurvey.php?course='.$_course['sysCode'].'&invitationcode='.$row['invitation_code'].'&cidReq='.$_course['sysCode'].'">'.$row['title'].'</a></td>'; |
4641 | 4640 | } else { |
4642 | 4641 | echo '<td>'; |
4643 | - echo Display::return_icon('statistics_na.png', get_lang('CreateNewSurvey'), array(),ICON_SIZE_TINY); |
|
4642 | + echo Display::return_icon('statistics_na.png', get_lang('CreateNewSurvey'), array(), ICON_SIZE_TINY); |
|
4644 | 4643 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=questionreport&cidReq='.$_course['sysCode'].'&id_session='.$row['session_id'].'&gidReq=0&origin=&survey_id='.$row['survey_id'].'">'.$row['title'].'</a></td>'; |
4645 | 4644 | } |
4646 | 4645 | echo '<td class="center">'; |
@@ -4787,7 +4786,7 @@ discard block |
||
4787 | 4786 | if ($field_details[7] == 0) { |
4788 | 4787 | $field_list_array['extra_'.$field_details[1]]['visibility'] = 0; |
4789 | 4788 | } else { |
4790 | - $field_list_array['extra_'.$field_details[1]]['visibility']=1; |
|
4789 | + $field_list_array['extra_'.$field_details[1]]['visibility'] = 1; |
|
4791 | 4790 | } |
4792 | 4791 | break; |
4793 | 4792 | case UserManager::USER_FIELD_TYPE_DIVIDER: |
@@ -4873,7 +4872,7 @@ discard block |
||
4873 | 4872 | $htmlChart = ''; |
4874 | 4873 | if (api_browser_support("svg")) { |
4875 | 4874 | $htmlChart .= api_get_js("d3/d3.v3.5.4.min.js"); |
4876 | - $htmlChart .= api_get_js("dimple.v2.1.2.min.js") . ' |
|
4875 | + $htmlChart .= api_get_js("dimple.v2.1.2.min.js").' |
|
4877 | 4876 | <script type="text/javascript"> |
4878 | 4877 | var svg = dimple.newSvg("#'.$chartContainerId.'", "100%", 400); |
4879 | 4878 | var data = ['; |
@@ -4882,40 +4881,40 @@ discard block |
||
4882 | 4881 | foreach ($chartData as $chartDataElement) { |
4883 | 4882 | $htmlChart .= '{"'; |
4884 | 4883 | if (!$hasSerie) { |
4885 | - $htmlChart .= get_lang("Option") . '":"' . $chartDataElement['option'] . '", "'; |
|
4884 | + $htmlChart .= get_lang("Option").'":"'.$chartDataElement['option'].'", "'; |
|
4886 | 4885 | array_push($order, $chartDataElement['option']); |
4887 | 4886 | } else { |
4888 | 4887 | if (!is_array($chartDataElement['serie'])) { |
4889 | - $htmlChart .= get_lang("Option") . '":"' . $chartDataElement['serie'] . '", "' . |
|
4890 | - get_lang("Score") . '":"' . $chartDataElement['option'] . '", "'; |
|
4888 | + $htmlChart .= get_lang("Option").'":"'.$chartDataElement['serie'].'", "'. |
|
4889 | + get_lang("Score").'":"'.$chartDataElement['option'].'", "'; |
|
4891 | 4890 | array_push($serie, $chartDataElement['serie']); |
4892 | 4891 | } else { |
4893 | - $htmlChart .= get_lang("Serie") . '":"' . $chartDataElement['serie'][0] . '", "' . |
|
4894 | - get_lang("Option") . '":"' . $chartDataElement['serie'][1] . '", "' . |
|
4895 | - get_lang("Score") . '":"' . $chartDataElement['option'] . '", "'; |
|
4892 | + $htmlChart .= get_lang("Serie").'":"'.$chartDataElement['serie'][0].'", "'. |
|
4893 | + get_lang("Option").'":"'.$chartDataElement['serie'][1].'", "'. |
|
4894 | + get_lang("Score").'":"'.$chartDataElement['option'].'", "'; |
|
4896 | 4895 | } |
4897 | 4896 | } |
4898 | - $htmlChart .= get_lang("Votes") . '":"' . $chartDataElement['votes'] . |
|
4897 | + $htmlChart .= get_lang("Votes").'":"'.$chartDataElement['votes']. |
|
4899 | 4898 | '"},'; |
4900 | 4899 | } |
4901 | 4900 | rtrim($htmlChart, ","); |
4902 | 4901 | $htmlChart .= ']; |
4903 | 4902 | var myChart = new dimple.chart(svg, data); |
4904 | - myChart.addMeasureAxis("y", "' . get_lang("Votes") . '");'; |
|
4903 | + myChart.addMeasureAxis("y", "' . get_lang("Votes").'");'; |
|
4905 | 4904 | if (!$hasSerie) { |
4906 | - $htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", "' . get_lang("Option") . '"); |
|
4907 | - xAxisCategory.addOrderRule(' . json_encode($order) . '); |
|
4908 | - myChart.addSeries("' . get_lang("Option") . '", dimple.plot.bar);'; |
|
4905 | + $htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", "'.get_lang("Option").'"); |
|
4906 | + xAxisCategory.addOrderRule(' . json_encode($order).'); |
|
4907 | + myChart.addSeries("' . get_lang("Option").'", dimple.plot.bar);'; |
|
4909 | 4908 | } else { |
4910 | 4909 | if (!is_array($chartDataElement['serie'])) { |
4911 | 4910 | $serie = array_values(array_unique($serie)); |
4912 | - $htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", ["' . get_lang("Option") . '","' . get_lang("Score") . '"]); |
|
4913 | - xAxisCategory.addOrderRule(' . json_encode($serie) . '); |
|
4914 | - xAxisCategory.addGroupOrderRule("' . get_lang("Score") . '"); |
|
4915 | - myChart.addSeries("' . get_lang("Option") . '", dimple.plot.bar);'; |
|
4911 | + $htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", ["'.get_lang("Option").'","'.get_lang("Score").'"]); |
|
4912 | + xAxisCategory.addOrderRule(' . json_encode($serie).'); |
|
4913 | + xAxisCategory.addGroupOrderRule("' . get_lang("Score").'"); |
|
4914 | + myChart.addSeries("' . get_lang("Option").'", dimple.plot.bar);'; |
|
4916 | 4915 | } else { |
4917 | - $htmlChart .= 'myChart.addCategoryAxis("x", ["' . get_lang("Option") . '","' . get_lang("Score") . '"]); |
|
4918 | - myChart.addSeries("' . get_lang("Serie") . '", dimple.plot.bar);'; |
|
4916 | + $htmlChart .= 'myChart.addCategoryAxis("x", ["'.get_lang("Option").'","'.get_lang("Score").'"]); |
|
4917 | + myChart.addSeries("' . get_lang("Serie").'", dimple.plot.bar);'; |
|
4919 | 4918 | } |
4920 | 4919 | } |
4921 | 4920 | $htmlChart .= 'myChart.draw(); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | isset($param['subkey']) && !empty($param['subkey']) ? $param['variable'].' ['.$param['subkey'].']' : $param['variable'], |
47 | 47 | $param['category'], |
48 | 48 | $param['access_url'], |
49 | - '<input type="text" disabled name="value_'.$param['id'].'" value="'.htmlspecialchars($param['selected_value'], ENT_COMPAT, 'UTF-8' ).'" />'. |
|
49 | + '<input type="text" disabled name="value_'.$param['id'].'" value="'.htmlspecialchars($param['selected_value'], ENT_COMPAT, 'UTF-8').'" />'. |
|
50 | 50 | '<br />Master value: '.$param['selected_value'], |
51 | 51 | $syncButton, |
52 | 52 | ); |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | |
57 | 57 | $content = '<form name="settingsform" action="'.$thisurl.'">'; |
58 | 58 | $content .= '<input type="hidden" name="what" value="" />'; |
59 | -$content .= $table->toHtml(); |
|
60 | -$content .= '</form>'; |
|
59 | +$content .= $table->toHtml(); |
|
60 | +$content .= '</form>'; |
|
61 | 61 | $actions = ''; |
62 | 62 | |
63 | 63 | Display::addFlash(Display::return_message($plugin->get_lang('Sync your master settings to all instances.'))); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | if ($displayMode == '1') { |
204 | 204 | // Show only the current course progress step |
205 | 205 | // $information_title = get_lang('InfoAboutLastDoneAdvance'); |
206 | - $last_done_advance = $thematic->get_last_done_thematic_advance(); |
|
206 | + $last_done_advance = $thematic->get_last_done_thematic_advance(); |
|
207 | 207 | $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance); |
208 | 208 | $subTitle1 = get_lang('CurrentTopic'); |
209 | 209 | $class1 = ' current'; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | } else if ($displayMode == '3') { |
219 | 219 | // Show the current and next course progress steps |
220 | 220 | // $information_title = get_lang('InfoAboutLastDoneAdvanceAndNextAdvanceNotDone'); |
221 | - $last_done_advance = $thematic->get_last_done_thematic_advance(); |
|
221 | + $last_done_advance = $thematic->get_last_done_thematic_advance(); |
|
222 | 222 | $next_advance_not_done = $thematic->get_next_thematic_advance_not_done(); |
223 | 223 | $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance); |
224 | 224 | $thematic_advance_info2 = $thematic->get_thematic_advance_list($next_advance_not_done); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | if (!empty($thematic_advance_info)) { |
231 | 231 | $thematic_advance = get_lang('CourseThematicAdvance'); |
232 | - $thematicScore = $thematic->get_total_average_of_thematic_advances() . '%'; |
|
232 | + $thematicScore = $thematic->get_total_average_of_thematic_advances().'%'; |
|
233 | 233 | $thematicUrl = api_get_path(WEB_CODE_PATH).'course_progress/index.php?action=thematic_details&'.api_get_cidreq(); |
234 | 234 | $thematic_info = $thematic->get_thematic_list( |
235 | 235 | $thematic_advance_info['thematic_id'] |
@@ -244,11 +244,11 @@ discard block |
||
244 | 244 | ); |
245 | 245 | $userInfo = api_get_user_info(); |
246 | 246 | $courseInfo = api_get_course_info(); |
247 | - $titleThematic = $thematic_advance .' : '. $courseInfo['name'] . ' <b>( '. $thematicScore .' )</b>'; |
|
247 | + $titleThematic = $thematic_advance.' : '.$courseInfo['name'].' <b>( '.$thematicScore.' )</b>'; |
|
248 | 248 | |
249 | - $infoUser = '<div class="thematic-avatar"><img src="' . $userInfo['avatar'] . '" class="img-circle img-responsive"></div>'; |
|
249 | + $infoUser = '<div class="thematic-avatar"><img src="'.$userInfo['avatar'].'" class="img-circle img-responsive"></div>'; |
|
250 | 250 | $infoUser .= '<div class="progress"> |
251 | - <div class="progress-bar progress-bar-danger" role="progressbar" style="width: ' . $thematicScore . ';"> |
|
251 | + <div class="progress-bar progress-bar-danger" role="progressbar" style="width: ' . $thematicScore.';"> |
|
252 | 252 | '.$thematicScore.' |
253 | 253 | </div> |
254 | 254 | </div>'; |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | $thematicItemOne = ' |
257 | 257 | <div class="col-md-6 items-progress"> |
258 | 258 | <div class="thematic-cont '.$class1.'"> |
259 | - <div class="topics">' . $subTitle1 . '</div> |
|
260 | - <h4 class="title-topics">' . Display::returnFontAwesomeIcon('book') . $thematic_info['title'] . '</h4> |
|
261 | - <p class="date">' . Display::returnFontAwesomeIcon('calendar-o') . $thematic_advance_info['start_date'] . '</p> |
|
262 | - <div class="views">' . Display::returnFontAwesomeIcon('file-text-o') . strip_tags($thematic_advance_info['content']). '</div> |
|
263 | - <p class="time">'. Display::returnFontAwesomeIcon('clock-o') . get_lang('DurationInHours') . ' : ' . $thematic_advance_info['duration'] . ' - <a href="' . $thematicUrl . '">' . get_lang('SeeDetail') . '</a></p> |
|
259 | + <div class="topics">' . $subTitle1.'</div> |
|
260 | + <h4 class="title-topics">' . Display::returnFontAwesomeIcon('book').$thematic_info['title'].'</h4> |
|
261 | + <p class="date">' . Display::returnFontAwesomeIcon('calendar-o').$thematic_advance_info['start_date'].'</p> |
|
262 | + <div class="views">' . Display::returnFontAwesomeIcon('file-text-o').strip_tags($thematic_advance_info['content']).'</div> |
|
263 | + <p class="time">'. Display::returnFontAwesomeIcon('clock-o').get_lang('DurationInHours').' : '.$thematic_advance_info['duration'].' - <a href="'.$thematicUrl.'">'.get_lang('SeeDetail').'</a></p> |
|
264 | 264 | </div> |
265 | 265 | </div>'; |
266 | 266 | |
@@ -273,19 +273,19 @@ discard block |
||
273 | 273 | <div class="col-md-6 items-progress"> |
274 | 274 | <div class="thematic-cont"> |
275 | 275 | <div class="topics">'.$subTitle2.'</div> |
276 | - <h4 class="title-topics">'. Display::returnFontAwesomeIcon('book') . $thematic_info2['title'].'</h4> |
|
277 | - <p class="date">' . Display::returnFontAwesomeIcon('calendar-o') .$thematic_advance_info2['start_date'].'</p> |
|
278 | - <div class="views">' . Display::returnFontAwesomeIcon('file-text-o') . strip_tags($thematic_advance_info2['content']).'</div> |
|
279 | - <p class="time">'. Display::returnFontAwesomeIcon('clock-o') .get_lang('DurationInHours').' : '.$thematic_advance_info2['duration'].' - <a href="'.$thematicUrl.'">'.get_lang('SeeDetail').'</a></p> |
|
276 | + <h4 class="title-topics">'. Display::returnFontAwesomeIcon('book').$thematic_info2['title'].'</h4> |
|
277 | + <p class="date">' . Display::returnFontAwesomeIcon('calendar-o').$thematic_advance_info2['start_date'].'</p> |
|
278 | + <div class="views">' . Display::returnFontAwesomeIcon('file-text-o').strip_tags($thematic_advance_info2['content']).'</div> |
|
279 | + <p class="time">'. Display::returnFontAwesomeIcon('clock-o').get_lang('DurationInHours').' : '.$thematic_advance_info2['duration'].' - <a href="'.$thematicUrl.'">'.get_lang('SeeDetail').'</a></p> |
|
280 | 280 | </div> |
281 | 281 | </div>'; |
282 | 282 | } |
283 | 283 | $thematicPanel = '<div class="row">'; |
284 | - $thematicPanel .= '<div class="col-md-2">' . $infoUser . '</div>'; |
|
285 | - $thematicPanel .= '<div class="col-md-10"><div class="row">' . $thematicItemOne . $thematicItemTwo . '</div></div>'; |
|
284 | + $thematicPanel .= '<div class="col-md-2">'.$infoUser.'</div>'; |
|
285 | + $thematicPanel .= '<div class="col-md-10"><div class="row">'.$thematicItemOne.$thematicItemTwo.'</div></div>'; |
|
286 | 286 | $thematicPanel .= '</div>'; |
287 | 287 | $thematicPanel .= '<div class="separate"> |
288 | - <a href="' . $thematicUrl . '" class="btn btn-default btn-block">' . get_lang('ShowFullCourseAdvance') . '</a> |
|
288 | + <a href="' . $thematicUrl.'" class="btn btn-default btn-block">'.get_lang('ShowFullCourseAdvance').'</a> |
|
289 | 289 | </div>'; |
290 | 290 | $thematicProgress = Display::panelCollapse($titleThematic, $thematicPanel, 'thematic', null, 'accordion-thematic', 'collapse-thematic', false); |
291 | 291 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $editIconButton = Display::url( |
303 | 303 | '<em class="fa fa-wrench"></em> ', |
304 | 304 | api_get_path(WEB_CODE_PATH).'course_info/tools.php?'.api_get_cidreq(), |
305 | - ['class' => 'btn btn-default', 'title' => get_lang('CustomizeIcons') ] |
|
305 | + ['class' => 'btn btn-default', 'title' => get_lang('CustomizeIcons')] |
|
306 | 306 | ); |
307 | 307 | } |
308 | 308 | |
@@ -313,12 +313,12 @@ discard block |
||
313 | 313 | // Displays "Add intro" commands |
314 | 314 | $toolbar = '<div class="btn-group pull-right" role="group">'; |
315 | 315 | if (!empty($courseId)) { |
316 | - $textIntro = '<a class="btn btn-default" title="' . addslashes(get_lang('AddIntro')) . '" href="'.api_get_self().'?' . api_get_cidreq().'&intro_cmdAdd=1">'; |
|
316 | + $textIntro = '<a class="btn btn-default" title="'.addslashes(get_lang('AddIntro')).'" href="'.api_get_self().'?'.api_get_cidreq().'&intro_cmdAdd=1">'; |
|
317 | 317 | $textIntro .= '<em class="fa fa-file-text"></em> '; |
318 | 318 | $textIntro .= "</a>"; |
319 | - $toolbar .= $textIntro . $editIconButton; |
|
319 | + $toolbar .= $textIntro.$editIconButton; |
|
320 | 320 | } else { |
321 | - $toolbar .= '<a class="btn btn-default" href="' . api_get_self() . '?intro_cmdAdd=1">' . get_lang('AddIntro') . '</a>'; |
|
321 | + $toolbar .= '<a class="btn btn-default" href="'.api_get_self().'?intro_cmdAdd=1">'.get_lang('AddIntro').'</a>'; |
|
322 | 322 | $toolbar .= $editIconButton; |
323 | 323 | } |
324 | 324 | $toolbar .= '</div>'; |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | '<a class="btn btn-default" href="'.api_get_self().'?'.api_get_cidreq().'&intro_cmdEdit=1" title="'.get_lang('Modify').'"> |
332 | 332 | <em class="fa fa-pencil"></em></a>'; |
333 | 333 | $toolbar .= $editIconButton; |
334 | - $toolbar .="<a class=\"btn btn-default\" href=\"".api_get_self()."?".api_get_cidreq()."&intro_cmdDel=1\" onclick=\"javascript: |
|
334 | + $toolbar .= "<a class=\"btn btn-default\" href=\"".api_get_self()."?".api_get_cidreq()."&intro_cmdDel=1\" onclick=\"javascript: |
|
335 | 335 | if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)). |
336 | 336 | "')) return false;\"><em class=\"fa fa-trash-o\"></em></a>"; |
337 | 337 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)). |
346 | 346 | "')) return false;\"><em class=\"fa fa-trash-o\"></em></a>"; |
347 | 347 | } |
348 | - $toolbar .= "</div>"; |
|
348 | + $toolbar .= "</div>"; |
|
349 | 349 | // Fix for chrome XSS filter for videos in iframes - BT#7930 |
350 | 350 | $browser = api_get_navigator(); |
351 | 351 | if (strpos($introduction_section, '<iframe') !== false && $browser['name'] == 'Chrome') { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | } else { |
365 | 365 | if (api_is_allowed_to_edit()) { |
366 | 366 | $introduction_section .= '<div class="help-course">'; |
367 | - $introduction_section .= get_lang('AddCustomCourseIntro') . ' ' . $textIntro; |
|
367 | + $introduction_section .= get_lang('AddCustomCourseIntro').' '.$textIntro; |
|
368 | 368 | $introduction_section .= '</div>'; |
369 | 369 | } |
370 | 370 | } |
@@ -115,8 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public static function getUTCDateTimeTypeClass() |
117 | 117 | { |
118 | - return isset(self::$utcDateTimeClass) ? self::$utcDateTimeClass : |
|
119 | - 'Application\DoctrineExtensions\DBAL\Types\UTCDateTimeType'; |
|
118 | + return isset(self::$utcDateTimeClass) ? self::$utcDateTimeClass : 'Application\DoctrineExtensions\DBAL\Types\UTCDateTimeType'; |
|
120 | 119 | } |
121 | 120 | |
122 | 121 | /** |
@@ -163,7 +162,7 @@ discard block |
||
163 | 162 | );*/ |
164 | 163 | |
165 | 164 | AnnotationRegistry::registerLoader( |
166 | - function ($class) use ($sysPath) { |
|
165 | + function($class) use ($sysPath) { |
|
167 | 166 | $file = str_replace("\\", DIRECTORY_SEPARATOR, $class).".php"; |
168 | 167 | $file = str_replace('Symfony/Component/Validator', '', $file); |
169 | 168 | $file = $sysPath.'vendor/symfony/validator'.$file; |
@@ -428,7 +427,7 @@ discard block |
||
428 | 427 | |
429 | 428 | if (!empty($params)) { |
430 | 429 | $sql = 'INSERT INTO '.$table_name.' ('.implode(',', $params).') |
431 | - VALUES (:'.implode(', :' ,$params).')'; |
|
430 | + VALUES (:'.implode(', :', $params).')'; |
|
432 | 431 | |
433 | 432 | $statement = self::getManager()->getConnection()->prepare($sql); |
434 | 433 | $result = $statement->execute($attributes); |
@@ -472,7 +471,7 @@ discard block |
||
472 | 471 | foreach ($attributes as $key => $value) { |
473 | 472 | $updateSql .= "$key = :$key "; |
474 | 473 | if ($count < count($attributes)) { |
475 | - $updateSql.= ', '; |
|
474 | + $updateSql .= ', '; |
|
476 | 475 | } |
477 | 476 | $count++; |
478 | 477 | } |
@@ -527,7 +526,7 @@ discard block |
||
527 | 526 | if ($columns == '*') { |
528 | 527 | $clean_columns = '*'; |
529 | 528 | } else { |
530 | - $clean_columns = (string)$columns; |
|
529 | + $clean_columns = (string) $columns; |
|
531 | 530 | } |
532 | 531 | } |
533 | 532 | |
@@ -574,7 +573,7 @@ discard block |
||
574 | 573 | $clean_values = array(); |
575 | 574 | foreach ($value_array as $item) { |
576 | 575 | $item = Database::escape_string($item); |
577 | - $clean_values[]= $item; |
|
576 | + $clean_values[] = $item; |
|
578 | 577 | } |
579 | 578 | } else { |
580 | 579 | $value_array = Database::escape_string($value_array); |
@@ -598,7 +597,7 @@ discard block |
||
598 | 597 | } |
599 | 598 | |
600 | 599 | if (!empty($where_return)) { |
601 | - $return_value = " WHERE $where_return" ; |
|
600 | + $return_value = " WHERE $where_return"; |
|
602 | 601 | } |
603 | 602 | break; |
604 | 603 | case 'order': |
@@ -621,10 +620,10 @@ discard block |
||
621 | 620 | if (in_array($element[1], array('desc', 'asc'))) { |
622 | 621 | $order = $element[1]; |
623 | 622 | } |
624 | - $temp_value[]= $element[0].' '.$order.' '; |
|
623 | + $temp_value[] = $element[0].' '.$order.' '; |
|
625 | 624 | } else { |
626 | 625 | //by default DESC |
627 | - $temp_value[]= $element[0].' DESC '; |
|
626 | + $temp_value[] = $element[0].' DESC '; |
|
628 | 627 | } |
629 | 628 | } |
630 | 629 | if (!empty($temp_value)) { |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | 'urlPicture' => $this->course->getPicturePath(true), |
239 | 239 | 'teachers' => $teachers, |
240 | 240 | 'tools' => array_map( |
241 | - function ($tool) { |
|
241 | + function($tool) { |
|
242 | 242 | return ['type' => $tool['name']]; |
243 | 243 | }, |
244 | 244 | $tools |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $results[] = [ |
262 | 262 | 'id' => $description->get_description_type(), |
263 | 263 | 'title' => $description->get_title(), |
264 | - 'content' => str_replace('src="/', 'src="' . api_get_path(WEB_PATH), $description->get_content()) |
|
264 | + 'content' => str_replace('src="/', 'src="'.api_get_path(WEB_PATH), $description->get_content()) |
|
265 | 265 | ]; |
266 | 266 | } |
267 | 267 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | $path = $directory['path']; |
296 | 296 | } |
297 | - require_once api_get_path(LIBRARY_PATH) . 'fileDisplay.lib.php'; |
|
297 | + require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php'; |
|
298 | 298 | |
299 | 299 | $courseInfo = api_get_course_info_by_id($this->course->getId()); |
300 | 300 | $documents = DocumentManager::get_all_document_data( |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | $results = []; |
310 | 310 | |
311 | 311 | if (is_array($documents)) { |
312 | - $webPath = api_get_path(WEB_CODE_PATH) . 'document/document.php?'; |
|
312 | + $webPath = api_get_path(WEB_CODE_PATH).'document/document.php?'; |
|
313 | 313 | |
314 | 314 | /** @var array $document */ |
315 | 315 | foreach ($documents as $document) { |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | 'type' => $document['filetype'], |
327 | 327 | 'title' => $document['title'], |
328 | 328 | 'path' => $document['path'], |
329 | - 'url' => $webPath . http_build_query([ |
|
329 | + 'url' => $webPath.http_build_query([ |
|
330 | 330 | 'username' => $this->user->getUsername(), |
331 | 331 | 'api_key' => $this->apiKey, |
332 | 332 | 'cidReq' => $this->course->getCode(), |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | $sessionId |
371 | 371 | ); |
372 | 372 | |
373 | - $announcements = array_map(function ($announcement) { |
|
373 | + $announcements = array_map(function($announcement) { |
|
374 | 374 | return [ |
375 | 375 | 'id' => intval($announcement['id']), |
376 | 376 | 'title' => strip_tags($announcement['title']), |
@@ -452,11 +452,11 @@ discard block |
||
452 | 452 | $webPath = api_get_path(WEB_PATH); |
453 | 453 | |
454 | 454 | return array_map( |
455 | - function ($event) use ($webPath) { |
|
455 | + function($event) use ($webPath) { |
|
456 | 456 | return [ |
457 | 457 | 'id' => intval($event['unique_id']), |
458 | 458 | 'title' => $event['title'], |
459 | - 'content' => str_replace('src="/', 'src="' . $webPath, $event['description']), |
|
459 | + 'content' => str_replace('src="/', 'src="'.$webPath, $event['description']), |
|
460 | 460 | 'startDate' => $event['start_date_localtime'], |
461 | 461 | 'endDate' => $event['end_date_localtime'], |
462 | 462 | 'isAllDay' => $event['allDay'] ? true : false |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | $notebooks = $notebooksRepo->findByUser($this->user, $this->course, $this->session); |
479 | 479 | |
480 | 480 | return array_map( |
481 | - function (\Chamilo\CourseBundle\Entity\CNotebook $notebook) { |
|
481 | + function(\Chamilo\CourseBundle\Entity\CNotebook $notebook) { |
|
482 | 482 | return [ |
483 | 483 | 'id' => $notebook->getIid(), |
484 | 484 | 'title' => $notebook->getTitle(), |
@@ -502,9 +502,9 @@ discard block |
||
502 | 502 | public function getCourseForumCategories() |
503 | 503 | { |
504 | 504 | $sessionId = $this->session ? $this->session->getId() : 0; |
505 | - $webCoursePath = api_get_path(WEB_COURSE_PATH) . $this->course->getDirectory() . '/upload/forum/images/'; |
|
505 | + $webCoursePath = api_get_path(WEB_COURSE_PATH).$this->course->getDirectory().'/upload/forum/images/'; |
|
506 | 506 | |
507 | - require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php'; |
|
507 | + require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; |
|
508 | 508 | |
509 | 509 | $categoriesFullData = get_forum_categories('', $this->course->getId(), $sessionId); |
510 | 510 | $categories = []; |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | 'catId' => intval($forumInfo['forum_category']), |
519 | 519 | 'title' => $forumInfo['forum_title'], |
520 | 520 | 'description' => $forumInfo['forum_comment'], |
521 | - 'image' => $forumInfo['forum_image'] ? ($webCoursePath . $forumInfo['forum_image']) : '', |
|
521 | + 'image' => $forumInfo['forum_image'] ? ($webCoursePath.$forumInfo['forum_image']) : '', |
|
522 | 522 | 'numberOfThreads' => isset($forumInfo['number_of_threads']) ? intval($forumInfo['number_of_threads']) : 0, |
523 | 523 | 'lastPost' => null |
524 | 524 | ]; |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | foreach ($categoriesFullData as $category) { |
542 | 542 | $categoryForums = array_filter( |
543 | 543 | $forums, |
544 | - function (array $forum) use ($category) { |
|
544 | + function(array $forum) use ($category) { |
|
545 | 545 | if ($forum['catId'] != $category['cat_id']) { |
546 | 546 | return false; |
547 | 547 | } |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | */ |
571 | 571 | public function getCourseForum($forumId) |
572 | 572 | { |
573 | - require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php'; |
|
573 | + require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; |
|
574 | 574 | |
575 | 575 | $forumInfo = get_forums($forumId, $this->course->getCode()); |
576 | 576 | |
@@ -578,12 +578,12 @@ discard block |
||
578 | 578 | throw new Exception(get_lang('NoForum')); |
579 | 579 | } |
580 | 580 | |
581 | - $webCoursePath = api_get_path(WEB_COURSE_PATH) . $this->course->getDirectory() . '/upload/forum/images/'; |
|
581 | + $webCoursePath = api_get_path(WEB_COURSE_PATH).$this->course->getDirectory().'/upload/forum/images/'; |
|
582 | 582 | $forum = [ |
583 | 583 | 'id' => $forumInfo['iid'], |
584 | 584 | 'title' => $forumInfo['forum_title'], |
585 | 585 | 'description' => $forumInfo['forum_comment'], |
586 | - 'image' => $forumInfo['forum_image'] ? ($webCoursePath . $forumInfo['forum_image']) : '', |
|
586 | + 'image' => $forumInfo['forum_image'] ? ($webCoursePath.$forumInfo['forum_image']) : '', |
|
587 | 587 | 'threads' => [] |
588 | 588 | ]; |
589 | 589 | |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | */ |
611 | 611 | public function getCourseForumThread($forumId, $threadId) |
612 | 612 | { |
613 | - require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php'; |
|
613 | + require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; |
|
614 | 614 | |
615 | 615 | $threadInfo = get_thread_information($forumId, $threadId); |
616 | 616 | |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | $pictureInfo = UserManager::get_user_picture_path_by_id($this->user->getId(), 'web'); |
649 | 649 | |
650 | 650 | $result = [ |
651 | - 'pictureUri' => $pictureInfo['dir'] . $pictureInfo['file'], |
|
651 | + 'pictureUri' => $pictureInfo['dir'].$pictureInfo['file'], |
|
652 | 652 | 'fullName' => $this->user->getCompleteName(), |
653 | 653 | 'username' => $this->user->getUsername(), |
654 | 654 | 'officialCode' => $this->user->getOfficialCode(), |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | 'id' => $lpId, |
759 | 759 | 'title' => Security::remove_XSS($lpDetails['lp_name']), |
760 | 760 | 'progress' => intval($progress), |
761 | - 'url' => api_get_path(WEB_CODE_PATH) . 'webservices/api/v2.php?' . http_build_query([ |
|
761 | + 'url' => api_get_path(WEB_CODE_PATH).'webservices/api/v2.php?'.http_build_query([ |
|
762 | 762 | 'hash' => $this->encodeParams([ |
763 | 763 | 'action' => 'course_learnpath', |
764 | 764 | 'lp_id' => $lpId, |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | * @param string $encoded |
806 | 806 | * @return array |
807 | 807 | */ |
808 | - public static function decodeParams($encoded){ |
|
808 | + public static function decodeParams($encoded) { |
|
809 | 809 | $decoded = str_replace(['-', '_', '.'], ['+', '/', '='], $encoded); |
810 | 810 | $mod4 = strlen($decoded) % 4; |
811 | 811 | |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | ChamiloSession::write('_user', $loggedUser); |
834 | 834 | Login::init_user($this->user->getId(), true); |
835 | 835 | |
836 | - $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . http_build_query([ |
|
836 | + $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.http_build_query([ |
|
837 | 837 | 'cidReq' => $this->course->getCode(), |
838 | 838 | 'id_session' => $sessionId, |
839 | 839 | 'gidReq' => 0, |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | */ |
856 | 856 | public function saveForumPost(array $postValues, $forumId) |
857 | 857 | { |
858 | - require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php'; |
|
858 | + require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; |
|
859 | 859 | |
860 | 860 | $forum = get_forums($forumId, $this->course->getCode()); |
861 | 861 | |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | */ |
993 | 993 | public function saveForumThread(array $values, $forumId) |
994 | 994 | { |
995 | - require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php'; |
|
995 | + require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; |
|
996 | 996 | |
997 | 997 | $forum = get_forums($forumId, $this->course->getCode()); |
998 | 998 | $courseInfo = api_get_course_info($this->course->getCode()); |