@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | return; |
18 | 18 | } |
19 | 19 | |
20 | -require_once dirname(__FILE__) . '../../../global.inc.php'; |
|
21 | -require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloQuery.php'; |
|
20 | +require_once dirname(__FILE__).'../../../global.inc.php'; |
|
21 | +require_once api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php'; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * search with filter and build base array avoding repeated terms |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | if (is_array($dkterms) && is_array($dkterms[1])) { |
34 | 34 | foreach ($specific_fields as $specific_field) { |
35 | 35 | foreach ($dkterms[1] as $obj) { |
36 | - foreach ($obj['sf-' . $specific_field['code']] as $raw_term) { |
|
36 | + foreach ($obj['sf-'.$specific_field['code']] as $raw_term) { |
|
37 | 37 | if (count($raw_term['name']) > 1) { |
38 | 38 | $normal_term = substr($raw_term['name'], 1); |
39 | 39 | $sf_terms[$specific_field['code']][$normal_term] = $normal_term; |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | |
55 | 55 | if (($cid = api_get_course_id()) != -1) { // with cid |
56 | 56 | // course filter |
57 | - $filter[] = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid); |
|
57 | + $filter[] = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid); |
|
58 | 58 | // term filter |
59 | 59 | if ($term != '__all__') { |
60 | - $filter[] = chamilo_get_boolean_query($prefix . $term); |
|
60 | + $filter[] = chamilo_get_boolean_query($prefix.$term); |
|
61 | 61 | // always and between term and courseid |
62 | 62 | $filter = chamilo_join_queries($filter, null, 'and'); |
63 | 63 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $sf_terms = get_usual_sf_terms($filter, $specific_fields); |
66 | 66 | } else { // without cid |
67 | 67 | if ($term != '__all__') { |
68 | - $filter[] = chamilo_get_boolean_query($prefix . $term); |
|
68 | + $filter[] = chamilo_get_boolean_query($prefix.$term); |
|
69 | 69 | |
70 | 70 | $sf_terms = get_usual_sf_terms($filter, $specific_fields); |
71 | 71 | } else { // no cid and all/any terms |
@@ -150,7 +150,7 @@ |
||
150 | 150 | $data = substr($png,$ipos,$chunk['size']); |
151 | 151 | $sections = explode("\0", $data); |
152 | 152 | if ($sections[0] == $key) { |
153 | - return $sections; |
|
153 | + return $sections; |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | // Extract the data and the CRC |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | foreach (array_keys($this->_chunks[$type]) as $typekey) { |
52 | 52 | list($key, $data) = explode("\0", $this->_chunks[$type][$typekey]); |
53 | 53 | if (strcmp($key, $check) == 0) { |
54 | - echo 'Key "' . $check . '" already exists in "' . $type . '" chunk.'; |
|
54 | + echo 'Key "'.$check.'" already exists in "'.$type.'" chunk.'; |
|
55 | 55 | return false; |
56 | 56 | } |
57 | 57 | } |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function addChunk($chunkType, $key, $value) { |
72 | 72 | |
73 | - $chunkData = $key . "\0" . $value; |
|
74 | - $crc = pack("N", crc32($chunkType . $chunkData)); |
|
73 | + $chunkData = $key."\0".$value; |
|
74 | + $crc = pack("N", crc32($chunkType.$chunkData)); |
|
75 | 75 | $len = pack("N", strlen($chunkData)); |
76 | 76 | |
77 | - $newChunk = $len . $chunkType . $chunkData . $crc; |
|
77 | + $newChunk = $len.$chunkType.$chunkData.$crc; |
|
78 | 78 | $result = substr($this->_contents, 0, $this->_size - 12) |
79 | 79 | . $newChunk |
80 | 80 | . substr($this->_contents, $this->_size - 12, 12); |
@@ -92,30 +92,30 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function removeChunks($chunkType, $key, $png) { |
94 | 94 | // Read the magic bytes and verify |
95 | - $retval = substr($png,0,8); |
|
95 | + $retval = substr($png, 0, 8); |
|
96 | 96 | $ipos = 8; |
97 | 97 | if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") |
98 | 98 | throw new Exception('Is not a valid PNG image'); |
99 | 99 | // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type |
100 | - $chunkHeader = substr($png,$ipos,8); |
|
100 | + $chunkHeader = substr($png, $ipos, 8); |
|
101 | 101 | $ipos = $ipos + 8; |
102 | 102 | while ($chunkHeader) { |
103 | 103 | // Extract length and type from binary data |
104 | 104 | $chunk = @unpack('Nsize/a4type', $chunkHeader); |
105 | 105 | $skip = false; |
106 | - if ( $chunk['type'] == $chunkType ) { |
|
107 | - $data = substr($png,$ipos,$chunk['size']); |
|
106 | + if ($chunk['type'] == $chunkType) { |
|
107 | + $data = substr($png, $ipos, $chunk['size']); |
|
108 | 108 | $sections = explode("\0", $data); |
109 | 109 | print_r($sections); |
110 | - if ( $sections[0] == $key ) $skip = true; |
|
110 | + if ($sections[0] == $key) $skip = true; |
|
111 | 111 | } |
112 | 112 | // Extract the data and the CRC |
113 | - $data = substr($png,$ipos,$chunk['size']+4); |
|
113 | + $data = substr($png, $ipos, $chunk['size'] + 4); |
|
114 | 114 | $ipos = $ipos + $chunk['size'] + 4; |
115 | 115 | // Add in the header, data, and CRC |
116 | - if ( ! $skip ) $retval = $retval . $chunkHeader . $data; |
|
116 | + if (!$skip) $retval = $retval.$chunkHeader.$data; |
|
117 | 117 | // Read next chunk header |
118 | - $chunkHeader = substr($png,$ipos,8); |
|
118 | + $chunkHeader = substr($png, $ipos, 8); |
|
119 | 119 | $ipos = $ipos + 8; |
120 | 120 | } |
121 | 121 | return $retval; |
@@ -131,34 +131,34 @@ discard block |
||
131 | 131 | * If there is PNG information that matches the key an array is returned |
132 | 132 | * |
133 | 133 | */ |
134 | - public function extractBadgeInfo($png, $key='openbadges') { |
|
134 | + public function extractBadgeInfo($png, $key = 'openbadges') { |
|
135 | 135 | // Read the magic bytes and verify |
136 | - $retval = substr($png,0,8); |
|
136 | + $retval = substr($png, 0, 8); |
|
137 | 137 | $ipos = 8; |
138 | 138 | if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") { |
139 | 139 | return false; |
140 | 140 | } |
141 | 141 | |
142 | 142 | // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type |
143 | - $chunkHeader = substr($png,$ipos,8); |
|
143 | + $chunkHeader = substr($png, $ipos, 8); |
|
144 | 144 | $ipos = $ipos + 8; |
145 | 145 | while ($chunkHeader) { |
146 | 146 | // Extract length and type from binary data |
147 | 147 | $chunk = @unpack('Nsize/a4type', $chunkHeader); |
148 | 148 | $skip = false; |
149 | 149 | if ($chunk['type'] == 'tEXt') { |
150 | - $data = substr($png,$ipos,$chunk['size']); |
|
150 | + $data = substr($png, $ipos, $chunk['size']); |
|
151 | 151 | $sections = explode("\0", $data); |
152 | 152 | if ($sections[0] == $key) { |
153 | 153 | return $sections; |
154 | 154 | } |
155 | 155 | } |
156 | 156 | // Extract the data and the CRC |
157 | - $data = substr($png,$ipos,$chunk['size']+4); |
|
157 | + $data = substr($png, $ipos, $chunk['size'] + 4); |
|
158 | 158 | $ipos = $ipos + $chunk['size'] + 4; |
159 | 159 | |
160 | 160 | // Read next chunk header |
161 | - $chunkHeader = substr($png,$ipos,8); |
|
161 | + $chunkHeader = substr($png, $ipos, 8); |
|
162 | 162 | $ipos = $ipos + 8; |
163 | 163 | } |
164 | 164 | } |
@@ -94,8 +94,9 @@ discard block |
||
94 | 94 | // Read the magic bytes and verify |
95 | 95 | $retval = substr($png,0,8); |
96 | 96 | $ipos = 8; |
97 | - if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") |
|
98 | - throw new Exception('Is not a valid PNG image'); |
|
97 | + if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") { |
|
98 | + throw new Exception('Is not a valid PNG image'); |
|
99 | + } |
|
99 | 100 | // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type |
100 | 101 | $chunkHeader = substr($png,$ipos,8); |
101 | 102 | $ipos = $ipos + 8; |
@@ -107,13 +108,17 @@ discard block |
||
107 | 108 | $data = substr($png,$ipos,$chunk['size']); |
108 | 109 | $sections = explode("\0", $data); |
109 | 110 | print_r($sections); |
110 | - if ( $sections[0] == $key ) $skip = true; |
|
111 | + if ( $sections[0] == $key ) { |
|
112 | + $skip = true; |
|
113 | + } |
|
111 | 114 | } |
112 | 115 | // Extract the data and the CRC |
113 | 116 | $data = substr($png,$ipos,$chunk['size']+4); |
114 | 117 | $ipos = $ipos + $chunk['size'] + 4; |
115 | 118 | // Add in the header, data, and CRC |
116 | - if ( ! $skip ) $retval = $retval . $chunkHeader . $data; |
|
119 | + if ( ! $skip ) { |
|
120 | + $retval = $retval . $chunkHeader . $data; |
|
121 | + } |
|
117 | 122 | // Read next chunk header |
118 | 123 | $chunkHeader = substr($png,$ipos,8); |
119 | 124 | $ipos = $ipos + 8; |
@@ -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 | } |