@@ -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 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | // then print the title in the PDF |
239 | 239 | if (is_array($file) && isset($file['title'])) { |
240 | 240 | $html_title = $file['title']; |
241 | - $file = $file['path']; |
|
241 | + $file = $file['path']; |
|
242 | 242 | } else { |
243 | 243 | //we suppose we've only been sent a file path |
244 | 244 | $html_title = basename($file); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | //it's not a chapter but the file exists, print its title |
270 | 270 | if ($print_title) { |
271 | 271 | $this->pdf->WriteHTML( |
272 | - '<html><body><h3>' . $html_title . '</h3></body></html>' |
|
272 | + '<html><body><h3>'.$html_title.'</h3></body></html>' |
|
273 | 273 | ); |
274 | 274 | } |
275 | 275 | |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | $filename = str_replace('_', ' ', $filename); |
283 | 283 | |
284 | 284 | if ($extension === 'html') { |
285 | - $filename = basename($filename,'.html'); |
|
286 | - } elseif($extension === 'htm'){ |
|
287 | - $filename = basename($filename,'.htm'); |
|
285 | + $filename = basename($filename, '.html'); |
|
286 | + } elseif ($extension === 'htm') { |
|
287 | + $filename = basename($filename, '.htm'); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | $document_html = @file_get_contents($file); |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | $document_html = str_replace('href="./css/frames.css"', $absolute_css_path, $document_html); |
296 | 296 | |
297 | 297 | if (!empty($course_data['path'])) { |
298 | - $document_html= str_replace('../', '', $document_html); |
|
298 | + $document_html = str_replace('../', '', $document_html); |
|
299 | 299 | $document_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document/'; |
300 | 300 | |
301 | 301 | $doc = new DOMDocument(); |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | if (!empty($document_html)) { |
374 | 374 | $this->pdf->WriteHTML($document_html.$page_break); |
375 | 375 | } |
376 | - } elseif (in_array($extension, array('jpg','jpeg','png','gif'))) { |
|
376 | + } elseif (in_array($extension, array('jpg', 'jpeg', 'png', 'gif'))) { |
|
377 | 377 | //Images |
378 | 378 | $image = Display::img($file); |
379 | 379 | $this->pdf->WriteHTML('<html><body>'.$image.'</body></html>'.$page_break); |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | |
437 | 437 | //absolute path for frames.css //TODO: necessary? |
438 | 438 | $absolute_css_path = api_get_path(WEB_CSS_PATH).api_get_setting('stylesheets').'/frames.css'; |
439 | - $document_html = str_replace('href="./css/frames.css"','href="'.$absolute_css_path.'"', $document_html); |
|
439 | + $document_html = str_replace('href="./css/frames.css"', 'href="'.$absolute_css_path.'"', $document_html); |
|
440 | 440 | |
441 | 441 | $document_html = str_replace('../../', '', $document_html); |
442 | 442 | $document_html = str_replace('../', '', $document_html); |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | $old_src_fixed = str_replace(api_get_path(REL_COURSE_PATH).$course_data['path'].'/document/', '', $old_src); |
465 | 465 | $old_src_fixed = str_replace('courses/'.$course_data['path'].'/document/', '', $old_src_fixed); |
466 | 466 | $new_path = $document_path.$old_src_fixed; |
467 | - $document_html= str_replace($old_src, $new_path, $document_html); |
|
467 | + $document_html = str_replace($old_src, $new_path, $document_html); |
|
468 | 468 | |
469 | 469 | } |
470 | 470 | } |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | //$document_html= str_replace('temp_template_path', 'src="/main/default_course_document/', $document_html);// restore src templates |
484 | 484 | |
485 | 485 | api_set_encoding_html($document_html, 'UTF-8'); // The library mPDF expects UTF-8 encoded input data. |
486 | - $title = api_get_title_html($document_html, 'UTF-8', 'UTF-8'); // TODO: Maybe it is better idea the title to be passed through |
|
486 | + $title = api_get_title_html($document_html, 'UTF-8', 'UTF-8'); // TODO: Maybe it is better idea the title to be passed through |
|
487 | 487 | // $_GET[] too, as it is done with file name. |
488 | 488 | // At the moment the title is retrieved from the html document itself. |
489 | 489 | |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | //$this->pdf->Output($output_file, $outputMode); // F to save the pdf in a file |
506 | 506 | |
507 | 507 | if ($outputMode == 'F') { |
508 | - $output_file = api_get_path(SYS_ARCHIVE_PATH) . $output_file; |
|
508 | + $output_file = api_get_path(SYS_ARCHIVE_PATH).$output_file; |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | if ($saveInFile) { |
@@ -538,14 +538,14 @@ discard block |
||
538 | 538 | $web_path = false; |
539 | 539 | if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') { |
540 | 540 | $course_info = api_get_course_info($course_code); |
541 | - $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
541 | + $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
542 | 542 | if (file_exists($store_path)) { |
543 | - $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
543 | + $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
544 | 544 | } |
545 | 545 | } else { |
546 | - $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
546 | + $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
547 | 547 | if (file_exists($store_path)) |
548 | - $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
548 | + $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
549 | 549 | } |
550 | 550 | return $web_path; |
551 | 551 | } |
@@ -585,10 +585,10 @@ discard block |
||
585 | 585 | { |
586 | 586 | if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') { |
587 | 587 | $course_info = api_get_course_info($course_code); |
588 | - $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path']; // course path |
|
588 | + $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path']; // course path |
|
589 | 589 | $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/pdf_watermark.png'; |
590 | 590 | } else { |
591 | - $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images'; // course path |
|
591 | + $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images'; // course path |
|
592 | 592 | $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
593 | 593 | } |
594 | 594 | $course_image = $store_path.'/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
@@ -621,9 +621,9 @@ discard block |
||
621 | 621 | */ |
622 | 622 | public function set_footer() |
623 | 623 | { |
624 | - $this->pdf->defaultfooterfontsize = 12; // in pts |
|
625 | - $this->pdf->defaultfooterfontstyle = 'B'; // blank, B, I, or BI |
|
626 | - $this->pdf->defaultfooterline = 1; // 1 to include line below header/above footer |
|
624 | + $this->pdf->defaultfooterfontsize = 12; // in pts |
|
625 | + $this->pdf->defaultfooterfontstyle = 'B'; // blank, B, I, or BI |
|
626 | + $this->pdf->defaultfooterline = 1; // 1 to include line below header/above footer |
|
627 | 627 | $platform_name = api_get_setting('Institution'); |
628 | 628 | $left_content = $platform_name; |
629 | 629 | $center_content = ''; |
@@ -690,9 +690,9 @@ discard block |
||
690 | 690 | */ |
691 | 691 | public function set_header($course_data) |
692 | 692 | { |
693 | - $this->pdf->defaultheaderfontsize = 10; // in pts |
|
694 | - $this->pdf->defaultheaderfontstyle = 'BI'; // blank, B, I, or BI |
|
695 | - $this->pdf->defaultheaderline = 1; // 1 to include line below header/above footer |
|
693 | + $this->pdf->defaultheaderfontsize = 10; // in pts |
|
694 | + $this->pdf->defaultheaderfontstyle = 'BI'; // blank, B, I, or BI |
|
695 | + $this->pdf->defaultheaderline = 1; // 1 to include line below header/above footer |
|
696 | 696 | |
697 | 697 | if (!empty($course_data['code'])) { |
698 | 698 | $teacher_list = CourseManager::get_teacher_list_from_course_code($course_data['code']); |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | $teachers = ''; |
701 | 701 | if (!empty($teacher_list)) { |
702 | 702 | foreach ($teacher_list as $teacher) { |
703 | - $teachers[]= $teacher['firstname'].' '.$teacher['lastname']; |
|
703 | + $teachers[] = $teacher['firstname'].' '.$teacher['lastname']; |
|
704 | 704 | } |
705 | 705 | if (count($teachers) > 1) { |
706 | 706 | $teachers = get_lang('Teachers').': '.implode(', ', $teachers); |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | 'line' => 1, |
768 | 768 | ), |
769 | 769 | ); |
770 | - $this->pdf->SetHeader($header);// ('{DATE j-m-Y}|{PAGENO}/{nb}|'.$title); |
|
770 | + $this->pdf->SetHeader($header); // ('{DATE j-m-Y}|{PAGENO}/{nb}|'.$title); |
|
771 | 771 | } |
772 | 772 | } |
773 | 773 | |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | $this->pdf->directionality = api_get_text_direction(); |
813 | 813 | $this->pdf->useOnlyCoreFonts = true; |
814 | 814 | // Use different Odd/Even headers and footers and mirror margins |
815 | - $this->pdf->mirrorMargins = 1; |
|
815 | + $this->pdf->mirrorMargins = 1; |
|
816 | 816 | |
817 | 817 | // Add decoration only if not stated otherwise |
818 | 818 | if ($complete) { |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | $watermark_text = api_get_setting('pdf_export_watermark_text'); |
841 | 841 | } |
842 | 842 | if (!empty($watermark_text)) { |
843 | - $this->pdf->SetWatermarkText(strcode2utf($watermark_text),0.1); |
|
843 | + $this->pdf->SetWatermarkText(strcode2utf($watermark_text), 0.1); |
|
844 | 844 | $this->pdf->showWatermarkText = true; |
845 | 845 | } |
846 | 846 | } |
@@ -848,8 +848,8 @@ discard block |
||
848 | 848 | if (empty($this->custom_header)) { |
849 | 849 | self::set_header($course_data); |
850 | 850 | } else { |
851 | - $this->pdf->SetHTMLHeader($this->custom_header,'E'); |
|
852 | - $this->pdf->SetHTMLHeader($this->custom_header,'O'); |
|
851 | + $this->pdf->SetHTMLHeader($this->custom_header, 'E'); |
|
852 | + $this->pdf->SetHTMLHeader($this->custom_header, 'O'); |
|
853 | 853 | } |
854 | 854 | |
855 | 855 | 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); |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | $value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H); |
45 | 45 | } |
46 | 46 | |
47 | - return $this->getElementJS() . ' |
|
47 | + return $this->getElementJS().' |
|
48 | 48 | <div class="input-group"> |
49 | 49 | <span class="input-group-addon"> |
50 | - <input ' . $this->_getAttrString($this->_attributes) . '> |
|
50 | + <input ' . $this->_getAttrString($this->_attributes).'> |
|
51 | 51 | </span> |
52 | - <input class="form-control" type="text" readonly id="' . $id . '_alt" value="' . $value . '"> |
|
52 | + <input class="form-control" type="text" readonly id="' . $id.'_alt" value="'.$value.'"> |
|
53 | 53 | </div> |
54 | 54 | '; |
55 | 55 | } |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | $js .= "<script> |
80 | 80 | $(function() { |
81 | 81 | $('#$id').hide().datepicker({ |
82 | - defaultDate: '" . $this->getValue() . "', |
|
82 | + defaultDate: '".$this->getValue()."', |
|
83 | 83 | dateFormat: 'yy-mm-dd', |
84 | 84 | altField: '#{$id}_alt', |
85 | - altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\", |
|
85 | + altFormat: \"".get_lang('DateFormatLongNoDayJS')."\", |
|
86 | 86 | showOn: 'both', |
87 | - buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "', |
|
87 | + buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."', |
|
88 | 88 | buttonImageOnly: true, |
89 | - buttonText: '" . get_lang('SelectDate') . "', |
|
89 | + buttonText: '" . get_lang('SelectDate')."', |
|
90 | 90 | changeMonth: true, |
91 | 91 | changeYear: true, |
92 | 92 | yearRange: 'c-60y:c+5y' |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | $value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H); |
39 | 39 | } |
40 | 40 | |
41 | - return $this->getElementJS() . ' |
|
41 | + return $this->getElementJS().' |
|
42 | 42 | <div class="input-group"> |
43 | 43 | <span class="input-group-addon"> |
44 | - <input ' . $this->_getAttrString($this->_attributes) . '> |
|
44 | + <input ' . $this->_getAttrString($this->_attributes).'> |
|
45 | 45 | </span> |
46 | - <input class="form-control" type="text" readonly id="' . $id . '_alt" value="' . $value . '"> |
|
46 | + <input class="form-control" type="text" readonly id="' . $id.'_alt" value="'.$value.'"> |
|
47 | 47 | </div> |
48 | 48 | '; |
49 | 49 | } |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | $js .= "<script> |
74 | 74 | $(function() { |
75 | 75 | $('#$id').hide().datetimepicker({ |
76 | - defaultDate: '" . $this->getValue() . "', |
|
76 | + defaultDate: '".$this->getValue()."', |
|
77 | 77 | dateFormat: 'yy-mm-dd', |
78 | 78 | timeFormat: 'HH:mm', |
79 | 79 | altField: '#{$id}_alt', |
80 | - altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\", |
|
81 | - altTimeFormat: \"" . get_lang('TimeFormatNoSecJS') . "\", |
|
82 | - altSeparator: \" " . get_lang('AtTime') . " \", |
|
80 | + altFormat: \"".get_lang('DateFormatLongNoDayJS')."\", |
|
81 | + altTimeFormat: \"" . get_lang('TimeFormatNoSecJS')."\", |
|
82 | + altSeparator: \" " . get_lang('AtTime')." \", |
|
83 | 83 | altFieldTimeOnly: false, |
84 | 84 | showOn: 'both', |
85 | - buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "', |
|
85 | + buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."', |
|
86 | 86 | buttonImageOnly: true, |
87 | - buttonText: '" . get_lang('SelectDate') . "', |
|
87 | + buttonText: '" . get_lang('SelectDate')."', |
|
88 | 88 | changeMonth: true, |
89 | 89 | changeYear: true |
90 | 90 | }); |
@@ -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 | } |