@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | * Code |
9 | 9 | */ |
10 | 10 | require_once 'xapian.php'; |
11 | -require_once dirname(__FILE__) . '/../IndexableChunk.class.php'; |
|
11 | +require_once dirname(__FILE__).'/../IndexableChunk.class.php'; |
|
12 | 12 | //TODO: think another way without including specific fields here |
13 | -require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
13 | +require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
14 | 14 | |
15 | -define('XAPIAN_DB', api_get_path(SYS_UPLOAD_PATH) . 'plugins/xapian/searchdb/'); |
|
15 | +define('XAPIAN_DB', api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb/'); |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Queries the database. |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | // process each specific field prefix |
97 | 97 | foreach ($specific_fields as $specific_field) { |
98 | - $results[$count]['sf-' . $specific_field['code']] = xapian_get_doc_terms($document, $specific_field['code']); |
|
98 | + $results[$count]['sf-'.$specific_field['code']] = xapian_get_doc_terms($document, $specific_field['code']); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | // rest of data |
@@ -261,6 +261,6 @@ discard block |
||
261 | 261 | } else { |
262 | 262 | $message_error = get_lang('SearchOtherXapianError'); |
263 | 263 | } |
264 | - $display_message = get_lang('Error') . ' : ' . $message_error; |
|
264 | + $display_message = get_lang('Error').' : '.$message_error; |
|
265 | 265 | Display::display_error_message($display_message); |
266 | 266 | } |
@@ -239,6 +239,7 @@ |
||
239 | 239 | /** |
240 | 240 | * @author Isaac flores paz <[email protected]> |
241 | 241 | * @param String The xapian error message |
242 | + * @param string $xapian_error_message |
|
242 | 243 | * @return String The chamilo error message |
243 | 244 | */ |
244 | 245 | function display_xapian_error($xapian_error_message) { |
@@ -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 | { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | /* More info @ http://mpdf1.com/manual/index.php?tid=184&searchstring=mPDF |
32 | 32 | * 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 ]]]]]]) |
33 | 33 | */ |
34 | - if (!in_array($orientation, array('P','L'))) { |
|
34 | + if (!in_array($orientation, array('P', 'L'))) { |
|
35 | 35 | $orientation = 'P'; |
36 | 36 | } |
37 | 37 | //$this->pdf = $pdf = new mPDF('UTF-8', $pageFormat, '', '', 30, 20, 27, 25, 16, 13, $orientation); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $visualTheme = api_get_visual_theme(); |
112 | 112 | $img = api_get_path(SYS_CSS_PATH).'themes/'.$visualTheme.'/images/pdf_logo_header.png'; |
113 | 113 | if (file_exists($img)) { |
114 | - $img = api_get_path(WEB_CSS_PATH) . 'themes/' . $visualTheme . '/images/pdf_logo_header.png'; |
|
114 | + $img = api_get_path(WEB_CSS_PATH).'themes/'.$visualTheme.'/images/pdf_logo_header.png'; |
|
115 | 115 | $organization = "<img src='$img'>"; |
116 | 116 | } |
117 | 117 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | // then print the title in the PDF |
251 | 251 | if (is_array($file) && isset($file['title'])) { |
252 | 252 | $html_title = $file['title']; |
253 | - $file = $file['path']; |
|
253 | + $file = $file['path']; |
|
254 | 254 | } else { |
255 | 255 | //we suppose we've only been sent a file path |
256 | 256 | $html_title = basename($file); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | //it's not a chapter but the file exists, print its title |
283 | 283 | if ($print_title) { |
284 | 284 | $this->pdf->WriteHTML( |
285 | - '<html><body><h3>' . $html_title . '</h3></body></html>', |
|
285 | + '<html><body><h3>'.$html_title.'</h3></body></html>', |
|
286 | 286 | 2 |
287 | 287 | ); |
288 | 288 | } |
@@ -293,12 +293,12 @@ discard block |
||
293 | 293 | if (in_array($extension, array('html', 'htm'))) { |
294 | 294 | $dirName = $file_info['dirname']; |
295 | 295 | $filename = $file_info['basename']; |
296 | - $filename = str_replace('_',' ',$filename); |
|
296 | + $filename = str_replace('_', ' ', $filename); |
|
297 | 297 | |
298 | 298 | if ($extension == 'html') { |
299 | - $filename = basename($filename,'.html'); |
|
300 | - } elseif($extension == 'htm'){ |
|
301 | - $filename = basename($filename,'.htm'); |
|
299 | + $filename = basename($filename, '.html'); |
|
300 | + } elseif ($extension == 'htm') { |
|
301 | + $filename = basename($filename, '.htm'); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | $document_html = @file_get_contents($file); |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | $document_html = str_replace('href="./css/frames.css"', $absolute_css_path, $document_html); |
310 | 310 | |
311 | 311 | if (!empty($course_data['path'])) { |
312 | - $document_html= str_replace('../','', $document_html); |
|
312 | + $document_html = str_replace('../', '', $document_html); |
|
313 | 313 | $document_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document/'; |
314 | 314 | |
315 | 315 | $doc = new DOMDocument(); |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | if (!empty($document_html)) { |
388 | 388 | $this->pdf->WriteHTML($document_html.$page_break, 2); |
389 | 389 | } |
390 | - } elseif (in_array($extension, array('jpg','jpeg','png','gif'))) { |
|
390 | + } elseif (in_array($extension, array('jpg', 'jpeg', 'png', 'gif'))) { |
|
391 | 391 | //Images |
392 | 392 | $image = Display::img($file); |
393 | 393 | $this->pdf->WriteHTML('<html><body>'.$image.'</body></html>'.$page_break, 2); |
@@ -450,11 +450,11 @@ discard block |
||
450 | 450 | |
451 | 451 | //absolute path for frames.css //TODO: necessary? |
452 | 452 | $absolute_css_path = api_get_path(WEB_CSS_PATH).api_get_setting('stylesheets').'/frames.css'; |
453 | - $document_html = str_replace('href="./css/frames.css"','href="'.$absolute_css_path.'"', $document_html); |
|
453 | + $document_html = str_replace('href="./css/frames.css"', 'href="'.$absolute_css_path.'"', $document_html); |
|
454 | 454 | |
455 | - $document_html= str_replace('../../','',$document_html); |
|
456 | - $document_html= str_replace('../','',$document_html); |
|
457 | - $document_html= str_replace((empty($_configuration['url_append'])?'':$_configuration['url_append'].'/').'courses/'.$course_code.'/document/','',$document_html); |
|
455 | + $document_html = str_replace('../../', '', $document_html); |
|
456 | + $document_html = str_replace('../', '', $document_html); |
|
457 | + $document_html = str_replace((empty($_configuration['url_append']) ? '' : $_configuration['url_append'].'/').'courses/'.$course_code.'/document/', '', $document_html); |
|
458 | 458 | |
459 | 459 | if (!empty($course_data['path'])) { |
460 | 460 | $document_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document/'; |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | $old_src_fixed = str_replace(api_get_path(REL_COURSE_PATH).$course_data['path'].'/document/', '', $old_src); |
475 | 475 | $old_src_fixed = str_replace('courses/'.$course_data['path'].'/document/', '', $old_src_fixed); |
476 | 476 | $new_path = $document_path.$old_src_fixed; |
477 | - $document_html= str_replace($old_src, $new_path, $document_html); |
|
477 | + $document_html = str_replace($old_src, $new_path, $document_html); |
|
478 | 478 | |
479 | 479 | } |
480 | 480 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | //$document_html= str_replace('temp_template_path', 'src="/main/default_course_document/', $document_html);// restore src templates |
494 | 494 | |
495 | 495 | api_set_encoding_html($document_html, 'UTF-8'); // The library mPDF expects UTF-8 encoded input data. |
496 | - $title = api_get_title_html($document_html, 'UTF-8', 'UTF-8'); // TODO: Maybe it is better idea the title to be passed through |
|
496 | + $title = api_get_title_html($document_html, 'UTF-8', 'UTF-8'); // TODO: Maybe it is better idea the title to be passed through |
|
497 | 497 | // $_GET[] too, as it is done with file name. |
498 | 498 | // At the moment the title is retrieved from the html document itself. |
499 | 499 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | //$this->pdf->Output($output_file, $outputMode); // F to save the pdf in a file |
516 | 516 | |
517 | 517 | if ($outputMode == 'F') { |
518 | - $output_file = api_get_path(SYS_ARCHIVE_PATH) . $output_file; |
|
518 | + $output_file = api_get_path(SYS_ARCHIVE_PATH).$output_file; |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | if ($saveInFile) { |
@@ -548,14 +548,14 @@ discard block |
||
548 | 548 | $web_path = false; |
549 | 549 | if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') { |
550 | 550 | $course_info = api_get_course_info($course_code); |
551 | - $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
551 | + $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
552 | 552 | if (file_exists($store_path)) { |
553 | - $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
553 | + $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
554 | 554 | } |
555 | 555 | } else { |
556 | - $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
556 | + $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path |
|
557 | 557 | if (file_exists($store_path)) |
558 | - $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
558 | + $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
|
559 | 559 | } |
560 | 560 | return $web_path; |
561 | 561 | } |
@@ -595,10 +595,10 @@ discard block |
||
595 | 595 | { |
596 | 596 | if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') { |
597 | 597 | $course_info = api_get_course_info($course_code); |
598 | - $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path']; // course path |
|
598 | + $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path']; // course path |
|
599 | 599 | $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/pdf_watermark.png'; |
600 | 600 | } else { |
601 | - $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images'; // course path |
|
601 | + $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images'; // course path |
|
602 | 602 | $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
603 | 603 | } |
604 | 604 | $course_image = $store_path.'/'.api_get_current_access_url_id().'_pdf_watermark.png'; |
@@ -633,9 +633,9 @@ discard block |
||
633 | 633 | */ |
634 | 634 | public function set_footer() |
635 | 635 | { |
636 | - $this->pdf->defaultfooterfontsize = 12; // in pts |
|
637 | - $this->pdf->defaultfooterfontstyle = 'B'; // blank, B, I, or BI |
|
638 | - $this->pdf->defaultfooterline = 1; // 1 to include line below header/above footer |
|
636 | + $this->pdf->defaultfooterfontsize = 12; // in pts |
|
637 | + $this->pdf->defaultfooterfontstyle = 'B'; // blank, B, I, or BI |
|
638 | + $this->pdf->defaultfooterline = 1; // 1 to include line below header/above footer |
|
639 | 639 | $platform_name = api_get_setting('Institution'); |
640 | 640 | $left_content = $platform_name; |
641 | 641 | $center_content = ''; |
@@ -702,9 +702,9 @@ discard block |
||
702 | 702 | */ |
703 | 703 | public function set_header($course_data) |
704 | 704 | { |
705 | - $this->pdf->defaultheaderfontsize = 10; // in pts |
|
706 | - $this->pdf->defaultheaderfontstyle = 'BI'; // blank, B, I, or BI |
|
707 | - $this->pdf->defaultheaderline = 1; // 1 to include line below header/above footer |
|
705 | + $this->pdf->defaultheaderfontsize = 10; // in pts |
|
706 | + $this->pdf->defaultheaderfontstyle = 'BI'; // blank, B, I, or BI |
|
707 | + $this->pdf->defaultheaderline = 1; // 1 to include line below header/above footer |
|
708 | 708 | |
709 | 709 | if (!empty($course_data['code'])) { |
710 | 710 | $teacher_list = CourseManager::get_teacher_list_from_course_code($course_data['code']); |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | if (!empty($teacher_list)) { |
714 | 714 | |
715 | 715 | foreach ($teacher_list as $teacher) { |
716 | - $teachers[]= $teacher['firstname'].' '.$teacher['lastname']; |
|
716 | + $teachers[] = $teacher['firstname'].' '.$teacher['lastname']; |
|
717 | 717 | } |
718 | 718 | if (count($teachers) > 1) { |
719 | 719 | $teachers = get_lang('Teachers').': '.implode(', ', $teachers); |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | 'line' => 1, |
781 | 781 | ), |
782 | 782 | ); |
783 | - $this->pdf->SetHeader($header);// ('{DATE j-m-Y}|{PAGENO}/{nb}|'.$title); |
|
783 | + $this->pdf->SetHeader($header); // ('{DATE j-m-Y}|{PAGENO}/{nb}|'.$title); |
|
784 | 784 | } |
785 | 785 | } |
786 | 786 | |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | $this->pdf->directionality = api_get_text_direction(); |
826 | 826 | $this->pdf->useOnlyCoreFonts = true; |
827 | 827 | // Use different Odd/Even headers and footers and mirror margins |
828 | - $this->pdf->mirrorMargins = 1; |
|
828 | + $this->pdf->mirrorMargins = 1; |
|
829 | 829 | |
830 | 830 | // Add decoration only if not stated otherwise |
831 | 831 | if ($complete) { |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | $watermark_text = api_get_setting('pdf_export_watermark_text'); |
854 | 854 | } |
855 | 855 | if (!empty($watermark_text)) { |
856 | - $this->pdf->SetWatermarkText(strcode2utf($watermark_text),0.1); |
|
856 | + $this->pdf->SetWatermarkText(strcode2utf($watermark_text), 0.1); |
|
857 | 857 | $this->pdf->showWatermarkText = true; |
858 | 858 | } |
859 | 859 | } |
@@ -861,8 +861,8 @@ discard block |
||
861 | 861 | if (empty($this->custom_header)) { |
862 | 862 | self::set_header($course_data); |
863 | 863 | } else { |
864 | - $this->pdf->SetHTMLHeader($this->custom_header,'E'); |
|
865 | - $this->pdf->SetHTMLHeader($this->custom_header,'O'); |
|
864 | + $this->pdf->SetHTMLHeader($this->custom_header, 'E'); |
|
865 | + $this->pdf->SetHTMLHeader($this->custom_header, 'O'); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | 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 | }); |