<?php
defined('_JEXEC') or die;
$output_html = '';
$lang = JFactory::getLanguage();
$lang->load('com_flippingbook',JPATH_SITE,$lang->getDefault(),false,false);
$book_id = intval( JRequest::getVar( 'id',0,'get','int') );
if ( isset( $book_id_for_module ) ) {
$book_id = $book_id_for_module;
}
$current_itemid = intval( JRequest::getInt( 'Itemid') );
if ( $current_itemid ) {
$current_itemid = '&Itemid='.$current_itemid;
}else {
$current_itemid = '';
}
$current_catid = intval( JRequest::getInt( 'catid') );
if ( $current_catid ) {
$current_catid = '&catid='.$current_catid;
}else {
$current_catid = '';
}
$db = JFactory::getDBO();
$db->setQuery( "SELECT * FROM #__flippingbook_books WHERE id=".intval ( $book_id ) );
$bookRow = $db->loadObjectList();
$bookParams = $bookRow[0];
$db->setQuery("SELECT * FROM #__flippingbook_pages WHERE book_id = ".intval ( $book_id )." AND published = 1 ORDER BY ordering");
$rows = $db->loadObjectList();
$total_pages = count($rows);
$firstPageNumber = intval( JRequest::getVar( 'page','','get','int') );
if ( $firstPageNumber == '') {
$firstPageNumber = $bookParams->first_page;
}
if ( $firstPageNumber == 0 ) {
$firstPageNumber = 1;
}
$firstPageNumber_for_html = $firstPageNumber;
if ( $bookParams->direction == "RTL") {
$firstPageNumber = $total_pages -$firstPageNumber +1;
if ( $total_pages%2 == 1 ) {
$firstPageNumber++;
}
}
if ( !defined( "FB_version") ) {
$db = JFactory::getDBO();
$query = "SELECT name, value FROM #__flippingbook_config";
$db->setQuery($query);
$c_rows = $db->loadObjectList();
foreach ( $c_rows as $row ) {
eval ( "DEFINE('FB_".$row->name ."', '".$row->value ."');");
}
}
$user = JFactory::getUser();
$levels = $user->authorisedLevels();
if ( !in_array($bookParams->access,$levels ) ) {
$output_html .= '<div class="fb_errorMessage">'.JText::_( "COM_FLIPPINGBOOK_YOU_ARE_NOT_AUTHORIZED_TO_VIEW_THIS_BOOK").'</div>';
}elseif ( count( $bookParams ) == 0) {
$output_html .= '<div class="fb_errorMessage">'.JText::_( "COM_FLIPPINGBOOK_THE_REQUESTED_BOOK_DOESN_T_EXISTS").'</div>';
}elseif ( $bookParams->published == 0) {
$output_html .= '<div class="fb_errorMessage">'.JText::_( "COM_FLIPPINGBOOK_THE_REQUESTED_BOOK_HAS_BEEN_UNPUBLISHED").'</div>';
}else {
$db->setQuery( "UPDATE #__flippingbook_books SET hits=(hits+1) WHERE id=".intval ( $book_id ) );
$db->query();
$document = JFactory::getDocument();
$headerTad = '<link rel="stylesheet" href="'.JURI::base(true).'/components/com_flippingbook/css/'.FB_theme .'" type="text/css" />';
$document->addCustomTag( $headerTad );
if ( !defined('FBComponentJSlibrariesMainLoaded') ) {
define ('FBComponentJSlibrariesMainLoaded',1);
$headerTad='<script type="text/javascript" src="'.JURI::base(true).'/components/com_flippingbook/js/swfobject.js"></script>';
$document->addCustomTag( $headerTad );
$headerTad='<script type="text/javascript" src="'.JURI::base(true).'/components/com_flippingbook/js/flippingbook.js"></script>';
$document->addCustomTag( $headerTad );
$headerTad='<script type="text/javascript" src="'.JURI::base(true).'/components/com_flippingbook/js/jquery-1.7.1.min.js"></script>';
$document->addCustomTag( $headerTad );
}
if ( !defined('FBComponentJSlibrariesAjaxLoaded') ) {
define ('FBComponentJSlibrariesAjaxLoaded',1);
if ( $bookParams->zooming_method == 1 ) {
$headerTad='<script type="text/javascript" src="'.JURI::base(true).'/components/com_flippingbook/js/ajax-zoom.js"></script>';
$document->addCustomTag( $headerTad );
$headerTad='<link rel="stylesheet" href="'.JURI::base(true).'/components/com_flippingbook/js/ajax-zoom.css" type="text/css" />';
$document->addCustomTag( $headerTad );
}
}
$unique_suffix = rand();
$output_html .= '<div id="fbContainer_'.$unique_suffix .'">';
$output_html .= '<div id="altmsg">'.JText::_("COM_FLIPPINGBOOK_THIS_IS_A_SEO_VERSION").'<strong>'.$bookParams->title .' '.JText::_( "COM_FLIPPINGBOOK_PAGE").$firstPageNumber_for_html .'</strong><br />'.JText::_( "COM_FLIPPINGBOOK_ENABLE_JAVASCRIPT").' <a class="altlink" href="http://www.adobe.com/go/getflashplayer/" target="_blank">'.JText::_( "COM_FLIPPINGBOOK_DOWNLOAD_ADOBE_FLASH_PLAYER_NOW").'</a></div>';
$output_html .= '<div style="text-align: center; padding: 20px 0 0 0; background-color: #'.$bookParams->background_color ."; background-image: url('".JURI::base(true)."/images/".$bookParams->background_image."');".'">';
if ( $total_pages >0 ) {
if ( strtolower( substr( $rows[$firstPageNumber_for_html -1]->file,-3,3 ) ) == 'swf') {
$output_html .= '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'.$bookParams->book_width .'" height="'.$bookParams->book_height .'"><param name="movie" value="'.JURI::root().'images/'.$rows[$firstPageNumber_for_html -1]->file .'" /><param name="quality" value="high" /><embed id="fb_zoomed_image" src="'.JURI::root().'images/'.$rows[$firstPageNumber_for_html -1]->file .'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'.$bookParams->book_width .'" height="'.$bookParams->book_height .'"></embed></object>';
}else {
if ( $rows[$firstPageNumber_for_html -1]->zoom_url == "") {
$zoom_url = $rows[$firstPageNumber_for_html -1]->file;
}else {
$zoom_url = $rows[$firstPageNumber_for_html -1]->zoom_url;
}
$output_html .= '<a target="_blank" href="'.JURI::root().'images/'.$zoom_url .'">';
$output_html .= '<img src="'.JURI::root().'images/'.$rows[$firstPageNumber_for_html -1]->file .'" height="'.$bookParams->book_height .'" width="'.$bookParams->book_width .'" border="0" alt="" />';
$output_html .= '</a>';
}
}
$output_html .= '<div id="nav_bar">';
$prev_link = $firstPageNumber_for_html -1;
if ($prev_link <1) $prev_link = 1;
$next_link = $firstPageNumber_for_html +1;
if ($next_link >$total_pages) $next_link = $total_pages;
$start_link = 1;
$end_link = $total_pages;
$tmpl_link = JRequest::getVar( 'tmpl','','get','string');
if ($tmpl_link == "component") {
$tmpl_link = '&tmpl=component';
}
$output_html .= '<a href="'.JRoute::_( "index.php?option=com_flippingbook&view=book&id=".$book_id .$current_catid ."&page=".$start_link .$current_itemid .$tmpl_link ).'">'.JText::_( "COM_FLIPPINGBOOK_START").'</a> ';
$output_html .= '<a href="'.JRoute::_( "index.php?option=com_flippingbook&view=book&id=".$book_id .$current_catid ."&page=".$prev_link .$current_itemid .$tmpl_link ).'">'.JText::_( "COM_FLIPPINGBOOK_PREVIOUS").'</a> ';
$output_html .= '<a href="'.JRoute::_( "index.php?option=com_flippingbook&view=book&id=".$book_id .$current_catid ."&page=".$next_link .$current_itemid .$tmpl_link ).'">'.JText::_( "COM_FLIPPINGBOOK_NEXT").'</a> ';
$output_html .= '<a href="'.JRoute::_( "index.php?option=com_flippingbook&view=book&id=".$book_id .$current_catid ."&page=".$end_link .$current_itemid .$tmpl_link ).'">'.JText::_( "COM_FLIPPINGBOOK_END").'</a><br /><br />';
for ( $i = 0;$i <$total_pages;$i++) {
$output_html .= '<a href="'.JRoute::_( "index.php?option=com_flippingbook&view=book&id=".$book_id .$current_catid ."&page=".($i+1).$current_itemid .$tmpl_link ).'">'.($i+1).'</a> ';
}
$output_html .= '</div>';
$output_html .= '</div>';
if ( $total_pages >0 ) {
$output_html .= $rows[$firstPageNumber_for_html -1]->description;
}
$output_html .= '</div>';
$output_html .= '<script language="JavaScript" type="text/javascript">'."\n";
$output_html .= 'flippingBook'.$unique_suffix .' = new FlippingBook();'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.pages = ['."\n";
if ( ( $bookParams->direction == "RTL") &&( $total_pages%2 == 1 ) &&( $total_pages >0 ) ) {
$output_html .= '"'.JURI::base(true).'/images/flippingbook/blank.png|",'."\n";
}
for ( $i = 0;$i <$total_pages;$i++) {
if ($bookParams->direction == "RTL") {
$output_html .= '"'.JURI::base(true)."/images/".$rows[$total_pages -$i -1]->file;
}else {
$output_html .= '"'.JURI::base(true)."/images/".$rows[$i]->file;
}
if ( $i != ($total_pages-1) ) {
$output_html .= '|",'."\n";
}else {
$output_html .= '"'."\n";
}
}
$output_html .= '];'."\n\n";
$output_html .= 'flippingBook'.$unique_suffix .'.enlargedImages = ['."\n";
if ( ( $bookParams->direction == "RTL") &&( $total_pages%2 == 1 ) &&( $total_pages >0 ) ) {
$output_html .= '"'.JURI::base(true).'/images/flippingbook/blank.png|",'."\n";
}
for ( $i = 0;$i <$total_pages;$i++) {
if ( $rows[$i]->zoom_url == "") {
$rows[$i]->zoom_url = $rows[$i]->file;
}
if ( $bookParams->direction == "RTL") {
$output_html .= '"'.JURI::base(true)."/images/".$rows[$total_pages -$i -1]->zoom_url;
}else {
$output_html .= '"'.JURI::base(true)."/images/".$rows[$i]->zoom_url;
}
if ( $i != ($total_pages-1) ) {
$output_html .= '|",'."\n";
}else {
$output_html .= '"'."\n";
}
}
$output_html .= '];'."\n\n";
$output_html .= 'flippingBook'.$unique_suffix .'.pageLinks = ['."\n";
if ( ( $bookParams->direction == "RTL") &&( $total_pages%2 == 1 ) &&( $total_pages >0 ) ) {
$output_html .= '"|",'."\n";
}
for ( $i = 0;$i <$total_pages;$i++) {
$rows[$i]->link_url = str_replace( '&','%26',$rows[$i]->link_url );
if ( $bookParams->direction == "RTL") {
$output_html .= '"'.$rows[$total_pages -$i -1]->link_url;
}else {
$output_html .= '"'.$rows[$i]->link_url;
}
if ( $i != ( $total_pages -1 ) ) {
$output_html .= '|",'."\n";
}else {
$output_html .= '"'."\n";
}
}
$output_html .= '];'."\n\n";
if ( $bookParams->zooming_method == 1 ) {
$output_html .= 'flippingBook'.$unique_suffix .'.swfHeight = ['."\n";
if ( ( $bookParams->direction == "RTL") &&( $total_pages%2 == 1 ) &&( $total_pages >0 ) ) {
$output_html .= '"|",'."\n";
}
for ( $i = 0;$i <$total_pages;$i++) {
if ( $bookParams->direction == "RTL") {
$output_html .= '"'.$rows[$total_pages -$i -1]->zoom_height;
}else {
$output_html .= '"'.$rows[$i]->zoom_height;
}
if ( $i != ( $total_pages -1 ) ) {
$output_html .= '|",'."\n";
}else {
$output_html .= '"'."\n";
}
}
$output_html .= '];'."\n\n";
$output_html .= 'flippingBook'.$unique_suffix .'.swfWidth = ['."\n";
for ( $i = 0;$i <$total_pages;$i++) {
if ( $bookParams->direction == "RTL") {
$output_html .= '"'.$rows[$total_pages -$i -1]->zoom_width;
}else {
$output_html .= '"'.$rows[$i]->zoom_width;
}
if ( $i != ( $total_pages -1 ) ) {
$output_html .= '|",'."\n";
}else {
$output_html .= '"'."\n";
}
}
$output_html .= '];'."\n\n";
}
$output_html .= 'flippingBook'.$unique_suffix .'.settings.uniqueSuffix = "'.$unique_suffix .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.stageWidth = "'.$bookParams->flash_width .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.stageHeight = "'.$bookParams->flash_height .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.direction = "'.$bookParams->direction .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.bookWidth = "'.( $bookParams->book_width * 2 +$bookParams->frame_width * 4 ).'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.bookHeight = "'.( $bookParams->book_height +$bookParams->frame_width * 2 ).'";'."\n";
$dynamic_scaling = $bookParams->dynamic_scaling == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.dynamicScaling = "'.$dynamic_scaling .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.bookSize = "'.$bookParams->book_size .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.firstPageNumber = "'.$firstPageNumber .'";'."\n";
if ( ( $bookParams->navigation_bar != "") &&( $bookParams->navigation_bar != "none") ) {
$output_html .= 'flippingBook'.$unique_suffix .'.settings.navigationBar = "'.JURI::base(true).'/components/com_flippingbook/navigationbars/'.$bookParams->navigation_bar .'";'."\n";
}
$output_html .= 'flippingBook'.$unique_suffix .'.settings.navigationBarPlacement = "'.$bookParams->navigation_bar_placement .'";'."\n";
if ( $bookParams->page_background_color != "") {
$output_html .= 'flippingBook'.$unique_suffix .'.settings.pageBackgroundColor = 0x'.$bookParams->page_background_color .';'."\n";
}
if ( $bookParams->background_color != "") {
$output_html .= 'flippingBook'.$unique_suffix .'.settings.backgroundColor = "'.$bookParams->background_color .'";'."\n";
}
if ( $bookParams->background_image != "") {
$output_html .= 'flippingBook'.$unique_suffix .'.settings.backgroundImage = "'.JURI::base(true).'/images/'.$bookParams->background_image .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.backgroundImagePlacement = "'.$bookParams->background_image_placement .'";'."\n";
}
$output_html .= 'flippingBook'.$unique_suffix .'.settings.staticShadowsType = "'.$bookParams->static_shadows_type .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.staticShadowsDepth = "'.$bookParams->static_shadows_depth .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.autoFlipSize = "'.$bookParams->auto_flip_size .'";'."\n";
$center_book = $bookParams->center_book == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.centerBook = '.$center_book .';'."\n";
$scale_content = $bookParams->scale_content == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.scaleContent = '.$scale_content .';'."\n";
$always_opened = $bookParams->always_opened == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.alwaysOpened = '.$always_opened .';'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.flipCornerStyle = "'.$bookParams->flip_corner_style .'";'."\n";
$hardcover = $bookParams->hardcover == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.hardcover = '.$hardcover .';'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.downloadURL = "'.$bookParams->download_url .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.downloadTitle = "'.$bookParams->download_title .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.downloadSize = "'.$bookParams->download_size .'";'."\n";
$allow_pages_unload = $bookParams->allow_pages_unload == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.allowPagesUnload = '.$allow_pages_unload .';'."\n";
$fullscreen_enabled = $bookParams->fullscreen_enabled == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.fullscreenEnabled = '.$fullscreen_enabled .';'."\n";
$zoom_enabled = $bookParams->zoom_enabled == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.zoomEnabled = '.$zoom_enabled .';'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.zoomImageWidth = "'.$bookParams->zoom_image_width .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.zoomImageHeight = "'.$bookParams->zoom_image_height .'";'."\n";
if ( $bookParams->zoom_ui_color != "") {
$output_html .= 'flippingBook'.$unique_suffix .'.settings.zoomUIColor = 0x'.$bookParams->zoom_ui_color .';'."\n";
}
$slideshow_button = $bookParams->show_slide_show_button == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.slideshowButton = '.$slideshow_button .';'."\n";
$slideshow_auto_play = $bookParams->slideshow_auto_play == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.slideshowAutoPlay = '.$slideshow_auto_play .';'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.slideshowDisplayDuration = "'.$bookParams->slideshow_display_duration .'";'."\n";
$go_to_page_field = $bookParams->go_to_page_field == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.goToPageField = '.$go_to_page_field .';'."\n";
$first_last_buttons = $bookParams->first_last_buttons == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.firstLastButtons = '.$first_last_buttons .';'."\n";
$print_enabled = $bookParams->print_enabled == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.printEnabled = '.$print_enabled .';'."\n";
$zooming_method = $bookParams->zooming_method == 1 ?'"ajax"': '"flash"';
$output_html .= 'flippingBook'.$unique_suffix .'.settings.zoomingMethod = '.$zooming_method .';'."\n";
$sound_control_button = $bookParams->sound_control_button == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.soundControlButton = '.$sound_control_button .';'."\n";
$transparent_pages = $bookParams->transparent_pages == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.showUnderlyingPages = '.$transparent_pages .';'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.fullscreenHint = "'.urlencode ( $bookParams->fullscreen_hint ).'";'."\n";
$show_zoom_hint = $bookParams->show_zoom_hint == 1 ?"true": "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.zoomHintEnabled = '.$show_zoom_hint .';'."\n";
FB_zoomOnClick == 1 ?$zoomOnClick = "true": $zoomOnClick = "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.zoomOnClick = '.$zoomOnClick .';'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.moveSpeed = "'.FB_moveSpeed .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.closeSpeed = "'.FB_closeSpeed .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.gotoSpeed = "'.FB_gotoSpeed .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.rigidPageSpeed = "'.FB_rigidPageSpeed .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.zoomHint = "'.JText::_("COM_FLIPPINGBOOK_ZOOM_HINT").'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.printTitle = "'.JText::_("COM_FLIPPINGBOOK_PRINT_TITLE").'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.downloadComplete = "'.JText::_("COM_FLIPPINGBOOK_DOWNLOAD_COMPLETE").'";'."\n";
FB_dropShadowEnabled == 1 ?$dropShadowEnabled = "true": $dropShadowEnabled = "false";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.dropShadowEnabled = '.$dropShadowEnabled .';'."\n";
if ( FB_flipSound != "") {
$output_html .= 'flippingBook'.$unique_suffix .'.settings.flipSound = "'.JURI::base(true).'/components/com_flippingbook/sounds/'.FB_flipSound .'";'."\n";
}
if ( FB_hardcoverSound != "") {
$output_html .= 'flippingBook'.$unique_suffix .'.settings.hardcoverSound = "'.JURI::base(true).'/components/com_flippingbook/sounds/'.FB_hardcoverSound .'";'."\n";
}
$output_html .= 'flippingBook'.$unique_suffix .'.settings.preloaderType = "'.FB_preloaderType .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.settings.loader = true;'."\n";
if ( $bookParams->frame_color != "") {
$output_html .= 'flippingBook'.$unique_suffix .'.settings.frameColor = 0x'.$bookParams->frame_color .';'."\n";
}
$output_html .= 'flippingBook'.$unique_suffix .'.settings.frameWidth = '.intval ( $bookParams->frame_width ).';'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.containerId = "fbContainer_'.$unique_suffix .'";'."\n";
$output_html .= 'flippingBook'.$unique_suffix .'.create("'.JURI::base(true).'/components/com_flippingbook/flippingbook.swf");'."\n";
$output_html .= 'jQuery.noConflict();'."\n";
if ( $bookParams->zooming_method == 1 ) {
$output_html .= 'jQuery(document).ready(function() {'."\n";
$output_html .= ' zoom_init("'.JURI::root().'", flippingBook'.$unique_suffix .');'."\n";
$output_html .= '});'."\n";
}
if ( $bookParams->flash_height == '100%') {
$output_html .= 'flippingBook'.$unique_suffix .'.removeSpaces();'."\n";
$output_html .= 'jQuery(window).load(function(){ flippingBook'.$unique_suffix .'.sizeContent("'.$unique_suffix .'"); });'."\n";
$output_html .= 'jQuery(window).resize(function(){ flippingBook'.$unique_suffix .'.sizeContent("'.$unique_suffix .'"); });'."\n";
}
$output_html .= '</script>'."\n";
if ( $bookParams->flash_height == '100%') {
$bookParams->show_pages_description = 0;
}
if ( ( $bookParams->show_pages_description == 1 ) ||( $bookParams->show_book_description == 1 ) ) {
$output_html .= '<div id="fbFooter">';
if ( $bookParams->show_pages_description == 1 ) {
if ( $bookParams->direction == "RTL") {
$output_html .= '<div id="fb_pageDescription_'.$unique_suffix .'" class="fb_pageDescription"><div id="fb_rightPageDescription_'.$unique_suffix .'" class="fb_rightPageDescription"></div>'."\n";
$output_html .= '<div id="fb_leftPageDescription_'.$unique_suffix .'" class="fb_leftPageDescription"></div></div>'."\n";
}else {
$output_html .= '<div id="fb_pageDescription_'.$unique_suffix .'" class="fb_pageDescription"><div id="fb_leftPageDescription_'.$unique_suffix .'" class="fb_leftPageDescription"></div>'."\n";
$output_html .= '<div id="fb_rightPageDescription_'.$unique_suffix .'" class="fb_rightPageDescription"></div></div>'."\n";
}
}
if ( $bookParams->show_book_description == 1 ) {
$output_html .= '<div id="fb_bookDescription'.$unique_suffix .'" class="fb_bookDescription">'.$bookParams->description ."</div>\n\n";
}
$output_html .= '</div>';
}
if ( $bookParams->show_pages_description == 1 ) {
$page_decriptions = '';
$db->setQuery( "SELECT * FROM #__flippingbook_pages WHERE book_id = ".intval ( $book_id )." AND published = 1 ORDER BY ordering");
$p_rows = $db->loadObjectList();
$i = 1;
foreach ( $p_rows as $row ) {
if ( $bookParams->direction == "RTL") {
$page_decriptions .= '<div id="fb_page_'.$unique_suffix .'_'.( $total_pages-$i+1 ).'">'.$row->description ."</div>\n";
}else {
$page_decriptions .= '<div id="fb_page_'.$unique_suffix .'_'.( $i ).'">'.$row->description ."</div>\n";
}
$i++;
}
$output_html .= '<div id="fb_hidden_'.$unique_suffix .'" style="position: absolute; visibility: hidden; display: none;">'."\n".$page_decriptions ."</div>\n";
}
}
if ( empty( $call_from_plugin ) ) {
echo $output_html;
}
?>