@@ -148,8 +148,8 @@ |
||
148 | 148 | eval('$this = Pager::factory($options);'); |
149 | 149 | } else { //php5 is case sensitive |
150 | 150 | $msg = 'Pager constructor is deprecated.' |
151 | - .' You must use the "Pager::factory($params)" method' |
|
152 | - .' instead of "new Pager($params)"'; |
|
151 | + .' You must use the "Pager::factory($params)" method' |
|
152 | + .' instead of "new Pager($params)"'; |
|
153 | 153 | trigger_error($msg, E_USER_ERROR); |
154 | 154 | } |
155 | 155 | } |
@@ -249,282 +249,282 @@ |
||
249 | 249 | return $affected_rows; |
250 | 250 | } |
251 | 251 | |
252 | - /** |
|
253 | - * Get all plugins path inside dashboard directory |
|
254 | - * @return array name plugins directories |
|
255 | - */ |
|
256 | - public static function getPossibleDashboardPluginsPath() |
|
252 | + /** |
|
253 | + * Get all plugins path inside dashboard directory |
|
254 | + * @return array name plugins directories |
|
255 | + */ |
|
256 | + public static function getPossibleDashboardPluginsPath() |
|
257 | 257 | { |
258 | - // get all plugins path inside plugin directory |
|
259 | - /* We scan the plugin directory. Each folder is a potential plugin. */ |
|
260 | - $possiblePlugins = array(); |
|
261 | - $dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/'; |
|
262 | - $handle = @opendir($dashboard_pluginpath); |
|
263 | - while (false !== ($file = readdir($handle))) { |
|
264 | - if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file)) { |
|
265 | - $possiblePlugins[] = $file; |
|
266 | - } |
|
267 | - } |
|
268 | - @closedir($handle); |
|
269 | - |
|
270 | - return $possiblePlugins; |
|
271 | - } |
|
272 | - |
|
273 | - /** |
|
274 | - * Get all blocks data without plugin directory |
|
275 | - * @return array Block data |
|
276 | - */ |
|
277 | - public static function get_block_data_without_plugin() |
|
258 | + // get all plugins path inside plugin directory |
|
259 | + /* We scan the plugin directory. Each folder is a potential plugin. */ |
|
260 | + $possiblePlugins = array(); |
|
261 | + $dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/'; |
|
262 | + $handle = @opendir($dashboard_pluginpath); |
|
263 | + while (false !== ($file = readdir($handle))) { |
|
264 | + if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file)) { |
|
265 | + $possiblePlugins[] = $file; |
|
266 | + } |
|
267 | + } |
|
268 | + @closedir($handle); |
|
269 | + |
|
270 | + return $possiblePlugins; |
|
271 | + } |
|
272 | + |
|
273 | + /** |
|
274 | + * Get all blocks data without plugin directory |
|
275 | + * @return array Block data |
|
276 | + */ |
|
277 | + public static function get_block_data_without_plugin() |
|
278 | 278 | { |
279 | - $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK); |
|
280 | - $possibleplugins = self::getPossibleDashboardPluginsPath(); |
|
281 | - |
|
282 | - // We check if plugin exists inside directory for updating active field |
|
283 | - $sql = "SELECT * FROM $tbl_block"; |
|
284 | - $rs = Database::query($sql); |
|
285 | - if (Database::num_rows($rs) > 0){ |
|
286 | - while ($row = Database::fetch_array($rs)) { |
|
287 | - $path = $row['path']; |
|
288 | - if (!in_array($row['path'],$possibleplugins)) { |
|
289 | - $active = 0; |
|
290 | - } else { |
|
291 | - $active = 1; |
|
292 | - } |
|
293 | - // update active |
|
294 | - $upd = "UPDATE $tbl_block SET active = '$active' |
|
279 | + $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK); |
|
280 | + $possibleplugins = self::getPossibleDashboardPluginsPath(); |
|
281 | + |
|
282 | + // We check if plugin exists inside directory for updating active field |
|
283 | + $sql = "SELECT * FROM $tbl_block"; |
|
284 | + $rs = Database::query($sql); |
|
285 | + if (Database::num_rows($rs) > 0){ |
|
286 | + while ($row = Database::fetch_array($rs)) { |
|
287 | + $path = $row['path']; |
|
288 | + if (!in_array($row['path'],$possibleplugins)) { |
|
289 | + $active = 0; |
|
290 | + } else { |
|
291 | + $active = 1; |
|
292 | + } |
|
293 | + // update active |
|
294 | + $upd = "UPDATE $tbl_block SET active = '$active' |
|
295 | 295 | WHERE path = '".$row['path']."'"; |
296 | - Database::query($upd); |
|
297 | - } |
|
298 | - } |
|
299 | - |
|
300 | - // get disabled block data |
|
301 | - $block_data = array(); |
|
302 | - $sql = "SELECT * FROM $tbl_block WHERE active = 0"; |
|
303 | - $rs_block = Database::query($sql); |
|
304 | - if (Database::num_rows($rs_block) > 0) { |
|
305 | - while ($row_block = Database::fetch_array($rs_block)) { |
|
306 | - $block_data[] = $row_block; |
|
307 | - } |
|
308 | - } |
|
309 | - |
|
310 | - return $block_data; |
|
311 | - |
|
312 | - } |
|
313 | - |
|
314 | - /** |
|
315 | - * get data about enabled dashboard block (stored insise block table) |
|
316 | - * @param string plugin path |
|
317 | - * @return array data |
|
318 | - */ |
|
319 | - public static function get_enabled_dashboard_blocks($path = '') |
|
296 | + Database::query($upd); |
|
297 | + } |
|
298 | + } |
|
299 | + |
|
300 | + // get disabled block data |
|
301 | + $block_data = array(); |
|
302 | + $sql = "SELECT * FROM $tbl_block WHERE active = 0"; |
|
303 | + $rs_block = Database::query($sql); |
|
304 | + if (Database::num_rows($rs_block) > 0) { |
|
305 | + while ($row_block = Database::fetch_array($rs_block)) { |
|
306 | + $block_data[] = $row_block; |
|
307 | + } |
|
308 | + } |
|
309 | + |
|
310 | + return $block_data; |
|
311 | + |
|
312 | + } |
|
313 | + |
|
314 | + /** |
|
315 | + * get data about enabled dashboard block (stored insise block table) |
|
316 | + * @param string plugin path |
|
317 | + * @return array data |
|
318 | + */ |
|
319 | + public static function get_enabled_dashboard_blocks($path = '') |
|
320 | 320 | { |
321 | - $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK); |
|
322 | - $condition_path = ''; |
|
323 | - if (!empty($path)) { |
|
324 | - $path = Database::escape_string($path); |
|
325 | - $condition_path = ' AND path = "'.$path.'" '; |
|
326 | - } |
|
327 | - |
|
328 | - $sql = "SELECT * FROM $tbl_block WHERE active = 1 $condition_path "; |
|
329 | - $rs = Database::query($sql); |
|
330 | - $block_data = array(); |
|
331 | - if (Database::num_rows($rs) > 0) { |
|
332 | - while ($row = Database::fetch_array($rs)) { |
|
333 | - $block_data[$row['path']] = $row; |
|
334 | - } |
|
335 | - } |
|
336 | - return $block_data; |
|
337 | - } |
|
338 | - |
|
339 | - /** |
|
340 | - * display user dashboard list |
|
341 | - * @param int User id |
|
342 | - * @return void |
|
343 | - */ |
|
344 | - public static function display_user_dashboard_list($user_id) |
|
321 | + $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK); |
|
322 | + $condition_path = ''; |
|
323 | + if (!empty($path)) { |
|
324 | + $path = Database::escape_string($path); |
|
325 | + $condition_path = ' AND path = "'.$path.'" '; |
|
326 | + } |
|
327 | + |
|
328 | + $sql = "SELECT * FROM $tbl_block WHERE active = 1 $condition_path "; |
|
329 | + $rs = Database::query($sql); |
|
330 | + $block_data = array(); |
|
331 | + if (Database::num_rows($rs) > 0) { |
|
332 | + while ($row = Database::fetch_array($rs)) { |
|
333 | + $block_data[$row['path']] = $row; |
|
334 | + } |
|
335 | + } |
|
336 | + return $block_data; |
|
337 | + } |
|
338 | + |
|
339 | + /** |
|
340 | + * display user dashboard list |
|
341 | + * @param int User id |
|
342 | + * @return void |
|
343 | + */ |
|
344 | + public static function display_user_dashboard_list($user_id) |
|
345 | 345 | { |
346 | - $enabled_dashboard_plugins = self::get_enabled_dashboard_blocks(); |
|
347 | - $user_block_data = self::get_user_block_data($user_id); |
|
348 | - |
|
349 | - if (count($enabled_dashboard_plugins) > 0) { |
|
350 | - echo '<div style="margin-top:20px">'; |
|
351 | - echo '<div><strong>'.get_lang('SelectBlockForDisplayingInsideBlocksDashboardView').'</strong></div><br />'; |
|
352 | - echo '<form name="dashboard_list" method="post" action="index.php?action=store_user_block">'; |
|
353 | - echo '<table class="data_table">'; |
|
354 | - echo '<tr>'; |
|
355 | - echo '<th width="5%">'; |
|
356 | - echo get_lang('Enabled'); |
|
357 | - echo '</th>'; |
|
358 | - echo '<th width="30%">'; |
|
359 | - echo get_lang('Name'); |
|
360 | - echo '</th>'; |
|
361 | - echo '<th width="40%">'; |
|
362 | - echo get_lang('Description'); |
|
363 | - echo '</th>'; |
|
364 | - echo '<th>'; |
|
365 | - echo get_lang('ColumnPosition'); |
|
366 | - echo '</th>'; |
|
367 | - echo '</tr>'; |
|
368 | - |
|
369 | - // We display all enabled plugins and the checkboxes |
|
370 | - foreach ($enabled_dashboard_plugins as $block) { |
|
371 | - |
|
372 | - $path = $block['path']; |
|
373 | - $controller_class = $block['controller']; |
|
374 | - $filename_controller = $path.'.class.php'; |
|
375 | - $dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/'; |
|
376 | - require_once $dashboard_plugin_path.$filename_controller; |
|
377 | - if (class_exists($controller_class)) { |
|
378 | - $obj_block = new $controller_class($user_id); |
|
379 | - |
|
380 | - // check if user is allowed to see the block |
|
381 | - if (method_exists($obj_block, 'is_block_visible_for_user')) { |
|
382 | - $is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id); |
|
383 | - if (!$is_block_visible_for_user) continue; |
|
384 | - } |
|
385 | - |
|
386 | - echo '<tr>'; |
|
387 | - // checkboxes |
|
388 | - self::display_user_dashboard_list_checkboxes($user_id, $block['id']); |
|
389 | - echo '<td>'.$block['name'].'</td>'; |
|
390 | - echo '<td>'.$block['description'].'</td>'; |
|
391 | - echo '<td> |
|
346 | + $enabled_dashboard_plugins = self::get_enabled_dashboard_blocks(); |
|
347 | + $user_block_data = self::get_user_block_data($user_id); |
|
348 | + |
|
349 | + if (count($enabled_dashboard_plugins) > 0) { |
|
350 | + echo '<div style="margin-top:20px">'; |
|
351 | + echo '<div><strong>'.get_lang('SelectBlockForDisplayingInsideBlocksDashboardView').'</strong></div><br />'; |
|
352 | + echo '<form name="dashboard_list" method="post" action="index.php?action=store_user_block">'; |
|
353 | + echo '<table class="data_table">'; |
|
354 | + echo '<tr>'; |
|
355 | + echo '<th width="5%">'; |
|
356 | + echo get_lang('Enabled'); |
|
357 | + echo '</th>'; |
|
358 | + echo '<th width="30%">'; |
|
359 | + echo get_lang('Name'); |
|
360 | + echo '</th>'; |
|
361 | + echo '<th width="40%">'; |
|
362 | + echo get_lang('Description'); |
|
363 | + echo '</th>'; |
|
364 | + echo '<th>'; |
|
365 | + echo get_lang('ColumnPosition'); |
|
366 | + echo '</th>'; |
|
367 | + echo '</tr>'; |
|
368 | + |
|
369 | + // We display all enabled plugins and the checkboxes |
|
370 | + foreach ($enabled_dashboard_plugins as $block) { |
|
371 | + |
|
372 | + $path = $block['path']; |
|
373 | + $controller_class = $block['controller']; |
|
374 | + $filename_controller = $path.'.class.php'; |
|
375 | + $dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/'; |
|
376 | + require_once $dashboard_plugin_path.$filename_controller; |
|
377 | + if (class_exists($controller_class)) { |
|
378 | + $obj_block = new $controller_class($user_id); |
|
379 | + |
|
380 | + // check if user is allowed to see the block |
|
381 | + if (method_exists($obj_block, 'is_block_visible_for_user')) { |
|
382 | + $is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id); |
|
383 | + if (!$is_block_visible_for_user) continue; |
|
384 | + } |
|
385 | + |
|
386 | + echo '<tr>'; |
|
387 | + // checkboxes |
|
388 | + self::display_user_dashboard_list_checkboxes($user_id, $block['id']); |
|
389 | + echo '<td>'.$block['name'].'</td>'; |
|
390 | + echo '<td>'.$block['description'].'</td>'; |
|
391 | + echo '<td> |
|
392 | 392 | <select class="selectpicker show-tick form-control" name="columns['.$block['id'].']"> |
393 | 393 | <option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==1?'selected':'').' >1</option> |
394 | 394 | <option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==2?'selected':'').' >2</option> |
395 | 395 | </select> |
396 | 396 | </td>'; |
397 | - echo '</tr>'; |
|
398 | - } else { |
|
399 | - echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3'))); |
|
400 | - } |
|
401 | - } |
|
402 | - |
|
403 | - echo '</table>'; |
|
404 | - echo '<div class="row"><div class="col-md-12">'; |
|
405 | - echo '<button class="btn btn-default" type="submit" name="submit_dashboard_list" value="'.get_lang('EnableDashboardBlock').'"><em class="fa fa-check-square"></em> '. |
|
397 | + echo '</tr>'; |
|
398 | + } else { |
|
399 | + echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3'))); |
|
400 | + } |
|
401 | + } |
|
402 | + |
|
403 | + echo '</table>'; |
|
404 | + echo '<div class="row"><div class="col-md-12">'; |
|
405 | + echo '<button class="btn btn-default" type="submit" name="submit_dashboard_list" value="'.get_lang('EnableDashboardBlock').'"><em class="fa fa-check-square"></em> '. |
|
406 | 406 | get_lang('EnableDashboardBlock').'</button></form>'; |
407 | - echo '</div></div>'; |
|
408 | - } else { |
|
409 | - echo '<div style="margin-top:20px">'.get_lang('ThereAreNoEnabledDashboardPlugins').'</div>'; |
|
410 | - if (api_is_platform_admin()) { |
|
411 | - echo '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'. |
|
407 | + echo '</div></div>'; |
|
408 | + } else { |
|
409 | + echo '<div style="margin-top:20px">'.get_lang('ThereAreNoEnabledDashboardPlugins').'</div>'; |
|
410 | + if (api_is_platform_admin()) { |
|
411 | + echo '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'. |
|
412 | 412 | get_lang('ConfigureDashboardPlugin').'</a>'; |
413 | - } |
|
414 | - } |
|
415 | - } |
|
416 | - |
|
417 | - /** |
|
418 | - * display checkboxes for user dashboard list |
|
419 | - * @param int User id |
|
420 | - * @param int Block id |
|
421 | - * @return void |
|
422 | - */ |
|
423 | - public static function display_user_dashboard_list_checkboxes($user_id, $block_id) { |
|
424 | - |
|
425 | - $user_id = intval($user_id); |
|
426 | - $user_block_data = self::get_user_block_data($user_id); |
|
427 | - $enabled_blocks_id = array_keys($user_block_data); |
|
428 | - |
|
429 | - $checked = ''; |
|
430 | - if (in_array($block_id, $enabled_blocks_id)) { |
|
431 | - $checked = "checked"; |
|
432 | - } |
|
433 | - |
|
434 | - echo "<td align=\"center\">"; |
|
435 | - echo '<input type="checkbox" name="enabled_blocks['.$block_id.']" value="true" '.$checked.'/>'; |
|
436 | - echo "</td>"; |
|
437 | - } |
|
438 | - |
|
439 | - /** |
|
440 | - * This function store enabled blocks id with its column position (block_id1:colum;block_id2:colum; ...) inside extra user fields |
|
441 | - * @param int User id |
|
442 | - * @param array selected blocks |
|
443 | - * @param array columns position |
|
444 | - * @return bool |
|
445 | - */ |
|
446 | - public static function store_user_blocks($user_id, $enabled_blocks, $columns) { |
|
447 | - $selected_blocks_id = array(); |
|
448 | - if (is_array($enabled_blocks) && count($enabled_blocks) > 0) { |
|
449 | - $selected_blocks_id = array_keys($enabled_blocks); |
|
450 | - } |
|
451 | - |
|
452 | - // build data for storing inside extra user field |
|
453 | - $fname = 'dashboard'; |
|
454 | - $fvalue = array(); |
|
455 | - foreach ($selected_blocks_id as $block_id) { |
|
456 | - $fvalue[] = $block_id.':'.$columns[$block_id]; |
|
457 | - } |
|
413 | + } |
|
414 | + } |
|
415 | + } |
|
416 | + |
|
417 | + /** |
|
418 | + * display checkboxes for user dashboard list |
|
419 | + * @param int User id |
|
420 | + * @param int Block id |
|
421 | + * @return void |
|
422 | + */ |
|
423 | + public static function display_user_dashboard_list_checkboxes($user_id, $block_id) { |
|
424 | + |
|
425 | + $user_id = intval($user_id); |
|
426 | + $user_block_data = self::get_user_block_data($user_id); |
|
427 | + $enabled_blocks_id = array_keys($user_block_data); |
|
428 | + |
|
429 | + $checked = ''; |
|
430 | + if (in_array($block_id, $enabled_blocks_id)) { |
|
431 | + $checked = "checked"; |
|
432 | + } |
|
433 | + |
|
434 | + echo "<td align=\"center\">"; |
|
435 | + echo '<input type="checkbox" name="enabled_blocks['.$block_id.']" value="true" '.$checked.'/>'; |
|
436 | + echo "</td>"; |
|
437 | + } |
|
438 | + |
|
439 | + /** |
|
440 | + * This function store enabled blocks id with its column position (block_id1:colum;block_id2:colum; ...) inside extra user fields |
|
441 | + * @param int User id |
|
442 | + * @param array selected blocks |
|
443 | + * @param array columns position |
|
444 | + * @return bool |
|
445 | + */ |
|
446 | + public static function store_user_blocks($user_id, $enabled_blocks, $columns) { |
|
447 | + $selected_blocks_id = array(); |
|
448 | + if (is_array($enabled_blocks) && count($enabled_blocks) > 0) { |
|
449 | + $selected_blocks_id = array_keys($enabled_blocks); |
|
450 | + } |
|
451 | + |
|
452 | + // build data for storing inside extra user field |
|
453 | + $fname = 'dashboard'; |
|
454 | + $fvalue = array(); |
|
455 | + foreach ($selected_blocks_id as $block_id) { |
|
456 | + $fvalue[] = $block_id.':'.$columns[$block_id]; |
|
457 | + } |
|
458 | 458 | $upd_extra_field = UserManager::update_extra_field_value( |
459 | 459 | $user_id, |
460 | 460 | $fname, |
461 | 461 | $fvalue |
462 | 462 | ); |
463 | 463 | |
464 | - return $upd_extra_field; |
|
464 | + return $upd_extra_field; |
|
465 | 465 | |
466 | - } |
|
466 | + } |
|
467 | 467 | |
468 | - /** |
|
469 | - * This function get user block data (block id with its number of column) from extra user data |
|
470 | - * @param int User id |
|
471 | - * @return array data (block_id,column) |
|
472 | - */ |
|
473 | - public static function get_user_block_data($user_id) |
|
468 | + /** |
|
469 | + * This function get user block data (block id with its number of column) from extra user data |
|
470 | + * @param int User id |
|
471 | + * @return array data (block_id,column) |
|
472 | + */ |
|
473 | + public static function get_user_block_data($user_id) |
|
474 | 474 | { |
475 | - $user_id = intval($user_id); |
|
476 | - $field_variable = 'dashboard'; |
|
477 | - $extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable); |
|
478 | - $extra_user_data = explode(';',$extra_user_data[$field_variable]); |
|
479 | - $data = array(); |
|
480 | - foreach ($extra_user_data as $extra) { |
|
481 | - $split_extra = explode(':',$extra); |
|
482 | - if (!empty($split_extra)) { |
|
483 | - $block_id = $split_extra[0]; |
|
484 | - $column = isset($split_extra[1]) ? $split_extra[1] : null; |
|
485 | - $data[$block_id] = array('block_id' => $block_id, 'column' => $column); |
|
486 | - } |
|
487 | - } |
|
488 | - |
|
489 | - return $data; |
|
490 | - } |
|
491 | - |
|
492 | - /** |
|
493 | - * This function update extra user blocks data after closing a dashboard block |
|
494 | - * @param int User id |
|
495 | - * @param string plugin path |
|
496 | - * @return bool |
|
497 | - */ |
|
498 | - public static function close_user_block($user_id, $path) |
|
475 | + $user_id = intval($user_id); |
|
476 | + $field_variable = 'dashboard'; |
|
477 | + $extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable); |
|
478 | + $extra_user_data = explode(';',$extra_user_data[$field_variable]); |
|
479 | + $data = array(); |
|
480 | + foreach ($extra_user_data as $extra) { |
|
481 | + $split_extra = explode(':',$extra); |
|
482 | + if (!empty($split_extra)) { |
|
483 | + $block_id = $split_extra[0]; |
|
484 | + $column = isset($split_extra[1]) ? $split_extra[1] : null; |
|
485 | + $data[$block_id] = array('block_id' => $block_id, 'column' => $column); |
|
486 | + } |
|
487 | + } |
|
488 | + |
|
489 | + return $data; |
|
490 | + } |
|
491 | + |
|
492 | + /** |
|
493 | + * This function update extra user blocks data after closing a dashboard block |
|
494 | + * @param int User id |
|
495 | + * @param string plugin path |
|
496 | + * @return bool |
|
497 | + */ |
|
498 | + public static function close_user_block($user_id, $path) |
|
499 | 499 | { |
500 | - $enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path); |
|
501 | - $user_block_data = self::get_user_block_data($user_id); |
|
502 | - |
|
503 | - foreach ($enabled_dashboard_blocks as $enabled_block) { |
|
504 | - unset($user_block_data[$enabled_block['id']]); |
|
505 | - } |
|
506 | - |
|
507 | - // get columns and blocks id for updating extra user data |
|
508 | - $columns = array(); |
|
509 | - $user_blocks_id = array(); |
|
510 | - foreach ($user_block_data as $data) { |
|
511 | - $user_blocks_id[$data['block_id']] = true; |
|
512 | - $columns[$data['block_id']] = $data['column']; |
|
513 | - } |
|
514 | - |
|
515 | - // update extra user blocks data |
|
516 | - $upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns); |
|
517 | - |
|
518 | - return $upd_extra_field; |
|
519 | - } |
|
520 | - |
|
521 | - /** |
|
522 | - * get links for styles from dashboard plugins |
|
523 | - * @return string links |
|
524 | - */ |
|
525 | - public static function get_links_for_styles_from_dashboard_plugins() { |
|
526 | - |
|
527 | - return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL; |
|
528 | - } |
|
500 | + $enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path); |
|
501 | + $user_block_data = self::get_user_block_data($user_id); |
|
502 | + |
|
503 | + foreach ($enabled_dashboard_blocks as $enabled_block) { |
|
504 | + unset($user_block_data[$enabled_block['id']]); |
|
505 | + } |
|
506 | + |
|
507 | + // get columns and blocks id for updating extra user data |
|
508 | + $columns = array(); |
|
509 | + $user_blocks_id = array(); |
|
510 | + foreach ($user_block_data as $data) { |
|
511 | + $user_blocks_id[$data['block_id']] = true; |
|
512 | + $columns[$data['block_id']] = $data['column']; |
|
513 | + } |
|
514 | + |
|
515 | + // update extra user blocks data |
|
516 | + $upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns); |
|
517 | + |
|
518 | + return $upd_extra_field; |
|
519 | + } |
|
520 | + |
|
521 | + /** |
|
522 | + * get links for styles from dashboard plugins |
|
523 | + * @return string links |
|
524 | + */ |
|
525 | + public static function get_links_for_styles_from_dashboard_plugins() { |
|
526 | + |
|
527 | + return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL; |
|
528 | + } |
|
529 | 529 | |
530 | 530 | } |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * Constructor |
14 | 14 | */ |
15 | - public function __construct() |
|
15 | + public function __construct() |
|
16 | 16 | { |
17 | 17 | $this->table = Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE); |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | 20 | public function get_all($where_conditions = array()) |
21 | 21 | { |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * Displays the title + grid |
31 | 31 | */ |
32 | - public function display() |
|
32 | + public function display() |
|
33 | 33 | { |
34 | - // action links |
|
35 | - $content = Display::actions(array( |
|
34 | + // action links |
|
35 | + $content = Display::actions(array( |
|
36 | 36 | array( |
37 | 37 | 'url' => 'event_type.php' , |
38 | 38 | 'content' => Display::return_icon('new_document.png', get_lang('Add'), array(), ICON_SIZE_MEDIUM) |
39 | - ) |
|
39 | + ) |
|
40 | 40 | ) |
41 | 41 | ); |
42 | 42 | $content .= Display::grid_html('event_email_template'); |
43 | 43 | return $content; |
44 | - } |
|
44 | + } |
|
45 | 45 | |
46 | 46 | public function get_status_list() |
47 | 47 | { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'Height' => '250', |
83 | 83 | ) |
84 | 84 | ); |
85 | - $status_list = $this->get_status_list(); |
|
85 | + $status_list = $this->get_status_list(); |
|
86 | 86 | $form->addElement('select', 'status', get_lang('Status'), $status_list); |
87 | 87 | if ($action == 'edit') { |
88 | 88 | $form->addElement('text', 'created_at', get_lang('CreatedAt')); |
@@ -99,17 +99,17 @@ discard block |
||
99 | 99 | $defaults = $this->get($id); |
100 | 100 | |
101 | 101 | if (!empty($defaults['created_at'])) { |
102 | - $defaults['created_at'] = api_convert_and_format_date($defaults['created_at']); |
|
102 | + $defaults['created_at'] = api_convert_and_format_date($defaults['created_at']); |
|
103 | 103 | } |
104 | 104 | if (!empty($defaults['updated_at'])) { |
105 | - $defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']); |
|
105 | + $defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']); |
|
106 | 106 | } |
107 | 107 | $form->setDefaults($defaults); |
108 | 108 | |
109 | 109 | // Setting the rules |
110 | 110 | $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); |
111 | 111 | |
112 | - return $form; |
|
112 | + return $form; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | public function get_count() |
@@ -1,53 +1,53 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | - * |
|
5 | - * File: $RCSfile: dompdf_config.inc.php,v $ |
|
6 | - * Created on: 2004-08-04 |
|
7 | - * |
|
8 | - * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | - * |
|
10 | - * This library is free software; you can redistribute it and/or |
|
11 | - * modify it under the terms of the GNU Lesser General Public |
|
12 | - * License as published by the Free Software Foundation; either |
|
13 | - * version 2.1 of the License, or (at your option) any later version. |
|
14 | - * |
|
15 | - * This library is distributed in the hope that it will be useful, |
|
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | - * Lesser General Public License for more details. |
|
19 | - * |
|
20 | - * You should have received a copy of the GNU Lesser General Public License |
|
21 | - * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | - * 02111-1307 USA |
|
24 | - * |
|
25 | - * Alternatively, you may distribute this software under the terms of the |
|
26 | - * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | - * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | - * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | - * |
|
30 | - * The latest version of DOMPDF might be available at: |
|
31 | - * http://www.dompdf.com/ |
|
32 | - * |
|
33 | - * @link http://www.dompdf.com/ |
|
34 | - * @copyright 2004 Benj Carson |
|
35 | - * @author Benj Carson <[email protected]> |
|
36 | - * @contributor Helmut Tischer <[email protected]> |
|
37 | - * @package dompdf |
|
38 | - * |
|
39 | - * Changes |
|
40 | - * @contributor Helmut Tischer <[email protected]> |
|
41 | - * @version 0.5.1.htischer.20090507 |
|
42 | - * - Allow overriding of configuration settings by calling php script. |
|
43 | - * This allows replacing of dompdf by a new version in an application |
|
44 | - * without any modification, |
|
45 | - * - Optionally separate font cache folder from font folder. |
|
46 | - * This allows write protecting the entire installation |
|
47 | - * - Add settings to enable/disable additional debug output categories |
|
48 | - * - Change some defaults to more practical values |
|
49 | - * - Add comments about configuration parameter implications |
|
50 | - */ |
|
3 | + * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | + * |
|
5 | + * File: $RCSfile: dompdf_config.inc.php,v $ |
|
6 | + * Created on: 2004-08-04 |
|
7 | + * |
|
8 | + * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | + * |
|
10 | + * This library is free software; you can redistribute it and/or |
|
11 | + * modify it under the terms of the GNU Lesser General Public |
|
12 | + * License as published by the Free Software Foundation; either |
|
13 | + * version 2.1 of the License, or (at your option) any later version. |
|
14 | + * |
|
15 | + * This library is distributed in the hope that it will be useful, |
|
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | + * Lesser General Public License for more details. |
|
19 | + * |
|
20 | + * You should have received a copy of the GNU Lesser General Public License |
|
21 | + * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | + * 02111-1307 USA |
|
24 | + * |
|
25 | + * Alternatively, you may distribute this software under the terms of the |
|
26 | + * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | + * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | + * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | + * |
|
30 | + * The latest version of DOMPDF might be available at: |
|
31 | + * http://www.dompdf.com/ |
|
32 | + * |
|
33 | + * @link http://www.dompdf.com/ |
|
34 | + * @copyright 2004 Benj Carson |
|
35 | + * @author Benj Carson <[email protected]> |
|
36 | + * @contributor Helmut Tischer <[email protected]> |
|
37 | + * @package dompdf |
|
38 | + * |
|
39 | + * Changes |
|
40 | + * @contributor Helmut Tischer <[email protected]> |
|
41 | + * @version 0.5.1.htischer.20090507 |
|
42 | + * - Allow overriding of configuration settings by calling php script. |
|
43 | + * This allows replacing of dompdf by a new version in an application |
|
44 | + * without any modification, |
|
45 | + * - Optionally separate font cache folder from font folder. |
|
46 | + * This allows write protecting the entire installation |
|
47 | + * - Add settings to enable/disable additional debug output categories |
|
48 | + * - Change some defaults to more practical values |
|
49 | + * - Add comments about configuration parameter implications |
|
50 | + */ |
|
51 | 51 | |
52 | 52 | /* $Id: dompdf_config.inc.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
53 | 53 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | |
115 | 115 | if (!defined("DOMPDF_FONT_CACHE")) { |
116 | - define("DOMPDF_FONT_CACHE", DOMPDF_FONT_DIR); |
|
116 | + define("DOMPDF_FONT_CACHE", DOMPDF_FONT_DIR); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * using the PFDLib back end. |
125 | 125 | */ |
126 | 126 | if (!defined('DOMPDF_TEMP_DIR')) { |
127 | - define("DOMPDF_TEMP_DIR", sys_get_temp_dir()); |
|
127 | + define("DOMPDF_TEMP_DIR", sys_get_temp_dir()); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output(); |
141 | 141 | */ |
142 | 142 | if (!defined("DOMPDF_CHROOT")) { |
143 | - define("DOMPDF_CHROOT", realpath(DOMPDF_DIR)); |
|
143 | + define("DOMPDF_CHROOT", realpath(DOMPDF_DIR)); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * |
158 | 158 | */ |
159 | 159 | if (!defined("DOMPDF_UNICODE_ENABLED")) { |
160 | - define("DOMPDF_UNICODE_ENABLED", false); |
|
160 | + define("DOMPDF_UNICODE_ENABLED", false); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | * @link http://ttf2pt1.sourceforge.net/ |
173 | 173 | */ |
174 | 174 | if (!defined("TTF2AFM")) { |
175 | - define("TTF2AFM", DOMPDF_LIB_DIR ."/ttf2ufm/ttf2ufm-src/ttf2pt1"); |
|
176 | - //define("TTF2AFM", "/usr/bin/ttf2pt1"); |
|
175 | + define("TTF2AFM", DOMPDF_LIB_DIR ."/ttf2ufm/ttf2ufm-src/ttf2pt1"); |
|
176 | + //define("TTF2AFM", "/usr/bin/ttf2pt1"); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * @link http://www.php.net/image |
206 | 206 | */ |
207 | 207 | if (!defined("DOMPDF_PDF_BACKEND")) { |
208 | - define("DOMPDF_PDF_BACKEND", "CPDF"); |
|
208 | + define("DOMPDF_PDF_BACKEND", "CPDF"); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * a real license code must exist! |
222 | 222 | */ |
223 | 223 | if (!defined("DOMPDF_PDFLIB_LICENSE")) { |
224 | - #define("DOMPDF_PDFLIB_LICENSE", "your license key here"); |
|
224 | + #define("DOMPDF_PDFLIB_LICENSE", "your license key here"); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * Therefore allow specification of content here. |
236 | 236 | */ |
237 | 237 | if (!defined("DOMPDF_DEFAULT_MEDIA_TYPE")) { |
238 | - define("DOMPDF_DEFAULT_MEDIA_TYPE", "screen"); |
|
238 | + define("DOMPDF_DEFAULT_MEDIA_TYPE", "screen"); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @see CPDF_Adapter::PAPER_SIZES for valid sizes |
247 | 247 | */ |
248 | 248 | if (!defined("DOMPDF_DEFAULT_PAPER_SIZE")) { |
249 | - define("DOMPDF_DEFAULT_PAPER_SIZE", "letter"); |
|
249 | + define("DOMPDF_DEFAULT_PAPER_SIZE", "letter"); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -257,43 +257,43 @@ discard block |
||
257 | 257 | * @var string |
258 | 258 | */ |
259 | 259 | if (!defined("DOMPDF_DEFAULT_FONT")) { |
260 | - define("DOMPDF_DEFAULT_FONT", "serif"); |
|
260 | + define("DOMPDF_DEFAULT_FONT", "serif"); |
|
261 | 261 | } |
262 | 262 | /** |
263 | - * Image DPI setting |
|
264 | - * |
|
265 | - * This setting determines the default DPI setting for images and fonts. The |
|
266 | - * DPI may be overridden for inline images by explictly setting the |
|
267 | - * image's width & height style attributes (i.e. if the image's native |
|
268 | - * width is 600 pixels and you specify the image's width as 72 points, |
|
269 | - * the image will have a DPI of 600 in the rendered PDF. The DPI of |
|
270 | - * background images can not be overridden and is controlled entirely |
|
271 | - * via this parameter. |
|
272 | - * |
|
273 | - * For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI). |
|
274 | - * If a size in html is given as px (or without unit as image size), |
|
275 | - * this tells the corresponding size in pt. |
|
276 | - * This adjusts the relative sizes to be similar to the rendering of the |
|
277 | - * html page in a reference browser. |
|
278 | - * |
|
279 | - * In pdf, always 1 pt = 1/72 inch |
|
280 | - * |
|
281 | - * Rendering resolution of various browsers in px per inch: |
|
282 | - * Windows Firefox and Internet Explorer: |
|
283 | - * SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:? |
|
284 | - * Linux Firefox: |
|
285 | - * about:config *resolution: Default:96 |
|
286 | - * (xorg screen dimension in mm and Desktop font dpi settings are ignored) |
|
287 | - * |
|
288 | - * Take care about extra font/image zoom factor of browser. |
|
289 | - * |
|
290 | - * In images, <img> size in pixel attribute, img css style, are overriding |
|
291 | - * the real image dimension in px for rendering. |
|
292 | - * |
|
293 | - * @var int |
|
294 | - */ |
|
263 | + * Image DPI setting |
|
264 | + * |
|
265 | + * This setting determines the default DPI setting for images and fonts. The |
|
266 | + * DPI may be overridden for inline images by explictly setting the |
|
267 | + * image's width & height style attributes (i.e. if the image's native |
|
268 | + * width is 600 pixels and you specify the image's width as 72 points, |
|
269 | + * the image will have a DPI of 600 in the rendered PDF. The DPI of |
|
270 | + * background images can not be overridden and is controlled entirely |
|
271 | + * via this parameter. |
|
272 | + * |
|
273 | + * For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI). |
|
274 | + * If a size in html is given as px (or without unit as image size), |
|
275 | + * this tells the corresponding size in pt. |
|
276 | + * This adjusts the relative sizes to be similar to the rendering of the |
|
277 | + * html page in a reference browser. |
|
278 | + * |
|
279 | + * In pdf, always 1 pt = 1/72 inch |
|
280 | + * |
|
281 | + * Rendering resolution of various browsers in px per inch: |
|
282 | + * Windows Firefox and Internet Explorer: |
|
283 | + * SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:? |
|
284 | + * Linux Firefox: |
|
285 | + * about:config *resolution: Default:96 |
|
286 | + * (xorg screen dimension in mm and Desktop font dpi settings are ignored) |
|
287 | + * |
|
288 | + * Take care about extra font/image zoom factor of browser. |
|
289 | + * |
|
290 | + * In images, <img> size in pixel attribute, img css style, are overriding |
|
291 | + * the real image dimension in px for rendering. |
|
292 | + * |
|
293 | + * @var int |
|
294 | + */ |
|
295 | 295 | if (!defined("DOMPDF_DPI")) { |
296 | - define("DOMPDF_DPI", "96"); |
|
296 | + define("DOMPDF_DPI", "96"); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @var bool |
310 | 310 | */ |
311 | 311 | if (!defined("DOMPDF_ENABLE_PHP")) { |
312 | - define("DOMPDF_ENABLE_PHP", true); |
|
312 | + define("DOMPDF_ENABLE_PHP", true); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * @var bool |
331 | 331 | */ |
332 | 332 | if (!defined("DOMPDF_ENABLE_REMOTE")) { |
333 | - define("DOMPDF_ENABLE_REMOTE", false); |
|
333 | + define("DOMPDF_ENABLE_REMOTE", false); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
@@ -344,25 +344,25 @@ discard block |
||
344 | 344 | * @param string $class |
345 | 345 | */ |
346 | 346 | function DOMPDF_autoload($class) { |
347 | - $filename = DOMPDF_INC_DIR . "/" . mb_strtolower($class) . ".cls.php"; |
|
347 | + $filename = DOMPDF_INC_DIR . "/" . mb_strtolower($class) . ".cls.php"; |
|
348 | 348 | |
349 | - if ( is_file($filename) ) |
|
349 | + if ( is_file($filename) ) |
|
350 | 350 | require_once($filename); |
351 | 351 | } |
352 | 352 | |
353 | 353 | if ( function_exists("spl_autoload_register") ) { |
354 | 354 | |
355 | - spl_autoload_register("DOMPDF_autoload"); |
|
355 | + spl_autoload_register("DOMPDF_autoload"); |
|
356 | 356 | |
357 | 357 | } else if ( !function_exists("__autoload") ) { |
358 | - /** |
|
359 | - * Default __autoload() function |
|
360 | - * |
|
361 | - * @param string $class |
|
362 | - */ |
|
363 | - function __autoload($class) { |
|
358 | + /** |
|
359 | + * Default __autoload() function |
|
360 | + * |
|
361 | + * @param string $class |
|
362 | + */ |
|
363 | + function __autoload($class) { |
|
364 | 364 | DOMPDF_autoload($class); |
365 | - } |
|
365 | + } |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | // ### End of user-configurable options ### |
@@ -416,11 +416,11 @@ discard block |
||
416 | 416 | * the browser cache and the premature output prevents setting of the mime type. |
417 | 417 | */ |
418 | 418 | if (!defined('DEBUGPNG')) { |
419 | - define('DEBUGPNG',0); |
|
419 | + define('DEBUGPNG',0); |
|
420 | 420 | } |
421 | 421 | if (!defined('DEBUGKEEPTEMP')) { |
422 | - define('DEBUGKEEPTEMP',0); |
|
422 | + define('DEBUGKEEPTEMP',0); |
|
423 | 423 | } |
424 | 424 | if (!defined('DEBUGCSS')) { |
425 | - define('DEBUGCSS',0); |
|
425 | + define('DEBUGCSS',0); |
|
426 | 426 | } |
@@ -1,44 +1,43 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | - * |
|
5 | - * File: $RCSfile: dompdf.php,v $ |
|
6 | - * Created on: 2004-06-22 |
|
7 | - * |
|
8 | - * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | - * |
|
10 | - * This library is free software; you can redistribute it and/or |
|
11 | - * modify it under the terms of the GNU Lesser General Public |
|
12 | - * License as published by the Free Software Foundation; either |
|
13 | - * version 2.1 of the License, or (at your option) any later version. |
|
14 | - * |
|
15 | - * This library is distributed in the hope that it will be useful, |
|
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | - * Lesser General Public License for more details. |
|
19 | - * |
|
20 | - * You should have received a copy of the GNU Lesser General Public License |
|
21 | - * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | - * 02111-1307 USA |
|
24 | - * |
|
25 | - * Alternatively, you may distribute this software under the terms of the |
|
26 | - * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | - * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | - * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | - * |
|
30 | - * The latest version of DOMPDF might be available at: |
|
31 | - * http://www.dompdf.com/ |
|
32 | - * |
|
33 | - * dompdf.php is a simple script to drive DOMPDF. It can be executed from |
|
34 | - * a browser or from the command line. |
|
35 | - * |
|
36 | - * @link http://www.dompdf.com/ |
|
37 | - * @copyright 2004 Benj Carson |
|
38 | - * @author Benj Carson <[email protected]> |
|
39 | - * @package dompdf |
|
40 | - |
|
41 | - */ |
|
3 | + * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | + * |
|
5 | + * File: $RCSfile: dompdf.php,v $ |
|
6 | + * Created on: 2004-06-22 |
|
7 | + * |
|
8 | + * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | + * |
|
10 | + * This library is free software; you can redistribute it and/or |
|
11 | + * modify it under the terms of the GNU Lesser General Public |
|
12 | + * License as published by the Free Software Foundation; either |
|
13 | + * version 2.1 of the License, or (at your option) any later version. |
|
14 | + * |
|
15 | + * This library is distributed in the hope that it will be useful, |
|
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | + * Lesser General Public License for more details. |
|
19 | + * |
|
20 | + * You should have received a copy of the GNU Lesser General Public License |
|
21 | + * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | + * 02111-1307 USA |
|
24 | + * |
|
25 | + * Alternatively, you may distribute this software under the terms of the |
|
26 | + * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | + * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | + * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | + * |
|
30 | + * The latest version of DOMPDF might be available at: |
|
31 | + * http://www.dompdf.com/ |
|
32 | + * |
|
33 | + * dompdf.php is a simple script to drive DOMPDF. It can be executed from |
|
34 | + * a browser or from the command line. |
|
35 | + * |
|
36 | + * @link http://www.dompdf.com/ |
|
37 | + * @copyright 2004 Benj Carson |
|
38 | + * @author Benj Carson <[email protected]> |
|
39 | + * @package dompdf |
|
40 | + */ |
|
42 | 41 | |
43 | 42 | /* $Id: dompdf.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
44 | 43 | |
@@ -70,7 +69,7 @@ discard block |
||
70 | 69 | */ |
71 | 70 | |
72 | 71 | function dompdf_usage() { |
73 | - echo |
|
72 | + echo |
|
74 | 73 | "\nUsage: {$_SERVER["argv"][0]} [options] html_file\n\n". |
75 | 74 | "html_file can be a filename, a url if fopen_wrappers are enabled, or the '-' \n". |
76 | 75 | "character to read from standard input.\n\n". |
@@ -94,80 +93,80 @@ discard block |
||
94 | 93 | |
95 | 94 | function getoptions() { |
96 | 95 | |
97 | - $opts = array(); |
|
96 | + $opts = array(); |
|
98 | 97 | |
99 | - if ( $_SERVER["argc"] == 1 ) |
|
98 | + if ( $_SERVER["argc"] == 1 ) |
|
100 | 99 | return $opts; |
101 | 100 | |
102 | - $i = 1; |
|
103 | - while ($i < $_SERVER["argc"]) { |
|
101 | + $i = 1; |
|
102 | + while ($i < $_SERVER["argc"]) { |
|
104 | 103 | |
105 | 104 | switch ($_SERVER["argv"][$i]) { |
106 | 105 | |
107 | 106 | case "--help": |
108 | 107 | case "-h": |
109 | 108 | $opts["h"] = true; |
110 | - $i++; |
|
111 | - break; |
|
109 | + $i++; |
|
110 | + break; |
|
112 | 111 | |
113 | 112 | case "-l": |
114 | 113 | $opts["l"] = true; |
115 | - $i++; |
|
116 | - break; |
|
114 | + $i++; |
|
115 | + break; |
|
117 | 116 | |
118 | 117 | case "-p": |
119 | 118 | if ( !isset($_SERVER["argv"][$i+1]) ) |
120 | 119 | die("-p switch requires a size parameter\n"); |
121 | - $opts["p"] = $_SERVER["argv"][$i+1]; |
|
122 | - $i += 2; |
|
123 | - break; |
|
120 | + $opts["p"] = $_SERVER["argv"][$i+1]; |
|
121 | + $i += 2; |
|
122 | + break; |
|
124 | 123 | |
125 | 124 | case "-o": |
126 | 125 | if ( !isset($_SERVER["argv"][$i+1]) ) |
127 | 126 | die("-o switch requires an orientation parameter\n"); |
128 | - $opts["o"] = $_SERVER["argv"][$i+1]; |
|
129 | - $i += 2; |
|
130 | - break; |
|
127 | + $opts["o"] = $_SERVER["argv"][$i+1]; |
|
128 | + $i += 2; |
|
129 | + break; |
|
131 | 130 | |
132 | 131 | case "-b": |
133 | 132 | if ( !isset($_SERVER["argv"][$i+1]) ) |
134 | 133 | die("-b switch requires a path parameter\n"); |
135 | - $opts["b"] = $_SERVER["argv"][$i+1]; |
|
136 | - $i += 2; |
|
137 | - break; |
|
134 | + $opts["b"] = $_SERVER["argv"][$i+1]; |
|
135 | + $i += 2; |
|
136 | + break; |
|
138 | 137 | |
139 | 138 | case "-f": |
140 | 139 | if ( !isset($_SERVER["argv"][$i+1]) ) |
141 | 140 | die("-f switch requires a filename parameter\n"); |
142 | - $opts["f"] = $_SERVER["argv"][$i+1]; |
|
143 | - $i += 2; |
|
144 | - break; |
|
141 | + $opts["f"] = $_SERVER["argv"][$i+1]; |
|
142 | + $i += 2; |
|
143 | + break; |
|
145 | 144 | |
146 | 145 | case "-v": |
147 | 146 | $opts["v"] = true; |
148 | - $i++; |
|
149 | - break; |
|
147 | + $i++; |
|
148 | + break; |
|
150 | 149 | |
151 | 150 | case "-d": |
152 | 151 | $opts["d"] = true; |
153 | - $i++; |
|
154 | - break; |
|
152 | + $i++; |
|
153 | + break; |
|
155 | 154 | |
156 | 155 | case "-t": |
157 | 156 | if ( !isset($_SERVER['argv'][$i + 1]) ) |
158 | 157 | die("-t switch requires a comma separated list of types\n"); |
159 | - $opts["t"] = $_SERVER['argv'][$i+1]; |
|
160 | - $i += 2; |
|
161 | - break; |
|
158 | + $opts["t"] = $_SERVER['argv'][$i+1]; |
|
159 | + $i += 2; |
|
160 | + break; |
|
162 | 161 | |
163 | - default: |
|
162 | + default: |
|
164 | 163 | $opts["filename"] = $_SERVER["argv"][$i]; |
165 | - $i++; |
|
166 | - break; |
|
164 | + $i++; |
|
165 | + break; |
|
167 | 166 | } |
168 | 167 | |
169 | - } |
|
170 | - return $opts; |
|
168 | + } |
|
169 | + return $opts; |
|
171 | 170 | } |
172 | 171 | |
173 | 172 | require_once("dompdf_config.inc.php"); |
@@ -179,112 +178,112 @@ discard block |
||
179 | 178 | |
180 | 179 | switch ( $sapi ) { |
181 | 180 | |
182 | - case "cli": |
|
181 | + case "cli": |
|
183 | 182 | |
184 | 183 | $opts = getoptions(); |
185 | 184 | |
186 | - if ( isset($opts["h"]) || (!isset($opts["filename"]) && !isset($opts["l"])) ) { |
|
185 | + if ( isset($opts["h"]) || (!isset($opts["filename"]) && !isset($opts["l"])) ) { |
|
187 | 186 | dompdf_usage(); |
188 | 187 | exit; |
189 | - } |
|
188 | + } |
|
190 | 189 | |
191 | - if ( isset($opts["l"]) ) { |
|
190 | + if ( isset($opts["l"]) ) { |
|
192 | 191 | echo "\nUnderstood paper sizes:\n"; |
193 | 192 | |
194 | 193 | foreach (array_keys(CPDF_Adapter::$PAPER_SIZES) as $size) |
195 | - echo " " . mb_strtoupper($size) . "\n"; |
|
194 | + echo " " . mb_strtoupper($size) . "\n"; |
|
196 | 195 | exit; |
197 | - } |
|
198 | - $file = $opts["filename"]; |
|
196 | + } |
|
197 | + $file = $opts["filename"]; |
|
199 | 198 | |
200 | - if ( isset($opts["p"]) ) |
|
199 | + if ( isset($opts["p"]) ) |
|
201 | 200 | $paper = $opts["p"]; |
202 | - else |
|
201 | + else |
|
203 | 202 | $paper = DOMPDF_DEFAULT_PAPER_SIZE; |
204 | 203 | |
205 | - if ( isset($opts["o"]) ) |
|
204 | + if ( isset($opts["o"]) ) |
|
206 | 205 | $orientation = $opts["o"]; |
207 | - else |
|
206 | + else |
|
208 | 207 | $orientation = "portrait"; |
209 | 208 | |
210 | - if ( isset($opts["b"]) ) |
|
209 | + if ( isset($opts["b"]) ) |
|
211 | 210 | $base_path = $opts["b"]; |
212 | 211 | |
213 | - if ( isset($opts["f"]) ) |
|
212 | + if ( isset($opts["f"]) ) |
|
214 | 213 | $outfile = $opts["f"]; |
215 | - else { |
|
214 | + else { |
|
216 | 215 | if ( $file === "-" ) |
217 | - $outfile = "dompdf_out.pdf"; |
|
216 | + $outfile = "dompdf_out.pdf"; |
|
218 | 217 | else |
219 | - $outfile = str_ireplace(array(".html", ".htm", ".php"), "", $file) . ".pdf"; |
|
220 | - } |
|
218 | + $outfile = str_ireplace(array(".html", ".htm", ".php"), "", $file) . ".pdf"; |
|
219 | + } |
|
221 | 220 | |
222 | - if ( isset($opts["v"]) ) |
|
221 | + if ( isset($opts["v"]) ) |
|
223 | 222 | $_dompdf_show_warnings = true; |
224 | 223 | |
225 | - if ( isset($opts["d"]) ) { |
|
224 | + if ( isset($opts["d"]) ) { |
|
226 | 225 | $_dompdf_show_warnings = true; |
227 | 226 | $_dompdf_debug = true; |
228 | - } |
|
227 | + } |
|
229 | 228 | |
230 | - if ( isset($opts['t']) ) { |
|
229 | + if ( isset($opts['t']) ) { |
|
231 | 230 | $arr = split(',',$opts['t']); |
232 | 231 | $types = array(); |
233 | 232 | foreach ($arr as $type) |
234 | - $types[ trim($type) ] = 1; |
|
233 | + $types[ trim($type) ] = 1; |
|
235 | 234 | $_DOMPDF_DEBUG_TYPES = $types; |
236 | - } |
|
235 | + } |
|
237 | 236 | |
238 | - $save_file = true; |
|
237 | + $save_file = true; |
|
239 | 238 | |
240 | - break; |
|
239 | + break; |
|
241 | 240 | |
242 | - default: |
|
241 | + default: |
|
243 | 242 | |
244 | - if ( isset($_GET["input_file"]) ) |
|
245 | - $file = basename(rawurldecode($_GET["input_file"])); |
|
246 | - else |
|
247 | - throw new DOMPDF_Exception("An input file is required (i.e. input_file _GET variable)."); |
|
243 | + if ( isset($_GET["input_file"]) ) |
|
244 | + $file = basename(rawurldecode($_GET["input_file"])); |
|
245 | + else |
|
246 | + throw new DOMPDF_Exception("An input file is required (i.e. input_file _GET variable)."); |
|
248 | 247 | |
249 | - if ( isset($_GET["paper"]) ) |
|
250 | - $paper = rawurldecode($_GET["paper"]); |
|
251 | - else |
|
252 | - $paper = DOMPDF_DEFAULT_PAPER_SIZE; |
|
248 | + if ( isset($_GET["paper"]) ) |
|
249 | + $paper = rawurldecode($_GET["paper"]); |
|
250 | + else |
|
251 | + $paper = DOMPDF_DEFAULT_PAPER_SIZE; |
|
253 | 252 | |
254 | - if ( isset($_GET["orientation"]) ) |
|
255 | - $orientation = rawurldecode($_GET["orientation"]); |
|
256 | - else |
|
257 | - $orientation = "portrait"; |
|
253 | + if ( isset($_GET["orientation"]) ) |
|
254 | + $orientation = rawurldecode($_GET["orientation"]); |
|
255 | + else |
|
256 | + $orientation = "portrait"; |
|
258 | 257 | |
259 | - if ( isset($_GET["base_path"]) ) |
|
260 | - $base_path = rawurldecode($_GET["base_path"]); |
|
258 | + if ( isset($_GET["base_path"]) ) |
|
259 | + $base_path = rawurldecode($_GET["base_path"]); |
|
261 | 260 | |
262 | 261 | |
263 | - $outfile = "dompdf_out.pdf"; # Don't allow them to set the output file |
|
264 | - $save_file = false; # Don't save the file |
|
265 | - $file = $base_path . $file; # Set the input file |
|
262 | + $outfile = "dompdf_out.pdf"; # Don't allow them to set the output file |
|
263 | + $save_file = false; # Don't save the file |
|
264 | + $file = $base_path . $file; # Set the input file |
|
266 | 265 | |
267 | - /* Check to see if the input file and base path = www/test */ |
|
268 | - if($base_path !== "www/test/") |
|
269 | - throw new DOMPDF_Exception("Access to dompdf.php via non-cli SAPI has been deprecated due to security concerns. Please use the dompdf class directly."); |
|
266 | + /* Check to see if the input file and base path = www/test */ |
|
267 | + if($base_path !== "www/test/") |
|
268 | + throw new DOMPDF_Exception("Access to dompdf.php via non-cli SAPI has been deprecated due to security concerns. Please use the dompdf class directly."); |
|
270 | 269 | |
271 | - break; |
|
270 | + break; |
|
272 | 271 | } |
273 | 272 | |
274 | 273 | $dompdf = new DOMPDF(); |
275 | 274 | |
276 | 275 | if ( $file === "-" ) { |
277 | - $str = ""; |
|
278 | - while ( !feof(STDIN) ) |
|
276 | + $str = ""; |
|
277 | + while ( !feof(STDIN) ) |
|
279 | 278 | $str .= fread(STDIN, 4096); |
280 | 279 | |
281 | - $dompdf->load_html($str); |
|
280 | + $dompdf->load_html($str); |
|
282 | 281 | |
283 | 282 | } else |
284 | - $dompdf->load_html_file($file); |
|
283 | + $dompdf->load_html_file($file); |
|
285 | 284 | |
286 | 285 | if ( isset($base_path) ) { |
287 | - $dompdf->set_base_path($base_path); |
|
286 | + $dompdf->set_base_path($base_path); |
|
288 | 287 | } |
289 | 288 | |
290 | 289 | $dompdf->set_paper($paper, $orientation); |
@@ -292,32 +291,32 @@ discard block |
||
292 | 291 | $dompdf->render(); |
293 | 292 | |
294 | 293 | if ( $_dompdf_show_warnings ) { |
295 | - global $_dompdf_warnings; |
|
296 | - foreach ($_dompdf_warnings as $msg) |
|
294 | + global $_dompdf_warnings; |
|
295 | + foreach ($_dompdf_warnings as $msg) |
|
297 | 296 | echo $msg . "\n"; |
298 | - echo $dompdf->get_canvas()->get_cpdf()->messages; |
|
299 | - flush(); |
|
297 | + echo $dompdf->get_canvas()->get_cpdf()->messages; |
|
298 | + flush(); |
|
300 | 299 | } |
301 | 300 | |
302 | 301 | if ( $save_file ) { |
303 | 302 | // if ( !is_writable($outfile) ) |
304 | 303 | // throw new DOMPDF_Exception("'$outfile' is not writable."); |
305 | - if ( strtolower(DOMPDF_PDF_BACKEND) === "gd" ) |
|
304 | + if ( strtolower(DOMPDF_PDF_BACKEND) === "gd" ) |
|
306 | 305 | $outfile = str_replace(".pdf", ".png", $outfile); |
307 | 306 | |
308 | - list($proto, $host, $path, $file) = explode_url($outfile); |
|
309 | - if ( $proto != "" ) // i.e. not file:// |
|
307 | + list($proto, $host, $path, $file) = explode_url($outfile); |
|
308 | + if ( $proto != "" ) // i.e. not file:// |
|
310 | 309 | $outfile = $file; // just save it locally, FIXME? could save it like wget: ./host/basepath/file |
311 | 310 | |
312 | - $outfile = realpath(dirname($outfile)) . DIRECTORY_SEPARATOR . basename($outfile); |
|
311 | + $outfile = realpath(dirname($outfile)) . DIRECTORY_SEPARATOR . basename($outfile); |
|
313 | 312 | |
314 | - if ( strpos($outfile, DOMPDF_CHROOT) !== 0 ) |
|
313 | + if ( strpos($outfile, DOMPDF_CHROOT) !== 0 ) |
|
315 | 314 | throw new DOMPDF_Exception("Permission denied."); |
316 | 315 | |
317 | - file_put_contents($outfile, $dompdf->output( array("compress" => 0) )); |
|
318 | - exit(0); |
|
316 | + file_put_contents($outfile, $dompdf->output( array("compress" => 0) )); |
|
317 | + exit(0); |
|
319 | 318 | } |
320 | 319 | |
321 | 320 | if ( !headers_sent() ) { |
322 | - $dompdf->stream($outfile); |
|
321 | + $dompdf->stream($outfile); |
|
323 | 322 | } |
@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | require_once("../dompdf_config.inc.php"); |
4 | 4 | if ( isset( $_POST["html"] ) ) { |
5 | 5 | |
6 | - if ( get_magic_quotes_gpc() ) |
|
6 | + if ( get_magic_quotes_gpc() ) |
|
7 | 7 | $_POST["html"] = stripslashes($_POST["html"]); |
8 | 8 | |
9 | - $dompdf = new DOMPDF(); |
|
10 | - $dompdf->load_html($_POST["html"]); |
|
11 | - $dompdf->set_paper($_POST["paper"], $_POST["orientation"]); |
|
12 | - $dompdf->render(); |
|
9 | + $dompdf = new DOMPDF(); |
|
10 | + $dompdf->load_html($_POST["html"]); |
|
11 | + $dompdf->set_paper($_POST["paper"], $_POST["orientation"]); |
|
12 | + $dompdf->render(); |
|
13 | 13 | |
14 | - $dompdf->stream("dompdf_out.pdf"); |
|
14 | + $dompdf->stream("dompdf_out.pdf"); |
|
15 | 15 | |
16 | - exit(0); |
|
16 | + exit(0); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | ?> |
@@ -42,18 +42,18 @@ discard block |
||
42 | 42 | $dompdf = dirname(dirname($_SERVER["PHP_SELF"])); |
43 | 43 | //echo '<li>['.$dompdf.']</li>'; |
44 | 44 | if ( $dompdf == '/' || $dompdf == '\\') { |
45 | - $dompdf = ''; |
|
45 | + $dompdf = ''; |
|
46 | 46 | } |
47 | 47 | //echo '<li>['.$dompdf.']</li>'; |
48 | 48 | $dompdf .= "/dompdf.php?base_path=" . rawurlencode("www/test/"); |
49 | 49 | //echo '<li>['.$dompdf.']</li>'; |
50 | 50 | foreach ( $test_files as $file ) { |
51 | - $file = basename($file); |
|
52 | - $arrow = "images/arrow_0" . rand(1, 6) . ".gif"; |
|
53 | - echo "<li style=\"list-style-image: url('$arrow');\">\n"; |
|
54 | - echo $file; |
|
55 | - echo " [<a class=\"button\" target=\"blank\" href=\"test/$file\">HTML</a>] [<a class=\"button\" href=\"$dompdf&input_file=" . rawurlencode("$file") . "\">PDF</a>]\n"; |
|
56 | - echo "</li>\n"; |
|
51 | + $file = basename($file); |
|
52 | + $arrow = "images/arrow_0" . rand(1, 6) . ".gif"; |
|
53 | + echo "<li style=\"list-style-image: url('$arrow');\">\n"; |
|
54 | + echo $file; |
|
55 | + echo " [<a class=\"button\" target=\"blank\" href=\"test/$file\">HTML</a>] [<a class=\"button\" href=\"$dompdf&input_file=" . rawurlencode("$file") . "\">PDF</a>]\n"; |
|
56 | + echo "</li>\n"; |
|
57 | 57 | } |
58 | 58 | ?> |
59 | 59 | </ul> |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | <select name="paper"> |
70 | 70 | <?php |
71 | 71 | foreach ( array_keys(CPDF_Adapter::$PAPER_SIZES) as $size ) |
72 | - echo "<option ". ($size == "letter" ? "selected " : "" ) . "value=\"$size\">$size</option>\n"; |
|
72 | + echo "<option ". ($size == "letter" ? "selected " : "" ) . "value=\"$size\">$size</option>\n"; |
|
73 | 73 | ?> |
74 | 74 | </select> |
75 | 75 | <select name="orientation"> |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | function li_arrow() { |
3 | - return '<li style="list-style-image: url(\'images/arrow_0' . rand(1,6) . '.gif\');">'; |
|
3 | + return '<li style="list-style-image: url(\'images/arrow_0' . rand(1,6) . '.gif\');">'; |
|
4 | 4 | } |
5 | 5 | function li_star() { |
6 | - return '<li style="list-style-image: url(\'images/star_0' . rand(1,5) . '.gif\');">'; |
|
6 | + return '<li style="list-style-image: url(\'images/star_0' . rand(1,5) . '.gif\');">'; |
|
7 | 7 | } |
8 | 8 | ?> |
9 | 9 | <?php echo '<?' . 'xml version="1.0" encoding="iso-8859-1"?' . '>'; ?> |
@@ -1,41 +1,40 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | - * |
|
5 | - * File: $RCSfile: inline_positioner.cls.php,v $ |
|
6 | - * Created on: 2004-06-08 |
|
7 | - * |
|
8 | - * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | - * |
|
10 | - * This library is free software; you can redistribute it and/or |
|
11 | - * modify it under the terms of the GNU Lesser General Public |
|
12 | - * License as published by the Free Software Foundation; either |
|
13 | - * version 2.1 of the License, or (at your option) any later version. |
|
14 | - * |
|
15 | - * This library is distributed in the hope that it will be useful, |
|
16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | - * Lesser General Public License for more details. |
|
19 | - * |
|
20 | - * You should have received a copy of the GNU Lesser General Public License |
|
21 | - * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | - * 02111-1307 USA |
|
24 | - * |
|
25 | - * Alternatively, you may distribute this software under the terms of the |
|
26 | - * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | - * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | - * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | - * |
|
30 | - * The latest version of DOMPDF might be available at: |
|
31 | - * http://www.dompdf.com/ |
|
32 | - * |
|
33 | - * @link http://www.dompdf.com/ |
|
34 | - * @copyright 2004 Benj Carson |
|
35 | - * @author Benj Carson <[email protected]> |
|
36 | - * @package dompdf |
|
37 | - |
|
38 | - */ |
|
3 | + * DOMPDF - PHP5 HTML to PDF renderer |
|
4 | + * |
|
5 | + * File: $RCSfile: inline_positioner.cls.php,v $ |
|
6 | + * Created on: 2004-06-08 |
|
7 | + * |
|
8 | + * Copyright (c) 2004 - Benj Carson <[email protected]> |
|
9 | + * |
|
10 | + * This library is free software; you can redistribute it and/or |
|
11 | + * modify it under the terms of the GNU Lesser General Public |
|
12 | + * License as published by the Free Software Foundation; either |
|
13 | + * version 2.1 of the License, or (at your option) any later version. |
|
14 | + * |
|
15 | + * This library is distributed in the hope that it will be useful, |
|
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
18 | + * Lesser General Public License for more details. |
|
19 | + * |
|
20 | + * You should have received a copy of the GNU Lesser General Public License |
|
21 | + * along with this library in the file LICENSE.LGPL; if not, write to the |
|
22 | + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
23 | + * 02111-1307 USA |
|
24 | + * |
|
25 | + * Alternatively, you may distribute this software under the terms of the |
|
26 | + * PHP License, version 3.0 or later. A copy of this license should have |
|
27 | + * been distributed with this file in the file LICENSE.PHP . If this is not |
|
28 | + * the case, you can obtain a copy at http://www.php.net/license/3_0.txt. |
|
29 | + * |
|
30 | + * The latest version of DOMPDF might be available at: |
|
31 | + * http://www.dompdf.com/ |
|
32 | + * |
|
33 | + * @link http://www.dompdf.com/ |
|
34 | + * @copyright 2004 Benj Carson |
|
35 | + * @author Benj Carson <[email protected]> |
|
36 | + * @package dompdf |
|
37 | + */ |
|
39 | 38 | |
40 | 39 | /* $Id: inline_positioner.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
41 | 40 | /** |
@@ -46,11 +45,11 @@ discard block |
||
46 | 45 | */ |
47 | 46 | class Inline_Positioner extends Positioner { |
48 | 47 | |
49 | - function __construct(Frame_Decorator $frame) { parent::__construct($frame); } |
|
48 | + function __construct(Frame_Decorator $frame) { parent::__construct($frame); } |
|
50 | 49 | |
51 | - //........................................................................ |
|
50 | + //........................................................................ |
|
52 | 51 | |
53 | - function position() { |
|
52 | + function position() { |
|
54 | 53 | $cb = $this->_frame->get_containing_block(); |
55 | 54 | |
56 | 55 | // Find our nearest block level parent and access its lines property. |
@@ -65,11 +64,11 @@ discard block |
||
65 | 64 | // End debugging |
66 | 65 | |
67 | 66 | if ( !$p ) |
68 | - throw new DOMPDF_Exception("No block-level parent found. Not good."); |
|
67 | + throw new DOMPDF_Exception("No block-level parent found. Not good."); |
|
69 | 68 | |
70 | 69 | $line = $p->get_current_line(); |
71 | 70 | |
72 | 71 | $this->_frame->set_position($cb["x"] + $line["w"], $line["y"]); |
73 | 72 | |
74 | - } |
|
73 | + } |
|
75 | 74 | } |
@@ -34,7 +34,6 @@ discard block |
||
34 | 34 | * @copyright 2004 Benj Carson |
35 | 35 | * @author Benj Carson <[email protected]> |
36 | 36 | * @package dompdf |
37 | - |
|
38 | 37 | */ |
39 | 38 | |
40 | 39 | /* $Id: table_row_positioner.cls.php 216 2010-03-11 22:49:18Z ryan.masten $ */ |
@@ -47,22 +46,22 @@ discard block |
||
47 | 46 | */ |
48 | 47 | class Table_Row_Positioner extends Positioner { |
49 | 48 | |
50 | - function __construct(Frame_Decorator $frame) { parent::__construct($frame); } |
|
49 | + function __construct(Frame_Decorator $frame) { parent::__construct($frame); } |
|
51 | 50 | |
52 | - //........................................................................ |
|
51 | + //........................................................................ |
|
53 | 52 | |
54 | - function position() { |
|
53 | + function position() { |
|
55 | 54 | |
56 | 55 | $cb = $this->_frame->get_containing_block(); |
57 | 56 | $p = $this->_frame->get_prev_sibling(); |
58 | 57 | |
59 | 58 | if ( $p ) |
60 | - $y = $p->get_position("y") + $p->get_margin_height(); |
|
59 | + $y = $p->get_position("y") + $p->get_margin_height(); |
|
61 | 60 | |
62 | 61 | else |
63 | - $y = $cb["y"]; |
|
62 | + $y = $cb["y"]; |
|
64 | 63 | |
65 | 64 | $this->_frame->set_position($cb["x"], $y); |
66 | 65 | |
67 | - } |
|
66 | + } |
|
68 | 67 | } |