| Current Path : /home/juvelize/martine/administrator/components/com_easybookreloaded/views/entry/ |
| Current File : /home/juvelize/martine/administrator/components/com_easybookreloaded/views/entry/view.html.php |
<?php
/**
* @copyright
* @package Easybook Reloaded - EBR for Joomla! 3.x
* @author Viktor Vogel <admin@kubik-rubik.de>
* @version 3.4.1.1-FREE - 2021-08-29
* @link https://kubik-rubik.de/ebr-easybook-reloaded
*
* @license GNU/GPL
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') || die('Restricted access');
use EasybookReloaded\Helper;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\{Document\HtmlDocument, Toolbar\ToolbarHelper, Language\Text, HTML\HTMLHelper, Factory, Uri\Uri};
/**
* Class EasybookReloadedViewEntry
*
* @since 3.4.0-FREE
* @version 3.4.1.0-FREE
*/
class EasybookReloadedViewEntry extends HtmlView
{
/**
* @var object $entry
* @since 3.4.0-FREE
*/
protected $entry;
/**
* @var object $guestbooks
* @since 3.4.0-FREE
*/
protected $guestbooks;
/**
* Executes and displays a template file
*
* @param string|null $tpl
*
* @return mixed|void
* @since 3.4.0-FREE
* @version 3.4.1.0-FREE
*/
public function display($tpl = null)
{
$this->entry = $this->get('Data');
$isNew = ($this->entry->id < 1);
$text = $isNew ? Text::_('COM_EASYBOOKRELOADED_NEWENTRY') : Text::_('COM_EASYBOOKRELOADED_EDITENTRY');
ToolbarHelper::title(Text::_('COM_EASYBOOKRELOADED') . ' - ' . $text, 'easybookreloaded');
ToolbarHelper::apply();
ToolbarHelper::save();
if ($isNew) {
ToolbarHelper::cancel();
} else {
ToolbarHelper::cancel('cancel', 'Close');
}
HTMLHelper::_('behavior.calendar');
$offset = Factory::getConfig()->get('config.offset');
$date = Factory::getDate($this->entry->gbdate, $offset);
$this->entry->gbdate = $date->format($date);
$this->guestbooks = $this->get('Data', 'gb');
/** @var HtmlDocument $document */
$document = Factory::getDocument();
HTMLHelper::_('behavior.framework');
$document->addStyleSheet('components/com_easybookreloaded/css/easybookreloaded.css');
if ((bool)Helper::getParams('showRating', true)) {
$document->addScript('../components/com_easybookreloaded/scripts/moostarrating.min.js');
$showRatingType = (int)Helper::getParams('showRatingType', 1);
if ($showRatingType === 0) {
$document->addCustomTag(
'<script type="text/javascript">
//<![CDATA[
window.addEvent("load", function() {
MooStarRatingImages.defaultImageFolder = "' . Uri::root() . 'components/com_easybookreloaded/images";
let Rating = new MooStarRating({ form: "gbookForm", radios: "gbvote", imageEmpty: "sun_empty.png", imageFull: "sun_full.png", imageHover: "sun_hover.png", tip: "<em>[VALUE] / [COUNT]</em>", tipTarget: $("easybookvotetip"), tipTargetType: "html" });
});
//]]>
</script>'
);
} elseif ($showRatingType === 1) {
$document->addCustomTag(
'<script type="text/javascript">
//<![CDATA[
window.addEvent("load", function() {
MooStarRatingImages.defaultImageFolder = "' . Uri::root() . 'components/com_easybookreloaded/images";
let Rating = new MooStarRating({ form: "adminForm", radios: "gbvote", imageEmpty: "star_empty.png", imageFull: "star_full.png", imageHover: "star_hover.png", tip: "<em>[VALUE] / [COUNT]</em>", tipTarget: $("easybookvotetip"), tipTargetType: "html" });
});
//]]>
</script>'
);
} elseif ($showRatingType === 2) {
$document->addCustomTag(
'<script type="text/javascript">
//<![CDATA[
window.addEvent("load", function() {
MooStarRatingImages.defaultImageFolder = "' . Uri::root() . 'components/com_easybookreloaded/images";
let Rating = new MooStarRating({ form: "adminForm", radios: "gbvote", imageEmpty: "star_boxed_empty.png", imageFull: "star_boxed_full.png", imageHover: "star_boxed_hover.png", width: 17, tip: "<em>[VALUE] / [COUNT]</em>", tipTarget: $("easybookvotetip"), tipTargetType: "html" });
});
//]]>
</script>'
);
}
}
parent::display($tpl);
}
}