| Current Path : /var/www/iplanru/data/old/www/i-plan.ru/media/zoo/elements/itemprint/ |
| Current File : /var/www/iplanru/data/old/www/i-plan.ru/media/zoo/elements/itemprint/itemprint.php |
<?php
/**
* @package ZOO
* @author YOOtheme http://www.yootheme.com
* @copyright Copyright (C) YOOtheme GmbH
* @license http://www.gnu.org/licenses/gpl.html GNU/GPL
*/
/*
Class: ElementItemPrint
The item print element class
*/
class ElementItemPrint extends Element {
/*
Function: hasValue
Checks if the element's value is set.
Parameters:
$params - render parameter
Returns:
Boolean - true, on success
*/
public function hasValue($params = array()) {
return true;
}
/*
Function: edit
Renders the edit form field.
Returns:
String - html
*/
public function edit() {
return null;
}
/*
Function: render
Renders the element.
Parameters:
$params - render parameter
Returns:
String - html
*/
public function render($params = array()) {
$params = $this->app->data->create($params);
// include assets css
$this->app->document->addStylesheet('elements:itemprint/assets/css/itemprint.css');
if ($this->app->request->getBool('print', 0)) {
// Hide respond form from the printing view
$this->app->document->addStyleDeclaration('#comments #respond { display:none; }');
// Hide comments if requested
if (!$params->get('showcomments', true)) {
$this->app->document->addStyleDeclaration('#comments { display:none; }');
}
return '<a class="element-print-button" onclick="window.print(); return false;" href="#"></a>';
} else {
$this->app->html->_('behavior.modal', 'a.modal');
$text = $params->get('showicon') ? '' : JText::_('Print');
$class = $params->get('showicon') ? 'modal element-print-button' : 'modal';
return '<a href="'.JRoute::_($this->app->route->item($this->_item, false).'&tmpl=component&print=1').'" title="'.JText::_('Print').'" rel="{handler: \'iframe\', size: {x: 850, y: 500}}" class="'.$class.'">'.$text.'</a>';
}
}
}