@@ -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 | } |
@@ -16,7 +16,6 @@ |
||
16 | 16 | * @author Patrick Cool |
17 | 17 | * @author René Haentjens, added CSV file import (October 2004) |
18 | 18 | * @package chamilo.link |
19 | - |
|
20 | 19 | */ |
21 | 20 | |
22 | 21 | // Including libraries |
@@ -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,66 +10,66 @@ 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 | - } |
|
40 | - /** |
|
41 | - * Create the form elements to build this element group |
|
42 | - */ |
|
43 | - function _createElements() |
|
44 | - { |
|
45 | - $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')')); |
|
46 | - $this->_elements[0]->setChecked(true); |
|
47 | - $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array ('onclick' => 'javascript:receivers_show(\'receivers_to\')')); |
|
48 | - $this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers); |
|
49 | - $this->_elements[2]->setSelected($this->receivers_selected); |
|
50 | - } |
|
51 | - /** |
|
52 | - * HTML representation |
|
53 | - */ |
|
54 | - public function toHtml() |
|
55 | - { |
|
56 | - include_once ('HTML/QuickForm/Renderer/Default.php'); |
|
57 | - $this->_separator = '<br/>'; |
|
58 | - $renderer = & new HTML_QuickForm_Renderer_Default(); |
|
59 | - $renderer->setElementTemplate('{element}'); |
|
60 | - $select_boxes = $this->_elements[2]; |
|
61 | - $select_boxes->setElementTemplate('<div style="margin-left:20px;display:block;" id="receivers_'.$select_boxes->getName().'">'.$select_boxes->_elementTemplate.'</div>'); |
|
62 | - parent :: accept($renderer); |
|
63 | - $js = $this->getElementJS(); |
|
64 | - return $renderer->toHtml().$js; |
|
65 | - } |
|
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 | + /** |
|
41 | + * Create the form elements to build this element group |
|
42 | + */ |
|
43 | + function _createElements() |
|
44 | + { |
|
45 | + $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')')); |
|
46 | + $this->_elements[0]->setChecked(true); |
|
47 | + $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array ('onclick' => 'javascript:receivers_show(\'receivers_to\')')); |
|
48 | + $this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers); |
|
49 | + $this->_elements[2]->setSelected($this->receivers_selected); |
|
50 | + } |
|
51 | + /** |
|
52 | + * HTML representation |
|
53 | + */ |
|
54 | + public function toHtml() |
|
55 | + { |
|
56 | + include_once ('HTML/QuickForm/Renderer/Default.php'); |
|
57 | + $this->_separator = '<br/>'; |
|
58 | + $renderer = & new HTML_QuickForm_Renderer_Default(); |
|
59 | + $renderer->setElementTemplate('{element}'); |
|
60 | + $select_boxes = $this->_elements[2]; |
|
61 | + $select_boxes->setElementTemplate('<div style="margin-left:20px;display:block;" id="receivers_'.$select_boxes->getName().'">'.$select_boxes->_elementTemplate.'</div>'); |
|
62 | + parent :: accept($renderer); |
|
63 | + $js = $this->getElementJS(); |
|
64 | + return $renderer->toHtml().$js; |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Get the necessary javascript |
|
69 | - */ |
|
67 | + /** |
|
68 | + * Get the necessary javascript |
|
69 | + */ |
|
70 | 70 | public function getElementJS() |
71 | - { |
|
72 | - $js = "<script type=\"text/javascript\"> |
|
71 | + { |
|
72 | + $js = "<script type=\"text/javascript\"> |
|
73 | 73 | /* <![CDATA[ */ |
74 | 74 | receivers_hide('receivers_to'); |
75 | 75 | function receivers_show(item) { |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | } |
83 | 83 | /* ]]> */ |
84 | 84 | </script>\n"; |
85 | - return $js; |
|
86 | - } |
|
87 | - /** |
|
88 | - * accept renderer |
|
89 | - */ |
|
90 | - function accept(& $renderer, $required = false, $error = null) |
|
91 | - { |
|
92 | - $renderer->renderElement($this, $required, $error); |
|
93 | - } |
|
85 | + return $js; |
|
86 | + } |
|
87 | + /** |
|
88 | + * accept renderer |
|
89 | + */ |
|
90 | + function accept(& $renderer, $required = false, $error = null) |
|
91 | + { |
|
92 | + $renderer->renderElement($this, $required, $error); |
|
93 | + } |
|
94 | 94 | } |
95 | 95 | ?> |
@@ -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); |
@@ -7,16 +7,16 @@ |
||
7 | 7 | */ |
8 | 8 | class HTML_QuickForm_Rule_Date extends HTML_QuickForm_Rule |
9 | 9 | { |
10 | - /** |
|
11 | - * Check a date |
|
12 | - * @see HTML_QuickForm_Rule |
|
13 | - * @param string $date example 2014-04-30 |
|
10 | + /** |
|
11 | + * Check a date |
|
12 | + * @see HTML_QuickForm_Rule |
|
13 | + * @param string $date example 2014-04-30 |
|
14 | 14 | * @param array $options |
15 | 15 | * |
16 | - * @return boolean True if date is valid |
|
17 | - */ |
|
18 | - public function validate($date, $options) |
|
19 | - { |
|
16 | + * @return boolean True if date is valid |
|
17 | + */ |
|
18 | + public function validate($date, $options) |
|
19 | + { |
|
20 | 20 | return api_is_valid_date($date, 'Y-m-d'); |
21 | - } |
|
21 | + } |
|
22 | 22 | } |
@@ -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 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @return boolean True if the 2 given dates match the operator |
13 | 13 | */ |
14 | 14 | function validate($values, $operator = null) { |
15 | - $datetime1 = api_strtotime($values[0]); |
|
15 | + $datetime1 = api_strtotime($values[0]); |
|
16 | 16 | $datetime2 = api_strtotime($values[1]); |
17 | 17 | |
18 | 18 | if (strpos($operator, 'allow_empty') !== false) { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | return true; |
22 | 22 | } |
23 | 23 | } |
24 | - $result = parent::validate(array($datetime1, $datetime2), $operator); |
|
24 | + $result = parent::validate(array($datetime1, $datetime2), $operator); |
|
25 | 25 | return $result; |
26 | 26 | } |
27 | 27 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | return true; |
22 | 22 | } |
23 | 23 | } |
24 | - $result = parent::validate(array($datetime1, $datetime2), $operator); |
|
24 | + $result = parent::validate(array($datetime1, $datetime2), $operator); |
|
25 | 25 | return $result; |
26 | 26 | } |
27 | 27 | } |
@@ -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; |