@@ -73,7 +73,6 @@ |
||
73 | 73 | * Export the given HTML to PDF, using a global template |
74 | 74 | * |
75 | 75 | * @uses export/table_pdf.tpl |
76 | - |
|
77 | 76 | * @param $content |
78 | 77 | * @param bool|false $saveToFile |
79 | 78 | * @param bool|false $returnHtml |
@@ -536,8 +536,9 @@ |
||
536 | 536 | } |
537 | 537 | } else { |
538 | 538 | $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
539 | - if (file_exists($store_path)) |
|
540 | - $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
539 | + if (file_exists($store_path)) { |
|
540 | + $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
541 | + } |
|
541 | 542 | } |
542 | 543 | return $web_path; |
543 | 544 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @param string pdf name |
193 | 193 | * @param string course code (if you are using html that are located in the document tool you must provide this) |
194 | 194 | * @param bool Whether to print the header, footer and watermark (true) or just the content (false) |
195 | - * @return bool |
|
195 | + * @return false|null |
|
196 | 196 | */ |
197 | 197 | public function html_to_pdf( |
198 | 198 | $html_file_array, |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | } |
767 | 767 | |
768 | 768 | /** |
769 | - * @param array $header html content |
|
769 | + * @param string $header html content |
|
770 | 770 | */ |
771 | 771 | public function set_custom_header($header) |
772 | 772 | { |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | } |
775 | 775 | |
776 | 776 | /** |
777 | - * @param array $footer html content |
|
777 | + * @param string $footer html content |
|
778 | 778 | */ |
779 | 779 | public function set_custom_footer($footer) |
780 | 780 | { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /* More info @ http://mpdf1.com/manual/index.php?tid=184&searchstring=mPDF |
34 | 34 | * mPDF ([ string $mode [, mixed $format [, float $default_font_size [, string $default_font [, float $margin_left , float $margin_right , float $margin_top , float $margin_bottom , float $margin_header , float $margin_footer [, string $orientation ]]]]]]) |
35 | 35 | */ |
36 | - if (!in_array($orientation, array('P','L'))) { |
|
36 | + if (!in_array($orientation, array('P', 'L'))) { |
|
37 | 37 | $orientation = 'P'; |
38 | 38 | } |
39 | 39 | //$this->pdf = $pdf = new mPDF('UTF-8', $pageFormat, '', '', 30, 20, 27, 25, 16, 13, $orientation); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $visualTheme = api_get_visual_theme(); |
101 | 101 | $img = api_get_path(SYS_CSS_PATH).'themes/'.$visualTheme.'/images/pdf_logo_header.png'; |
102 | 102 | if (file_exists($img)) { |
103 | - $img = api_get_path(WEB_CSS_PATH) . 'themes/' . $visualTheme . '/images/pdf_logo_header.png'; |
|
103 | + $img = api_get_path(WEB_CSS_PATH).'themes/'.$visualTheme.'/images/pdf_logo_header.png'; |
|
104 | 104 | $organization = "<img src='$img'>"; |
105 | 105 | } |
106 | 106 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | // then print the title in the PDF |
238 | 238 | if (is_array($file) && isset($file['title'])) { |
239 | 239 | $html_title = $file['title']; |
240 | - $file = $file['path']; |
|
240 | + $file = $file['path']; |
|
241 | 241 | } else { |
242 | 242 | //we suppose we've only been sent a file path |
243 | 243 | $html_title = basename($file); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | //it's not a chapter but the file exists, print its title |
269 | 269 | if ($print_title) { |
270 | 270 | $this->pdf->WriteHTML( |
271 | - '<html><body><h3>' . $html_title . '</h3></body></html>' |
|
271 | + '<html><body><h3>'.$html_title.'</h3></body></html>' |
|
272 | 272 | ); |
273 | 273 | } |
274 | 274 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | |
283 | 283 | if ($extension === 'html') { |
284 | 284 | $filename = basename($filename, '.html'); |
285 | - } elseif($extension === 'htm'){ |
|
285 | + } elseif ($extension === 'htm') { |
|
286 | 286 | $filename = basename($filename, '.htm'); |
287 | 287 | } |
288 | 288 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | $document_html = str_replace('href="./css/frames.css"', $absolute_css_path, $document_html); |
295 | 295 | |
296 | 296 | if (!empty($course_data['path'])) { |
297 | - $document_html= str_replace('../', '', $document_html); |
|
297 | + $document_html = str_replace('../', '', $document_html); |
|
298 | 298 | $document_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document/'; |
299 | 299 | |
300 | 300 | $doc = new DOMDocument(); |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | if (!empty($document_html)) { |
373 | 373 | $this->pdf->WriteHTML($document_html.$page_break); |
374 | 374 | } |
375 | - } elseif (in_array($extension, array('jpg','jpeg','png','gif'))) { |
|
375 | + } elseif (in_array($extension, array('jpg', 'jpeg', 'png', 'gif'))) { |
|
376 | 376 | //Images |
377 | 377 | $image = Display::img($file); |
378 | 378 | $this->pdf->WriteHTML('<html><body>'.$image.'</body></html>'.$page_break); |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | |
436 | 436 | //absolute path for frames.css //TODO: necessary? |
437 | 437 | $absolute_css_path = api_get_path(WEB_CSS_PATH).api_get_setting('stylesheets').'/frames.css'; |
438 | - $document_html = str_replace('href="./css/frames.css"','href="'.$absolute_css_path.'"', $document_html); |
|
438 | + $document_html = str_replace('href="./css/frames.css"', 'href="'.$absolute_css_path.'"', $document_html); |
|
439 | 439 | |
440 | 440 | $document_html = str_replace('../../', '', $document_html); |
441 | 441 | $document_html = str_replace('../', '', $document_html); |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | $old_src_fixed = str_replace(api_get_path(REL_COURSE_PATH).$course_data['path'].'/document/', '', $old_src); |
464 | 464 | $old_src_fixed = str_replace('courses/'.$course_data['path'].'/document/', '', $old_src_fixed); |
465 | 465 | $new_path = $document_path.$old_src_fixed; |
466 | - $document_html= str_replace($old_src, $new_path, $document_html); |
|
466 | + $document_html = str_replace($old_src, $new_path, $document_html); |
|
467 | 467 | |
468 | 468 | } |
469 | 469 | } |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | //$document_html= str_replace('temp_template_path', 'src="/main/default_course_document/', $document_html);// restore src templates |
483 | 483 | |
484 | 484 | api_set_encoding_html($document_html, 'UTF-8'); // The library mPDF expects UTF-8 encoded input data. |
485 | - $title = api_get_title_html($document_html, 'UTF-8', 'UTF-8'); // TODO: Maybe it is better idea the title to be passed through |
|
485 | + $title = api_get_title_html($document_html, 'UTF-8', 'UTF-8'); // TODO: Maybe it is better idea the title to be passed through |
|
486 | 486 | // $_GET[] too, as it is done with file name. |
487 | 487 | // At the moment the title is retrieved from the html document itself. |
488 | 488 | |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | //$this->pdf->Output($output_file, $outputMode); // F to save the pdf in a file |
505 | 505 | |
506 | 506 | if ($outputMode == 'F') { |
507 | - $output_file = api_get_path(SYS_ARCHIVE_PATH) . $output_file; |
|
507 | + $output_file = api_get_path(SYS_ARCHIVE_PATH).$output_file; |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | if ($saveInFile) { |
@@ -537,14 +537,14 @@ discard block |
||
537 | 537 | $web_path = false; |
538 | 538 | if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') { |
539 | 539 | $course_info = api_get_course_info($course_code); |
540 | - $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
540 | + $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
541 | 541 | if (file_exists($store_path)) { |
542 | - $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
542 | + $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
543 | 543 | } |
544 | 544 | } else { |
545 | - $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
545 | + $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
546 | 546 | if (file_exists($store_path)) |
547 | - $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
547 | + $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
548 | 548 | } |
549 | 549 | return $web_path; |
550 | 550 | } |
@@ -584,10 +584,10 @@ discard block |
||
584 | 584 | { |
585 | 585 | if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') { |
586 | 586 | $course_info = api_get_course_info($course_code); |
587 | - $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path']; // course path |
|
587 | + $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path']; // course path |
|
588 | 588 | $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/pdf_watermark.png'; |
589 | 589 | } else { |
590 | - $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images'; // course path |
|
590 | + $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images'; // course path |
|
591 | 591 | $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
592 | 592 | } |
593 | 593 | $course_image = $store_path.'/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
@@ -620,9 +620,9 @@ discard block |
||
620 | 620 | */ |
621 | 621 | public function set_footer() |
622 | 622 | { |
623 | - $this->pdf->defaultfooterfontsize = 12; // in pts |
|
624 | - $this->pdf->defaultfooterfontstyle = 'B'; // blank, B, I, or BI |
|
625 | - $this->pdf->defaultfooterline = 1; // 1 to include line below header/above footer |
|
623 | + $this->pdf->defaultfooterfontsize = 12; // in pts |
|
624 | + $this->pdf->defaultfooterfontstyle = 'B'; // blank, B, I, or BI |
|
625 | + $this->pdf->defaultfooterline = 1; // 1 to include line below header/above footer |
|
626 | 626 | $platform_name = api_get_setting('Institution'); |
627 | 627 | $left_content = $platform_name; |
628 | 628 | $center_content = ''; |
@@ -689,9 +689,9 @@ discard block |
||
689 | 689 | */ |
690 | 690 | public function set_header($course_data) |
691 | 691 | { |
692 | - $this->pdf->defaultheaderfontsize = 10; // in pts |
|
693 | - $this->pdf->defaultheaderfontstyle = 'BI'; // blank, B, I, or BI |
|
694 | - $this->pdf->defaultheaderline = 1; // 1 to include line below header/above footer |
|
692 | + $this->pdf->defaultheaderfontsize = 10; // in pts |
|
693 | + $this->pdf->defaultheaderfontstyle = 'BI'; // blank, B, I, or BI |
|
694 | + $this->pdf->defaultheaderline = 1; // 1 to include line below header/above footer |
|
695 | 695 | |
696 | 696 | if (!empty($course_data['code'])) { |
697 | 697 | $teacher_list = CourseManager::get_teacher_list_from_course_code($course_data['code']); |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | $teachers = ''; |
700 | 700 | if (!empty($teacher_list)) { |
701 | 701 | foreach ($teacher_list as $teacher) { |
702 | - $teachers[]= $teacher['firstname'].' '.$teacher['lastname']; |
|
702 | + $teachers[] = $teacher['firstname'].' '.$teacher['lastname']; |
|
703 | 703 | } |
704 | 704 | if (count($teachers) > 1) { |
705 | 705 | $teachers = get_lang('Teachers').': '.implode(', ', $teachers); |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | 'line' => 1, |
767 | 767 | ), |
768 | 768 | ); |
769 | - $this->pdf->SetHeader($header);// ('{DATE j-m-Y}|{PAGENO}/{nb}|'.$title); |
|
769 | + $this->pdf->SetHeader($header); // ('{DATE j-m-Y}|{PAGENO}/{nb}|'.$title); |
|
770 | 770 | } |
771 | 771 | } |
772 | 772 | |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | $this->pdf->directionality = api_get_text_direction(); |
812 | 812 | $this->pdf->useOnlyCoreFonts = true; |
813 | 813 | // Use different Odd/Even headers and footers and mirror margins |
814 | - $this->pdf->mirrorMargins = 1; |
|
814 | + $this->pdf->mirrorMargins = 1; |
|
815 | 815 | |
816 | 816 | // Add decoration only if not stated otherwise |
817 | 817 | if ($complete) { |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | $watermark_text = api_get_setting('pdf_export_watermark_text'); |
840 | 840 | } |
841 | 841 | if (!empty($watermark_text)) { |
842 | - $this->pdf->SetWatermarkText(strcode2utf($watermark_text),0.1); |
|
842 | + $this->pdf->SetWatermarkText(strcode2utf($watermark_text), 0.1); |
|
843 | 843 | $this->pdf->showWatermarkText = true; |
844 | 844 | } |
845 | 845 | } |
@@ -847,8 +847,8 @@ discard block |
||
847 | 847 | if (empty($this->custom_header)) { |
848 | 848 | self::set_header($course_data); |
849 | 849 | } else { |
850 | - $this->pdf->SetHTMLHeader($this->custom_header,'E'); |
|
851 | - $this->pdf->SetHTMLHeader($this->custom_header,'O'); |
|
850 | + $this->pdf->SetHTMLHeader($this->custom_header, 'E'); |
|
851 | + $this->pdf->SetHTMLHeader($this->custom_header, 'O'); |
|
852 | 852 | } |
853 | 853 | |
854 | 854 | if (empty($this->custom_footer)) { |
@@ -41,9 +41,9 @@ |
||
41 | 41 | */ |
42 | 42 | function _createElements() |
43 | 43 | { |
44 | - $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')')); |
|
44 | + $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array('onclick' => 'javascript:receivers_hide(\'receivers_to\')')); |
|
45 | 45 | $this->_elements[0]->setChecked(true); |
46 | - $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array ('onclick' => 'javascript:receivers_show(\'receivers_to\')')); |
|
46 | + $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array('onclick' => 'javascript:receivers_show(\'receivers_to\')')); |
|
47 | 47 | $this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers); |
48 | 48 | $this->_elements[2]->setSelected($this->receivers_selected); |
49 | 49 | } |
@@ -10,68 +10,68 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class HTML_QuickForm_receivers extends HTML_QuickForm_group |
12 | 12 | { |
13 | - /** |
|
14 | - * Array of all receivers |
|
15 | - */ |
|
16 | - var $receivers; |
|
17 | - /** |
|
18 | - * Array of selected receivers |
|
19 | - */ |
|
20 | - var $receivers_selected; |
|
13 | + /** |
|
14 | + * Array of all receivers |
|
15 | + */ |
|
16 | + var $receivers; |
|
17 | + /** |
|
18 | + * Array of selected receivers |
|
19 | + */ |
|
20 | + var $receivers_selected; |
|
21 | 21 | |
22 | - /** |
|
23 | - * Constructor |
|
24 | - * @param string $elementName |
|
25 | - * @param string $elementLabel |
|
26 | - * @param array $attributes This should contain the keys 'receivers' and |
|
27 | - * 'receivers_selected' |
|
28 | - */ |
|
29 | - public function __construct($elementName = null, $elementLabel = null, $attributes = null) |
|
30 | - { |
|
31 | - $this->receivers = $attributes['receivers']; |
|
32 | - $this->receivers_selected = $attributes['receivers_selected']; |
|
33 | - unset($attributes['receivers']); |
|
34 | - unset($attributes['receivers_selected']); |
|
35 | - parent::__construct($elementName, $elementLabel, $attributes); |
|
36 | - $this->_persistantFreeze = true; |
|
37 | - $this->_appendName = true; |
|
38 | - $this->_type = 'receivers'; |
|
39 | - } |
|
22 | + /** |
|
23 | + * Constructor |
|
24 | + * @param string $elementName |
|
25 | + * @param string $elementLabel |
|
26 | + * @param array $attributes This should contain the keys 'receivers' and |
|
27 | + * 'receivers_selected' |
|
28 | + */ |
|
29 | + public function __construct($elementName = null, $elementLabel = null, $attributes = null) |
|
30 | + { |
|
31 | + $this->receivers = $attributes['receivers']; |
|
32 | + $this->receivers_selected = $attributes['receivers_selected']; |
|
33 | + unset($attributes['receivers']); |
|
34 | + unset($attributes['receivers_selected']); |
|
35 | + parent::__construct($elementName, $elementLabel, $attributes); |
|
36 | + $this->_persistantFreeze = true; |
|
37 | + $this->_appendName = true; |
|
38 | + $this->_type = 'receivers'; |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Create the form elements to build this element group |
|
43 | - */ |
|
44 | - function _createElements() |
|
45 | - { |
|
46 | - $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')')); |
|
47 | - $this->_elements[0]->setChecked(true); |
|
48 | - $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array ('onclick' => 'javascript:receivers_show(\'receivers_to\')')); |
|
49 | - $this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers); |
|
50 | - $this->_elements[2]->setSelected($this->receivers_selected); |
|
51 | - } |
|
41 | + /** |
|
42 | + * Create the form elements to build this element group |
|
43 | + */ |
|
44 | + function _createElements() |
|
45 | + { |
|
46 | + $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')')); |
|
47 | + $this->_elements[0]->setChecked(true); |
|
48 | + $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array ('onclick' => 'javascript:receivers_show(\'receivers_to\')')); |
|
49 | + $this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers); |
|
50 | + $this->_elements[2]->setSelected($this->receivers_selected); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * HTML representation |
|
55 | - */ |
|
56 | - public function toHtml() |
|
57 | - { |
|
58 | - include_once ('HTML/QuickForm/Renderer/Default.php'); |
|
59 | - $this->_separator = '<br/>'; |
|
60 | - $renderer = & new HTML_QuickForm_Renderer_Default(); |
|
61 | - $renderer->setElementTemplate('{element}'); |
|
62 | - $select_boxes = $this->_elements[2]; |
|
63 | - $select_boxes->setElementTemplate('<div style="margin-left:20px;display:block;" id="receivers_'.$select_boxes->getName().'">'.$select_boxes->_elementTemplate.'</div>'); |
|
64 | - parent :: accept($renderer); |
|
65 | - $js = $this->getElementJS(); |
|
66 | - return $renderer->toHtml().$js; |
|
67 | - } |
|
53 | + /** |
|
54 | + * HTML representation |
|
55 | + */ |
|
56 | + public function toHtml() |
|
57 | + { |
|
58 | + include_once ('HTML/QuickForm/Renderer/Default.php'); |
|
59 | + $this->_separator = '<br/>'; |
|
60 | + $renderer = & new HTML_QuickForm_Renderer_Default(); |
|
61 | + $renderer->setElementTemplate('{element}'); |
|
62 | + $select_boxes = $this->_elements[2]; |
|
63 | + $select_boxes->setElementTemplate('<div style="margin-left:20px;display:block;" id="receivers_'.$select_boxes->getName().'">'.$select_boxes->_elementTemplate.'</div>'); |
|
64 | + parent :: accept($renderer); |
|
65 | + $js = $this->getElementJS(); |
|
66 | + return $renderer->toHtml().$js; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * Get the necessary javascript |
|
71 | - */ |
|
69 | + /** |
|
70 | + * Get the necessary javascript |
|
71 | + */ |
|
72 | 72 | public function getElementJS() |
73 | - { |
|
74 | - $js = "<script type=\"text/javascript\"> |
|
73 | + { |
|
74 | + $js = "<script type=\"text/javascript\"> |
|
75 | 75 | /* <![CDATA[ */ |
76 | 76 | receivers_hide('receivers_to'); |
77 | 77 | function receivers_show(item) { |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | } |
85 | 85 | /* ]]> */ |
86 | 86 | </script>\n"; |
87 | - return $js; |
|
88 | - } |
|
89 | - /** |
|
90 | - * accept renderer |
|
91 | - */ |
|
92 | - function accept(& $renderer, $required = false, $error = null) |
|
93 | - { |
|
94 | - $renderer->renderElement($this, $required, $error); |
|
95 | - } |
|
87 | + return $js; |
|
88 | + } |
|
89 | + /** |
|
90 | + * accept renderer |
|
91 | + */ |
|
92 | + function accept(& $renderer, $required = false, $error = null) |
|
93 | + { |
|
94 | + $renderer->renderElement($this, $required, $error); |
|
95 | + } |
|
96 | 96 | } |
97 | 97 | \ No newline at end of file |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | class DateRangePicker extends HTML_QuickForm_text |
8 | 8 | { |
9 | 9 | /** |
10 | - * Constructor |
|
11 | - */ |
|
10 | + * Constructor |
|
11 | + */ |
|
12 | 12 | public function __construct($elementName = null, $elementLabel = null, $attributes = null) |
13 | 13 | { |
14 | 14 | if (!isset($attributes['id'])) { |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
147 | - * @param array $dates result of parseDateRange() |
|
148 | - * |
|
149 | - * @return bool |
|
150 | - */ |
|
147 | + * @param array $dates result of parseDateRange() |
|
148 | + * |
|
149 | + * @return bool |
|
150 | + */ |
|
151 | 151 | public function validateDates($dates, $format = null) |
152 | 152 | { |
153 | 153 | if (empty($dates['start']) || empty($dates['end'])) { |
@@ -88,7 +88,7 @@ |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | $timePicker = 'true'; |
91 | - $timePickerValue = $this->getAttribute('timePicker'); |
|
91 | + $timePickerValue = $this->getAttribute('timePicker'); |
|
92 | 92 | if (!empty($timePickerValue)) { |
93 | 93 | $timePicker = $timePickerValue; |
94 | 94 | } |
@@ -74,9 +74,9 @@ |
||
74 | 74 | $styleCss = $this->editor->getConfigAttribute('style'); |
75 | 75 | |
76 | 76 | if ($styleCss) { |
77 | - $style = true; |
|
77 | + $style = true; |
|
78 | 78 | } else { |
79 | - $style = false; |
|
79 | + $style = false; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | return $this->buildEditor($style); |
@@ -6,24 +6,24 @@ |
||
6 | 6 | */ |
7 | 7 | class HTML_QuickForm_Rule_UsernameAvailable extends HTML_QuickForm_Rule |
8 | 8 | { |
9 | - /** |
|
10 | - * Function to check if a username is available |
|
11 | - * @see HTML_QuickForm_Rule |
|
12 | - * @param string $username Wanted username |
|
13 | - * @param string $current_username |
|
14 | - * @return boolean True if username is available |
|
15 | - */ |
|
16 | - function validate($username, $current_username = null) { |
|
17 | - $user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
9 | + /** |
|
10 | + * Function to check if a username is available |
|
11 | + * @see HTML_QuickForm_Rule |
|
12 | + * @param string $username Wanted username |
|
13 | + * @param string $current_username |
|
14 | + * @return boolean True if username is available |
|
15 | + */ |
|
16 | + function validate($username, $current_username = null) { |
|
17 | + $user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
18 | 18 | $username = Database::escape_string($username); |
19 | 19 | $current_username = Database::escape_string($current_username); |
20 | 20 | |
21 | - $sql = "SELECT * FROM $user_table WHERE username = '$username'"; |
|
22 | - if (!is_null($current_username)) { |
|
23 | - $sql .= " AND username != '$current_username'"; |
|
24 | - } |
|
25 | - $res = Database::query($sql); |
|
26 | - $number = Database::num_rows($res); |
|
27 | - return $number == 0; |
|
28 | - } |
|
21 | + $sql = "SELECT * FROM $user_table WHERE username = '$username'"; |
|
22 | + if (!is_null($current_username)) { |
|
23 | + $sql .= " AND username != '$current_username'"; |
|
24 | + } |
|
25 | + $res = Database::query($sql); |
|
26 | + $number = Database::num_rows($res); |
|
27 | + return $number == 0; |
|
28 | + } |
|
29 | 29 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | function validate($html, $mode = NO_HTML) |
18 | 18 | { |
19 | - $allowed_tags = self::get_allowed_tags ($mode, $fullpage); |
|
19 | + $allowed_tags = self::get_allowed_tags($mode, $fullpage); |
|
20 | 20 | $cleaned_html = kses($html, $allowed_tags); |
21 | 21 | return $html == $cleaned_html; |
22 | 22 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // Include the allowed tags. |
34 | 34 | //include(dirname(__FILE__).'/allowed_tags.inc.php'); |
35 | 35 | global $allowed_tags_student, $allowed_tags_student_full_page, $allowed_tags_teacher, $allowed_tags_teacher_full_page; |
36 | - switch($mode) |
|
36 | + switch ($mode) |
|
37 | 37 | { |
38 | 38 | case NO_HTML: |
39 | 39 | return array(); |
@@ -25,8 +25,6 @@ |
||
25 | 25 | * Get allowed tags |
26 | 26 | * @param int $mode NO_HTML, STUDENT_HTML, TEACHER_HTML, |
27 | 27 | * STUDENT_HTML_FULLPAGE or TEACHER_HTML_FULLPAGE |
28 | - * @param boolean $fullpage If true, the allowed tags for full-page editing |
|
29 | - * are returned. |
|
30 | 28 | */ |
31 | 29 | static function get_allowed_tags($mode) |
32 | 30 | { |
@@ -27,10 +27,10 @@ |
||
27 | 27 | */ |
28 | 28 | function validate($value, $options = null) |
29 | 29 | { |
30 | - if(is_array($value)) |
|
31 | - { |
|
32 | - $value = implode(null,$value); |
|
33 | - } |
|
30 | + if(is_array($value)) |
|
31 | + { |
|
32 | + $value = implode(null,$value); |
|
33 | + } |
|
34 | 34 | if ((string)$value == '') { |
35 | 35 | return false; |
36 | 36 | } |
@@ -27,11 +27,11 @@ |
||
27 | 27 | */ |
28 | 28 | function validate($value, $options = null) |
29 | 29 | { |
30 | - if(is_array($value)) |
|
30 | + if (is_array($value)) |
|
31 | 31 | { |
32 | - $value = implode(null,$value); |
|
32 | + $value = implode(null, $value); |
|
33 | 33 | } |
34 | - if ((string)$value == '') { |
|
34 | + if ((string) $value == '') { |
|
35 | 35 | return false; |
36 | 36 | } |
37 | 37 | return true; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | // If the mail only need to be send once (we know that thanks to the events.conf), we log it in the table |
126 | 126 | if ($event_config[$event_name]["sending_mail_once"]) { |
127 | - $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . ' (user_from, user_to, event_type_name) |
|
127 | + $sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_SENT).' (user_from, user_to, event_type_name) |
|
128 | 128 | VALUES ('.$event_data["user_id"].', '.$id.' ,"'.Database::escape_string($event_name).'") |
129 | 129 | '; |
130 | 130 | Database::query($sql); |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | // Second, we send to people linked to the event |
136 | 136 | // So, we get everyone |
137 | 137 | $sql = 'SELECT u.user_id, u.language, u.email, u.firstname, u.lastname |
138 | - FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER) . ' ue |
|
138 | + FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER).' ue |
|
139 | 139 | INNER JOIN '.Database::get_main_table(TABLE_MAIN_USER).' u ON u.user_id = ue.user_id |
140 | - WHERE event_type_name = "' . $event_name . '"'; |
|
140 | + WHERE event_type_name = "' . $event_name.'"'; |
|
141 | 141 | $result = Database::store_result(Database::query($sql), 'ASSOC'); |
142 | 142 | // for each of the linked users |
143 | 143 | foreach ($result as $key => $value) { |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | // If the mail only need to be send once (we know that thanks to the events.conf, we log it in the table |
179 | 179 | if ($event_config[$event_name]["sending_mail_once"]) { |
180 | - $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . ' |
|
180 | + $sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_SENT).' |
|
181 | 181 | (user_from, user_to, event_type_name) |
182 | 182 | VALUES ('.$event_data["user_id"].', '.$value["user_id"].' , "'.Database::escape_string($event_name).'"); |
183 | 183 | '; |
@@ -202,16 +202,16 @@ discard block |
||
202 | 202 | $current_language = api_get_interface_language(); |
203 | 203 | |
204 | 204 | $sql = 'SELECT COUNT(*) as total |
205 | - FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em |
|
206 | - INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE) . ' l |
|
205 | + FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE).' em |
|
206 | + INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE).' l |
|
207 | 207 | ON em.language_id = l.id |
208 | 208 | WHERE |
209 | - em.event_type_name = "' . $event_name . '" and |
|
209 | + em.event_type_name = "' . $event_name.'" and |
|
210 | 210 | l.dokeos_folder = "'.$current_language.'" and |
211 | 211 | em.activated = 1'; |
212 | 212 | |
213 | 213 | $exists = Database::store_result(Database::query($sql), 'ASSOC'); |
214 | - if ($exists[0]["total"]) { |
|
214 | + if ($exists[0]["total"]) { |
|
215 | 215 | return true; |
216 | 216 | } else { |
217 | 217 | return false; |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | private static function getMessage($event_name, $language) |
229 | 229 | { |
230 | 230 | $sql = 'SELECT message, subject, l.dokeos_folder |
231 | - FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em |
|
232 | - INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE) . ' l |
|
231 | + FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE).' em |
|
232 | + INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE).' l |
|
233 | 233 | ON em.language_id = l.id |
234 | 234 | WHERE |
235 | - em.event_type_name = "' . $event_name . '" AND |
|
236 | - (l.dokeos_folder = "' . $language . '" OR l.dokeos_folder = "english") AND |
|
235 | + em.event_type_name = "' . $event_name.'" AND |
|
236 | + (l.dokeos_folder = "' . $language.'" OR l.dokeos_folder = "english") AND |
|
237 | 237 | em.message <> "" |
238 | 238 | '; |
239 | 239 | return Database::store_result(Database::query($sql), 'ASSOC'); |
@@ -274,8 +274,8 @@ discard block |
||
274 | 274 | private static function formatMessage(&$message, &$subject, $event_config, $event_name, &$event_data) |
275 | 275 | { |
276 | 276 | foreach ($event_config[$event_name]["available_keyvars"] as $key => $word) { |
277 | - $message = str_replace('((' . $key . '))', $event_data[$word], $message); |
|
278 | - $subject = str_replace('((' . $key . '))', $event_data[$word], $subject); |
|
277 | + $message = str_replace('(('.$key.'))', $event_data[$word], $message); |
|
278 | + $subject = str_replace('(('.$key.'))', $event_data[$word], $subject); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | } |
@@ -2097,7 +2097,9 @@ |
||
2097 | 2097 | FROM $tbl_course course |
2098 | 2098 | WHERE course.code IN (".implode(',',$courses_code).")"; |
2099 | 2099 | |
2100 | - if (!in_array($direction, array('ASC','DESC'))) $direction = 'ASC'; |
|
2100 | + if (!in_array($direction, array('ASC','DESC'))) { |
|
2101 | + $direction = 'ASC'; |
|
2102 | + } |
|
2101 | 2103 | |
2102 | 2104 | $column = intval($column); |
2103 | 2105 | $from = intval($from); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $session_id = intval($session_id); |
135 | 135 | |
136 | 136 | $sql = 'SELECT login_course_date, logout_course_date |
137 | - FROM ' . $tbl_track_course . ' |
|
137 | + FROM ' . $tbl_track_course.' |
|
138 | 138 | WHERE |
139 | 139 | user_id = '.$user_id.' AND |
140 | 140 | c_id = '.$courseId.' AND |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | foreach ($course_list as $course_item) { |
174 | 174 | $courseInfo = api_get_course_info($course_item['code']); |
175 | 175 | $courseId = $courseInfo['real_id']; |
176 | - $new_course_list[] = '"'.$courseId.'"'; |
|
176 | + $new_course_list[] = '"'.$courseId.'"'; |
|
177 | 177 | } |
178 | 178 | $course_list = implode(', ', $new_course_list); |
179 | 179 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | return false; |
182 | 182 | } |
183 | 183 | $sql = 'SELECT login_course_date, logout_course_date, c_id |
184 | - FROM ' . $tbl_track_course . ' |
|
184 | + FROM ' . $tbl_track_course.' |
|
185 | 185 | WHERE |
186 | 186 | user_id = '.$user_id.' AND |
187 | 187 | c_id IN ('.$course_list.') AND |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | // student score |
260 | 260 | $avg_score = Tracking :: get_avg_student_score($user_id, $courseCode); |
261 | 261 | if (is_numeric($avg_score)) { |
262 | - $avg_score = round($avg_score,2); |
|
262 | + $avg_score = round($avg_score, 2); |
|
263 | 263 | } else { |
264 | 264 | $$avg_score = '-'; |
265 | 265 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | $t_head = ' <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">'; |
297 | 297 | //$t_head .= ' <caption>'.get_lang('CourseInformation').'</caption>'; |
298 | - $t_head .= '<tr>'; |
|
298 | + $t_head .= '<tr>'; |
|
299 | 299 | $t_head .= ' <th width="155px" style="border-left:0;border-bottom:0"><span>'.get_lang('Course').'</span></th>'; |
300 | 300 | $t_head .= ' <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>'; |
301 | 301 | $t_head .= ' <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>'; |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | $addparams = array('view' => 'admin', 'display' => 'user'); |
315 | 315 | |
316 | - $table = new SortableTable('tracking_user_overview', array('MySpace','get_number_of_users_tracking_overview'), array('MySpace','get_user_data_tracking_overview'), 0); |
|
316 | + $table = new SortableTable('tracking_user_overview', array('MySpace', 'get_number_of_users_tracking_overview'), array('MySpace', 'get_user_data_tracking_overview'), 0); |
|
317 | 317 | $table->additional_parameters = $addparams; |
318 | 318 | |
319 | 319 | $table->set_header(0, get_lang('OfficialCode'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt')); |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | } |
327 | 327 | $table->set_header(3, get_lang('LoginName'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt')); |
328 | 328 | $table->set_header(4, $t_head, false, array('style' => 'width:90%;border:0;padding:0;font-size:7.5pt;'), array('style' => 'width:90%;padding:0;font-size:7.5pt;')); |
329 | - $table->set_column_filter(4, array('MySpace','course_info_tracking_filter')); |
|
329 | + $table->set_column_filter(4, array('MySpace', 'course_info_tracking_filter')); |
|
330 | 330 | $table->display(); |
331 | 331 | } |
332 | 332 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $table -> set_header(7, get_lang('Sessions'), false); |
387 | 387 | |
388 | 388 | if ($is_western_name_order) { |
389 | - $csv_header[] = array ( |
|
389 | + $csv_header[] = array( |
|
390 | 390 | get_lang('FirstName'), |
391 | 391 | get_lang('LastName'), |
392 | 392 | get_lang('TimeSpentOnThePlatform'), |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | get_lang('NumberOfSessions') |
397 | 397 | ); |
398 | 398 | } else { |
399 | - $csv_header[] = array ( |
|
399 | + $csv_header[] = array( |
|
400 | 400 | get_lang('LastName'), |
401 | 401 | get_lang('FirstName'), |
402 | 402 | get_lang('TimeSpentOnThePlatform'), |
@@ -536,9 +536,9 @@ discard block |
||
536 | 536 | |
537 | 537 | if ($tracking_column != 3) { |
538 | 538 | if ($tracking_direction == 'DESC') { |
539 | - usort($all_datas, array('MySpace','rsort_users')); |
|
539 | + usort($all_datas, array('MySpace', 'rsort_users')); |
|
540 | 540 | } else { |
541 | - usort($all_datas, array('MySpace','sort_users')); |
|
541 | + usort($all_datas, array('MySpace', 'sort_users')); |
|
542 | 542 | } |
543 | 543 | } |
544 | 544 | |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | /** |
598 | 598 | * Column config |
599 | 599 | */ |
600 | - $column_model = array( |
|
600 | + $column_model = array( |
|
601 | 601 | array( |
602 | 602 | 'name' => 'username', |
603 | 603 | 'index' => 'username', |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | |
639 | 639 | $action_links = ''; |
640 | 640 | // jqgrid will use this URL to do the selects |
641 | - $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_lp_progress&session_id=' . $sessionId . '&course_id=' . $courseId . '&date_to=' . $date_to . '&date_from=' . $date_from; |
|
641 | + $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_lp_progress&session_id='.$sessionId.'&course_id='.$courseId.'&date_to='.$date_to.'&date_from='.$date_from; |
|
642 | 642 | |
643 | 643 | //Table Id |
644 | 644 | $tableId = 'lpProgress'; |
@@ -660,11 +660,11 @@ discard block |
||
660 | 660 | true |
661 | 661 | ); |
662 | 662 | |
663 | - $return = '<script>$(function() {'. $table . |
|
663 | + $return = '<script>$(function() {'.$table. |
|
664 | 664 | 'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true}); |
665 | 665 | jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{ |
666 | 666 | caption:"", |
667 | - title:"' . get_lang('ExportExcel') . '", |
|
667 | + title:"' . get_lang('ExportExcel').'", |
|
668 | 668 | onClickButton : function () { |
669 | 669 | jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"}); |
670 | 670 | } |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | /** |
715 | 715 | * Column config |
716 | 716 | */ |
717 | - $column_model = array( |
|
717 | + $column_model = array( |
|
718 | 718 | array('name'=>'session', 'index'=>'session', 'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"), |
719 | 719 | array('name'=>'exercise_id', 'index'=>'exercise_id', 'align'=>'left', 'search' => 'true'), |
720 | 720 | array('name'=>'quiz_title', 'index'=>'quiz_title', 'align'=>'left', 'search' => 'true'), |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | //get dynamic column names |
732 | 732 | |
733 | 733 | // jqgrid will use this URL to do the selects |
734 | - $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_progress&session_id=' . $sessionId . '&course_id=' . $courseId . '&exercise_id=' . $exerciseId . '&date_to=' . $date_to . '&date_from=' . $date_from; |
|
734 | + $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_progress&session_id='.$sessionId.'&course_id='.$courseId.'&exercise_id='.$exerciseId.'&date_to='.$date_to.'&date_from='.$date_from; |
|
735 | 735 | |
736 | 736 | // Autowidth |
737 | 737 | $extra_params['autowidth'] = 'true'; |
@@ -742,11 +742,11 @@ discard block |
||
742 | 742 | $tableId = 'exerciseProgressOverview'; |
743 | 743 | $table = Display::grid_js($tableId, $url, $columns, $column_model, $extra_params, array(), '', true); |
744 | 744 | |
745 | - $return = '<script>$(function() {'. $table . |
|
745 | + $return = '<script>$(function() {'.$table. |
|
746 | 746 | 'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true}); |
747 | 747 | jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{ |
748 | 748 | caption:"", |
749 | - title:"' . get_lang('ExportExcel') . '", |
|
749 | + title:"' . get_lang('ExportExcel').'", |
|
750 | 750 | onClickButton : function () { |
751 | 751 | jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"}); |
752 | 752 | } |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | // adding the fields that are checked to the session |
807 | 807 | $message = ''; |
808 | 808 | foreach ($values as $field_ids => $value) { |
809 | - if ($value == 1 && strstr($field_ids,'extra_export_field')) { |
|
809 | + if ($value == 1 && strstr($field_ids, 'extra_export_field')) { |
|
810 | 810 | $_SESSION['additional_export_fields'][] = str_replace('extra_export_field', '', $field_ids); |
811 | 811 | } |
812 | 812 | } |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | // Displaying a feedback message |
822 | 822 | if (!empty($_SESSION['additional_export_fields'])) { |
823 | 823 | Display::display_confirmation_message(get_lang('FollowingFieldsWillAlsoBeExported').': <br /><ul>'.$message.'</ul>', false); |
824 | - } else { |
|
824 | + } else { |
|
825 | 825 | Display::display_confirmation_message(get_lang('NoAdditionalFieldsWillBeExported'), false); |
826 | 826 | } |
827 | 827 | } else { |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | { |
850 | 850 | $t_head = ' <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">'; |
851 | 851 | //$t_head .= ' <caption>'.get_lang('CourseInformation').'</caption>'; |
852 | - $t_head .= '<tr>'; |
|
852 | + $t_head .= '<tr>'; |
|
853 | 853 | $t_head .= ' <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>'; |
854 | 854 | $t_head .= ' <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>'; |
855 | 855 | $t_head .= ' <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgCourseScore'), 6, true).'</span></th>'; |
@@ -866,13 +866,13 @@ discard block |
||
866 | 866 | |
867 | 867 | $addparams = array('view' => 'admin', 'display' => 'courseoverview'); |
868 | 868 | |
869 | - $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_courses'), array('MySpace','get_course_data_tracking_overview'), 1); |
|
869 | + $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_courses'), array('MySpace', 'get_course_data_tracking_overview'), 1); |
|
870 | 870 | $table->additional_parameters = $addparams; |
871 | 871 | |
872 | 872 | $table->set_header(0, '', false, null, array('style' => 'display: none')); |
873 | 873 | $table->set_header(1, get_lang('Course'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt')); |
874 | 874 | $table->set_header(2, $t_head, false, array('style' => 'width:90%;border:0;padding:0;font-size:7.5pt;'), array('style' => 'width:90%;padding:0;font-size:7.5pt;')); |
875 | - $table->set_column_filter(2, array('MySpace','course_tracking_filter')); |
|
875 | + $table->set_column_filter(2, array('MySpace', 'course_tracking_filter')); |
|
876 | 876 | $table->display(); |
877 | 877 | } |
878 | 878 | |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | $sql .= " ORDER BY col$column $direction "; |
909 | 909 | $sql .= " LIMIT $from,$number_of_items"; |
910 | 910 | $result = Database::query($sql); |
911 | - $return = array (); |
|
911 | + $return = array(); |
|
912 | 912 | while ($course = Database::fetch_row($result)) { |
913 | 913 | $return[] = $course; |
914 | 914 | } |
@@ -961,18 +961,18 @@ discard block |
||
961 | 961 | $progress += $progress_tmp[0]; |
962 | 962 | $nb_progress_lp += $progress_tmp[1]; |
963 | 963 | $score_tmp = Tracking :: get_avg_student_score($row->user_id, $course_code, array(), null, true); |
964 | - if(is_array($score_tmp)) { |
|
964 | + if (is_array($score_tmp)) { |
|
965 | 965 | $score += $score_tmp[0]; |
966 | 966 | $nb_score_lp += $score_tmp[1]; |
967 | 967 | } |
968 | 968 | $nb_messages += Tracking::count_student_messages($row->user_id, $course_code); |
969 | 969 | $nb_assignments += Tracking::count_student_assignments($row->user_id, $course_code); |
970 | 970 | $last_login_date_tmp = Tracking :: get_last_connection_date_on_the_course($row->user_id, $courseInfo, null, false); |
971 | - if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned |
|
971 | + if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned |
|
972 | 972 | $last_login_date = $last_login_date_tmp; |
973 | - } else if($last_login_date_tmp != false && $last_login_date != false) { // TODO: Repeated previous condition. To be cleaned. |
|
973 | + } else if ($last_login_date_tmp != false && $last_login_date != false) { // TODO: Repeated previous condition. To be cleaned. |
|
974 | 974 | // Find the max and assign it to first_login_date |
975 | - if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) { |
|
975 | + if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) { |
|
976 | 976 | $last_login_date = $last_login_date_tmp; |
977 | 977 | } |
978 | 978 | } |
@@ -1110,7 +1110,7 @@ discard block |
||
1110 | 1110 | $progress += $progress_tmp[0]; |
1111 | 1111 | $nb_progress_lp += $progress_tmp[1]; |
1112 | 1112 | $score_tmp = Tracking :: get_avg_student_score($row->user_id, $course_code, array(), null, true); |
1113 | - if(is_array($score_tmp)) { |
|
1113 | + if (is_array($score_tmp)) { |
|
1114 | 1114 | $score += $score_tmp[0]; |
1115 | 1115 | $nb_score_lp += $score_tmp[1]; |
1116 | 1116 | } |
@@ -1118,11 +1118,11 @@ discard block |
||
1118 | 1118 | $nb_assignments += Tracking::count_student_assignments($row->user_id, $course_code); |
1119 | 1119 | |
1120 | 1120 | $last_login_date_tmp = Tracking::get_last_connection_date_on_the_course($row->user_id, $courseInfo, null, false); |
1121 | - if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned. |
|
1121 | + if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned. |
|
1122 | 1122 | $last_login_date = $last_login_date_tmp; |
1123 | - } else if($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned. |
|
1123 | + } else if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned. |
|
1124 | 1124 | // Find the max and assign it to first_login_date |
1125 | - if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) { |
|
1125 | + if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) { |
|
1126 | 1126 | $last_login_date = $last_login_date_tmp; |
1127 | 1127 | } |
1128 | 1128 | } |
@@ -1132,22 +1132,22 @@ discard block |
||
1132 | 1132 | $total_score_possible += $exercise_results_tmp['score_possible']; |
1133 | 1133 | $total_questions_answered += $exercise_results_tmp['questions_answered']; |
1134 | 1134 | } |
1135 | - if($nb_progress_lp > 0) { |
|
1135 | + if ($nb_progress_lp > 0) { |
|
1136 | 1136 | $avg_progress = round($progress / $nb_progress_lp, 2); |
1137 | 1137 | } else { |
1138 | 1138 | $avg_progress = 0; |
1139 | 1139 | } |
1140 | - if($nb_score_lp > 0) { |
|
1140 | + if ($nb_score_lp > 0) { |
|
1141 | 1141 | $avg_score = round($score / $nb_score_lp, 2); |
1142 | 1142 | } else { |
1143 | 1143 | $avg_score = '-'; |
1144 | 1144 | } |
1145 | - if($last_login_date) { |
|
1145 | + if ($last_login_date) { |
|
1146 | 1146 | $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get()); |
1147 | 1147 | } else { |
1148 | 1148 | $last_login_date = '-'; |
1149 | 1149 | } |
1150 | - if($total_score_possible > 0) { |
|
1150 | + if ($total_score_possible > 0) { |
|
1151 | 1151 | $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2); |
1152 | 1152 | } else { |
1153 | 1153 | $total_score_percentage = 0; |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | { |
1184 | 1184 | $t_head = ' <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">'; |
1185 | 1185 | //$t_head .= ' <caption>'.get_lang('CourseInformation').'</caption>'; |
1186 | - $t_head .= '<tr>'; |
|
1186 | + $t_head .= '<tr>'; |
|
1187 | 1187 | $t_head .= ' <th width="155px" style="border-left:0;border-bottom:0"><span>'.get_lang('Course').'</span></th>'; |
1188 | 1188 | $t_head .= ' <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>'; |
1189 | 1189 | $t_head .= ' <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>'; |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | |
1202 | 1202 | $addparams = array('view' => 'admin', 'display' => 'sessionoverview'); |
1203 | 1203 | |
1204 | - $table = new SortableTable('tracking_session_overview', array('MySpace','get_total_number_sessions'), array('MySpace','get_session_data_tracking_overview'), 1); |
|
1204 | + $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_sessions'), array('MySpace', 'get_session_data_tracking_overview'), 1); |
|
1205 | 1205 | $table->additional_parameters = $addparams; |
1206 | 1206 | |
1207 | 1207 | $table->set_header(0, '', false, null, array('style' => 'display: none')); |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | $sql .= " ORDER BY col$column $direction "; |
1241 | 1241 | $sql .= " LIMIT $from,$number_of_items"; |
1242 | 1242 | $result = Database::query($sql); |
1243 | - $return = array (); |
|
1243 | + $return = array(); |
|
1244 | 1244 | while ($session = Database::fetch_row($result)) { |
1245 | 1245 | $return[] = $session; |
1246 | 1246 | } |
@@ -1329,10 +1329,10 @@ discard block |
||
1329 | 1329 | if ($last_login_date_tmp != false && $last_login_date == false) { |
1330 | 1330 | // TODO: To be cleaned. |
1331 | 1331 | $last_login_date = $last_login_date_tmp; |
1332 | - } else if($last_login_date_tmp != false && $last_login_date != false) { |
|
1332 | + } else if ($last_login_date_tmp != false && $last_login_date != false) { |
|
1333 | 1333 | // TODO: Repeated previous condition! To be cleaned. |
1334 | 1334 | // Find the max and assign it to first_login_date |
1335 | - if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) { |
|
1335 | + if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) { |
|
1336 | 1336 | $last_login_date = $last_login_date_tmp; |
1337 | 1337 | } |
1338 | 1338 | } |
@@ -1342,27 +1342,27 @@ discard block |
||
1342 | 1342 | $total_score_possible += $exercise_results_tmp['score_possible']; |
1343 | 1343 | $total_questions_answered += $exercise_results_tmp['questions_answered']; |
1344 | 1344 | } |
1345 | - if($nb_progress_lp > 0) { |
|
1345 | + if ($nb_progress_lp > 0) { |
|
1346 | 1346 | $avg_progress = round($progress / $nb_progress_lp, 2); |
1347 | 1347 | } else { |
1348 | 1348 | $avg_progress = 0; |
1349 | 1349 | } |
1350 | - if($nb_score_lp > 0) { |
|
1350 | + if ($nb_score_lp > 0) { |
|
1351 | 1351 | $avg_score = round($score / $nb_score_lp, 2); |
1352 | 1352 | } else { |
1353 | 1353 | $avg_score = '-'; |
1354 | 1354 | } |
1355 | - if($last_login_date) { |
|
1355 | + if ($last_login_date) { |
|
1356 | 1356 | $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get()); |
1357 | 1357 | } else { |
1358 | 1358 | $last_login_date = '-'; |
1359 | 1359 | } |
1360 | - if($total_score_possible > 0) { |
|
1360 | + if ($total_score_possible > 0) { |
|
1361 | 1361 | $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2); |
1362 | 1362 | } else { |
1363 | 1363 | $total_score_percentage = 0; |
1364 | 1364 | } |
1365 | - if($total_score_percentage > 0) { |
|
1365 | + if ($total_score_percentage > 0) { |
|
1366 | 1366 | $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)'; |
1367 | 1367 | } else { |
1368 | 1368 | $total_score = '-'; |
@@ -1473,7 +1473,7 @@ discard block |
||
1473 | 1473 | $total_score_obtained = 0; |
1474 | 1474 | $total_score_possible = 0; |
1475 | 1475 | $total_questions_answered = 0; |
1476 | - while($row_user = Database::fetch_object($result_users)) { |
|
1476 | + while ($row_user = Database::fetch_object($result_users)) { |
|
1477 | 1477 | // get time spent in the course and session |
1478 | 1478 | $time_spent += Tracking::get_time_spent_on_the_course($row_user->user_id, $courseId, $session_id); |
1479 | 1479 | $progress_tmp = Tracking::get_avg_student_progress($row_user->user_id, $row->code, array(), $session_id, true); |
@@ -1502,11 +1502,11 @@ discard block |
||
1502 | 1502 | $session_id, |
1503 | 1503 | false |
1504 | 1504 | ); |
1505 | - if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned. |
|
1505 | + if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned. |
|
1506 | 1506 | $last_login_date = $last_login_date_tmp; |
1507 | - } else if($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned. |
|
1507 | + } else if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned. |
|
1508 | 1508 | // Find the max and assign it to first_login_date |
1509 | - if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) { |
|
1509 | + if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) { |
|
1510 | 1510 | $last_login_date = $last_login_date_tmp; |
1511 | 1511 | } |
1512 | 1512 | } |
@@ -1516,27 +1516,27 @@ discard block |
||
1516 | 1516 | $total_score_possible += $exercise_results_tmp['score_possible']; |
1517 | 1517 | $total_questions_answered += $exercise_results_tmp['questions_answered']; |
1518 | 1518 | } |
1519 | - if($nb_progress_lp > 0) { |
|
1519 | + if ($nb_progress_lp > 0) { |
|
1520 | 1520 | $avg_progress = round($progress / $nb_progress_lp, 2); |
1521 | 1521 | } else { |
1522 | 1522 | $avg_progress = 0; |
1523 | 1523 | } |
1524 | - if($nb_score_lp > 0) { |
|
1524 | + if ($nb_score_lp > 0) { |
|
1525 | 1525 | $avg_score = round($score / $nb_score_lp, 2); |
1526 | 1526 | } else { |
1527 | 1527 | $avg_score = '-'; |
1528 | 1528 | } |
1529 | - if($last_login_date) { |
|
1529 | + if ($last_login_date) { |
|
1530 | 1530 | $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get()); |
1531 | 1531 | } else { |
1532 | 1532 | $last_login_date = '-'; |
1533 | 1533 | } |
1534 | - if($total_score_possible > 0) { |
|
1534 | + if ($total_score_possible > 0) { |
|
1535 | 1535 | $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2); |
1536 | 1536 | } else { |
1537 | 1537 | $total_score_percentage = 0; |
1538 | 1538 | } |
1539 | - if($total_score_percentage > 0) { |
|
1539 | + if ($total_score_percentage > 0) { |
|
1540 | 1540 | $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)'; |
1541 | 1541 | } else { |
1542 | 1542 | $total_score = '-'; |
@@ -1596,7 +1596,7 @@ discard block |
||
1596 | 1596 | while ($row = Database::fetch_array($result)) { |
1597 | 1597 | $score_obtained += $row['exe_result']; |
1598 | 1598 | $score_possible += $row['exe_weighting']; |
1599 | - $questions_answered ++; |
|
1599 | + $questions_answered++; |
|
1600 | 1600 | } |
1601 | 1601 | |
1602 | 1602 | if ($score_possible != 0) { |
@@ -1716,9 +1716,9 @@ discard block |
||
1716 | 1716 | } |
1717 | 1717 | } |
1718 | 1718 | // time spent in the course |
1719 | - $csv_row[] = api_time_to_hms(Tracking::get_time_spent_on_the_course ($user[4], $courseId)); |
|
1719 | + $csv_row[] = api_time_to_hms(Tracking::get_time_spent_on_the_course($user[4], $courseId)); |
|
1720 | 1720 | // student progress in course |
1721 | - $csv_row[] = round(Tracking::get_avg_student_progress ($user[4], $row[0]), 2); |
|
1721 | + $csv_row[] = round(Tracking::get_avg_student_progress($user[4], $row[0]), 2); |
|
1722 | 1722 | // student score |
1723 | 1723 | $csv_row[] = round(Tracking::get_avg_student_score($user[4], $row[0]), 2); |
1724 | 1724 | // student tes score |
@@ -1726,7 +1726,7 @@ discard block |
||
1726 | 1726 | // student messages |
1727 | 1727 | $csv_row[] = Tracking::count_student_messages($user[4], $row[0]); |
1728 | 1728 | // student assignments |
1729 | - $csv_row[] = Tracking::count_student_assignments ($user[4], $row[0]); |
|
1729 | + $csv_row[] = Tracking::count_student_assignments($user[4], $row[0]); |
|
1730 | 1730 | // student exercises results |
1731 | 1731 | $exercises_results = MySpace::exercises_results($user[4], $row[0]); |
1732 | 1732 | $csv_row[] = $exercises_results['score_obtained']; |
@@ -1734,7 +1734,7 @@ discard block |
||
1734 | 1734 | $csv_row[] = $exercises_results['questions_answered']; |
1735 | 1735 | $csv_row[] = $exercises_results['percentage']; |
1736 | 1736 | // first connection |
1737 | - $csv_row[] = Tracking::get_first_connection_date_on_the_course ($user[4], $courseId); |
|
1737 | + $csv_row[] = Tracking::get_first_connection_date_on_the_course($user[4], $courseId); |
|
1738 | 1738 | // last connection |
1739 | 1739 | $csv_row[] = strip_tags(Tracking::get_last_connection_date_on_the_course($user[4], $courseInfo)); |
1740 | 1740 | |
@@ -1768,9 +1768,9 @@ discard block |
||
1768 | 1768 | // get all courses with limit |
1769 | 1769 | $sql = "SELECT course.code as col1, course.title as col2 |
1770 | 1770 | FROM $tbl_course course |
1771 | - WHERE course.code IN (".implode(',',$courses_code).")"; |
|
1771 | + WHERE course.code IN (".implode(',', $courses_code).")"; |
|
1772 | 1772 | |
1773 | - if (!in_array($direction, array('ASC','DESC'))) $direction = 'ASC'; |
|
1773 | + if (!in_array($direction, array('ASC', 'DESC'))) $direction = 'ASC'; |
|
1774 | 1774 | |
1775 | 1775 | $column = intval($column); |
1776 | 1776 | $from = intval($from); |
@@ -1839,7 +1839,7 @@ discard block |
||
1839 | 1839 | $table_row[] = $avg_assignments_in_course; |
1840 | 1840 | |
1841 | 1841 | //set the "from" value to know if I access the Reporting by the chamilo tab or the course link |
1842 | - $table_row[] = '<center><a href="../../tracking/courseLog.php?cidReq=' .$course_code.'&from=myspace&id_session='.$session_id.'"> |
|
1842 | + $table_row[] = '<center><a href="../../tracking/courseLog.php?cidReq='.$course_code.'&from=myspace&id_session='.$session_id.'"> |
|
1843 | 1843 | '.Display::return_icon('2rightarrow.png').' |
1844 | 1844 | </a> |
1845 | 1845 | </center>'; |
@@ -1848,7 +1848,7 @@ discard block |
||
1848 | 1848 | $nb_students_in_course, |
1849 | 1849 | $avg_time_spent_in_course, |
1850 | 1850 | is_null($avg_progress_in_course) ? null : $avg_progress_in_course.'%', |
1851 | - is_null($avg_score_in_course) ? null : is_numeric($avg_score_in_course) ? $avg_score_in_course.'%' : $avg_score_in_course , |
|
1851 | + is_null($avg_score_in_course) ? null : is_numeric($avg_score_in_course) ? $avg_score_in_course.'%' : $avg_score_in_course, |
|
1852 | 1852 | is_null($avg_score_in_exercise) ? null : $avg_score_in_exercise.'%', |
1853 | 1853 | $avg_messages_in_course, |
1854 | 1854 | $avg_assignments_in_course, |
@@ -1916,7 +1916,7 @@ discard block |
||
1916 | 1916 | $sql .= " ORDER BY col$column $direction "; |
1917 | 1917 | $sql .= " LIMIT $from,$number_of_items"; |
1918 | 1918 | $result = Database::query($sql); |
1919 | - $return = array (); |
|
1919 | + $return = array(); |
|
1920 | 1920 | while ($user = Database::fetch_row($result)) { |
1921 | 1921 | $return[] = $user; |
1922 | 1922 | } |
@@ -1971,7 +1971,7 @@ discard block |
||
1971 | 1971 | $i++; |
1972 | 1972 | } |
1973 | 1973 | } |
1974 | - $username_array = array('username' => $desired_username , 'sufix' => $sufix); |
|
1974 | + $username_array = array('username' => $desired_username, 'sufix' => $sufix); |
|
1975 | 1975 | return $username_array; |
1976 | 1976 | } else { |
1977 | 1977 | $username_array = array('username' => $username, 'sufix' => ''); |
@@ -2246,7 +2246,7 @@ discard block |
||
2246 | 2246 | foreach ($users as $index => $user) { |
2247 | 2247 | $userid = $user['id']; |
2248 | 2248 | $sql_insert = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id, registered_at) |
2249 | - VALUES ('$id_session','$userid', '" . api_get_utc_datetime() . "')"; |
|
2249 | + VALUES ('$id_session','$userid', '".api_get_utc_datetime()."')"; |
|
2250 | 2250 | Database::query($sql_insert); |
2251 | 2251 | $user['added_at_session'] = 1; |
2252 | 2252 | $new_users[] = $user; |
@@ -2280,10 +2280,10 @@ discard block |
||
2280 | 2280 | ); |
2281 | 2281 | $userInfo = api_get_user_info($user['id']); |
2282 | 2282 | |
2283 | - if (($user['added_at_platform'] == 1 && $user['added_at_session'] == 1) || $user['added_at_session'] == 1) { |
|
2283 | + if (($user['added_at_platform'] == 1 && $user['added_at_session'] == 1) || $user['added_at_session'] == 1) { |
|
2284 | 2284 | if ($user['added_at_platform'] == 1) { |
2285 | 2285 | $addedto = get_lang('UserCreatedPlatform'); |
2286 | - } else { |
|
2286 | + } else { |
|
2287 | 2287 | $addedto = ' '; |
2288 | 2288 | } |
2289 | 2289 | |
@@ -2346,7 +2346,7 @@ discard block |
||
2346 | 2346 | global $current_tag; |
2347 | 2347 | switch ($data) { |
2348 | 2348 | case 'Contact' : |
2349 | - $user = array (); |
|
2349 | + $user = array(); |
|
2350 | 2350 | break; |
2351 | 2351 | default : |
2352 | 2352 | $current_tag = $data; |
@@ -2393,9 +2393,9 @@ discard block |
||
2393 | 2393 | global $current_value; |
2394 | 2394 | global $user; |
2395 | 2395 | global $users; |
2396 | - $users = array (); |
|
2396 | + $users = array(); |
|
2397 | 2397 | $parser = xml_parser_create('UTF-8'); |
2398 | - xml_set_element_handler($parser, array('MySpace','element_start'), array('MySpace','element_end')); |
|
2398 | + xml_set_element_handler($parser, array('MySpace', 'element_start'), array('MySpace', 'element_end')); |
|
2399 | 2399 | xml_set_character_data_handler($parser, "character_data"); |
2400 | 2400 | xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false); |
2401 | 2401 | xml_parse($parser, api_utf8_encode_xml(file_get_contents($file))); |
@@ -2441,7 +2441,7 @@ discard block |
||
2441 | 2441 | get_lang('SearchCourse'), |
2442 | 2442 | $courseList, |
2443 | 2443 | [ |
2444 | - 'url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?' . http_build_query([ |
|
2444 | + 'url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?'.http_build_query([ |
|
2445 | 2445 | 'a' => 'search_course_by_session_all', |
2446 | 2446 | 'session_id' => $sessionId |
2447 | 2447 | ]) |
@@ -2460,7 +2460,7 @@ discard block |
||
2460 | 2460 | course_id: $('#course_id').val() || 0 |
2461 | 2461 | }); |
2462 | 2462 | |
2463 | - return '" . api_get_path(WEB_AJAX_PATH) . "session.ajax.php?' + params; |
|
2463 | + return '" . api_get_path(WEB_AJAX_PATH)."session.ajax.php?' + params; |
|
2464 | 2464 | } |
2465 | 2465 | " |
2466 | 2466 | ] |
@@ -2491,7 +2491,7 @@ discard block |
||
2491 | 2491 | course_id: $('#course_id').val() |
2492 | 2492 | }); |
2493 | 2493 | |
2494 | - return '" . api_get_path(WEB_AJAX_PATH) . "course.ajax.php?' + params; |
|
2494 | + return '" . api_get_path(WEB_AJAX_PATH)."course.ajax.php?' + params; |
|
2495 | 2495 | } |
2496 | 2496 | " |
2497 | 2497 | ] |
@@ -2579,7 +2579,7 @@ discard block |
||
2579 | 2579 | " : " |
2580 | 2580 | u.lastname AS col2, |
2581 | 2581 | u.firstname AS col3, |
2582 | - " ) . " |
|
2582 | + " )." |
|
2583 | 2583 | a.logout_course_date, |
2584 | 2584 | c.title, |
2585 | 2585 | c.code, |
@@ -2590,7 +2590,7 @@ discard block |
||
2590 | 2590 | |
2591 | 2591 | if (isset($_GET['session_id']) && !empty($_GET['session_id'])) { |
2592 | 2592 | $sessionId = intval($_GET['session_id']); |
2593 | - $sql .= " WHERE a.session_id = " . $sessionId; |
|
2593 | + $sql .= " WHERE a.session_id = ".$sessionId; |
|
2594 | 2594 | } |
2595 | 2595 | |
2596 | 2596 | $sql .= " ORDER BY col$column $orderDirection "; |
@@ -2696,13 +2696,13 @@ discard block |
||
2696 | 2696 | function get_stats($user_id, $courseId, $start_date = null, $end_date = null) |
2697 | 2697 | { |
2698 | 2698 | // Database table definitions |
2699 | - $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
2699 | + $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
2700 | 2700 | |
2701 | 2701 | $course_info = api_get_course_info_by_id($courseId); |
2702 | 2702 | if (!empty($course_info)) { |
2703 | 2703 | $strg_sd = ''; |
2704 | 2704 | $strg_ed = ''; |
2705 | - if ($start_date != null && $end_date != null){ |
|
2705 | + if ($start_date != null && $end_date != null) { |
|
2706 | 2706 | $end_date = add_day_to($end_date); |
2707 | 2707 | $strg_sd = "AND login_course_date BETWEEN '$start_date' AND '$end_date'"; |
2708 | 2708 | $strg_ed = "AND logout_course_date BETWEEN '$start_date' AND '$end_date'"; |
@@ -2711,10 +2711,10 @@ discard block |
||
2711 | 2711 | SEC_TO_TIME(avg(time_to_sec(timediff(logout_course_date,login_course_date)))) as avrg, |
2712 | 2712 | SEC_TO_TIME(sum(time_to_sec(timediff(logout_course_date,login_course_date)))) as total, |
2713 | 2713 | count(user_id) as times |
2714 | - FROM ' . $tbl_track_course . ' |
|
2714 | + FROM ' . $tbl_track_course.' |
|
2715 | 2715 | WHERE |
2716 | - user_id = ' . intval($user_id) . ' AND |
|
2717 | - c_id = ' . intval($courseId) . ' '.$strg_sd.' '.$strg_ed.' '.' |
|
2716 | + user_id = ' . intval($user_id).' AND |
|
2717 | + c_id = ' . intval($courseId).' '.$strg_sd.' '.$strg_ed.' '.' |
|
2718 | 2718 | ORDER BY login_course_date ASC'; |
2719 | 2719 | |
2720 | 2720 | $rs = Database::query($sql); |
@@ -2732,7 +2732,7 @@ discard block |
||
2732 | 2732 | } |
2733 | 2733 | |
2734 | 2734 | function add_day_to($end_date) { |
2735 | - $foo_date = strtotime( $end_date ); |
|
2735 | + $foo_date = strtotime($end_date); |
|
2736 | 2736 | $foo_date = strtotime(" +1 day", $foo_date); |
2737 | 2737 | $foo_date = date("Y-m-d", $foo_date); |
2738 | 2738 | return $foo_date; |
@@ -2746,7 +2746,7 @@ discard block |
||
2746 | 2746 | * @version OCT-22- 2010 |
2747 | 2747 | * @return array |
2748 | 2748 | */ |
2749 | -function convert_to_array($sql_result){ |
|
2749 | +function convert_to_array($sql_result) { |
|
2750 | 2750 | $result_to_print = '<table>'; |
2751 | 2751 | foreach ($sql_result as $key => $data) { |
2752 | 2752 | $result_to_print .= '<tr><td>'.date('d-m-Y (H:i:s)', $data['login']).'</td><td>'.api_time_to_hms($data['logout'] - $data['login']).'</tr></td>'."\n"; |
@@ -2765,7 +2765,7 @@ discard block |
||
2765 | 2765 | * @version OCT-22- 2010 |
2766 | 2766 | * @return string |
2767 | 2767 | */ |
2768 | -function convert_to_string($sql_result){ |
|
2768 | +function convert_to_string($sql_result) { |
|
2769 | 2769 | $result_to_print = '<table>'; |
2770 | 2770 | if (!empty($sql_result)) { |
2771 | 2771 | foreach ($sql_result as $key => $data) { |
@@ -2790,18 +2790,18 @@ discard block |
||
2790 | 2790 | */ |
2791 | 2791 | function grapher($sql_result, $start_date, $end_date, $type = "") |
2792 | 2792 | { |
2793 | - if (empty($start_date)) { $start_date =""; } |
|
2794 | - if (empty($end_date)) { $end_date =""; } |
|
2795 | - if ($type == ""){ $type = 'day'; } |
|
2796 | - $main_year = $main_month_year = $main_day = array(); |
|
2793 | + if (empty($start_date)) { $start_date = ""; } |
|
2794 | + if (empty($end_date)) { $end_date = ""; } |
|
2795 | + if ($type == "") { $type = 'day'; } |
|
2796 | + $main_year = $main_month_year = $main_day = array(); |
|
2797 | 2797 | // get last 8 days/months |
2798 | 2798 | $last_days = 5; |
2799 | 2799 | $last_months = 3; |
2800 | 2800 | for ($i = $last_days; $i >= 0; $i--) { |
2801 | - $main_day[date ('d-m-Y', time () - $i * 3600 * 24)] = 0; |
|
2801 | + $main_day[date('d-m-Y', time() - $i * 3600 * 24)] = 0; |
|
2802 | 2802 | } |
2803 | 2803 | for ($i = $last_months; $i >= 0; $i--) { |
2804 | - $main_month_year[date ('m-Y', time () - $i * 30 * 3600 * 24)] = 0; |
|
2804 | + $main_month_year[date('m-Y', time() - $i * 30 * 3600 * 24)] = 0; |
|
2805 | 2805 | } |
2806 | 2806 | |
2807 | 2807 | $i = 0; |
@@ -2837,7 +2837,7 @@ discard block |
||
2837 | 2837 | /* Create and populate the pData object */ |
2838 | 2838 | $myData = new pData(); |
2839 | 2839 | $myData->addPoints($main_date, 'Serie1'); |
2840 | - if (count($main_date)!= 1) { |
|
2840 | + if (count($main_date) != 1) { |
|
2841 | 2841 | $myData->addPoints($labels, 'Labels'); |
2842 | 2842 | $myData->setSerieDescription('Labels', 'Months'); |
2843 | 2843 | $myData->setAbscissa('Labels'); |
@@ -2845,7 +2845,7 @@ discard block |
||
2845 | 2845 | $myData->setSerieWeight('Serie1', 1); |
2846 | 2846 | $myData->setSerieDescription('Serie1', get_lang('MyResults')); |
2847 | 2847 | $myData->setAxisName(0, get_lang('Minutes')); |
2848 | - $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
2848 | + $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
2849 | 2849 | |
2850 | 2850 | // Cache definition |
2851 | 2851 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
@@ -2854,9 +2854,9 @@ discard block |
||
2854 | 2854 | |
2855 | 2855 | if ($myCache->isInCache($chartHash)) { |
2856 | 2856 | //if we already created the img |
2857 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
2857 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
2858 | 2858 | $myCache->saveFromCache($chartHash, $imgPath); |
2859 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
2859 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
2860 | 2860 | } else { |
2861 | 2861 | /* Define width, height and angle */ |
2862 | 2862 | $mainWidth = 760; |
@@ -2885,7 +2885,7 @@ discard block |
||
2885 | 2885 | /* Set the default font */ |
2886 | 2886 | $myPicture->setFontProperties( |
2887 | 2887 | array( |
2888 | - "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
2888 | + "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
2889 | 2889 | "FontSize" => 10) |
2890 | 2890 | ); |
2891 | 2891 | /* Write the chart title */ |
@@ -2902,7 +2902,7 @@ discard block |
||
2902 | 2902 | /* Set the default font */ |
2903 | 2903 | $myPicture->setFontProperties( |
2904 | 2904 | array( |
2905 | - "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
2905 | + "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
2906 | 2906 | "FontSize" => 8 |
2907 | 2907 | ) |
2908 | 2908 | ); |
@@ -2944,7 +2944,7 @@ discard block |
||
2944 | 2944 | /* Draw the line chart */ |
2945 | 2945 | $myPicture->setFontProperties( |
2946 | 2946 | array( |
2947 | - "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
2947 | + "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
2948 | 2948 | "FontSize" => 10 |
2949 | 2949 | ) |
2950 | 2950 | ); |
@@ -2963,15 +2963,15 @@ discard block |
||
2963 | 2963 | |
2964 | 2964 | /* Write and save into cache */ |
2965 | 2965 | $myCache->writeToCache($chartHash, $myPicture); |
2966 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
2966 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
2967 | 2967 | $myCache->saveFromCache($chartHash, $imgPath); |
2968 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
2968 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
2969 | 2969 | } |
2970 | - $html = '<img src="' . $imgPath . '">'; |
|
2970 | + $html = '<img src="'.$imgPath.'">'; |
|
2971 | 2971 | |
2972 | 2972 | return $html; |
2973 | 2973 | } else { |
2974 | - $foo_img = api_convert_encoding('<div id="messages" class="warning-message">'.get_lang('GraphicNotAvailable').'</div>','UTF-8'); |
|
2974 | + $foo_img = api_convert_encoding('<div id="messages" class="warning-message">'.get_lang('GraphicNotAvailable').'</div>', 'UTF-8'); |
|
2975 | 2975 | |
2976 | 2976 | return $foo_img; |
2977 | 2977 | } |
@@ -679,7 +679,6 @@ discard block |
||
679 | 679 | * @param int $sessionId The session ID |
680 | 680 | * @param int $courseId The course ID |
681 | 681 | * @param int $exerciseId The quiz ID |
682 | - * @param int $answer Answer status (0 = incorrect, 1 = correct, 2 = both) |
|
683 | 682 | * @return string HTML array of results formatted for gridJS |
684 | 683 | * @author César Perales <[email protected]>, Beeznest Team |
685 | 684 | */ |
@@ -898,6 +897,7 @@ discard block |
||
898 | 897 | * @param int Number of items to select |
899 | 898 | * @param string Column to order on |
900 | 899 | * @param string Order direction |
900 | + * @param integer $number_of_items |
|
901 | 901 | * @return array Results |
902 | 902 | */ |
903 | 903 | public static function get_course_data_tracking_overview($from, $number_of_items, $column, $direction) |
@@ -1235,6 +1235,7 @@ discard block |
||
1235 | 1235 | * @param int Number of items to select |
1236 | 1236 | * @param string Column to order on |
1237 | 1237 | * @param string Order direction |
1238 | + * @param integer $number_of_items |
|
1238 | 1239 | * @return array Results |
1239 | 1240 | */ |
1240 | 1241 | public static function get_session_data_tracking_overview($from, $number_of_items, $column, $direction) |
@@ -1255,7 +1256,6 @@ discard block |
||
1255 | 1256 | /** |
1256 | 1257 | * Fills in session reporting data |
1257 | 1258 | * |
1258 | - * @param integer $user_id the id of the user |
|
1259 | 1259 | * @param array $url_params additonal url parameters |
1260 | 1260 | * @param array $row the row information (the other columns) |
1261 | 1261 | * @return string html code |
@@ -1888,6 +1888,7 @@ discard block |
||
1888 | 1888 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
1889 | 1889 | * @version Dokeos 1.8.6 |
1890 | 1890 | * @since October 2008 |
1891 | + * @param integer $number_of_items |
|
1891 | 1892 | */ |
1892 | 1893 | public static function get_user_data_tracking_overview($from, $number_of_items, $column, $direction) |
1893 | 1894 | { |
@@ -1990,7 +1991,6 @@ discard block |
||
1990 | 1991 | /** |
1991 | 1992 | * Checks if there are repeted users in a given array |
1992 | 1993 | * @param array $usernames list of the usernames in the uploaded file |
1993 | - * @param array $user_array['username'] and $user_array['sufix'] where sufix is the number part in a login i.e -> jmontoya2 |
|
1994 | 1994 | * @return array with the $usernames array and the $user_array array |
1995 | 1995 | * @author Julio Montoya |
1996 | 1996 | */ |
@@ -2165,6 +2165,7 @@ discard block |
||
2165 | 2165 | |
2166 | 2166 | /** |
2167 | 2167 | * Adds missing user-information (which isn't required, like password, etc). |
2168 | + * @return integer |
|
2168 | 2169 | */ |
2169 | 2170 | function complete_missing_data($user) { |
2170 | 2171 | // 1. Generate a password if it is necessary. |