mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Featurebox tabbed content support added (new core 'tabs' template)
This commit is contained in:
parent
c6ade9d33a
commit
e7410e2440
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) e107 Inc 2009 - e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id: e_shortcode.php,v 1.10 2009-12-11 14:38:26 secretr Exp $
|
||||
* $Id: e_shortcode.php,v 1.11 2009-12-12 16:35:45 secretr Exp $
|
||||
*
|
||||
* Featurebox shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files.
|
||||
*/
|
||||
@ -49,10 +49,11 @@ class featurebox_shortcodes // must match the plugin's folder name. ie. [PLUGIN_
|
||||
return '';
|
||||
}
|
||||
|
||||
$tmpl = $this->getFboxTemplate($category);
|
||||
$tmpl = $this->getFboxTemplate($ctemplate);
|
||||
$tp = e107::getParser();
|
||||
$category->updateParams($parm);
|
||||
|
||||
$ret = $tp->parseTemplate($tmpl['list_start'], true, $category).$this->render($category, $parm).$tp->parseTemplate($tmpl['list_end'], true, $category);
|
||||
$ret = $tp->parseTemplate($tmpl['list_start'], true, $category).$this->render($category, $ctemplate, $parm).$tp->parseTemplate($tmpl['list_end'], true, $category);
|
||||
if(isset($parm['notablestyle']))
|
||||
{
|
||||
return $ret;
|
||||
@ -66,7 +67,8 @@ class featurebox_shortcodes // must match the plugin's folder name. ie. [PLUGIN_
|
||||
* Available parameters (GET string format)
|
||||
* - loop (boolean): loop using 'nav_loop' template, default 0
|
||||
* - base (string): template key prefix, default is 'nav'. Example: 'mynav' base key will search templates 'mynav_start', 'mynav_loop', 'mynav_end'.
|
||||
* - nolimit (boolean): ignore 'limit' field , us 'total' items number for navigation looping
|
||||
* - nolimit (boolean): ignore 'limit' field , use 'total' items number for navigation looping
|
||||
* - uselimit (boolean): ignore 'limit' field , use 'total' items number for navigation looping
|
||||
*
|
||||
* @param string $parm parameters
|
||||
* @param string $mod category template
|
||||
@ -99,28 +101,69 @@ class featurebox_shortcodes // must match the plugin's folder name. ie. [PLUGIN_
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
$tmpl = $this->getFboxTemplate($category);
|
||||
$tmpl = $this->getFboxTemplate($ctemplate);
|
||||
if($category->get('fb_category_random'))
|
||||
{
|
||||
$parm['loop'] = 0;
|
||||
}
|
||||
|
||||
$base = vartrue($parm['base'], 'nav').'_';
|
||||
$tree_ids = array_keys($tree->getTree()); //all available item ids
|
||||
|
||||
$ret = $category->toHTML(varset($tmpl[$base.'start']), true);
|
||||
$cols = $category->getParam('cols');
|
||||
|
||||
if(isset($parm['loop']) && $tree->getTotal() > 0 && vartrue($tmpl[$base.'item']))
|
||||
{
|
||||
if(isset($parm['nolimit'])) $total = $tree->getTotal();
|
||||
else $total = ceil($tree->getTotal() / ($category->sc_featurebox_category_limit() ? intval($category->sc_featurebox_category_limit()) : $tree->getTotal()) );
|
||||
$model = clone $category;
|
||||
$tmp = array();
|
||||
for ($index = 1; $index <= $total; $index++)
|
||||
// loop for all
|
||||
if(isset($parm['nolimit']))
|
||||
{
|
||||
$total = $tree->getTotal();
|
||||
}
|
||||
// loop for limit number
|
||||
elseif(isset($parm['uselimit']))
|
||||
{
|
||||
$total = $category->sc_featurebox_category_limit() ? intval($category->sc_featurebox_category_limit()) : $tree->getTotal();
|
||||
}
|
||||
// default - number based on all / limit (usefull for ajax navigation)
|
||||
else
|
||||
{
|
||||
$total = ceil($tree->getTotal() / ($category->sc_featurebox_category_limit() ? intval($category->sc_featurebox_category_limit()) : $tree->getTotal()) );
|
||||
}
|
||||
if($cols > 1)
|
||||
{
|
||||
$total = ceil($total / $cols);
|
||||
}
|
||||
$model = clone $category;
|
||||
$item = new plugin_featurebox_item();
|
||||
$tmp = array();
|
||||
for ($index = 1; $index <= $total; $index++)
|
||||
{
|
||||
$nodeid = varset($tree_ids[($index - 1) * $cols], 0);
|
||||
if($nodeid && $tree->hasNode($nodeid))
|
||||
{
|
||||
$model->setParam('counter', $index)
|
||||
->setParam('total', $total)
|
||||
->setParam('active', $index == varset($parm['from'], 1));
|
||||
|
||||
$node = $tree->getNode($nodeid);
|
||||
|
||||
e107::getScParser()->resetScClass('plugin_featurebox_category', $model);
|
||||
$node->setCategory($model)
|
||||
->setParam('counter', $index)
|
||||
->setParam('total', $total)
|
||||
->setParam('limit', $category->get('fb_category_limit'))
|
||||
;
|
||||
|
||||
$tmp[] = $node->toHTML($tmpl[$base.'item'], true);
|
||||
continue;
|
||||
}
|
||||
|
||||
e107::getScParser()->resetScClass('plugin_featurebox_item', $item);
|
||||
$tmp[] = $model->setParam('counter', $index)
|
||||
->setParam('active', $index == varset($parm['from'], 1))
|
||||
->toHTML($tmpl[$base.'item'], true);
|
||||
}
|
||||
}
|
||||
$ret .= implode(varset($tmpl[$base.'separator']), $tmp);
|
||||
unset($model, $tmp);
|
||||
}
|
||||
@ -174,17 +217,18 @@ class featurebox_shortcodes // must match the plugin's folder name. ie. [PLUGIN_
|
||||
{
|
||||
return '';
|
||||
}
|
||||
return $this->render($category, $parm);
|
||||
return $this->render($category, $ctemplate, $parm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render featurebox list
|
||||
* @param plugin_featurebox_category $category
|
||||
* @param string $ctemplate category template
|
||||
* @param array $parm
|
||||
*/
|
||||
public function render($category, $parm)
|
||||
public function render($category, $ctemplate, $parm)
|
||||
{
|
||||
$tmpl = $this->getFboxTemplate($category);
|
||||
$tmpl = $this->getFboxTemplate($ctemplate);
|
||||
$cols = intval(vartrue($parm['cols'], 1));
|
||||
$limit = intval(varset($parm['limit'], $category->sc_featurebox_category_limit()));
|
||||
$from = (intval(vartrue($parm['from'], 1)) - 1) * $limit;
|
||||
@ -238,7 +282,7 @@ class featurebox_shortcodes // must match the plugin's folder name. ie. [PLUGIN_
|
||||
$tmpl_item .= $tmpl['col_end'];
|
||||
}
|
||||
// else add item separator
|
||||
else
|
||||
elseif($cols != $col_counter && 1 != $col_counter)
|
||||
{
|
||||
$tmpl_item .= $tmpl['item_separator'];
|
||||
}
|
||||
@ -292,15 +336,15 @@ class featurebox_shortcodes // must match the plugin's folder name. ie. [PLUGIN_
|
||||
/**
|
||||
* Retrieve template array by category
|
||||
*
|
||||
* @param plugin_featurebox_category $category
|
||||
* @param string $ctemplate
|
||||
* @return array
|
||||
*/
|
||||
public function getFboxTemplate($category)
|
||||
public function getFboxTemplate($ctemplate)
|
||||
{
|
||||
$tmpl = e107::getTemplate('featurebox', 'featurebox_category', $category->get('fb_category_template'), 'front');
|
||||
if(!$tmpl && e107::getTemplate('featurebox', 'featurebox_category', $category->get('fb_category_template'), false))
|
||||
$tmpl = e107::getTemplate('featurebox', 'featurebox_category', $ctemplate, 'front');
|
||||
if(!$tmpl && e107::getTemplate('featurebox', 'featurebox_category', $ctemplate, false))
|
||||
{
|
||||
$tmpl = e107::getTemplate('featurebox', 'featurebox_category', $category->get('fb_category_template'), false); // plugin template
|
||||
$tmpl = e107::getTemplate('featurebox', 'featurebox_category', $ctemplate, false); // plugin template
|
||||
}
|
||||
elseif(!$tmpl && e107::getTemplate('featurebox', 'featurebox_category', 'default'))
|
||||
{
|
||||
|
@ -9,9 +9,9 @@
|
||||
* Featurebox Item model
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/includes/item.php,v $
|
||||
* $Revision: 1.7 $
|
||||
* $Date: 2009-12-12 10:30:33 $
|
||||
* $Author: e107coders $
|
||||
* $Revision: 1.8 $
|
||||
* $Date: 2009-12-12 16:35:46 $
|
||||
* $Author: secretr $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -87,10 +87,6 @@ class plugin_featurebox_item extends e_model
|
||||
|
||||
$src = $tp->replaceConstants($this->get('fb_image'), 'full');
|
||||
|
||||
|
||||
//FIXME - doesn't display anything that uses {e_MEDIA} in the path.
|
||||
|
||||
|
||||
if(isset($parm['src']))
|
||||
{
|
||||
return $src;
|
||||
@ -166,7 +162,7 @@ class plugin_featurebox_item extends e_model
|
||||
*/
|
||||
public function setCategory($category)
|
||||
{
|
||||
$this->_category = $category;
|
||||
$this->_category = $category;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -192,7 +188,7 @@ class plugin_featurebox_item extends e_model
|
||||
*/
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
if (strpos($method, "sc_featurebox_category_") === 0)
|
||||
if (strpos($method, "sc_featurebox_") === 0)
|
||||
{
|
||||
return call_user_func_array(array($this->getCategory(), $method), $arguments);
|
||||
}
|
||||
|
@ -1,18 +1,11 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/languages/English_admin_featurebox.php,v $
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 2009-12-08 17:21:34 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
* Copyright (c) e107 Inc 2009 - e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id: English_admin_featurebox.php,v 1.5 2009-12-12 16:35:46 secretr Exp $
|
||||
*
|
||||
* Featurebox back-end laguage defines
|
||||
* TODO - cleanup constants not in use
|
||||
*/
|
||||
|
||||
define("FBLAN_01", "Feature Box");
|
||||
define("FBLAN_02", "This plugin allows you to display a box above your news items with features / whatever you like in it. The messages can either be revolved randomly or dynamically faded.");
|
||||
|
@ -1,18 +1,10 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/languages/English_front_featurebox.php,v $
|
||||
* $Revision: 1.1 $
|
||||
* $Date: 2009-12-09 18:36:32 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
* Copyright (c) e107 Inc 2009 - e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id: English_front_featurebox.php,v 1.2 2009-12-12 16:35:46 secretr Exp $
|
||||
*
|
||||
* Featurebox front-end laguage defines
|
||||
*/
|
||||
|
||||
define("FBLAN_01", "Feature Box");
|
||||
?>
|
@ -1,4 +1,12 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) e107 Inc 2009 - e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id: featurebox_category_template.php,v 1.5 2009-12-12 16:35:46 secretr Exp $
|
||||
*
|
||||
* Featurebox core category templates
|
||||
*/
|
||||
|
||||
// TODO - list of all available shortcodes & schortcode parameters
|
||||
|
||||
// avoid PHP warnings
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE = array();
|
||||
@ -83,77 +91,39 @@ $FEATUREBOX_CATEGORY_TEMPLATE['dynamic']['js_inline'] = 'new Featurebox(\'featur
|
||||
|
||||
|
||||
//TODO - tabs template.
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['list_start'] = '';
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['list_start'] = '
|
||||
<div class="box featurebox admintabs" id="featurebox-tab-container">
|
||||
{FEATUREBOX_NAVIGATION|tabs=loop&uselimit}
|
||||
<div class="tab-content-wrap">
|
||||
';
|
||||
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['list_end'] = '';
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['list_end'] = '
|
||||
</div>
|
||||
<div class="clear"><!-- --></div>
|
||||
</div>
|
||||
';
|
||||
|
||||
// For Reference:
|
||||
/*
|
||||
<div class="admintabs" id="tab-container">
|
||||
// no column support
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['col_start'] = '<div id="tab-{FEATUREBOX_COLSCOUNT}-activate"><div class="tab-content">';
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['col_end'] = '</div></div>';
|
||||
|
||||
<div class="tabs">
|
||||
// ajax navigation (unobtrusive)
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['item_start'] = '';
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['item_end'] = '';
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['item_separator'] = '<div class="clear"><!-- --></div>';
|
||||
|
||||
<ul class="e-tabs e-hideme clearer" id="front-tabs">
|
||||
// empty item - used with col templates, no shortcodes just basic markup
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['item_empty'] = '';
|
||||
|
||||
<li id="tab-01"><a href="#tab-01-activate"><span>'.LAN_THEME_TAB_1.'</span></a></li>
|
||||
|
||||
<li id="tab-02"><a href="#tab-02-activate"><span>'.LAN_THEME_TAB_2.'</span></a></li>
|
||||
|
||||
<li id="tab-03"><a href="#tab-03-activate"><span>'.LAN_THEME_TAB_3.'</span></a></li>
|
||||
|
||||
<li id="tab-04"><a href="#tab-04-activate"><span>'.LAN_THEME_TAB_4.'</span></a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-content-wrap">
|
||||
|
||||
<div id="tab-01-activate">
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
{MENU=2}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="tab-02-activate">
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
{MENU=3}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="tab-03-activate">
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
{MENU=4}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="tab-04-activate">
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
{MENU=5}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
*/
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['nav_start'] = '<div class="tabs"><ul class="e-tabs clear" id="front-tabs">';
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['nav_item'] = '<li id="featurebox-tab-{FEATUREBOX_NAV_COUNTER}"><a href="#tab-{FEATUREBOX_NAV_COUNTER}-activate"><span>{FEATUREBOX_TITLE}</span></a></li>';
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['nav_end'] = '</ul></div>';
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['nav_separator'] = '';
|
||||
|
||||
// external JS, comma separated list
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['js'] = '{e_FILE}jslib/core/tabs.js';
|
||||
// inline JS, without <script> tags
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['tabs']['js_inline'] = 'new e107Widgets.Tabs("featurebox-tab-container", { bookmarkFix: false });';
|
||||
|
||||
/**
|
||||
* Template information.
|
||||
@ -164,9 +134,9 @@ $FEATUREBOX_CATEGORY_TEMPLATE['tabs']['list_end'] = '';
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
$FEATUREBOX_CATEGORY_TEMPLATE['__INFO__'] = array(
|
||||
'default' => array('title' => 'Default - show by category limit'),
|
||||
'dynamic' => array('title' => 'Dynamic (AJAX) loading'),
|
||||
'tabs' => array('title' => 'Tabs')
|
||||
$FEATUREBOX_CATEGORY_INFO = array(
|
||||
'default' => array('title' => 'Default (core)', 'description' => 'Flat - show by category limit'),
|
||||
'dynamic' => array('title' => 'Dynamic (core)', 'description' => 'Load items on click (AJAX)'),
|
||||
'tabs' => array('title' => 'Tabs (core)' , 'description' => 'Tabbed Feature box items')
|
||||
);
|
||||
?>
|
@ -1,4 +1,11 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) e107 Inc 2009 - e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id: featurebox_template.php,v 1.6 2009-12-12 16:35:46 secretr Exp $
|
||||
*
|
||||
* Featurebox core item templates
|
||||
*/
|
||||
|
||||
global $sc_style;
|
||||
|
||||
$FEATUREBOX_TEMPLATE['default'] = '
|
||||
@ -26,10 +33,9 @@ $FEATUREBOX_TEMPLATE['image_right'] = '
|
||||
</div>
|
||||
';
|
||||
|
||||
$FEATUREBOX_TEMPLATE['__INFO__'] = array(
|
||||
'default' => array('title' => 'Default - no image'),
|
||||
'image_right' => array('title' => 'Image to right'),
|
||||
'image_left' => array('title' => 'Image to left'),
|
||||
$FEATUREBOX_INFO = array(
|
||||
'default' => array('title' => 'Default (core)', 'description' => 'Title and description - no image'),
|
||||
'image_right' => array('title' => 'Right image (core)', 'description' => 'Right floated image'),
|
||||
'image_left' => array('title' => 'Left image (core)' , 'description' => 'Left floated image')
|
||||
);
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user