Files
zurawik.pl/core/plugins/Smarty/block.innerFrame.php
2026-05-15 18:33:51 +02:00

407 lines
14 KiB
PHP

<?php
/**
* @author krku, mija
*
* Smarty plugin
* -------------------------------------------------------------
* File: block.innerFrame.php
* Type: block
* Name: innerFrame
* Purpose: Wewnêtrzna ramka
* -------------------------------------------------------------
*/
function __temp_function_make_image_url($headerTitle, $imageType, $zak = null) {
$url = Utils::makeImageUrlFromHeader($headerTitle);
if ($zak !== null) {
$imageUrl = "/image/Strona/zakladki/" . $imageType . $url . ($zak === 1 ? '_' : '-') . '.gif';
} else {
$imageUrl = "/image/Strona/" . ($imageType == 'header' ? "naglowki/" : "") . $imageType . $url . '.gif';
}
return $imageUrl;
}
function smarty_block_innerFrame($params, $content, &$smarty, &$repeat)
{
if (!$repeat) // Coby siê dwa razy nie wykonywa³o
{
$los = uniqid();
$mainObjPreserve = $smarty->get_template_vars("MainObjPreserve");
$bookmarks = $smarty->get_template_vars('bookmarks');
if (isset($bookmarks) && isset($bookmarks['count']) && $bookmarks['count'] > 0) {
$zakladki = true;
} else {
$bookmarks = array('data' => array());
$zakladki = false;
}
// if ($smarty->get_template_vars('MainObjPreserve')->GetId() != 0) {
$login_f = true;
// } else {
// $login_f = false;
// }
$firstBookmark = $params;
$firstBookmark['content'] = $content;
$useUrl = false;
if ($zakladki) {
if ($bookmarks['useUrl']) {
$useUrl = true;
$bcont = $firstBookmark['content'];
}
if (isset($firstBookmark['headerTitle'])) {
$headerTitleAll = $firstBookmark['headerTitle'];
}
$display = 'none';
} else {
$bookmarks['data'][] = $firstBookmark;
$display = 'block';
}
//Usuwamy tre¶æ zak³adek, ¿eby siê wiêcej razy nie pojawia³a
//Utils::ArrayDisplay($bookmarks);
$smarty->clear_assign('bookmarks');
$headerShown ='';
if(isset($params['hidden']) && $params['hidden'] == true ){
$headerShown = 'style="display:none"';
}
$className='';
if(isset($params['className'])){
$className = ' '.$params['className'].' menuTab';
}
$content = '';
$header = '<div class="innerFrameHeader'.$className.'" '.$headerShown.'>';
if (isset($headerTitleAll)) {
$headerImg = __temp_function_make_image_url($headerTitleAll, 'header');
if (file_exists(PATH_STATIC_CONTENT . $headerImg)) {
$header .= '<img class="innerFrameHeaderTitleMain' . ($bookmarks['small'] ? "Small" : "") . '" src="' . URL_STATIC_CONTENT . $headerImg . '" alt="' . $headerTitleAll . '" title="' . $headerTitleAll . '" />';
} else {
$header .= '<h1 class="innerFrameHeaderTitleMain' . ($bookmarks['small'] ? "Small" : "") . '">' . $headerTitleAll . '</h1>';
}
}
if ($zakladki) {
$header .= '<div class="innerFrameHeaderBookmarkMenu">';
}
foreach ($bookmarks['data'] as $k => $bookmark) {
if (!$useUrl) {
$bcont = $bookmark['content'];
}
if ($zakladki && $k == $bookmarks['active']) {
$displayIn = 'block';
$img = '_';
} else {
$displayIn = $display;
$img = '-';
}
if (((isset($cookmark['moreButton']) && $cookmark['moreButton']) || !isset($bookmark['moreButton'])) && isset($bookmark['moreUrl']) && $bookmark['moreUrl']) {
$moreUrl = $bookmark['moreUrl'];
} else if (((isset($firstBookmark['moreButton']) && $firstBookmark['moreButton']) || !isset($firstBookmark['moreButton'])) && isset($firstBookmark['moreUrl']) && $firstBookmark['moreUrl']) {
$moreUrl = $firstBookmark['moreUrl'];
}
if ((isset($bookmark['addButton']) && $bookmark['addButton']) || !isset($bookmark['addButton'])) {
if (isset($bookmark['addUrl']) && $bookmark['addUrl']) {
$addUrl = $bookmark['addUrl'];
}
else if (isset($bookmark['addUrlScript']) && $bookmark['addUrlScript']) {
$addUrl = $bookmark['addUrlScript'];
$addScript = true;
}
else if ((isset($firstBookmark['addButton']) && $firstBookmark['addButton']) || !isset($firstBookmark['addButton'])) {
if (isset($firstBookmark['addUrl']) && $firstBookmark['addUrl']) {
$addUrl = $firstBookmark['addUrl'];
}
else if (isset($firstBookmark['addUrlScript']) && $firstBookmark['addUrlScript']) {
$addUrl = $firstBookmark['addUrlScript'];
$addScript = true;
}
}
}
if (((isset($bookmark['editBlocked']) && !$bookmark['editBlocked']) || !isset($bookmark['editBlocked'])) && isset($bookmark['editUrl'])) {
$editUrl = $bookmark['editUrl'];
} else if (((isset($firstBookmark['editBlocked']) && !$firstBookmark['editBlocked']) || !isset($firstBookmark['editBlocked'])) && isset($firstBookmark['editUrl'])) {
$editUrl = $firstBookmark['edit'];
}
if (((isset($bookmark['abuseButton']) && $bookmark['abuseButton']) || !isset($bookmark['abuseButton'])) && isset($bookmark['abuseUrl'])) {
$abuseUrl = $bookmark['abuseUrl'];
} else if (((isset($firstBookmark['abuseButton']) && $firstBookmark['abuseButton']) || !isset($firstBookmark['abuseButton'])) && isset($firstBookmark['abuseUrl'])) {
$abuseUrl = $firstBookmark['abuseUrl'];
}
if (!$zakladki) {
if (isset($moreUrl)) {
$header .= '<div>';
} else {
$header .= '<div>';
}
}
if ($zakladki) {
$headerImg = __temp_function_make_image_url($bookmark['headerTitle'], 'zak', ($k == $bookmarks['active'] ? 1 : 0));
} else {
$headerImg = __temp_function_make_image_url($bookmark['headerTitle'], 'header');
}
if (file_exists(PATH_STATIC_CONTENT . $headerImg)) {
$hT = '<img id="innerFrameContentBookmark' . $k . 'Button' . $los . 'Img" src="' . URL_STATIC_CONTENT . $headerImg . '" alt="' . $bookmark['headerTitle'] . '" title="' . $bookmark['headerTitle'] . '"';
if ($zakladki) {
if ($useUrl) {
$header .= '<a href="' . $bookmark['url'] . '">' . $hT . ' /></a>';
} else {
$header .= $hT . ' onclick="switchBookmark(\'' . $los . '\', ' . $k . ');" />';
}
} else {
$hT .= " />";
if (isset($moreUrl) && $moreUrl) {
$header .= '<a href="' . $moreUrl . '">' . $hT . '</a>';
} else {
$header .= $hT;
}
}
} else {
$hT = $bookmark['headerTitle'];
if ($zakladki) {
if ($useUrl) {
$header .= '<h1><a href="' . $bookmark['url'] . '">' . $hT . '</a></h1>';
} else {
$header .= '<h1>' . $hT . '</h1>';
}
} else if (isset($moreUrl) && $moreUrl) {
$header .= '<h1><a href="' . $moreUrl . '">' . $hT . '</a></h1>';
} else {
$header .= '<h1>' . $hT . '</h1>';
}
}
unset($hT);
if (!$zakladki) {
$header .= '</div>';
}
if(isset($params['hidden']) && $params['hidden'] == true ){
$displayIn = 'none';
}
$content .= '<div class="innerFrame'.$className.'" id="inner' . $k . 'Frame' . $los . '" style="display: ' . $displayIn . ';">'.
'<div class="innerFrameContent"' . (isset($bookmark['contentId']) ? ' id="' . $bookmark['contentId'] . '"' : '') . '>' .
(isset($bookmarks['begin_content']) ? $bookmarks['begin_content'] : '') . $bcont . (isset($bookmarks['end_content']) ? $bookmarks['end_content'] : '').
'</div>'.
'<div class="cornerInnerTopLeft"><img src="'.URL_STATIC_CONTENT.'/image/Strona/cornerFrameTopLeft.gif" alt="" border="0" /></div>'.
'<div class="cornerInnerTopRight"><img src="'.URL_STATIC_CONTENT.'/image/Strona/cornerFrameTopRight.gif" alt="" border="0" /></div>'.
'<div class="cornerInnerBottomLeft"><img src="'.URL_STATIC_CONTENT.'/image/Strona/cornerFrameBottomLeft.gif" alt="" border="0" /></div>'.
'<div class="cornerInnerBottomRight"><img src="'.URL_STATIC_CONTENT.'/image/Strona/cornerFrameBottomRight.gif" alt="" border="0" /></div>';
if (!$zakladki || $zakladki && ((isset($bookmark['frameIcon']) && $bookmark['frameIcon']) || (isset($firstBookmark['frameIcon']) && $firstBookmark['frameIcon']))) {
if (isset($bookmark['frameIcon'])) {
$frameIcon = '/image/Strona/icon' . $bookmark['frameIcon'] . '.gif';
} else if (isset($firstBookmark['frameIcon'])) {
$frameIcon = '/image/Strona/icon' . $firstBookmark['frameIcon'] . '.gif';
} else {
$frameIcon = __temp_function_make_image_url($bookmark['headerTitle'], 'icon');
}
if (isset($bookmark['iconTop'])) {
$iconTop = $bookmark['iconTop'];
} else {
if($frameIcon == "/image/Strona/iconDeformator.gif")
$iconTop = -60;
else
$iconTop = -45;
}
if (isset($bookmark['iconRight'])) {
$iconRight = $bookmark['iconRight'];
} else {
$iconRight = 10;
}
if (isset($bookmark))
$frameIcon = $frameIcon;
if (file_exists(PATH_STATIC_CONTENT . $frameIcon)) {
$content .= '<div class="innerFrameIcon" style="top: ' . $iconTop .'px; right: ' . $iconRight . 'px;">'.
'<img src="' . URL_STATIC_CONTENT . $frameIcon . '" border="0" title="' . $bookmark['headerTitle'] . '" alt="' . $bookmark['headerTitle'] . '" />'.
'</div>';
}
}
if (isset($moreUrl)) {
$moreId = "buttonFrameMore" . ($zakladki ? $k : '') . $los;
if (isset($bookmark['moreTitle'])) {
$moreTitle = $bookmark['moreTitle'];
} else {
$moreTitle = "wiêcej";
}
$content .= '
<div class="innerFrameMore">'.
'<a onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'' . $moreId . '\');" href="' . $moreUrl . '" title="' . $moreTitle . '">'.
'<img id="' . $moreId . '" src="' . URL_STATIC_CONTENT . '/image/Strona/buttony/ramka/buttonFrameMore-.gif" alt="' . $moreTitle . '" title="' . $moreTitle . '" border="0" />'.
'</a></div>';
}
if (isset($addUrl)) {
$addImg = 'buttonFrame';
if (isset($bookmark['addImg'])) {
$addImg .= $bookmark['addImg'];
} else if (isset($bookmark['addComment'])) {
$addImg .= 'AddComment';
} else if (isset($firstBookmark['addImg'])) {
$addImg .= $firstBookmark['addImg'];
} else if (isset($firstBookmark['addComment'])) {
$addImg .= 'AddComment';
} else {
$addImg .= 'Add';
}
if (isset($bookmark['addComment']) || isset($firstBookmark['addComment'])) {
$addId = "buttonFrameAddComment";
} else {
$addId = "buttonFrameAdd" . ($zakladki ? $k : '') . $los;
}
$addClass = "innerFrameAdd";
if (isset($bookmark['addOnTop']) || isset($bookmark['addComment']) || isset($firstBookmark['addOnTop']) || isset($firstBookmark['addComment'])) {
$addClass .= "Top";
if (!isset($firstBookmark['addComment']) && !isset($bookmark['addComment'])) {
$addImg .= "Top";
}
} else if (isset($editUrl)) {
$addClass .= "WithEdit";
}
if (isset($bookmark['addTitle'])) {
$addTitle = $bookmark['addTitle'];
} else if (isset($firstBookmark['addTitle'])) {
$addTitle = $firstBookmark['addTitle'];
} else {
$addTitle = "dodaj";
}
$content .= '<div class="' . $addClass .'" ';
// if ($mainObjPreserve->GetId() == 0) {
// $addTitle = 'Zaloguj siê aby co¶ dodaæ';
// $addImgW = $addImg;
// $content .= '><a rev="width: 405px; height: 370px; scrolling: no;" title="' . $addTitle . '" rel="lyteframe" href="#" onclick="myLytebox.start(this, false, true,false,\'logowanie.html\'); return false;">';
// $addInactive = true;
// } else {
$addImgW = $addImg;
$addImg .= '-';
$addInactive = false;
$content .= 'onmouseover="MM_swapImage(\'' . $addId . '\');" onmouseout="MM_swapImgRestore()"';
if (!isset($addScript)) {
$content .= '><a href="' . $addUrl . '" title="' .$addTitle . '">';
} else {
$content .= ' onclick="' . $addUrl . '">';
}
// }
$content .= '<img style="display: none;" src="' . URL_STATIC_CONTENT . '/image/Strona/buttony/ramka/' . $addImgW . '-.gif" alt="" /><img style="display: none;" src="' . URL_STATIC_CONTENT . '/image/Strona/buttony/ramka/' . $addImgW . '_.gif" alt="" />';
$content .= '<img id="' . $addId . '" src="' . URL_STATIC_CONTENT . '/image/Strona/buttony/ramka/' . $addImg . '.gif" alt="' . $addTitle . '" title="' . $addTitle . '" border="0" />';
if (!isset($addScript)) {
$content .= '</a>';
}
$content .= '</div>';
if (isset($bookmark['addComment'])) {
$content .= '<div id="buttonFrameCancelComment" class="innerFrameAddTop" onmouseover="MM_swapImage(\'commentCancel\')" onmouseout="MM_swapImgRestore()" onclick="HideAddForm();" style="display: none;">'.
'<img id="commentCancel" border="0" title="Anuluj komentowanie" alt="Anuluj komentowanie" src="' . URL_STATIC_CONTENT . '/image/Strona/buttony/ramka/buttonFrameAnulujKomentowanie-.gif" />'.
'</div>';
}
}
if (isset($editUrl) && $login_f) {
$editId = "buttonFrameEdit" . ($zakladki ? $k : '') . $los;
if (isset($bookmark['editTitle'])) {
$editTitle = $bookmark['editTitle'];
} else {
$editTitle = "edytuj";
}
$content .= '
<div class="innerFrameEdit"' . (isset($addUrl) && $addUrl ? '' : 'WithoutAdd') . '>'.
'<a onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'' . $editId . '\');" href="' . $editUrl . '" title="' . $editTitle . '">'.
'<img id="' . $editId . '" src="' . URL_STATIC_CONTENT . '/image/Strona/buttony/ramka/buttonFrameEdit-.gif" alt="' . $editTitle . '" title="' . $editTitle . '" border="0" />'.
'</a></div>';
}
if (isset($abuseUrl)) {
$abuseImg = 'buttonFrame';
if (isset($bookmark['abuseImg'])) {
$abuseImg .= $bookmark['abuseImg'];
} else {
$abuseImg .= 'Abuse';
}
if (isset($bookmark['abuseTitle'])) {
$abuseTitle = $bookmark['abuseTitle'];
} else {
$abuseTitle = "Zg³o¶ nadu¿ycie";
}
$abuseId = "buttonFrameAbuse" . ($zakladki ? $k : '') . $los;
$abuseClass = "innerFrameAbuse";
$content .= '<div class="' . $abuseClass . '"><a title="' . $abuseTitle . '" rev="width: 540px; height: 425px; scrolling: no;" rel="lyteframe" onclick="myLytebox.start(this, false, true,true,\'' . $abuseUrl. '\'); return false;">'.
'<img id="' . $abuseId . '" src="' . URL_STATIC_CONTENT . '/image/Strona/buttony/ramka/' . $abuseImg . '.gif" alt="' . $abuseTitle . '" title="' . $abuseTitle . '" border="0" /></a></div>';
}
$content .= '</div>';
}
$header .= '</div>';
if ($zakladki) {
$header .= '</div>';
}
$smarty->clear_assign('bookmarks');
//Utils::ArrayDisplay($content);
return $header . $content;
}
}
?>