forked from XoopsModules25x/publisher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
print.php
87 lines (69 loc) · 3.44 KB
/
print.php
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
<?php
/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
which is considered copyrighted (c) material of the original comment or credit authors.
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.
*/
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
* @package Publisher
* @subpackage Action
* @since 1.0
* @author trabis <lusopoemas@gmail.com>
* @author The SmartFactory <www.smartfactory.ca>
*/
use Xmf\Request;
use XoopsModules\Publisher;
require_once __DIR__ . '/header.php';
require_once $GLOBALS['xoops']->path('class/template.php');
$itemid = Request::getInt('itemid', 0, 'GET');
if (0 == $itemid) {
redirect_header('javascript:history.go(-1)', 1, _MD_PUBLISHER_NOITEMSELECTED);
}
// Creating the ITEM object for the selected ITEM
$itemObj = $helper->getHandler('Item')->get($itemid);
// if the selected ITEM was not found, exit
if ($itemObj->notLoaded()) {
redirect_header('javascript:history.go(-1)', 1, _MD_PUBLISHER_NOITEMSELECTED);
}
// Check user permissions to access that category of the selected ITEM
if (!$itemObj->accessGranted()) {
redirect_header('javascript:history.go(-1)', 1, _NOPERM);
}
// Creating the category object that holds the selected ITEM
$categoryObj = $itemObj->getCategory();
$xoopsTpl = new \XoopsTpl();
$myts = \MyTextSanitizer::getInstance();
$item['title'] = $itemObj->getTitle();
$item['body'] = $itemObj->getBody();
$item['categoryname'] = $myts->displayTarea($categoryObj->name());
$mainImage = $itemObj->getMainImage();
if ('' != $mainImage['image_path']) {
$item['image'] = '<img src="' . $mainImage['image_path'] . '" alt="' . $myts->undoHtmlSpecialChars($mainImage['image_name']) . '">';
}
$xoopsTpl->assign('item', $item);
$xoopsTpl->assign('printtitle', $GLOBALS['xoopsConfig']['sitename'] . ' - ' . Publisher\Utility::html2text($categoryObj->getCategoryPath()) . ' > ' . $myts->displayTarea($itemObj->getTitle()));
$xoopsTpl->assign('printlogourl', $helper->getConfig('print_logourl'));
$xoopsTpl->assign('printheader', $myts->displayTarea($helper->getConfig('print_header'), 1));
$xoopsTpl->assign('lang_category', _CO_PUBLISHER_CATEGORY);
$xoopsTpl->assign('lang_author_date', sprintf(_MD_PUBLISHER_WHO_WHEN, $itemObj->posterName(), $itemObj->getDatesub()));
$doNotStartPrint = false;
$noTitle = false;
$noCategory = false;
$smartPopup = false;
$xoopsTpl->assign('doNotStartPrint', $doNotStartPrint);
$xoopsTpl->assign('noTitle', $noTitle);
$xoopsTpl->assign('smartPopup', $smartPopup);
$xoopsTpl->assign('current_language', $GLOBALS['xoopsConfig']['language']);
if ('item footer' === $helper->getConfig('print_footer') || 'both' === $helper->getConfig('print_footer')) {
$xoopsTpl->assign('itemfooter', $myts->displayTarea($helper->getConfig('item_footer'), 1));
}
if ('index footer' === $helper->getConfig('print_footer') || 'both' === $helper->getConfig('print_footer')) {
$xoopsTpl->assign('indexfooter', $myts->displayTarea($helper->getConfig('index_footer'), 1));
}
$xoopsTpl->assign('display_whowhen_link', $helper->getConfig('item_disp_whowhen_link'));
$xoopsTpl->display('db:publisher_print.tpl');