File: //opt/cpanel/ea-php54/root/usr/share/pear/RVSeagullMod/lib/RVSGL/rvsLibs/Navigator.php
<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// WebSite: http://www.rvglobalsoft.com
// Unauthorized copying is strictly forbidden and may result in severe legal action.
// Copyright (c) 2006 RV Global Soft Co.,Ltd. All rights reserved.
//
// =====YOU MUST KEEP THIS COPYRIGHTS NOTICE INTACT AND CAN NOT BE REMOVE =======
// Copyright (c) 2006 RV Global Soft Co.,Ltd. All rights reserved.
// This Agreement is a legal contract, which specifies the terms of the license
// and warranty limitation between you and RV Global Soft Co.,Ltd. and RV Site Builder.
// You should carefully read the following terms and conditions before
// installing or using this software. Unless you have a different license
// agreement obtained from RV Global Soft Co.,Ltd., installation or use of this software
// indicates your acceptance of the license and warranty limitation terms
// contained in this Agreement. If you do not agree to the terms of this
// Agreement, promptly delete and destroy all copies of the Software.
//
// ===== Grant of License =======
// The Software may only be installed and used on a single host machine.
//
// ===== Disclaimer of Warranty =======
// THIS SOFTWARE AND ACCOMPANYING DOCUMENTATION ARE PROVIDED "AS IS" AND
// WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER
// WARRANTIES WHETHER EXPRESSED OR IMPLIED. BECAUSE OF THE VARIOUS HARDWARE
// AND SOFTWARE ENVIRONMENTS INTO WHICH RV SITE BUILDER MAY BE USED, NO WARRANTY OF
// FITNESS FOR A PARTICULAR PURPOSE IS OFFERED. THE USER MUST ASSUME THE
// ENTIRE RISK OF USING THIS PROGRAM. ANY LIABILITY OF RV GLOBAL SOFT CO.,LTD. WILL BE
// LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT OR REFUND OF PURCHASE PRICE.
// IN NO CASE SHALL RV GLOBAL SOFT CO.,LTD. BE LIABLE FOR ANY INCIDENTAL, SPECIAL OR
// CONSEQUENTIAL DAMAGES OR LOSS, INCLUDING, WITHOUT LIMITATION, LOST PROFITS
// OR THE INABILITY TO USE EQUIPMENT OR ACCESS DATA, WHETHER SUCH DAMAGES ARE
// BASED UPON A BREACH OF EXPRESS OR IMPLIED WARRANTIES, BREACH OF CONTRACT,
// NEGLIGENCE, STRICT TORT, OR ANY OTHER LEGAL THEORY. THIS IS TRUE EVEN IF
// RV GLOBAL SOFT CO.,LTD. IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO CASE WILL
// RV GLOBAL SOFT CO.,LTD.'S LIABILITY EXCEED THE AMOUNT OF THE LICENSE FEE ACTUALLY PAID
// BY LICENSEE TO RV GLOBAL SOFT CO.,LTD.
// +---------------------------------------------------------------------------+
// $Id$
// +---------------------------------------------------------------------------+
/**
* RvSiteBuilder navigator libary
*
* @package RvsLibs
* @author Pairote Manunphol <pairote@rvglobalsoft.com>
* @version $Revision$
* @since PHP 5.1
*/
if (class_exists('RvsLibs_Navigator_Delete') === false) {
class RvsLibs_Navigator_Delete { }
}
if (class_exists('RvsLibs_Navigator_Set') === false) {
class RvsLibs_Navigator_Set extends RvsLibs_Navigator_Delete
{
public static function setUikitNavigationAlign($navCode, $navAlign)
{
switch(strtolower($navAlign)){
case 'center':
$cmdalign = 'uk-navbar-center';
break;
case 'right':
$cmdalign = 'uk-align-right';
break;
case 'left':
default:
$cmdalign = 'uk-align-left';
}
$navCode = preg_replace_callback(
'/(<div[^>]*?id\s*=\s*"getDetailNavigator"\s*[^>]*?cmdalign\s*=\s*")[^"]*?"/ims',
RvsLibs_Navigator_Set::_replaceAlignment($aMatch, $cmdalign)
,$navCode
);
return $navCode;
}
public static function _replaceAlignment($aMatch, $cmdalign)
{
return $aMatch[1].$cmdalign.'"';
}
}
}
if (class_exists('RvsLibs_Navigator_Get') === false) {
class RvsLibs_Navigator_Get extends RvsLibs_Navigator_Set
{
/**
* string $action
* 0 is step 5 , 1 is preview and 2 is publish
*/
public static function getNavigatorUrl($aValues, $publishPath, $publishUrl, $action)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
require_once SGL_MOD_DIR . '/sitebuilder/classes/PreviewMgr.php';
$oPreview = new PreviewMgr();
$aTemplateData = $aValues['aTemplateData'];
if(empty($input)) {
$input = new stdClass();
}
$input->menustyle_id = $aTemplateData->menustyle_id;
$input->template_item_folder = $aTemplateData->template_item_folder;
$input->def_navigator_id = $aTemplateData->navigator_id;
$input->template_path = $aTemplateData->templatePath;
$input->template_path_url = $aTemplateData->templateUrl;
$input->color_id = $aTemplateData->color_id;
$input->project_id = $aValues['aProjectInfoData']->project_id;
$input->rvs_usr_id = $aValues['aProjectInfoData']->rvs_usr_id;
$input->uniqueId = isset($aValues['cssNavigatorName']) && $aValues['cssNavigatorName']
? $aValues['cssNavigatorName']
: RvsLibs_String::genUniqueId();
$navigatorId = $aValues['aProjectInfoData']->navigator_id;
$input->navigator_name_id = (isset($aValues['aProjectInfoData']->navigator_name_id)) ? $aValues['aProjectInfoData']->navigator_name_id : 5;
// START is navigator template specific fix navigator_name_id = 999
if ($input->navigator_name_id == 999) {
// optimize : nipaporn : reuturn NavigatorUrl
return $oPreview->getPathNavigator($input->rvs_usr_id, $input->project_id, $input->template_item_folder);
}
// END is navigator template specific fix navigator_name_id = 999
if ( file_exists($input->template_path . '/' . $input->template_item_folder . '/colordb.ini.php')
&& file_exists(TEMPLATE_PATH . '/navigator/' . $navigatorId . '.css.php') || (!$navigatorId) ) {
$navigatorUrl = $oPreview->generateNavigator($input);
if ($action == 2) {
@copy(PROJECT_PATH . '/' . $input->project_id . '/' . $input->uniqueId . '.css', $publishPath . '/' . $input->uniqueId . '.css');
$url = $publishUrl . '/' . $input->uniqueId . '.css';
} else {
$url = $navigatorUrl;
}
} elseif ( file_exists($input->template_path . '/' . $input->template_item_folder . '/colordb.ini.php')
&& !file_exists(PROJECT_PATH . '/' . $input->project_id . '/' . $navigatorId . '.css')) {
$aValues['aProjectInfoData']->navigator_id = 0;
$url = RvsLibs_Navigator::getNavigatorUrl($aValues, $publishPath, $publishUrl, $action);
} elseif ( !file_exists($input->template_path . '/' . $input->template_item_folder . '/colordb.ini.php')
&& file_exists(TEMPLATE_PATH . '/navigator/' . $navigatorId . '.css.php')) {
$res = RvsLibs_Project::getColorGroupID($input->color_id);
$colorGroupId = $res[0]->color_group_id;
$res = DaoFactory::Navigator()->findNavigatorByNavigatorData(null, $input->navigator_name_id, $input->menustyle_id, $colorGroupId, 'getall');
$navigatorId = $res[0]->navigator_id;
copy(TEMPLATE_PATH . '/navigator/' . $navigatorId . '.css.php', $publishPath . '/' . $navigatorId . '.css.php');
$url = ($action != 0) ? $publishUrl . '/' . $navigatorId . '.css.php' : TEMPLATE_URL . '/navigator/' . $navigatorId . '.css.php';
} elseif ( !file_exists($input->template_path . '/' . $input->template_item_folder . '/colordb.ini.php')
&& !file_exists(TEMPLATE_PATH . '/navigator/' . $navigatorId . '.css.php')) {
$aValues['aProjectInfoData']->navigator_id = 0;
$url = RvsLibs_Navigator::getNavigatorUrl($aValues, $publishPath, $publishUrl, $action);
} else {
$aValues['aProjectInfoData']->navigator_id = 0;
$url = RvsLibs_Navigator::getNavigatorUrl($aValues, $publishPath, $publishUrl, $action);
}
SGL::logMessage("SB==" . $url, PEAR_LOG_DEBUG);
return $url;
}
/**
* set default color config navigator case no config color
* @param $projectId
* @param $templateItemFolder
* @return array
* @author duangdao.k
*/
public static function setDefaultaColorConfigNav($projectId, $templateItemFolder, $templatePath)
{
/// check file customcss/colordb.ini.php ถ้ามี file ให้ใช้ file customcss/colordb.ini.php ถ้าไม่มีให้ ใช้ template/colordb.ini.php
$aColorConfig = array();
$customCssPath = RvsLibs_Project::getCustomCssPath($projectId, $templateItemFolder);
$fileCustomColorDb = RvsLibs_File::buildPath(array($customCssPath, 'colordb.ini.php'));
SGL::logMessage('rvdebug: colordb: ' . $fileCustomColorDb, PEAR_LOG_DEBUG);
if (is_file($fileCustomColorDb) == true) {
$aColorConfig = (is_file($fileCustomColorDb))
? RvsLibs_Config::parse_ini_file($fileCustomColorDb,true)
: array();
if (count($aColorConfig) <= 0) {
$aColorConfig = RvsLibs_Navigator::getDefaultColorDB($templatePath, $templateItemFolder);
$aColorConfig = RvsLibs_Navigator::_updateColorDb2Level($aColorConfig, $fileCustomColorDb);
}
} else {
if (!is_dir($customCssPath)) {
RvsLibs_System::mkDir(array('-p', '-m', 0755, $customCssPath));
}
$aColorConfig = RvsLibs_Navigator::getDefaultColorDB($templatePath, $templateItemFolder);
//update colordb
$aColorConfig = RvsLibs_Navigator::_updateColorDb2Level($aColorConfig, $fileCustomColorDb);
}
return $aColorConfig;
}
public static function getDefaultColorDB($templatePath, $templateItemFolder)
{
$pathColordb = RvsLibs_File::buildPath(
array($templatePath, $templateItemFolder, 'colordb.ini.php')
);
$aColorConfig = (is_file($pathColordb))
? RvsLibs_Config::parse_ini_file($pathColordb,true)
: array();
return $aColorConfig;
}
/**
* get config font style สำหรับ navigation
* ทั้ง main menu > level1 > level2
*
* @return Ambigous <multitype:, string>
*/
public static function getDefaultFontStyle($config = array())
{
SGL::logMessage('rvdebug: >>>>>>',PEAR_LOG_DEBUG);
$font = (isset($config['font']['font_family']) && $config['font']['font_family']) ? $config['font']['font_family'] : 'Verdana';
$fontSize = (isset($config['font']['font_size']) && $config['font']['font_size']) ? $config['font']['font_size'] : '12px';
$fontId = (isset($config['font']['fontfamilyId']) && $config['font']['fontfamilyId']) ? $config['font']['fontfamilyId'] : '12';
$fontStyle = (isset($config['font']['fontstyle']) && $config['font']['fontstyle']) ? $config['font']['fontstyle'] : 'normal';
$aLoop = array('', '_sub', '_sub2');
$aDefault = array();
foreach ($aLoop as $k => $isSub) {
$aDefault['font']['font_style' . $isSub] = "font-family:{$font};font-size:{$fontSize};font-style:{$fontStyle};";
$aDefault['font']['font_family' . $isSub] = $font;
$aDefault['font']['font_size' . $isSub] = $fontSize;
$aDefault['font']['fontfamilyId' . $isSub] = $fontId;
$aDefault['font']['fontstyle' . $isSub] = $fontStyle;
}
return $aDefault;
}
/**
* merge navigation font style default + aCustomdb
*
* @param unknown $aCustomdb
* @return string
*/
static function getNavigationStyle($aCustomdb)
{
SGL::logMessage('rvdebug: ===', PEAR_LOG_DEBUG);
//font
$font = '';
$aCustomdb['font']['fontfamilyId'] = (isset($aCustomdb['font']['font_family'])) ? $aCustomdb['font']['font_family'] : '12';
$fontName = 'Verdana';
$aFont = RvsLibs_Util::getFonts();
if (isset($aFont[$aCustomdb['font']['font_family']])) {
$fontName = $aFont[$aCustomdb['font']['font_family']];
}
$aCustomdb['font']['font_family'] = $fontName;
$fontFamily = (isset($aCustomdb['font']['font_family']) && $aCustomdb['font']['font_family']) ? $aCustomdb['font']['font_family'] : 'Verdana';
$fontSize = (isset($aCustomdb['font']['font_size']) && $aCustomdb['font']['font_size']) ? $aCustomdb['font']['font_size'] : '12px';
$fontStyle = (isset($aCustomdb['font']['fontstyle']) && $aCustomdb['font']['fontstyle']) ? $aCustomdb['font']['fontstyle'] : 'normal';
$font = "font-family:{$fontFamily};font-size:{$fontSize};font-style:{$fontStyle};";
$aCustomdb['font']['font_style'] = $font;
//get navigation default merge input->aCustomdb
$defaultFont = RvsLibs_Navigator::getDefaultFontStyle($aCustomdb);
$aLoop = array('', '_sub', '_sub2');
foreach ($aLoop as $k => $isSub) {
$defaultFont['link']['color_anor' . $isSub] = $aCustomdb['link']['color_anor'];
$defaultFont['link']['color_ahov' . $isSub] = $aCustomdb['link']['color_ahov'];
$defaultFont['bgcolor']['color_bgh' . $isSub] = $aCustomdb['bgcolor']['color_bgh'];
}
return $defaultFont;
}
/**
* font only
* @param unknown $aCustomdb
* @return string
*/
static function getNavigationStyleFontV5($aCustomdb)
{
SGL::logMessage('rvdebug: ===', PEAR_LOG_DEBUG);
$aFont = RvsLibs_Util::getFonts();
$aLoop = array('', '_sub', '_sub2');
foreach ($aLoop as $k => $isSub) {
if (isset($aCustomdb['font']['fontfamilyId' . $isSub])) {
$fontId = $aCustomdb['font']['fontfamilyId' . $isSub];
$fontName = $aFont[$fontId];
$fontSize = $aCustomdb['font']['font_size' . $isSub];
$fontStyle = $aCustomdb['font']['fontstyle' . $isSub];
$aCustomdb['font']['font_family' . $isSub] = $fontName;
$fontCss = "font-family:{$fontName};font-size:{$fontSize};font-style:{$fontStyle};";
$aCustomdb['font']['font_style' . $isSub] = $fontCss;
}
}
//echo '<pre>'; print_r($defaultFont); exit;
return $aCustomdb;
}
/**
*
* @param unknown $array1
* @param unknown $array2
*/
public static function mergeConfig($aColorConfig, $aCustomFileConfig)
{
foreach ($aCustomFileConfig as $key => $value) {
if (!is_array($value)) {
if (empty($value)) {
$aCustomFileConfig[$key] = isset($aColorConfig[$key])
? $aColorConfig[$key]
: '';
}
continue;
}
foreach ($value as $k => $v) {
if (empty($v)) {
$aCustomFileConfig[$key][$k] = isset($aColorConfig[$key][$k])
? $aColorConfig[$key][$k]
: '';
}
}
}
return $aCustomFileConfig;
}
/**
*
* @param unknown $array1
* @param unknown $array2
* @param string $isSub
*/
public static function mergeConfigSub($aCustomdb, $aCustomMerge, $isSub = '')
{
foreach ($aCustomdb as $key => $value) {
if (!is_array($value)) {
continue;
}
foreach ($value as $k => $v) {
if (!empty($v)) {
$aCustomMerge[$key][$k] = (isset($aCustomMerge[$key][$k]) && $aCustomMerge[$key][$k])
? $aCustomMerge[$key][$k] : '';
$aCustomMerge[$key][$k . $isSub] = $v;
} else {
$aCustomMerge[$key][$k] = (isset($aCustomMerge[$key][$k]) && $aCustomMerge[$key][$k])
? $aCustomMerge[$key][$k] : '';
$aSub = (isset($aCustomMerge[$key][$k . $isSub]) && $aCustomMerge[$key][$k . $isSub])
? $aCustomMerge[$key][$k . $isSub] : $aCustomMerge[$key][$k];
$aCustomMerge[$key][$k . $isSub] = $aSub;
}
}
}
return $aCustomMerge;
}
public static function _updateColorDb2Level($aColorConfig, $fileCustomColorDb)
{
SGL::logMessage('rvdebug: colordb: ' . $fileCustomColorDb, PEAR_LOG_DEBUG);
//ถ้าเป็น sub menu และไม่ได้ config ไว้ ให้ ใช้ ค่า main men
if (count($aColorConfig) > 0) {
foreach ($aColorConfig as $key => $aValue) {
foreach ($aValue as $k => $v) {
$aColorConfig[$key][$k . '_sub'] = (isset($aColorConfig[$key][$k . '_sub']) && $aColorConfig[$key][$k . '_sub'])
? $aColorConfig[$key][$k . '_sub']
: $aColorConfig[$key][$k];
$aColorConfig[$key][$k . '_sub2'] = (isset($aColorConfig[$key][$k . '_sub2']) && $aColorConfig[$key][$k . '_sub2'])
? $aColorConfig[$key][$k . '_sub2']
: $aColorConfig[$key][$k];
}
}
$aDefault = RvsLibs_Navigator::getDefaultFontStyle($aColorConfig);
$aColorConfig['font'] = $aDefault['font'];
}
RvsLibs_Config::writeConfigToIniFile($aColorConfig, $fileCustomColorDb);
return $aColorConfig;
}
/**
* fix W3C match change id="normal" to class="normail"
* @param unknown_type $cssPath
* @return unknown_type
*/
public static function writeIdtoClass($cssPath)
{
if (file_exists($cssPath)) {
$aNavigator = file($cssPath);
$navigator = join('',$aNavigator);
$navigator = preg_replace('/a\#normal/','a.normal',$navigator);
$navigator = preg_replace('/\#navigator/','.navigator',$navigator);
$res = RvsLibs_File::writeFile($cssPath, $navigator, 'w+');
if (SGL::isError($res) === true) {
SGL_Error::pop();
}
}
}
public static function genLinkNavigatorLevel2($projectId, $rvsOwnerId, $aOnePageStructure, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl = PROJECT_URL, $navigatorId)
{
$pageId = $aOnePageStructure->project_page_id;
$realPageId = (isset($aOnePageStructure->project_real_page_id) && $aOnePageStructure->project_real_page_id) ? $aOnePageStructure->project_real_page_id : $pageId;
// set เครื่องหมาย + ใหกับ main page ที่ มี subpage
$pageName = $aOnePageStructure->page_name;
$projectId = (isset($projectId) && $projectId != null)? $projectId : RvsLibs_Project::getProjectId();
$fileOptionTable = RvsLibs_File::buildPath(array(REAL_PROJECT_PATH, $projectId, 'setOptionTableTop.ini'));
$aShowHideMarkSub = (is_file($fileOptionTable) == true)
? RvsLibs_Config::parse_ini_file($fileOptionTable , true)
: false;
if (isset($aOnePageStructure->level1) && count($aOnePageStructure->level1)) {
$pageName = (isset($aShowHideMarkSub['showHideMarkSub']['status']) && $aShowHideMarkSub['showHideMarkSub']['status'] == 'hideMask')
? $pageName
: $pageName . " +";
} elseif (isset($aOnePageStructure->level2) && count($aOnePageStructure->level2)) {
$pageName = (isset($aShowHideMarkSub['showHideMarkSub_sub']['status']) && $aShowHideMarkSub['showHideMarkSub_sub']['status'] == 'hideMask')
? $pageName
: $pageName . " +";
}
$parentProjectPageId = $aOnePageStructure->parent_project_page_id;
$rvsLinkId = $aOnePageStructure->rvs_link_id;
$pageTarget = $aOnePageStructure->target;
$componentId = $aOnePageStructure->rvs_component_id;
$pagelinkActive = (isset($aOnePageStructure->link_active)) ? $aOnePageStructure->link_active : 0;
$fileName = (isset($aOnePageStructure->file_name)) ? $aOnePageStructure->file_name : '';
$pages = RvsLibs_Navigator::getUrlForThisPage($pageId, $realPageId, $componentId, $navAction, $rvsOwnerId, $pagelinkActive, $fileName);
if ($rvsLinkId) {
$realPageId = (isset($realPageId) && $realPageId) ? $realPageId : $pageId;
$aLinkOption = RvsLibs_Navigator::_getPageLinkOptionData($rvsLinkId, $realPageId);
} else {
$aLinkOption = "";
}
// Set Link target for MainPage
$linkTarget = RvsLibs_Navigator::_setLinkTarget($rvsLinkId, $pageTarget, $navAction);
return $navigator = RvsLibs_Navigator::_generateNavigatorParentLevel2($pageName, $realPageId, $currentPageId , $projectUrl, $pages, $linkTarget, $menustyleId, $projectRealPageId, 0, 0, 0, $navAction, $aLinkOption, $pagelinkActive, $aOnePageStructure);
}
/**
* generate navigation select option level2
*/
public static function genNavigatorOptionLevel2($projectId, $rvsOwnerId, $aPageStructure, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl = PROJECT_URL, $navigatorId)
{
SGL::logMessage('test', PEAR_LOG_DEBUG);
$navHTM = '<div class="rs_select_navigation">';
$navHTM .= '<select id="jumpmenu" name="jumpmenu" onchange="res_jumpmenu(\'parent\',this)">' . "\n";
$genDivForDialog = '';
//main level0
//echo '<pre>';
//print_r($aPageStructure);
//exit;
foreach ($aPageStructure as $k => $v) {
if (isset($v->component_name) && $v->component_name == 'Newsletter') {
continue;
}
$builNav = RvsLibs_Navigator::genLinkNavigatorLevel2($projectId, $rvsOwnerId, $v, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl, $navigatorId);
//grep URL
//$navHTM .= '<option value="#">'.$builNav['data'].'</option>';
if (preg_match_all('/<a href="(.*?)"(.*?)><span(.*?)>(.*?)<\/span>/', $builNav['data'],$aM)) {
$navHTM .= '<option id="op_' . $k . '" value="' . $aM[1][0] . '">' . $aM[4][0] . '</option>';
}
//level 1
if (isset($v->level1) && count($v->level1)) {
foreach ($v->level1 as $k1 => $v1) {
if (RvsLibs_Util::validateTrue($v1->set_draft) === true) {
continue;
}
$builNav = RvsLibs_Navigator::genLinkNavigatorLevel2($projectId, $rvsOwnerId, $v1, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl, $navigatorId);
//$navHTM .= '<option value="#">'.$builNav['data'].'</option>';
if (preg_match_all('/<a href="(.*?)"(.*?)><span(.*?)>(.*?)<\/span>/', $builNav['data'],$aM)) {
$navHTM .= '<option id="op_' . $currentPageId . '" value="' . $aM[1][0] . '"> > ' . $aM[4][0] . '</option>';
}
//level 2
if (isset($v1->level2) && count($v1->level2)) {
foreach ($v1->level2 as $k2 => $v2) {
if (RvsLibs_Util::validateTrue($v2->set_draft) === true) {
continue;
}
$builNav = RvsLibs_Navigator::genLinkNavigatorLevel2($projectId, $rvsOwnerId, $v2, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl, $navigatorId);
//$navHTM .= '<option value="#">'.$builNav['data'].'</option>';
if (preg_match_all('/<a href="(.*?)"(.*?)><span(.*?)>(.*?)<\/span>/', $builNav['data'],$aM)) {
$navHTM .= '<option id="op_' . $currentPageId . '" value="' . $aM[1][0] . '"> >> ' . $aM[4][0] . '</option>';
}
}
}
}
}
}
$navHTM .= '</select>';
$navHTM .= '</div>';
return $navHTM;
}
public static function genNavigatorLevel2($projectId, $rvsOwnerId, $aPageStructure, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl = PROJECT_URL, $navigatorId)
{
SGL::logMessage('test', PEAR_LOG_DEBUG);
if (SGL_Output::isV6Session() == true) {
$pageId = $aPageStructure->project_page_id;
$aTagHeadPage = DaoFactory::Project()->findRvsHead($projectId, $pageId, 'getrow');
if (count($aTagHeadPage) > 0 ) {
$aPageStructure->other_embed = $aTagHeadPage['head_tag_data'];
}
}
$navHTM = '<div id="rvnavigator"><ul class="rvnavigator">' . "\n";
$genDivForDialog = '';
foreach ($aPageStructure as $k => $v) {
if (RvsLibs_Util::validateTrue($v->set_draft) === true) {
continue;
}
//v5 ไม่โชว์ newsletter ใน navagator
if (isset($v->component_name) && $v->component_name == 'Newsletter') {
continue;
}
$navHTM .= '<li>' . "\n";
$builNav = RvsLibs_Navigator::genLinkNavigatorLevel2($projectId, $rvsOwnerId, $v, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl, $navigatorId);
$navHTM .= $builNav['data'];
$genDivForDialog .= (isset($builNav['genDiv']))?$builNav['genDiv']. "\n" :'';
//START <ul> level1
$navHTM .= (isset($v->level1) && count($v->level1)) ? '<ul>' . "\n" : '';
if (isset($v->level1) && count($v->level1)) {
foreach ($v->level1 as $k1 => $v1) {
if (RvsLibs_Util::validateTrue($v1->set_draft) === true) {
continue;
}
$navHTM .= '<li>' . "\n";
$builNav = RvsLibs_Navigator::genLinkNavigatorLevel2($projectId, $rvsOwnerId, $v1, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl, $navigatorId);
$navHTM .= $builNav['data'];
$genDivForDialog .= (isset($builNav['genDiv']))?$builNav['genDiv']. "\n" :'';
//START <ul> level2
$navHTM .= (isset($v1->level2) && count($v1->level2)) ? '<ul>' . "\n" : '';
if (isset($v1->level2) && count($v1->level2)) {
foreach ($v1->level2 as $k2 => $v2) {
if (RvsLibs_Util::validateTrue($v2->set_draft) === true) {
continue;
}
$navHTM .= '<li>' . "\n";
$builNav = RvsLibs_Navigator::genLinkNavigatorLevel2($projectId, $rvsOwnerId, $v2, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl, $navigatorId);
$navHTM .= $builNav['data'];
$genDivForDialog .= (isset($builNav['genDiv']))?$builNav['genDiv']. "\n" :'';
$navHTM .= '</li>' . "\n";
}
}
//END </ul> level2
$navHTM .= (isset($v1->level2) && count($v1->level2)) ? '</ul>' . "\n" : '';
$navHTM .= '</li>' . "\n";
}
}
//END </ul> level1
$navHTM .= (isset($v->level1) && count($v->level1)) ? '</ul>' . "\n" : '';
$navHTM .= '</li>' . "\n";
}
//END <ul> level0
$navHTM .= '</ul></div>' . "\n" . '<div class="clear"></div>' . "\n";
//echo "<hr>";
//echo htmlspecialchars($navHTM);
if ($genDivForDialog != '') {
$genDivForDialog = '<!-- {literal} --><script language="JavaScript" type="text/javascript">' . "\n" . $genDivForDialog . '</script><!-- {/literal} -->' . "\n";
}
return $genDivForDialog . $navHTM;
}
//navigator desktop
public static function genNavigatorLevel2Uikit($projectId, $rvsOwnerId, $aPageStructure, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl = PROJECT_URL, $navigatorId)
{
$oPublishReg = Publish_Registry::singleton();
$action = $oPublishReg->get('action');
//get current pahe_id
$currentPageId = ($oPublishReg->get('project_page_id')) ? $oPublishReg->get('project_page_id') : $currentPageId;
SGL::logMessage('test action : ' . $action . ' currentPageId: ' . $currentPageId, PEAR_LOG_DEBUG);
$navHTM = '<div class="uk-container uk-container-center">
<div id="rvnavigator">
<nav class="uk-navbar" style="margin: 0px;">
<ul class="uk-navbar-nav uk-hidden-small">' . "\n";
$genDivForDialog = '';
foreach ($aPageStructure as $k => $v) {
//case: set draft not show lv0 preview/publish
if ($action != 0 && RvsLibs_Util::validateTrue($v->set_draft) === true) {
continue;
}
//v5 ไม่โชว์ newsletter ใน navagator
if (isset($v->component_name) && $v->component_name == 'Newsletter') {
continue;
}
//check set active is current page_id
$ukActiveParent = ($v->project_page_id == $currentPageId) ? 'uk-active' : '';
$ukActive = ($v->project_page_id == $currentPageId) ? ' class="uk-active" ' : '';
//have sub
$navHTM .= (isset($v->level1) && count($v->level1)) ? sprintf('<li class="uk-parent %s" data-uk-dropdown="">', $ukActiveParent) . "\n" : sprintf('<li %s>' ,$ukActive) . "\n";
$builNav = RvsLibs_Navigator::genLinkNavigatorLevel2($projectId, $rvsOwnerId, $v, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl, $navigatorId);
$navHTM .= $builNav['data'];
$genDivForDialog .= (isset($builNav['genDiv']))?$builNav['genDiv']. "\n" :'';
//START <ul> level1
$navHTM .= (isset($v->level1) && count($v->level1)) ? '<div class="uk-dropdown uk-dropdown-navbar">' . "\n" . '<ul class="uk-nav uk-nav-navbar">' . "\n" : '';
if (isset($v->level1) && count($v->level1)) {
foreach ($v->level1 as $k1 => $v1) {
//case: set draft not show lv1 preview/publish
if ($action != 0 && RvsLibs_Util::validateTrue($v1->set_draft) === true) {
continue;
}
$navHTM .= '<li>' . "\n";
$builNav = RvsLibs_Navigator::genLinkNavigatorLevel2($projectId, $rvsOwnerId, $v1, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl, $navigatorId);
$navHTM .= $builNav['data'];
$genDivForDialog .= (isset($builNav['genDiv']))?$builNav['genDiv']. "\n" :'';
//START <ul> level2
$navHTM .= (isset($v1->level2) && count($v1->level2)) ? '<ul class="uk-nav-sub">' . "\n" : '';
if (isset($v1->level2) && count($v1->level2)) {
foreach ($v1->level2 as $k2 => $v2) {
//case: set draft not show lv2 preview/publish
if ($action != 0 && RvsLibs_Util::validateTrue($v2->set_draft) === true) {
continue;
}
$navHTM .= '<li>' . "\n";
$builNav = RvsLibs_Navigator::genLinkNavigatorLevel2($projectId, $rvsOwnerId, $v2, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl, $navigatorId);
$navHTM .= $builNav['data'];
$genDivForDialog .= (isset($builNav['genDiv']))?$builNav['genDiv']. "\n" :'';
$navHTM .= '</li>' . "\n";
}
}
//END </ul> level2
$navHTM .= (isset($v1->level2) && count($v1->level2)) ? '</ul>' . "\n" : '';
$navHTM .= '</li>' . "\n";
}
}
//END </ul> level1
$navHTM .= (isset($v->level1) && count($v->level1)) ? '</ul>' . "\n" . "</div>" : '';
$navHTM .= '</li>' . "\n";
}
$isMemberPage = $oPublishReg->get('pageData', 'is_member_page', $currentPageId);
//END <ul> level0
$navHTM .= '</ul>
<a href="#offcanvas" class="uk-navbar-toggle uk-visible-small" data-uk-offcanvas></a>
<div class="uk-navbar-brand uk-navbar-center uk-visible-small">{COMPANY_NAME}</div>
</nav>
</div>
' . "\n" . '<div class="clear"></div></div>' . "\n";
//echo "<hr>";
//echo htmlspecialchars($navHTM);
if ($genDivForDialog != '') {
$genDivForDialog = '<!-- {literal} --><script language="JavaScript" type="text/javascript">' . "\n" . $genDivForDialog . '</script><!-- {/literal} -->' . "\n";
}
return $genDivForDialog . $navHTM;
}
//navigator mobile
public static function genNavigatorOptionLevel2Uikit($projectId, $rvsOwnerId, $aPageStructure, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl = PROJECT_URL, $navigatorId)
{
$oPublishReg = Publish_Registry::singleton();
$action = $oPublishReg->get('action');
SGL::logMessage('test action : ' . $action, PEAR_LOG_DEBUG);
$navHTM = '<div id="offcanvas" class="uk-offcanvas">
<div class="uk-offcanvas-bar">
<ul class="uk-nav uk-nav-parent-icon uk-nav-offcanvas" data-uk-nav="">' . "\n";
$genDivForDialog = '';
foreach ($aPageStructure as $k => $v) {
//case: set draft not show lv0 preview/publish
if ($action != 0 && RvsLibs_Util::validateTrue($v->set_draft) === true) {
continue;
}
//v5 ไม่โชว์ newsletter ใน navagator
if (isset($v->component_name) && $v->component_name == 'Newsletter') {
continue;
}
//have sub
$navHTM .= (isset($v->level1) && count($v->level1)) ? '<li class="uk-parent">' . "\n" : '<li>' . "\n";
$builNav = RvsLibs_Navigator::genLinkNavigatorLevel2($projectId, $rvsOwnerId, $v, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl, $navigatorId);
$navHTM .= $builNav['data'];
$genDivForDialog .= (isset($builNav['genDiv']))?$builNav['genDiv']. "\n" :'';
//START <ul> level1
$navHTM .= (isset($v->level1) && count($v->level1)) ? '<ul class="uk-nav-sub">' . "\n" : '';
if (isset($v->level1) && count($v->level1)) {
foreach ($v->level1 as $k1 => $v1) {
//case: set draft not show lv1 preview/publish
if ($action != 0 && RvsLibs_Util::validateTrue($v1->set_draft) === true) {
continue;
}
$navHTM .= '<li>' . "\n";
$builNav = RvsLibs_Navigator::genLinkNavigatorLevel2($projectId, $rvsOwnerId, $v1, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl, $navigatorId);
$navHTM .= $builNav['data'];
$genDivForDialog .= (isset($builNav['genDiv']))?$builNav['genDiv']. "\n" :'';
//START <ul> level2
$navHTM .= (isset($v1->level2) && count($v1->level2)) ? '<ul class="uk-nav-sub">' . "\n" : '';
if (isset($v1->level2) && count($v1->level2)) {
foreach ($v1->level2 as $k2 => $v2) {
//case: set draft not show lv2 preview/publish
if ($action != 0 && RvsLibs_Util::validateTrue($v2->set_draft) === true) {
continue;
}
$navHTM .= '<li>' . "\n";
$builNav = RvsLibs_Navigator::genLinkNavigatorLevel2($projectId, $rvsOwnerId, $v2, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl, $navigatorId);
$navHTM .= $builNav['data'];
$genDivForDialog .= (isset($builNav['genDiv']))?$builNav['genDiv']. "\n" :'';
$navHTM .= '</li>' . "\n";
}
}
//END </ul> level2
$navHTM .= (isset($v1->level2) && count($v1->level2)) ? '</ul>' . "\n" : '';
$navHTM .= '</li>' . "\n";
}
}
//END </ul> level1
$navHTM .= (isset($v->level1) && count($v->level1)) ? '</ul>' : '';
$navHTM .= '</li>' . "\n";
}
//END <ul> level0
$navHTM .= '</ul>
</div>
' . "\n" . '<div class="clear"></div></div>' . "\n";
//echo "<hr>";
//echo htmlspecialchars($navHTM);
if ($genDivForDialog != '') {
$genDivForDialog = '<!-- {literal} --><script language="JavaScript" type="text/javascript">' . "\n" . $genDivForDialog . '</script><!-- {/literal} -->' . "\n";
}
return $genDivForDialog . $navHTM;
}
/**
* generateNavigator
* The function to build navigator for end-user website in WYSIWYG, Preview, and Publish view
*
* @author Apiruk <apiruk@rvglobalsoft.com>
* @author Pairote <pairote@rvglobalsoft.com>
* @version $Revision: 1.112 $
* @param $rvsOwnerId: deprecated ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝาน๏ฟฝ๏ฟฝในฟัง๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ ๏ฟฝ๏ฟฝ๏ฟฝัง๏ฟฝีบาง๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ่งค๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ
*/
public static function generateNavigator($projectId, $rvsOwnerId, $aPageStructure, $currentPageId , $navAction, $menustyleId, $projectRealPageId, $projectUrl = PROJECT_URL, $navigatorId)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
if ($navAction == '0') {
$projectUrl = $projectUrl . '/' . INDEX_PHPSU . '/sitebuilder';
} else {
$projectUrl = $projectUrl . '/' . $projectId;
}
$setHead = 0;
$idx = 0;
$totalPage = 0;
$head = '';
$isNotFirstParentPage = 0;
$setTopMoveLayer = '';
$subMenuData = '';
if ($aPageStructure) {
$totalPage = count($aPageStructure);
foreach ($aPageStructure as $key=>$line) {
if ($aPageStructure[$key]->parent_project_page_id) {
$setHead = 1;
$menustyleId = $menustyleId;
$subMenuData = '<!-- START SUBMENU DATA -->';
$subMenuData .= "\n";
$subMenuData .= '<!-- beginning of menu footer - PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/ -->';
$subMenuData .= "\n";
break;
}
}
$navigator = ($navAction == 0 && $navigatorId == 999) ? '<style type="text/css">.subframe{top:29px;}</style>' : '';
$navigator .= ($navAction != 0) ? '<div class="navigator">' . "\n" : '<div id="navigator">' . "\n";
//comment fix W3C
//<ul> cannot add div </ul>
/*Fix <ul class="navigator" id="vermenu1" class="verbar" เวลา flexy compile มันจะตัด attr class ตัวหนึ่งออก*/
if ($setHead && $menustyleId == 1) {
$navigator .= ($navAction != 0)
? '<ul class="navigator verbar" id="vermenu1" onmouseover="clearLMTO();" onmouseout="setLMTO();"'
: '<ul id="navigator">' . "\n" . '<div id="vermenu1" class="verbar" onmouseover="clearLMTO();" onmouseout="setLMTO();">' . "\n";
} else {
$navigator .= ($navAction != 0) ? '<ul class="navigator"' : '<ul id="navigator">' . "\n";
}
$navigator .= ($navAction != 0) ? '>' . "\n" : "";
//end fix W3C
foreach ($aPageStructure as $key=>$line) {
//$aPageStructure[$key]->project_page_id คือ page name
$pageId = $aPageStructure[$key]->project_page_id;
$realPageId = (isset($aPageStructure[$key]->project_real_page_id) && $aPageStructure[$key]->project_real_page_id) ? $aPageStructure[$key]->project_real_page_id : $pageId;
$pageName = $aPageStructure[$key]->page_name;
$parentProjectPageId = $aPageStructure[$key]->parent_project_page_id;
$menustyleId = $menustyleId;
$idx = $aPageStructure[$key]->idx;
$rvsLinkId = $aPageStructure[$key]->rvs_link_id;
$pageTarget = $aPageStructure[$key]->target;
$componentId = $aPageStructure[$key]->rvs_component_id;
$pagelinkActive = (isset($aPageStructure[$key]->link_active)) ? $aPageStructure[$key]->link_active : 0;
$fileName = (isset($aPageStructure[$key]->file_name)) ? $aPageStructure[$key]->file_name : '';
$pages = RvsLibs_Navigator::getUrlForThisPage($pageId, $realPageId, $componentId, $navAction, $rvsOwnerId, $pagelinkActive, $fileName);
if ($rvsLinkId) {
$realPageId = (isset($realPageId) && $realPageId) ? $realPageId : $pageId;
$aLinkOption = RvsLibs_Navigator::_getPageLinkOptionData($rvsLinkId, $realPageId);
} else {
$aLinkOption = "";
}
// Set Link target for MainPage
$linkTarget = RvsLibs_Navigator::_setLinkTarget($rvsLinkId, $pageTarget, $navAction);
if ($setHead) {
// There is subpage in this navigator
if (!$parentProjectPageId) {
$aChildValues = RvsLibs_Navigator::_getChildIndexFromParentPageIdx($aPageStructure, $aPageStructure[$key]->idx);
if (count($aChildValues) > 0) {
//optimize:pharadol
for ($i = 0, $max = count($aChildValues); $i < $max; $i++) {
if ($i == 0 && $isNotFirstParentPage == 0) {
$listParentPage = "listl = ['L" . $idx . "'";
$fatherKeys = "father_keys = ['L" . $aChildValues[0]['child_idx'] . "'";
$fatherVals = "father_vals = ['L" . $idx . "'";
$isNotFirstParentPage = 1;
} else {
if ($i == 0) {
$listParentPage .= ",'L" . $idx . "'";
}
$fatherKeys .= ",'L" . $aChildValues[$i]['child_idx'] . "'";
$fatherVals .= ",'L" . $idx . "'";
}
}
if ($menustyleId == 2) {
$setTopMoveLayer .= "setTop('L" . $idx . "', hormenu1TOP + hormenu1HEIGHT);" . "\n";
$setTopMoveLayer .= "moveLayerX1('L" . $idx . "', 'hormenu1');" . "\n";
} else {
$setTopMoveLayer .= "setLeft('L" . $idx . "', vermenu1LEFT + vermenu1WIDTH - menuRightShift);" . "\n";
}
// This is a parent page with subpages
$navigator .= RvsLibs_Navigator::_generateNavigatorParent($pageName, $realPageId, $currentPageId , $projectUrl, $pages, $linkTarget, $menustyleId, $projectRealPageId, $setHead, $idx, 1, $navAction, $aLinkOption, $pagelinkActive);
// Generate child page data
$subMenuData .= RvsLibs_Navigator::_generateNavigatorChild($idx, $aChildValues, $projectUrl, $linkTarget, $menustyleId, $navAction, $rvsOwnerId);
} else {
// This is a parent page without subpages
$navigator .= RvsLibs_Navigator::_generateNavigatorParent($pageName, $realPageId, $currentPageId , $projectUrl, $pages, $linkTarget, $menustyleId, $projectRealPageId, $setHead, $idx, 0, $navAction, $aLinkOption, $pagelinkActive);
}
}
} else {
// There is zero subpage in this navigator
$navigator .= RvsLibs_Navigator::_generateNavigatorParent($pageName, $realPageId, $currentPageId , $projectUrl, $pages, $linkTarget, $menustyleId, $projectRealPageId, 0, 0, 0, $navAction, $aLinkOption, $pagelinkActive);
}
}
//fix W3C
if ($navAction == 0 && $setHead && $menustyleId == 1) {
$navigator .= '</div>' . "\n";
}
//end fix W3C
$navigator .= '</ul>' . "\n";
$navigator .= '</div>' . "\n";
if ($setHead) {
$listParentPage .= '];' . "\n";
$fatherKeysVals = $fatherKeys . '];' . "\n" . $fatherVals . '];' . "\n";
$subMenuData .= "\n";
$subMenuData .= '<script language="JavaScript" type="text/javascript">' . "\n";
//$subMenuData .= '<!--' . "\n";
$subMenuData .= '//<!--' . "\n";
$subMenuData .= 'loaded = 1;' . "\n";
$subMenuData .= '// -->' . "\n";
$subMenuData .= '</script>' . "\n";
$subMenuData .= '<!-- end of menu footer - PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/ -->' . "\n";
$subMenuData .= '<!-- END SUBMENU DATA -->' . "\n";
$head = RvsLibs_Navigator::_getSubMenuHead($totalPage, $listParentPage, $fatherKeysVals, $setTopMoveLayer, $menustyleId, $navAction);
} else {
//fixed java undefine Opera56
// $head .= '//</script>' . "\n";
$head = RvsLibs_Navigator::_getMainMenuHead($menustyleId);
//echo'else -->' . $head;
}
// optimize : nipapon
return array($head, $navigator, $subMenuData);
}
}
/**
* generate page name menu with extionsion .php or .html
*
* @param string $pageId is page name
* @param string $realPageId is page id
* @param string $componentId
* @param string $navAction
* @param string $rvsOwnerId
* @param int $pagelinkActive
* @return unknown
*/
public static function getUrlForThisPage($pageId, $realPageId, $componentId, $navAction, $rvsOwnerId, $pagelinkActive = 0, $fullPage = null)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$htmlcode = SGL_Session::get('htmlcode');
$oMgr = SGL_Manager::singleton();
$oPublishReg = Publish_Registry::singleton();
$publishUrl = $oPublishReg->get('publishUrl');
// get component_name
if ($componentId != '0' && $componentId != '') {
$componentName = $oPublishReg->get('componentConfig', 'component_name', $componentId);
if (is_null($componentName) || empty($componentName)) {
$aComponentData = RvsLibs_Component::getComponentData($componentId, $rvsOwnerId);
$componentName = isset($aComponentData[$componentId]->component_name)
? $aComponentData[$componentId]->component_name
: '';
}
//fixed PHPMD scan 30/06/2544
//$cComponentName = 'c' . $componentName;
//$strlComponentName = RvsLibs_String::strtolower($cComponentName);
//$componentConfigUser = RvsLibs_String::strtolower('ComponentConfigUser');
}
if ($navAction == '0') {
if (isset($componentName) && ($componentId != '0') && $componentName != "Online_Form") {
//$pages = "/" . $componentConfigUser . "/project_page_id/" . $pageId . '/component_name/' . $componentName . '/menuName/Configuration';
//$pages = "/listpagestructure/displayMainPageStructure/false/project_page_id/" . $pageId . '/component_name/' . $componentName . '/menuName/Configuration';
$pages = SGL_Output::makeUrl("","ComponentUserAndSystem","sitebuilder");
$pages .= "/sitebuilder/ComponentUserAndSystem/project_page_id/" . $pageId . '/component_name/' . $componentName . '/isWys/1';
} else {
// $pages = "/wysiwyg/project_page_id/" . $pageId ."/project_id/" . $projectId;
$pages = SGL_Output::makeUrl("","layouttemplateuser","sitebuilder");
$isHtmlCode = (isset($htmlcode) && $htmlcode == 1) ? "/htmlcode/1" :"";
$pages .= "/sitebuilder/layouttemplateuser/project_page_id/" . $pageId . $isHtmlCode;
}
} else {
$pages = $publishUrl . '/' . $fullPage;
/*
comment 05/01/54
if ($componentId != '0') {
$pages = $pageId . '.php';
} else {
if ($oMgr->conf['wysiwyg']['allowPhp'] == 1 || SGL_Session::get("onlineform_" . $realPageId) || RvsLibs_Project::isPublishCompoDB()) {
$pages = $pageId . '.php';
} else {
$pages = $pageId . '.html';
}
}
*/
}
//var_dump($projectId);
//var_dump(RvsLibs_Project::isPublishCompoDB($projectId));exit;
//echo $pages;
// check page link active disable
// optimize :nipaporn
return (isset($pagelinkActive) && $pagelinkActive == 1) ? '' : $pages;
}
/**
* get link option data
* @param $rvsLinkId
* @param $pageId
* @return unknown_type
*/
public static function _getPageLinkOptionData($rvsLinkId, $pageId)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
if (!$rvsLinkId || $rvsLinkId == ""
|| $rvsLinkId == "0" || $rvsLinkId == NULL) {
return false;
} else {
// optimize : nipaporn
return DaoFactory::ProjectPage()->findPageLinkOptionDataByProjectPageIdAndLinkId($pageId, $rvsLinkId, 'getassoc');
}
}
/** setLinkTarget
* ๏ฟฝ๏ฟฝ๏ฟฝ ๏ฟฝ๏ฟฝ External page ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ target ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ edit ๏ฟฝ step5 (Link Option)
* ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ External page target ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ _blank ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ _self ในกรณ๏ฟฝหน๏ฟฝ๏ฟฝ edit WYSIWYG ๏ฟฝ๏ฟฝ set ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ _top
*/
public static function _setLinkTarget($rvsLinkId, $pageTarget, $navAction = 0)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
if ($rvsLinkId) {
$linkTarget = ' target="' . $pageTarget . '" ';
} elseif ($navAction != "0") {
if ($pageTarget) {
$linkTarget = ' target="' . $pageTarget . '" ';
} else {
$linkTarget = ' target="_self" ';
}
} else {
$linkTarget = ' target="_top" ';
}
return $linkTarget;
}
/**
* get child index form parent
* @param unknown_type $aPageStructure
* @param unknown_type $parentPageIdx
* @return Ambigous <multitype:, multitype:NULL >
*/
public static function _getChildIndexFromParentPageIdx($aPageStructure, $parentPageIdx)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$aChildValues = array();
foreach ($aPageStructure as $key=>$line) {
if ($aPageStructure[$key]->parent_idx == $parentPageIdx) {
$aChildValues[] = array(
'page_name' =>$aPageStructure[$key]->page_name,
'child_idx' => $aPageStructure[$key]->idx,
'page_id' => $aPageStructure[$key]->project_page_id,
'real_page_id' => isset($aPageStructure[$key]->project_real_page_id) ? $aPageStructure[$key]->project_real_page_id : $aPageStructure[$key]->project_page_id,
'component_id' => $aPageStructure[$key]->rvs_component_id,
'rvs_link_id' => $aPageStructure[$key]->rvs_link_id,
'target' => $aPageStructure[$key]->target,
'file_name' => isset($aPageStructure[$key]->file_name) ? $aPageStructure[$key]->file_name : '',
);
}
}
return $aChildValues;
}
public static function _generateNavigatorParentLevel2($pageName, $pageId, $currentPageId, $projectUrl, $pages, $linkTarget, $menustyleId, $projectRealPageId, $setHead = 0, $idx = 0, $parentWsubpage = 0, $navAction = 0, $aLinkOption = 0, $pagelinkActive = 0, $aPageStructure)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$navigator = '';
$htmlcode = SGL_Session::get('htmlcode');
$index = 'index.' . RvsLibs_File::phpFileType();
$index_phpsu = (INDEX_PHPSU == $index . '?') ? $index . '?' : $index;
if ($menustyleId == 2) {
$icon = 'down-arrow.gif" border="0" alt=">"';
} else {
$icon = 'forward-arrow.gif" border="0" alt=">" class="fwdarr" ';
}
if (isset($aLinkOption[$pageId]) && isset($aLinkOption[$pageId]->rvs_link_id)) {
if ($aLinkOption[$pageId]->external_url == '') {
$pageURL = $pages;
} else {
$pageURL = $aLinkOption[$pageId]->external_url;
}
// If Full Size set defualt 1
//fixed PHPMD scan 30/06/2544
if ((preg_match('/_blank/i', $linkTarget) && $aLinkOption[$pageId]->fullscreen == "1")||preg_match('/_self/i', $linkTarget)) {
//$navigator .= '<a href="#" onclick="openCustomSize(\'' . $pageURL . '\', \'\', \'\', \'1\', \'1\', \'1\', \'1\', \'1\', \'1\');return false;" ';
$navigator .= '<a href="' . $pageURL . '" title=" ' . $pageURL . '" ';
} else {
// TODO:: darawan If Custom Size
if ($aLinkOption[$pageId]->dialog_option == '') {
$toolBar = $aLinkOption[$pageId]->toolbar;
$location = $aLinkOption[$pageId]->location;
$statusBar = $aLinkOption[$pageId]->status_bar;
$menuBar = $aLinkOption[$pageId]->menubar;
$resizeable = $aLinkOption[$pageId]->resizeable;
$scrollBars = $aLinkOption[$pageId]->scrollbars;
$width = $aLinkOption[$pageId]->size_width;
$height = $aLinkOption[$pageId]->size_height;
$navigator .= '<a href="' . $pageURL . '" title=" ' . $pageURL . '" onclick="openCustomSize(\'' . $pageURL . '\', \'' . $width . '\', \'' . $height . '\', \'' . $toolBar . '\', \'' . $location . '\', \'' . $statusBar . '\', \'' . $menuBar . '\', \'' . $resizeable . '\', \'' . $scrollBars . '\');return false;" ';
} else {
$linkTarget = '';
$navigator .= '<a href="javascript::void(0);" title=" ' . $pageURL . '" onclick="openDialogOption(\'' . $pageId .'\',\''.$pageURL.'\');return false;" ';
$aNavigator['genDiv'] = <<<EOF
var opt_{$pageId} = {$aLinkOption[$pageId]->dialog_option}
if(opt_{$pageId}.autoOpen == true){
openDialogOption('{$pageId}','{$pageURL}');
}
EOF;
}
}
} else {
//navigator full URL for WYSIWYG $navAction = 0
//open new window
if ($navAction == 0 && $pagelinkActive != 1) {
//fix link wysi rvsitebuilder/www/project/wysiwyg/project_page_id/{projectPageId}
// to rvsitebuilder/www/index.php/sitebuilder/wysiwyg/project_page_id/{projectPageId}
$navigatorURL = $pages;
if(isset($htmlcode) && $htmlcode == 1) {
// open new window html
$nameOfWin = 'newwinhtml'.$pageId;
$winName ='windowsNamehtml'.$pageId;
$navigator .= '<a href="' . $navigatorURL. '" target="' .$winName. '" onclick="return jQuery.sitebuilder.sitebuilder.switchNewWin( \''.$nameOfWin.'\', oPageParent);" ';
} else {
// open new window wysiwyg
$nameOfWin = 'newwin'.$pageId;
$winName ='windowsName'.$pageId;
$navigator .= '<a href="' . $navigatorURL. '" target="' .$winName. '" onclick="return jQuery.sitebuilder.sitebuilder.switchNewWin( \''.$nameOfWin.'\', oPageParent);" ';
}
} else {
// === case normal
//$navigatorURL = $pages;
$navigator .= '<a href="' . $pages . '" ';
}
$linkTarget = $linkTarget;
}
//$aAttr = array('attr_name' => 'attr_value');
$aAttr = array('pageid' => $pageId
,'is_homepage' => (isset($aPageStructure->is_home)) ? $aPageStructure->is_home : 0
,'is_draft' => (isset($aPageStructure->set_draft)) ? $aPageStructure->set_draft : 0
,'page_title' => (isset($aPageStructure->page_title)) ? $aPageStructure->page_title : ''
,'meta_keyword' => (isset($aPageStructure->meta_keyword)) ? $aPageStructure->meta_keyword : ''
,'meta_description' => (isset($aPageStructure->meta_description)) ? $aPageStructure->meta_description : ''
,'file_name' => (isset($aPageStructure->file_name)) ? $aPageStructure->file_name : ''
,'other_embed' => self::_getPageHeadTag($pageId)
,'page_css' => self::_getCssPage($pageId)
);
//is_home
$navigator .= ' ' . $linkTarget . '><span ' . self::_buildPageAttr($aAttr) . '>' . RvsLibs_String::brToNewline($pageName,"<br>");
if ($setHead && $parentWsubpage) {
$navigator .= ' <img src="images/' . $icon . ' />';
}
$navigator .= '</span></a>';
$aNavigator['data'] = $navigator;
return $aNavigator;
}
//other_embed for v6 onyy
static function _getPageHeadTag($pageId)
{
$embed = '';
if (SGL_Output::isV6Session() == true) {
$projectId = SGL_Session::get('rvs_project_id');
$aTagHeadPage = DaoFactory::Project()->findRvsHead($projectId, $pageId, 'getrow');
if (count($aTagHeadPage) > 0 ) {
$embed = urlencode($aTagHeadPage['head_tag_data']);
}
}
return $embed;
}
static function _getCssPage($pageId)
{
$cssData = '';
if (SGL_Output::isV6Session() == true) {
$projectId = SGL_Session::get('rvs_project_id');
$aTagCss = DaoFactory::Project()->findRvsCss($projectId, $pageId, 'getrow');
if (isset($aTagCss['css_tag_data']) && $aTagCss['css_tag_data'] != '') {
$cssData = urlencode($aTagCss['css_tag_data']);
}
}
return $cssData;
}
/**
* gen attr page attrName1="attrValue1" attrName2="attrValue2"
* @param unknown $aAttr
* @return string
*/
public static function _buildPageAttr($aAttr = array())
{
$str = '';
if (count($aAttr)) {
foreach ($aAttr as $k => $v) {
$str .= ' ' . $k . '="' . $v .'" ';
}
}
return $str;
}
/**
* ๏ฟฝยก๏ฟฝ๏ฟฝ๏ฟฝ check MainPage ๏ฟฝ๏ฟฝ๏ฟฝ SubPage ๏ฟฝอก๏ฟฝาก generateNavigator()
*/
public static function _generateNavigatorParent($pageName, $pageId, $currentPageId, $projectUrl, $pages, $linkTarget, $menustyleId, $projectRealPageId, $setHead = 0, $idx = 0, $parentWsubpage = 0, $navAction = 0, $aLinkOption = 0, $pagelinkActive = 0)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$htmlcode = SGL_Session::get('htmlcode');
if ($menustyleId == 2) {
$icon = 'down-arrow.gif" border="0" alt=">"';
} else {
$icon = 'forward-arrow.gif" border="0" alt=">" class="fwdarr" ';
}
$navigator = '<li';
if ($pageId == $currentPageId ) {
//$navigator .= ' id="active"';
}
//fix W3C
$navigator .= ($navAction == 0) ? '>' : ''; //$navAction --case wysiwyg
if ($setHead && $menustyleId == 1) {
// Vertical menu
//fix W3C
//$navigator .= '<div id="refL' . $idx . '">';
$navigator .= ($navAction != 0)
? ' id="refL' . $idx . '">'
: '<div id="refL' . $idx . '">';
} elseif ($setHead) {
// Honrizontal menu
//fix W3C
//$navigator .= '<div id="hormenu1L' . $idx . '" onmouseover="clearLMTO();" onmouseout="setLMTO();">';
$navigator .= ($navAction != 0)
? ' id="hormenu1L' . $idx . '" onmouseover="clearLMTO();" onmouseout="setLMTO();">'
: '<div id="hormenu1L' . $idx . '" onmouseover="clearLMTO();" onmouseout="setLMTO();">';
} else {
$navigator .= ($navAction != 0) ? '>' : '';
}
// Parent Page Set LinkOption
// openCustomSize(PageURL, Weight, Height, ToolBar, Location, StatusBar, Resizeable, ScrollBars)
// $linkTarget = $this->setLinkTarget($aLinkOption[$pageId]->rvs_link_id, $aLinkOption[$pageId]->target, $navAction);
if (isset($aLinkOption[$pageId]) && isset($aLinkOption[$pageId]->rvs_link_id)) {
$pageURL = $aLinkOption[$pageId]->external_url;
// If Full Size set defualt 1
//fixed PHPMD scan 30/06/2544
if ($aLinkOption[$pageId]->fullscreen == "1" && preg_match('/_self/i', $linkTarget)) {
//$navigator .= '<a href="#" onclick="openCustomSize(\'' . $pageURL . '\', \'\', \'\', \'1\', \'1\', \'1\', \'1\', \'1\', \'1\');return false;" ';
$navigator .= '<a href="' . $pageURL . '" title=" ' . $pageURL . '" ';
} else {
// If Custom Size
$toolBar = $aLinkOption[$pageId]->toolbar;
$location = $aLinkOption[$pageId]->location;
$statusBar = $aLinkOption[$pageId]->status_bar;
$menuBar = $aLinkOption[$pageId]->menubar;
$resizeable = $aLinkOption[$pageId]->resizeable;
$scrollBars = $aLinkOption[$pageId]->scrollbars;
$width = $aLinkOption[$pageId]->size_width;
$height = $aLinkOption[$pageId]->size_height;
$navigator .= '<a href="' . $pageURL . '" title=" ' . $pageURL . '" onclick="openCustomSize(\'' . $pageURL . '\', \'' . $width . '\', \'' . $height . '\', \'' . $toolBar . '\', \'' . $location . '\', \'' . $statusBar . '\', \'' . $menuBar . '\', \'' . $resizeable . '\', \'' . $scrollBars . '\');return false;" ';
}
} else {
//navigator full URL for WYSIWYG $navAction = 0
//open new window
if ($navAction == 0 && $pagelinkActive != 1) {
$navigatorURL = $pages;
if(isset($htmlcode) && $htmlcode == 1) {
// open new window html
$nameOfWin = 'newwinhtml'.$pageId;
$winName ='windowsNamehtml'.$pageId;
$navigator .= '<a href="' . $navigatorURL. '" target="' .$winName. '" onclick="return jQuery.sitebuilder.sitebuilder.switchNewWin( \''.$nameOfWin.'\', oPageParent);" ';
} else {
// open new window wysiwyg
$nameOfWin = 'newwin'.$pageId;
$winName ='windowsName'.$pageId;
$navigator .= '<a href="' . $navigatorURL. '" target="' .$winName. '" onclick="return jQuery.sitebuilder.sitebuilder.switchNewWin( \''.$nameOfWin.'\', oPageParent);" ';
}
} else {
$navigatorURL = $pages;
$navigator .= '<a href="' . $navigatorURL . '" ';
}
$linkTarget = $linkTarget;
}
//set id current page
//fix W3C change id="normal" to class="normal"
$classN = ($navAction != 0) ? ' class="normal"' : ' id="normal"';
$navigator .= ($projectRealPageId == $pageId) ? ' id="current"' : $classN;
if ($setHead && $parentWsubpage && $menustyleId == 2) {
$navigator .= ' onmouseover="moveLayerX1(\'L' . $idx . '\', \'hormenu1\'); LMPopUp(\'L' . $idx . '\', false);"';
} elseif ($setHead && $parentWsubpage) {
$navigator .= ' onmouseover="moveLayerX(\'L' . $idx . '\'); moveLayerY(\'L' . $idx . '\'); LMPopUp(\'L' . $idx . '\', false);"';
} elseif ($setHead) {
$navigator .= ' onmouseover="shutdown();"';
}
$navigator .= ' ' . $linkTarget . '><span>' . $pageName;
if ($setHead && $parentWsubpage) {
$navigator .= ' <img src="images/' . $icon . ' />';
}
$navigator .= '</span></a>';
//fix W3C
if ($navAction == 0 && $setHead) {
$navigator .= '</div>';
}
//end fix W3C
$navigator .= '</li>' . "\n";
return $navigator;
}
public static function _generateNavigatorChild($parentIdx, $aChildValues, $projectUrl, $linkTarget, $menustyleId, $navAction, $rvsOwnerId)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$htmlcode = SGL_Session::get('htmlcode');
// This is sub page
$subMenuData = '<div id="L' . $parentIdx . '" class="submenu" onmouseover="clearLMTO();" onmouseout="setLMTO();">' . "\n";
$subMenuData .= ' <table border="0" cellspacing="0" cellpadding="0">' . "\n";
$subMenuData .= '<tr>' . "\n";
$subMenuData .= '<td nowrap="nowrap">' . "\n";
$subMenuData .= ' <div class="subframe">' . "\n";
foreach ($aChildValues as $key => $value) {
$subMenuData .= ' <div id="refL' . $aChildValues[$key]['child_idx'] . '" class="item">' . "\n";
$pages = RvsLibs_Navigator::getUrlForThisPage($aChildValues[$key]['page_id'], $aChildValues[$key]['real_page_id'], $aChildValues[$key]['component_id'], $navAction, $rvsOwnerId, 0, $value['file_name']);
$pageName = ' ' . $aChildValues[$key]['page_name'] . ' ';
if (RvsLibs_String::strlen($pageName) < 40) {
$add = 40 - RvsLibs_String::strlen($pageName);
$pageName .= str_repeat(' ', $add);
}
// ChildPage Set LinkOption
// openCustomSize(PageURL, Weight, Height, ToolBar, Location, StatusBar, Resizeable, ScrollBars)
$aLinkOption = RvsLibs_Navigator::_getPageLinkOptionData($aChildValues[$key]['rvs_link_id'] , $aChildValues[$key]['real_page_id']);
// Set Link target for SubPage
$linkTarget = RvsLibs_Navigator::_setLinkTarget($aChildValues[$key]['rvs_link_id'], $aChildValues[$key]['target'], $navAction);
if (isset($aLinkOption[$aChildValues[$key]['real_page_id']]->rvs_link_id)) {
$pageURL = $aLinkOption[$aChildValues[$key]['real_page_id']]->external_url;
// If Full Size set defualt 1
//fixed PHPMD scan 30/06/2544
if ($aLinkOption[$aChildValues[$key]['real_page_id']]->fullscreen == "1" && preg_match('/_self/i', $linkTarget)) {
$subMenuData .= '<a href="' . $pageURL . '" title=" ' . $pageURL . '" onmouseover="LMPopUp(\'L' . $parentIdx . '\', true);"' . ' ' . $linkTarget . '><span>' . $pageName . '</span></a>';
} else {
// If Custom Size
$toolBar = $aLinkOption[$aChildValues[$key]['real_page_id']]->toolbar;
$location = $aLinkOption[$aChildValues[$key]['real_page_id']]->location;
$statusBar = $aLinkOption[$aChildValues[$key]['real_page_id']]->status_bar;
$menuBar = $aLinkOption[$aChildValues[$key]['real_page_id']]->menubar;
$resizeable = $aLinkOption[$aChildValues[$key]['real_page_id']]->resizeable;
$scrollBars = $aLinkOption[$aChildValues[$key]['real_page_id']]->scrollbars;
$width = $aLinkOption[$aChildValues[$key]['real_page_id']]->size_width;
$height = $aLinkOption[$aChildValues[$key]['real_page_id']]->size_height;
$subMenuData .= '<a href="' . $pageURL . '" title=" ' . $pageURL . '" onclick="openCustomSize(\'' . $pageURL . '\', \'' . $width . '\', \'' . $height . '\', \'' . $toolBar . '\', \'' . $location . '\', \'' . $statusBar . '\', \'' . $menuBar . '\', \'' . $resizeable . '\', \'' . $scrollBars . '\');return false;" onmouseover="LMPopUp(\'L' . $parentIdx . '\', true);"' . $linkTarget . '><span>' . $pageName . '</span></a>' . "\n";
}
} else {
//navigator full URL for WYSIWYG $navAction = 0
//open new window
if($navAction == 0) {
$navigatorURL = $pages;
SGL::logMessage('ning test wys 0 = ' . $navigatorURL, PEAR_LOG_DEBUG);
if(isset($htmlcode) && $htmlcode == 1) {
SGL::logMessage('ning test wys 1 = ' . $navigatorURL, PEAR_LOG_DEBUG);
// open new window html
$winName ='windowsNamehtml'.$aChildValues[$key]['page_id'];
$nameOfWin = 'newwinhtml'.$aChildValues[$key]['page_id'];
$subMenuData .= '<a href="' . $navigatorURL . '" target="' .$winName. '" onclick="return jQuery.sitebuilder.sitebuilder.switchNewWin( \''.$nameOfWin.'\', oPageParent);" onmouseover="LMPopUp(\'L' . $parentIdx . '\', true);" ' . $linkTarget . '><span>' . $pageName . '</span> </a>' . "\n";
} else {
SGL::logMessage('ning test wys 2 = ' . $navigatorURL, PEAR_LOG_DEBUG);
// open new window wysiwyg
$winName ='windowsName'.$aChildValues[$key]['page_id'];
$nameOfWin = 'newwin'.$aChildValues[$key]['page_id'];
$subMenuData .= '<a href="' . $navigatorURL . '" target="' .$winName. '" onclick="return jQuery.sitebuilder.sitebuilder.switchNewWin( \''.$nameOfWin.'\', oPageParent);" onmouseover="LMPopUp(\'L' . $parentIdx . '\', true);" ' . $linkTarget . '><span>' . $pageName . '</span> </a>' . "\n";
}
} else {
$navigatorURL = $pages;
SGL::logMessage('ning test wys 3 = ' . $navigatorURL, PEAR_LOG_DEBUG);
$subMenuData .= '<a href="' . $navigatorURL . '" onmouseover="LMPopUp(\'L' . $parentIdx . '\', true);"' . $linkTarget . '><span>' . $pageName . '</span></a>' . "\n";
}
// $subMenuData .= '<a href="' . $navigatorURL . '" onmouseover="LMPopUp(\'L' . $parentIdx . '\', true);"' . $linkTarget . '><span>' . $pageName . '</span></a>' . "\n";
$linkTarget = $linkTarget;
}
$subMenuData .= '</div>' . "\n";
}
$subMenuData .= '</div>' . "\n";
$subMenuData .= '</td>' . "\n";
$subMenuData .= '</tr>' . "\n";
$subMenuData .= '</table>' . "\n";
$subMenuData .= '</div>' . "\n";
return $subMenuData;
}
public static function _getSubMenuHead($totalMenu, $listParentPage, $fatherKeysVals, $setTopMoveLayer, $menustyleId, $navAction)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
//Comment for return code include js file
$head= '';
$head .= "\n";
$head .= '// PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/' . "\n";
$head .= "\n";
$head .= 'DOM = (document.getElementById) ? 1 : 0;' . "\n";
$head .= 'NS4 = (document.layers) ? 1 : 0;' . "\n";
$head .= '// We need to explicitly detect Konqueror' . "\n";
$head .= '// because Konqueror 3 sets IE = 1 ... AAAAAAAAAARGHHH!!!' . "\n";
$head .= 'Konqueror = (navigator.userAgent.indexOf(\'Konqueror\') > -1) ? 1 : 0;' . "\n";
$head .= '// We need to detect Konqueror 2.2 as it does not handle the window.onresize event' . "\n";
$head .= 'Konqueror22 = (navigator.userAgent.indexOf(\'Konqueror 2.2\') > -1 || navigator.userAgent.indexOf(\'Konqueror/2.2\') > -1) ? 1 : 0;' . "\n";
$head .= 'Konqueror30 =' . "\n";
$head .= '(' . "\n";
$head .= 'navigator.userAgent.indexOf(\'Konqueror 3.0\') > -1' . "\n";
$head .= '|| navigator.userAgent.indexOf(\'Konqueror/3.0\') > -1' . "\n";
$head .= '|| navigator.userAgent.indexOf(\'Konqueror 3;\') > -1' . "\n";
$head .= '|| navigator.userAgent.indexOf(\'Konqueror/3;\') > -1' . "\n";
$head .= '|| navigator.userAgent.indexOf(\'Konqueror 3)\') > -1' . "\n";
$head .= '|| navigator.userAgent.indexOf(\'Konqueror/3)\') > -1' . "\n";
$head .= ')' . "\n";
$head .= '? 1 : 0;' . "\n";
$head .= 'Konqueror31 = (navigator.userAgent.indexOf(\'Konqueror 3.1\') > -1 || navigator.userAgent.indexOf(\'Konqueror/3.1\') > -1) ? 1 : 0;' . "\n";
$head .= '// We need to detect Konqueror 3.2 and 3.3 as they are affected by the see-through effect only for 2 form elements' . "\n";
$head .= 'Konqueror32 = (navigator.userAgent.indexOf(\'Konqueror 3.2\') > -1 || navigator.userAgent.indexOf(\'Konqueror/3.2\') > -1) ? 1 : 0;' . "\n";
$head .= 'Konqueror33 = (navigator.userAgent.indexOf(\'Konqueror 3.3\') > -1 || navigator.userAgent.indexOf(\'Konqueror/3.3\') > -1) ? 1 : 0;' . "\n";
$head .= 'Opera = (navigator.userAgent.indexOf(\'Opera\') > -1) ? 1 : 0;' . "\n";
$head .= 'Opera5 = (navigator.userAgent.indexOf(\'Opera 5\') > -1 || navigator.userAgent.indexOf(\'Opera/5\') > -1) ? 1 : 0;' . "\n";
$head .= 'Opera6 = (navigator.userAgent.indexOf(\'Opera 6\') > -1 || navigator.userAgent.indexOf(\'Opera/6\') > -1) ? 1 : 0;' . "\n";
$head .= 'Opera56 = Opera5 || Opera6;' . "\n";
$head .= 'IE = (navigator.userAgent.indexOf(\'MSIE\') > -1) ? 1 : 0;' . "\n";
$head .= 'IE = IE && !Opera;' . "\n";
$head .= 'IE5 = IE && DOM;' . "\n";
$head .= 'IE4 = (document.all) ? 1 : 0;' . "\n";
$head .= 'IE4 = IE4 && IE && !DOM;' . "\n";
$head .= "\n";
$head .= "\n";
//$head .= '//<!-- beginning of menu header - PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/ -->' . "\n";
$head .= "\n";
$head .= 'menuTopShift = 6;' . "\n";
$head .= 'menuRightShift = 7;' . "\n";
$head .= 'menuLeftShift = 2;' . "\n";
$head .= "\n";
if ($menustyleId == 2) {
$head .= 'var thresholdY = 1;' . "\n";
} else {
$head .= 'var thresholdY = 5;' . "\n";
}
$head .= 'var abscissaStep = 140;' . "\n";
$head .= "\n";
$head .= 'toBeHidden = new Array();' . "\n";
$head .= 'toBeHiddenLeft = new Array();' . "\n";
$head .= 'toBeHiddenTop = new Array();' . "\n";
$head .= '// List the Parent Page that contain submenu' . "\n";
$head .= $listParentPage . "\n";
$head .= 'var numl = listl.length;' . "\n";
$head .= "\n";
$head .= 'father = {}' . "\n";
$head .= '// $i is the total menu including parent menu' . "\n";
$head .= 'for (i=1; i <= ' . $totalMenu . '; i++) {' . "\n";
$head .= ' father[\'L\' + i] = \'\';' . "\n";
$head .= '}' . "\n";
$head .= "\n";
$head .= '// Father keys and vals must match the child and parents values' . "\n";
$head .= $fatherKeysVals . "\n";
$head .= 'for (i=0; i < father_keys.length; i++) {' . "\n";
$head .= ' father[father_keys[i]] = father_vals[i];' . "\n";
$head .= '}' . "\n";
$head .= "\n";
$head .= 'lwidth = new Array();' . "\n";
$head .= 'var lwidthDetected = 0;' . "\n";
$head .= "\n";
$head .= 'function moveLayers()' . "\n";
$head .= '{' . "\n";
$head .= 'if (!lwidthDetected) {' . "\n";
$head .= 'for (i=0; i<numl; i++) {' . "\n";
$head .= ' lwidth[listl[i]] = getOffsetWidth(listl[i]);' . "\n";
$head .= '}' . "\n";
$head .= 'lwidthDetected = 1;' . "\n";
$head .= '}' . "\n";
$head .= 'if (IE4) {' . "\n";
$head .= 'for (i=0; i<numl; i++) {' . "\n";
$head .= ' setWidth(listl[i], abscissaStep);' . "\n";
$head .= '}' . "\n";
$head .= '}' . "\n";
if ($menustyleId == 2) {
$head .= 'var hormenu1TOP = getOffsetTop(\'hormenu1L1\');' . "\n";
$head .= 'var hormenu1HEIGHT = getOffsetHeight(\'hormenu1L1\');' . "\n";
} else {
$head .= 'var vermenu1TOP = getOffsetTop(\'vermenu1\');' . "\n";
$head .= 'var vermenu1LEFT = getOffsetLeft(\'vermenu1\');' . "\n";
$head .= 'var vermenu1WIDTH = getOffsetWidth(\'vermenu1\');' . "\n";
}
$head .= "\n";
$head .= '// Add this 2 lines for each parent menu' . "\n";
$head .= $setTopMoveLayer . "\n";
$head .= '}' . "\n";
$head .= "\n";
$head .= 'back = new Array();' . "\n";
$head .= '// $i is the total menu including parent menu' . "\n";
$head .= 'for (i=1; i<=' . $totalMenu . '; i++) {' . "\n";
$head .= ' back[\'L\' + i] = 0;' . "\n";
$head .= '}' . "\n";
$head .= "\n";
//$head .= '//<!-- end of menu header - PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/ -->' . "\n";
$head .= "\n";
return $head;
}
public static function _getMainMenuHead($menustyleId)
{
$head = '// PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/' . "\n";
$head .= "\n";
$head .= 'DOM = (document.getElementById) ? 1 : 0;' . "\n";
$head .= 'NS4 = (document.layers) ? 1 : 0;' . "\n";
$head .= 'Konqueror = (navigator.userAgent.indexOf(\'Konqueror\') > -1) ? 1 : 0;' . "\n";
$head .= '// We need to detect Konqueror 2.2 as it does not handle the window.onresize event' . "\n";
$head .= 'Konqueror22 = (navigator.userAgent.indexOf(\'Konqueror 2.2\') > -1 || navigator.userAgent.indexOf(\'Konqueror/2.2\') > -1) ? 1 : 0;' . "\n";
$head .= 'Konqueror30 =' . "\n";
$head .= '(' . "\n";
$head .= 'navigator.userAgent.indexOf(\'Konqueror 3.0\') > -1' . "\n";
$head .= '|| navigator.userAgent.indexOf(\'Konqueror/3.0\') > -1' . "\n";
$head .= '|| navigator.userAgent.indexOf(\'Konqueror 3;\') > -1' . "\n";
$head .= '|| navigator.userAgent.indexOf(\'Konqueror/3;\') > -1' . "\n";
$head .= '|| navigator.userAgent.indexOf(\'Konqueror 3)\') > -1' . "\n";
$head .= '|| navigator.userAgent.indexOf(\'Konqueror/3)\') > -1' . "\n";
$head .= ')' . "\n";
$head .= '? 1 : 0;' . "\n";
$head .= 'Konqueror31 = (navigator.userAgent.indexOf(\'Konqueror 3.1\') > -1 || navigator.userAgent.indexOf(\'Konqueror/3.1\') > -1) ? 1 : 0;' . "\n";
$head .= '// We need to detect Konqueror 3.2 and 3.3 as they are affected by the see-through effect only for 2 form elements' . "\n";
$head .= 'Konqueror32 = (navigator.userAgent.indexOf(\'Konqueror 3.2\') > -1 || navigator.userAgent.indexOf(\'Konqueror/3.2\') > -1) ? 1 : 0;' . "\n";
$head .= 'Konqueror33 = (navigator.userAgent.indexOf(\'Konqueror 3.3\') > -1 || navigator.userAgent.indexOf(\'Konqueror/3.3\') > -1) ? 1 : 0;' . "\n";
$head .= 'Opera = (navigator.userAgent.indexOf(\'Opera\') > -1) ? 1 : 0;' . "\n";
$head .= 'Opera5 = (navigator.userAgent.indexOf(\'Opera 5\') > -1 || navigator.userAgent.indexOf(\'Opera/5\') > -1) ? 1 : 0;' . "\n";
$head .= 'Opera6 = (navigator.userAgent.indexOf(\'Opera 6\') > -1 || navigator.userAgent.indexOf(\'Opera/6\') > -1) ? 1 : 0;' . "\n";
$head .= 'Opera56 = Opera5 || Opera6;' . "\n";
$head .= 'IE = (navigator.userAgent.indexOf(\'MSIE\') > -1) ? 1 : 0;' . "\n";
$head .= 'IE = IE && !Opera;' . "\n";
$head .= 'IE5 = IE && DOM;' . "\n";
$head .= 'IE4 = (document.all) ? 1 : 0;' . "\n";
$head .= 'IE4 = IE4 && IE && !DOM;' . "\n";
$head .= "\n";
$head .= "\n";
//$head .= '//<!-- beginning of menu header - PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/ -->' . "\n";
$head .= "\n";
$head .= 'menuTopShift = 6;' . "\n";
$head .= 'menuRightShift = 7;' . "\n";
$head .= 'menuLeftShift = 2;' . "\n";
$head .= "\n";
if ($menustyleId == 2) {
$head .= 'var thresholdY = 1;' . "\n";
} else {
$head .= 'var thresholdY = 5;' . "\n";
}
$head .= 'var abscissaStep = 140;' . "\n";
$head .= 'toBeHidden = new Array();' . "\n";
$head .= 'toBeHiddenLeft = new Array();' . "\n";
$head .= 'toBeHiddenTop = new Array();' . "\n";
$head .= 'var numl = new Array();' . "\n";
$head .= 'father = {};' . "\n";
$head .= "\n";
$head .= 'lwidth = new Array();' . "\n";
$head .= 'var lwidthDetected = 0;' . "\n";
$head .= "\n";
/*if ($menustyleId == 2) {
$head .= 'var hormenu1TOP = getOffsetTop(\'hormenu1L1\');' . "\n";
$head .= 'var hormenu1HEIGHT = getOffsetHeight(\'hormenu1L1\');' . "\n";
} else {
$head .= 'var vermenu1TOP = getOffsetTop(\'vermenu1\');' . "\n";
$head .= 'var vermenu1LEFT = getOffsetLeft(\'vermenu1\');' . "\n";
$head .= 'var vermenu1WIDTH = getOffsetWidth(\'vermenu1\');' . "\n";
} */
$head .= "\n";
$head .= 'back = new Array();' . "\n";
$head .= "\n";
return $head;
}
public static function getNavigatorJavaScript($project_id, $template_path, $template_item_folder)
{
$customCssPath = RvsLibs_Project::validateCustomCssPath($project_id, $template_item_folder);
$fileCustomColorDb = RvsLibs_File::buildPath(array($customCssPath, 'colordb.ini.php'));
$fileColorDb = RvsLibs_File::buildPath(array($template_path, $template_item_folder, 'colordb.ini.php'));
$aConf = array();
if (is_file($fileCustomColorDb) === true) {
$aConf = RvsLibs_Config::parse_ini_file($fileCustomColorDb, true);
} elseif (is_file($fileColorDb) === true) {
$aConf = RvsLibs_Config::parse_ini_file($fileColorDb, true);
}
$color_bgn = (isset($aConf['bgcolor']['color_bgn'])) ? $aConf['bgcolor']['color_bgn'] : '';
$color_bgh = (isset($aConf['bgcolor']['color_bgh'])) ? $aConf['bgcolor']['color_bgh'] : '';
return '
<script type="text/javascript">
/*load navigator color */
$(document).ready(function(){
$(".rvnavigator li,.rvnavigator li").hover(
function() { $(this).addClass("iehover"); },
function() { $(this).removeClass("iehover"); }
);
$("ul.rvnavigator li a").show(function() {
$(this).stop().animate({ backgroundColor: "' . $color_bgn . '"}, 400); /* normal and Add Config {{color_bgn}} */
});
$("ul.rvnavigator li a").hover(function() {
$(this).stop().animate({ backgroundColor: "' . $color_bgh . '"}, 400); /*mouse over and Add Config {{color_bgh}} */
},function() {
$(this).stop().animate({ backgroundColor: "'. $color_bgn .'" }, 400); /*mouse out and Add Config {{color_bgn}} */
});
});
</script>';
}
//Generate Css uikit style 3-5
public static function generateCssUikitStyle3to5($customTemplatePath)
{
require_once SGL_MOD_DIR . '/sitebuilder/classes/RV_CssParser.php';
$oCss = RV_CssParser::singleton(true);
$oCssStyle1 = RV_CssParser::singleton(true);
$templatePath = $customTemplatePath;
//Load default rvsb-nav-style-1.css
$sourceFileStyle1 = RvsLibs_File::buildPath(array($templatePath, 'rvsb-css', 'rvsb-nav-style-1.css'));
SGL::logMessage('load default: ' . $sourceFileStyle1, PEAR_LOG_DEBUG);
if (is_file($sourceFileStyle1) == false) {
SGL::logMessage('cannot load default: ' . $sourceFileStyle1, PEAR_LOG_ERR);
return false;
}
//style3
$fileCss = 'rvsb-nav-style-3.css';
//default www/UikitTemplate/MasterTemplateUIKit
$sourceFile = UIKIT_LIB_PATH . '/rvsb-css/' . $fileCss;
if (is_file($sourceFile) == false) {
SGL::logMessage('sourceFile error ' . $sourceFile, PEAR_LOG_ERR);
return false;
}
//custom target file
$tarGetFile = RvsLibs_File::buildPath(array($templatePath, 'rvsb-css', $fileCss));
//load default
$aData = $oCss->parse_file($sourceFile);
//load default style1
$oCssStyle1->parse_file($sourceFileStyle1);
//bg normal
$oCss->set_value('.uk-navbar', 'background-color', $oCssStyle1->get_value('.uk-navbar', 'background-color'));
//lv0
//text normal
$oCss->set_value('.uk-navbar-nav > li > a', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li > a', 'color'));
$oCss->set_value('.uk-navbar-nav > li > a', 'font-family', "'Open Sans', Arial, sans-serif");
$oCss->set_value('.uk-navbar-nav > li > a', 'font-size', '16px');
//bg hover
$oCss->set_value('.uk-navbar-nav > li:hover > a', 'background-color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'background-color'));
$oCss->set_value('.uk-navbar-nav > li > a:focus', 'background-color', $oCssStyle1->get_value('.uk-navbar-nav > li > a:focus', 'background-color'));
$oCss->set_value('.uk-navbar-nav > li.uk-open > a', 'background-color', $oCssStyle1->get_value('.uk-navbar-nav > li.uk-open > a', 'background-color'));
//line Hover = text hover
$oCss->set_value('.uk-navbar-nav > li:hover > a', 'border-color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.uk-nav-navbar > li > a:focus', 'border-color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.uk-dropdown > ul > li > a:focus', 'border-top', '0px !important');
$oCss->set_value('.getHoverNavColorLevel0', 'border-color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
//text hover
$oCss->set_value('.uk-navbar-nav > li:hover > a', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.uk-navbar-nav > li > a:focus', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.uk-navbar-nav > li.uk-open > a', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.getHoverNavColorLevel0', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
//uk-active
$oCss->set_value('.uk-navbar-nav > li.uk-active > a', 'background-color', $oCssStyle1->get_value('.uk-navbar-nav > li.uk-active > a', 'background-color'));
$oCss->set_value('.uk-navbar-nav > li.uk-active > a', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li.uk-active > a', 'color'));
$oCss->set_value('.uk-navbar-nav > li.uk-active > a', 'border-color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.getHoverNavColorLevel0', 'background-color', $oCssStyle1->get_value('.getHoverNavColorLevel0', 'background-color'));
//======================== sub menu เหมือนกันหมด ======================
//lv1
//bg normal
$oCss->set_value('.uk-dropdown ul', 'background-color', $oCssStyle1->get_value('.uk-dropdown ul', 'background-color'));
//text normal
$oCss->set_value('.uk-nav-navbar > li > a', 'color', $oCssStyle1->get_value('.uk-nav-navbar > li > a', 'color'));
//text hover
$oCss->set_value('.uk-nav-navbar > li > a:hover', 'color', $oCssStyle1->get_value('.uk-nav-navbar > li > a:hover', 'color'));
$oCss->set_value('.getHoverNavColorLevel1', 'color', $oCssStyle1->get_value('.getHoverNavColorLevel1', 'color'));
//bg hover (จะ hover background color ทั้ง sub vel 1 และ sub vel2)
$oCss->set_value('.uk-dropdown ul > li > a:hover', 'background-color', $oCssStyle1->get_value('.uk-dropdown ul > li > a:hover', 'background-color'));
$oCss->set_value('.getHoverNavColorLevel1', 'background-color', $oCssStyle1->get_value('.getHoverNavColorLevel1', 'background-color'));
//lv2
//text normal
$oCss->set_value('ul.uk-nav-sub > li > a', 'color', $oCssStyle1->get_value('ul.uk-nav-sub > li > a', 'color'));
//text hover
$oCss->set_value('ul.uk-nav-sub > li > a:hover', 'color', $oCssStyle1->get_value('ul.uk-nav-sub > li > a:hover', 'color'));
$oCss->set_value('ul.uk-nav-sub > li > a:focus', 'color', $oCssStyle1->get_value('ul.uk-nav-sub > li > a:focus', 'color'));
$oCss->set_value('.getHoverNavColorLevel2', 'color', $oCssStyle1->get_value('.getHoverNavColorLevel2', 'color'));
$oCss->build_css(false);
//update uikit css footer
SGL::logMessage('tarGetFile: ' . $tarGetFile, PEAR_LOG_DEBUG);
$oCss->write_file($tarGetFile);
/*------------------------------------------- end nav style3 -----------------------------------------------------------*/
//style4
$fileCss = 'rvsb-nav-style-4.css';
//default www/UikitTemplate/MasterTemplateUIKit
$sourceFile = UIKIT_LIB_PATH . '/rvsb-css/' . $fileCss;
if (is_file($sourceFile) == false) {
SGL::logMessage('sourceFile error ' . $sourceFile, PEAR_LOG_ERR);
return false;
}
//custom target file
$tarGetFile = RvsLibs_File::buildPath(array($templatePath, 'rvsb-css', $fileCss));
//load default
$aData = $oCss->parse_file($sourceFile);
//load default style1
$oCssStyle1->parse_file($sourceFileStyle1);
//bg normal
$oCss->set_value('.uk-navbar', 'background-color', $oCssStyle1->get_value('.uk-navbar', 'background-color'));
//lv0
//text normal
$oCss->set_value('.uk-navbar-nav > li > a', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li > a', 'color'));
$oCss->set_value('.uk-navbar-nav > li > a', 'font-family', "'Open Sans', Arial, sans-serif");
$oCss->set_value('.uk-navbar-nav > li > a', 'font-size', '16px');
//bg hover
$oCss->set_value('.uk-navbar-nav > li:hover > a', 'background-color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'background-color'));
$oCss->set_value('.uk-navbar-nav > li > a:focus', 'background-color', 'transparent !important');
$oCss->set_value('.uk-navbar-nav > li.uk-open > a', 'background-color', $oCssStyle1->get_value('.uk-navbar-nav > li.uk-open > a', 'background-color'));
//line Hover = text hover
$oCss->set_value('.uk-navbar-nav > li:hover > a', 'border-color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.uk-nav-navbar > li > a:focus', 'border-color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.uk-dropdown > ul > li > a:focus', 'border-bottom', '0px !important');
//text hover
$oCss->set_value('.uk-navbar-nav > li:hover > a', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.uk-navbar-nav > li > a:focus', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.uk-navbar-nav > li.uk-open > a', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.getHoverNavColorLevel0', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
//uk-active
$oCss->set_value('.uk-navbar-nav > li.uk-active > a', 'background-color', $oCssStyle1->get_value('.uk-navbar-nav > li.uk-active > a', 'background-color'));
$oCss->set_value('.uk-navbar-nav > li.uk-active > a', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li.uk-active > a', 'color'));
$oCss->set_value('.uk-navbar-nav > li.uk-active > a', 'border-color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.getHoverNavColorLevel0', 'background-color', $oCssStyle1->get_value('.getHoverNavColorLevel0', 'background-color'));
//======================== sub menu เหมือนกันหมด ======================
//lv1
//bg normal
$oCss->set_value('.uk-dropdown ul', 'background-color', $oCssStyle1->get_value('.uk-dropdown ul', 'background-color'));
//text normal
$oCss->set_value('.uk-nav-navbar > li > a', 'color', $oCssStyle1->get_value('.uk-nav-navbar > li > a', 'color'));
//text hover
$oCss->set_value('.uk-nav-navbar > li > a:hover', 'color', $oCssStyle1->get_value('.uk-nav-navbar > li > a:hover', 'color'));
$oCss->set_value('.getHoverNavColorLevel1', 'color', $oCssStyle1->get_value('.getHoverNavColorLevel1', 'color'));
//bg hover (จะ hover background color ทั้ง sub vel 1 และ sub vel2)
$oCss->set_value('.uk-dropdown ul > li > a:hover', 'background-color', $oCssStyle1->get_value('.uk-dropdown ul > li > a:hover', 'background-color'));
$oCss->set_value('.getHoverNavColorLevel1', 'background-color', $oCssStyle1->get_value('.getHoverNavColorLevel1', 'background-color'));
//lv2
//text normal
$oCss->set_value('ul.uk-nav-sub > li > a', 'color', $oCssStyle1->get_value('ul.uk-nav-sub > li > a', 'color'));
//text hover
$oCss->set_value('ul.uk-nav-sub > li > a:hover', 'color', $oCssStyle1->get_value('ul.uk-nav-sub > li > a:hover', 'color'));
$oCss->set_value('ul.uk-nav-sub > li > a:focus', 'color', $oCssStyle1->get_value('ul.uk-nav-sub > li > a:focus', 'color'));
$oCss->set_value('.getHoverNavColorLevel2', 'color', $oCssStyle1->get_value('.getHoverNavColorLevel2', 'color'));
$oCss->build_css(false);
//update uikit css footer
SGL::logMessage('tarGetFile: ' . $tarGetFile, PEAR_LOG_DEBUG);
$oCss->write_file($tarGetFile);
/*------------------------------------------- end nav style4 -----------------------------------------------------------*/
//style5
$fileCss = 'rvsb-nav-style-5.css';
//default www/UikitTemplate/MasterTemplateUIKit
$sourceFile = UIKIT_LIB_PATH . '/rvsb-css/' . $fileCss;
if (is_file($sourceFile) == false) {
SGL::logMessage('sourceFile error ' . $sourceFile, PEAR_LOG_ERR);
return false;
}
//custom target file
$tarGetFile = RvsLibs_File::buildPath(array($templatePath, 'rvsb-css', $fileCss));
//load default
$aData = $oCss->parse_file($sourceFile);
//load default style1
$oCssStyle1->parse_file($sourceFileStyle1);
//bg normal
$oCss->set_value('.uk-navbar', 'background-color', $oCssStyle1->get_value('.uk-navbar', 'background-color'));
//lv0
//text normal
$oCss->set_value('.uk-navbar-nav > li > a', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li > a', 'color'));
$oCss->set_value('.uk-navbar-nav > li > a', 'font-family', "'Open Sans', Arial, sans-serif");
$oCss->set_value('.uk-navbar-nav > li > a', 'font-size', '16px');
//bg hover (ไม่อยากให้ปรับ)
$oCss->set_value('.uk-navbar-nav > li:hover > a', 'background-color', 'transparent !important');
$oCss->set_value('.uk-navbar-nav > li > a:focus', 'background-color', 'transparent !important');
$oCss->set_value('.uk-navbar-nav > li.uk-open > a', 'background-color', 'transparent !important');
$oCss->set_value('.getHoverNavColorLevel0', 'background-color', 'transparent !important');
//thin line hover = link hover
$oCss->set_value('.uk-navbar-nav > li > a:after', 'background-color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.uk-navbar-nav > li.uk-active a:after', 'background-color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.getHoverNavColorLevel0', 'background-color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
//text hover
$oCss->set_value('.uk-navbar-nav > li:hover > a', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.uk-navbar-nav > li > a:focus', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.uk-navbar-nav > li.uk-open > a', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.getHoverNavColorLevel0', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
//uk-active
$oCss->set_value('.uk-navbar-nav > li.uk-active > a', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.uk-navbar-nav > li.uk-open > a', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.getHoverNavColorLevel0', 'color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
$oCss->set_value('.uk-navbar-nav > li.uk-active > a', 'background-color', 'transparent !important');
$oCss->set_value('.uk-navbar-nav > li.uk-active > a:after', 'background-color', $oCssStyle1->get_value('.uk-navbar-nav > li:hover > a', 'color'));
//======================== sub menu เหมือนกันหมด ======================
//lv1
//bg normal
$oCss->set_value('.uk-dropdown ul', 'background-color', $oCssStyle1->get_value('.uk-dropdown ul', 'background-color'));
//text normal
$oCss->set_value('.uk-nav-navbar > li > a', 'color', $oCssStyle1->get_value('.uk-nav-navbar > li > a', 'color'));
//text hover
$oCss->set_value('.uk-nav-navbar > li > a:hover', 'color', $oCssStyle1->get_value('.uk-nav-navbar > li > a:hover', 'color'));
$oCss->set_value('.getHoverNavColorLevel1', 'color', $oCssStyle1->get_value('.getHoverNavColorLevel1', 'color'));
//bg hover (จะ hover background color ทั้ง sub vel 1 และ sub vel2)
$oCss->set_value('.uk-dropdown ul > li > a:hover', 'background-color', $oCssStyle1->get_value('.uk-dropdown ul > li > a:hover', 'background-color'));
$oCss->set_value('.getHoverNavColorLevel1', 'background-color', $oCssStyle1->get_value('.getHoverNavColorLevel1', 'background-color'));
//lv2
//text normal
$oCss->set_value('ul.uk-nav-sub > li > a', 'color', $oCssStyle1->get_value('ul.uk-nav-sub > li > a', 'color'));
//text hover
$oCss->set_value('ul.uk-nav-sub > li > a:hover', 'color', $oCssStyle1->get_value('ul.uk-nav-sub > li > a:hover', 'color'));
$oCss->set_value('ul.uk-nav-sub > li > a:focus', 'color', $oCssStyle1->get_value('ul.uk-nav-sub > li > a:focus', 'color'));
$oCss->set_value('.getHoverNavColorLevel2', 'color', $oCssStyle1->get_value('.getHoverNavColorLevel2', 'color'));
$oCss->build_css(false);
//update uikit css footer
SGL::logMessage('tarGetFile: ' . $tarGetFile, PEAR_LOG_DEBUG);
$oCss->write_file($tarGetFile);
/*------------------------------------------- end nav style5 -----------------------------------------------------------*/
}
}
}
if (class_exists('RvsLibs_Navigator_Validate') === false) {
class RvsLibs_Navigator_Validate extends RvsLibs_Navigator_Get
{
public static function isNavigatorHide($projectId)
{
$fileOptionTable = REAL_PROJECT_PATH . '/' . $projectId . '/setOptionTableTop.ini';
$showHide = (is_file($fileOptionTable)) ? RvsLibs_Config::parse_ini_file($fileOptionTable , true) : false;
// optimize : nipaporn
return (isset($showHide['showorhide']['status']) && $showHide['showorhide']['status'] == 'hide')
? true
: false;
}
}
}
if (class_exists('RvsLibs_Navigator') === false) {
class RvsLibs_Navigator extends RvsLibs_Navigator_Validate
{
}
}
?>