1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93:
<?php
defined("ICMS_ROOT_PATH") or die("ICMS root path not defined");
class icms_view_Printerfriendly {
public $_title;
public $_dsc;
public $_content;
public $_tpl;
public $_pageTitle = FALSE;
public $_width = 680;
public function __construct($content, $title = FALSE, $dsc = FALSE) {
$this->_title = $title;
$this->_dsc = $dsc;
$this->_content = $content;
}
public function setPageTitle($text) {
$this->_pageTitle = $text;
}
public function setWidth($width) {
$this->_width = $width;
}
public function render() {
$this->_tpl = new icms_view_Tpl();
$this->_tpl->assign('icms_print_pageTitle', $this->_pageTitle ? $this->_pageTitle : $this->_title);
$this->_tpl->assign('icms_print_title', $this->_title);
$this->_tpl->assign('icms_print_dsc', $this->_dsc);
$this->_tpl->assign('icms_print_content', $this->_content);
$this->_tpl->assign('icms_print_width', $this->_width);
$current_url = icms::$urls['full'];
$this->_tpl->assign('icms_print_currenturl', $current_url);
$this->_tpl->assign('icms_print_url', $this->url);
$this->_tpl->display('db:system_print.html');
}
static public function generate($content, $title = FALSE, $description = FALSE, $pagetitle = FALSE, $width = 680) {
$PrintDataBuilder = new self($content, $title, $description);
$PrintDataBuilder->setPageTitle($pagetitle);
$PrintDataBuilder->setWidth($width);
$PrintDataBuilder->render();
}
}