mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
featurebox front-end - work in progress
This commit is contained in:
@@ -9,8 +9,8 @@
|
|||||||
* e107 Main
|
* e107 Main
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $
|
||||||
* $Revision: 1.88 $
|
* $Revision: 1.89 $
|
||||||
* $Date: 2009-12-02 16:51:02 $
|
* $Date: 2009-12-08 17:21:32 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1221,7 +1221,7 @@ class e107
|
|||||||
{
|
{
|
||||||
$reg_path = 'core/e107/templates/'.$id.($override ? '/ext' : '');
|
$reg_path = 'core/e107/templates/'.$id.($override ? '/ext' : '');
|
||||||
$path = self::coreTemplatePath($id, $override);
|
$path = self::coreTemplatePath($id, $override);
|
||||||
|
$id = str_replace('/', '_', $id);
|
||||||
return self::_getTemplate($id, $key, $reg_path, $path);
|
return self::_getTemplate($id, $key, $reg_path, $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1254,7 +1254,7 @@ class e107
|
|||||||
{
|
{
|
||||||
$reg_path = 'plugin/'.$plug_name.'/templates/'.$id.($override ? '/ext' : '');
|
$reg_path = 'plugin/'.$plug_name.'/templates/'.$id.($override ? '/ext' : '');
|
||||||
$path = self::templatePath($plug_name, $id, $override);
|
$path = self::templatePath($plug_name, $id, $override);
|
||||||
|
$id = str_replace('/', '_', $id);
|
||||||
return self::_getTemplate($id, $key, $reg_path, $path);
|
return self::_getTemplate($id, $key, $reg_path, $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1277,8 +1277,8 @@ class e107
|
|||||||
$tmp = self::getTemplate($plugin_name, $id, null, $where);
|
$tmp = self::getTemplate($plugin_name, $id, null, $where);
|
||||||
}
|
}
|
||||||
|
|
||||||
$templates = array();
|
$templates = array();
|
||||||
$filter_mask = explode($filter_mask);
|
$filter_mask = $filter_mask ? explode(',', $filter_mask) : array();
|
||||||
foreach($tmp as $key => $val)
|
foreach($tmp as $key => $val)
|
||||||
{
|
{
|
||||||
// Special key INFO in format aray('layout' => array(info))
|
// Special key INFO in format aray('layout' => array(info))
|
||||||
@@ -1289,7 +1289,7 @@ class e107
|
|||||||
$match = true;
|
$match = true;
|
||||||
if($filter_mask)
|
if($filter_mask)
|
||||||
{
|
{
|
||||||
$match = false;
|
$match = false;
|
||||||
foreach ($filter_mask as $mask)
|
foreach ($filter_mask as $mask)
|
||||||
{
|
{
|
||||||
if(strpos($key, $mask) === 0) //e.g. retrieve only keys starting with 'layout_'
|
if(strpos($key, $mask) === 0) //e.g. retrieve only keys starting with 'layout_'
|
||||||
@@ -1325,7 +1325,7 @@ class e107
|
|||||||
{
|
{
|
||||||
$regPath = $reg_path;
|
$regPath = $reg_path;
|
||||||
$var = strtoupper($id).'_TEMPLATE';
|
$var = strtoupper($id).'_TEMPLATE';
|
||||||
|
|
||||||
if(null === self::getRegistry($regPath))
|
if(null === self::getRegistry($regPath))
|
||||||
{
|
{
|
||||||
(deftrue('E107_DEBUG_LEVEL') ? include_once($path) : @include_once($path));
|
(deftrue('E107_DEBUG_LEVEL') ? include_once($path) : @include_once($path));
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* e107 Base Model
|
* e107 Base Model
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
|
||||||
* $Revision: 1.46 $
|
* $Revision: 1.47 $
|
||||||
* $Date: 2009-11-28 15:34:46 $
|
* $Date: 2009-12-08 17:21:33 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -850,7 +850,7 @@ class e_model
|
|||||||
*/
|
*/
|
||||||
public function load($id, $force = false)
|
public function load($id, $force = false)
|
||||||
{
|
{
|
||||||
if(!$force && $this->hasData())
|
if(!$force && $this->getId())
|
||||||
{
|
{
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@@ -868,12 +868,18 @@ class e_model
|
|||||||
SELECT * FROM #'.$this->getModelTable().' WHERE '.$this->getFieldIdName().'='.$id.'
|
SELECT * FROM #'.$this->getModelTable().' WHERE '.$this->getFieldIdName().'='.$id.'
|
||||||
';
|
';
|
||||||
}
|
}
|
||||||
//TODO - error reporting
|
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
if($sql->db_Select_gen($qry))
|
if($sql->db_Select_gen($qry))
|
||||||
{
|
{
|
||||||
$this->setData($sql->db_Fetch());
|
$this->setData($sql->db_Fetch());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($sql->getLastErrorNumber())
|
||||||
|
{
|
||||||
|
$this->addMessageDebug('SQL error #'.$sql->getLastErrorNumber().': '.$sql->getLastErrorText());
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||||
* $Id: English_admin_banner.php,v 1.1 2009-07-23 16:43:03 e107coders Exp $
|
* $Id: English_admin_banner.php,v 1.2 2009-12-08 17:21:36 secretr Exp $
|
||||||
*
|
*
|
||||||
* Administration Language File
|
* Administration Language File
|
||||||
*
|
*
|
||||||
@@ -77,4 +77,7 @@ define("BNRLAN_66", "N/A");
|
|||||||
|
|
||||||
define("BNRLAN_67", "No campaigns yet.");
|
define("BNRLAN_67", "No campaigns yet.");
|
||||||
define("BNRLAN_68", "Banner Menu Configuration");
|
define("BNRLAN_68", "Banner Menu Configuration");
|
||||||
|
|
||||||
|
// Plugin manager
|
||||||
|
define("BNRLAN_100", "Banner Plugin Description TODO");
|
||||||
?>
|
?>
|
@@ -1,12 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<!-- $Id: plugin.xml,v 1.4 2009-10-20 03:49:21 e107coders Exp $ -->
|
<!-- $Id: plugin.xml,v 1.5 2009-12-08 17:21:34 secretr Exp $ -->
|
||||||
|
|
||||||
<e107Plugin name="Banners" version="1.0" compatibility="0.8" installRequired="true" releaseUrl=''>
|
<e107Plugin name="Banners" version="1.0" compatibility="0.8" installRequired="true" releaseUrl=''>
|
||||||
<author name="e107 Inc." url="http://e107.org" email="jalist@e107.org" />
|
<author name="e107 Inc." url="http://e107.org" email="jalist@e107.org" />
|
||||||
<description>FBLAN_02</description>
|
<description>BNRLAN_100</description>
|
||||||
<languageFiles>
|
<languageFiles>
|
||||||
<file type='log' path='languages/--LAN--_admin_banner.php' />
|
<file type='log' path='languages/--LAN--_admin_banner.php' />
|
||||||
|
<file type='install' path='languages/--LAN--_admin_banner.php' />
|
||||||
</languageFiles>
|
</languageFiles>
|
||||||
<category>content</category>
|
<category>content</category>
|
||||||
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
||||||
|
@@ -1,16 +1,64 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Copyright (c) e107 Inc 2009 - e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
* Copyright (c) e107 Inc 2009 - e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||||
* $Id: e_shortcode.php,v 1.1 2009-11-25 12:01:25 e107coders Exp $
|
* $Id: e_shortcode.php,v 1.2 2009-12-08 17:21:30 secretr Exp $
|
||||||
*
|
*
|
||||||
* Banner shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files.
|
* Featurebox shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class featurebox_shortcodes // must match the plugin's folder name. ie. [PLUGIN_FOLDER]_shortcodes
|
class featurebox_shortcodes // must match the plugin's folder name. ie. [PLUGIN_FOLDER]_shortcodes
|
||||||
{
|
{
|
||||||
function sc_featurebox($parm)
|
function sc_featurebox($parm, $mod = '')
|
||||||
{
|
{
|
||||||
require_once(e_PLUGIN."featurebox/featurebox.php");
|
// TODO cache
|
||||||
|
if(!$mod)
|
||||||
|
{
|
||||||
|
$clayout = 'default';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$clayout = $mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
$category = new plugin_featurebox_category();
|
||||||
|
$category->loadByLayout($clayout);
|
||||||
|
if(!$category->hasData())
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$tree = $category->getItemTree();
|
||||||
|
if($tree->isEmpty())
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmpl = e107::getTemplate('featurebox', 'layout/'.$category->get('fb_category_layout'));
|
||||||
|
if(!$tmpl)
|
||||||
|
{
|
||||||
|
$tmpl = e107::getTemplate('featurebox', 'layout/default');
|
||||||
|
}
|
||||||
|
|
||||||
|
$tp = e107::getParser();
|
||||||
|
$ret = array();
|
||||||
|
|
||||||
|
$counter = 1;
|
||||||
|
foreach ($tree->getTree() as $id => $node)
|
||||||
|
{
|
||||||
|
$tmpl_item = e107::getTemplate('featurebox', 'featurebox', $node->get('fb_template'));
|
||||||
|
if(!$tmpl_item)
|
||||||
|
{
|
||||||
|
$tmpl_item = e107::getTemplate('featurebox', 'featurebox', 'default');
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret[] = $node->setParam('counter', $counter)
|
||||||
|
->setCategory($category)
|
||||||
|
->toHTML($tmpl_item);
|
||||||
|
|
||||||
|
//$ret[] = $node->toHTML($tmpl_item);
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tp->parseTemplate($tmpl['list_start'], true, $category).implode($ret['item_separator'], $ret).$tp->parseTemplate($tmpl['list_end'], true, $category);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
@@ -6,15 +6,17 @@
|
|||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
* Custom FAQ install/uninstall/update routines
|
* Custom Featurebox install/uninstall/update routines
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/featurebox_setup.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/featurebox_setup.php,v $
|
||||||
* $Revision: 1.2 $
|
* $Revision: 1.3 $
|
||||||
* $Date: 2009-11-26 17:15:46 $
|
* $Date: 2009-12-08 17:21:31 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
class featurebox_setup
|
class featurebox_setup
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -26,25 +28,41 @@ class featurebox_setup
|
|||||||
*/
|
*/
|
||||||
function install_post($var)
|
function install_post($var)
|
||||||
{
|
{
|
||||||
$sql = e107::getDb();
|
e107::includeLan(e_PLUGIN.'featurebox/languages/'.e_LANGUAGE.'_admin_featurebox.php');
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
|
|
||||||
$query = "
|
$query = array();
|
||||||
INSERT INTO #featurebox (`fb_id`, `fb_title`, `fb_text`, `fb_mode`, `fb_class`, `fb_rendertype`, `fb_template`, `fb_order`, `fb_image`, `fb_imageurl`, `fb_category`) VALUES
|
$query['fb_category_id'] = 0;
|
||||||
(1, 'Default Title', 'Default Message', 0, 0, 0, '0', 0, '', '', 0);
|
$query['fb_category_title'] = 'General';
|
||||||
";
|
$query['fb_category_layout'] = 'default';
|
||||||
|
$query['fb_category_random'] = 0;
|
||||||
|
$query['fb_category_class'] = e_UC_PUBLIC;
|
||||||
|
$query['fb_category_limit'] = 1;
|
||||||
|
$inserted = e107::getDb()->db_Insert('featurebox_category', $query);
|
||||||
|
$status = $inserted ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
|
||||||
|
$mes->add(FBLAN_INSTALL_01, $status);
|
||||||
|
|
||||||
$query2 = "
|
if($inserted)
|
||||||
INSERT INTO #featurebox_category (`fb_category_id`, `fb_category_title`, `fb_category_class`, `fb_category_order`) VALUES
|
{
|
||||||
(1, 'General', 0, 0);
|
$query = array();
|
||||||
";
|
$query['fb_id'] = 0;
|
||||||
|
$query['fb_category'] = $inserted;
|
||||||
//FIXME - I should be able to put both INSERTs into the same $query. MySQL class issue.
|
$query['fb_title'] = 'Default Title';
|
||||||
$status = ($sql->db_Select_gen($query)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
|
$query['fb_text'] = 'Default Message';
|
||||||
$mes->add("Adding Default table data.",$status);
|
$query['fb_mode'] = 0;
|
||||||
|
$query['fb_class'] = e_UC_PUBLIC;
|
||||||
$status = ($sql->db_Select_gen($query2)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
|
$query['fb_rendertype'] = 0;
|
||||||
$mes->add("Adding Default table data.",$status);
|
$query['fb_template'] = 'default';
|
||||||
|
$query['fb_order'] = 0;
|
||||||
|
$query['fb_image'] = '';
|
||||||
|
$query['fb_imageurl'] = 0;
|
||||||
|
$status = e107::getDb('sql2')->db_Insert('featurebox', $query) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$status = E_MESSAGE_ERROR;
|
||||||
|
}
|
||||||
|
$mes->add(FBLAN_INSTALL_02, $status);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
function uninstall_options()
|
function uninstall_options()
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
<?php exit; ?>
|
||||||
CREATE TABLE featurebox (
|
CREATE TABLE featurebox (
|
||||||
`fb_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`fb_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`fb_title` varchar(200) NOT NULL DEFAULT '',
|
`fb_title` varchar(200) NOT NULL DEFAULT '',
|
||||||
|
@@ -9,27 +9,97 @@
|
|||||||
* Featurebox Category model
|
* Featurebox Category model
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/includes/category.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/includes/category.php,v $
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.2 $
|
||||||
* $Date: 2009-12-04 18:52:19 $
|
* $Date: 2009-12-08 17:21:31 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
class plugin_featurebox_category extends e_model
|
class plugin_featurebox_category extends e_model
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var plugin_featurebox_tree
|
* @var plugin_featurebox_tree
|
||||||
*/
|
*/
|
||||||
protected $_tree = null;
|
protected $_tree = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data loaded check
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $_loaded_data = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see e_model::_field_id
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $_field_id = 'fb_category_id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see e_model::_db_table
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $_db_table = 'featurebox_category';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameter (single string format):
|
||||||
|
* - alt: return title as tag attribute text
|
||||||
|
* @param string $parm
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function sc_featurebox_category_title($parm)
|
||||||
|
{
|
||||||
|
return ($parm == 'alt' ? e107::getParser()->toAttribute($this->get('fb_category_title')) : e107::getParser()->toHTML($this->get('fb_category_title'), false, 'TITLE'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameter (single string format):
|
||||||
|
* - src: return image src URL only
|
||||||
|
*
|
||||||
|
* @param string $parm
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function sc_featurebox_category_icon($parm)
|
||||||
|
{
|
||||||
|
if(!$this->get('fb_category_icon'))
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
|
$src = $tp->replaceConstants($this->get('fb_category_icon'), 'full');
|
||||||
|
if($parm == 'src')
|
||||||
|
{
|
||||||
|
return $src;
|
||||||
|
}
|
||||||
|
return '<img src="'.$src.'" alt="'.$tp->toAttribute($this->get('fb_category_title')).'" class="icon" />';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sc_featurebox_category_layout()
|
||||||
|
{
|
||||||
|
return $this->get('fb_category_layout');
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Load category data by layout
|
* Load category data by layout
|
||||||
|
* TODO - system cache
|
||||||
*
|
*
|
||||||
* @param string $layout
|
* @param string $layout
|
||||||
* @param boolean $force
|
* @param boolean $force
|
||||||
|
* @return plugin_featurebox_category
|
||||||
*/
|
*/
|
||||||
public function loadByLayout($layout, $force = false)
|
public function loadByLayout($layout, $force = false)
|
||||||
{
|
{
|
||||||
//TODO
|
if($force || null === $this->_loaded_data)
|
||||||
|
{
|
||||||
|
if(e107::getDb()->db_Select('featurebox_category', '*', 'fb_category_class IN ('.USERCLASS_LIST.') AND fb_category_layout=\''.e107::getParser()->toDB($layout).'\''))
|
||||||
|
{
|
||||||
|
$this->setData(e107::getDb()->db_Fetch());
|
||||||
|
$this->_loaded_data = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->_loaded_data = false;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,12 +109,15 @@ class plugin_featurebox_category extends e_model
|
|||||||
* @param boolean $force
|
* @param boolean $force
|
||||||
* @return plugin_featurebox_tree
|
* @return plugin_featurebox_tree
|
||||||
*/
|
*/
|
||||||
public function getTree($force = false)
|
public function getItemTree($force = false)
|
||||||
{
|
{
|
||||||
if($force || null === $this->_tree)
|
if($force || null === $this->_tree)
|
||||||
{
|
{
|
||||||
$this->_tree = new plugin_featurebox_tree();
|
$this->_tree = new plugin_featurebox_tree();
|
||||||
$options = array(); // TODO options
|
$options = array(
|
||||||
|
'limit' => $this->getParam('limit', $this->get('fb_category_limit')),
|
||||||
|
'random' => $this->getParam('random', $this->get('fb_category_random'))
|
||||||
|
);
|
||||||
$this->_tree->load($this->getId(), $options, $force);
|
$this->_tree->load($this->getId(), $options, $force);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,12 +127,12 @@ class plugin_featurebox_category extends e_model
|
|||||||
/**
|
/**
|
||||||
* Set item tree
|
* Set item tree
|
||||||
*
|
*
|
||||||
* @param plugin_featurebox_tree $category_tree
|
* @param plugin_featurebox_tree $item_tree
|
||||||
* @return plugin_featurebox_category
|
* @return plugin_featurebox_category
|
||||||
*/
|
*/
|
||||||
public function setTree($category_tree)
|
public function setItemTree($item_tree)
|
||||||
{
|
{
|
||||||
$this->_tree = $category_tree;
|
$this->_tree = $item_tree;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -9,14 +9,139 @@
|
|||||||
* Featurebox Item model
|
* Featurebox Item model
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/includes/item.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/includes/item.php,v $
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.2 $
|
||||||
* $Date: 2009-12-04 18:52:19 $
|
* $Date: 2009-12-08 17:21:32 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
// TODO - sc_* methods
|
// TODO - sc_* methods
|
||||||
class plugin_featurebox_item extends e_model
|
class plugin_featurebox_item extends e_model
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @see e_model::_field_id
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $_field_id = 'fb_id';
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* @see e_model::_db_table
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $_db_table = 'featurebox';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var plugin_featurebox_category
|
||||||
|
*/
|
||||||
|
protected $_category = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameter list (GET string format):
|
||||||
|
* - alt: return title as tag attribute text
|
||||||
|
* - url: add url tag to the output (only if 'fb_imageurl' is available)
|
||||||
|
*
|
||||||
|
* @param string $parm
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function sc_featurebox_title($parm = '')
|
||||||
|
{
|
||||||
|
parse_str($parm, $parm);
|
||||||
|
$tp = e107::getParser();
|
||||||
|
if(isset($parm['alt']))
|
||||||
|
{
|
||||||
|
return $tp->toAttribute($this->get('fb_title'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret = $tp->toHTML($this->get('fb_title'), false, 'TITLE');
|
||||||
|
if(isset($parm['url']) && $this->get('fb_imageurl'))
|
||||||
|
{
|
||||||
|
return '<a id="featurebox-titleurl-"'.$this->getId().' href="'.$tp->replaceConstants($this->get('fb_imageurl'), 'full').'" title="'.$tp->toAttribute($this->get('fb_title')).'" rel="'.$tp->toAttribute(vartrue($parm['rel'], 'external')).'">'.$ret.'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sc_featurebox_text()
|
||||||
|
{
|
||||||
|
return e107::getParser()->toHTML($this->get('fb_text'), true, 'BODY');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameter list (GET string format):
|
||||||
|
* - src: return image src URL only
|
||||||
|
* - nourl: force no url tag
|
||||||
|
*
|
||||||
|
* @param string $parm
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function sc_featurebox_image($parm = '')
|
||||||
|
{
|
||||||
|
if(!$this->get('fb_image'))
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
parse_str($parm, $parm);
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
|
$src = $tp->replaceConstants($this->get('fb_image'), 'full');
|
||||||
|
if(isset($parm['src']))
|
||||||
|
{
|
||||||
|
return $src;
|
||||||
|
}
|
||||||
|
$tag = '<img id="featurebox-image-"'.$this->getId().' src="'.$src.'" alt="'.$tp->toAttribute($this->get('fb_title')).'" class="featurebox" />';
|
||||||
|
if(isset($parm['nourl']) || !$this->get('fb_imageurl'))
|
||||||
|
{
|
||||||
|
return $tag;
|
||||||
|
}
|
||||||
|
return '<a id="featurebox-imageurl-"'.$this->getId().' href="'.$tp->replaceConstants($this->get('fb_imageurl'), 'full').'" title="'.$tp->toAttribute($this->get('fb_title')).'" rel="'.$tp->toAttribute(vartrue($parm['rel'], 'external')).'">'.$tag.'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sc_featurebox_counter()
|
||||||
|
{
|
||||||
|
return $this->getParam('counter', 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set current category
|
||||||
|
* @param plugin_featurebox_category $category
|
||||||
|
* @return plugin_featurebox_item
|
||||||
|
*/
|
||||||
|
public function setCategory($category)
|
||||||
|
{
|
||||||
|
$this->_category = $category;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Category model instance
|
||||||
|
* @return plugin_featurebox_category
|
||||||
|
*/
|
||||||
|
public function getCategory()
|
||||||
|
{
|
||||||
|
if(null === $this->_category)
|
||||||
|
{
|
||||||
|
$this->_category = new plugin_featurebox_category();
|
||||||
|
$this->_category->load($this->get('fb_category'));
|
||||||
|
}
|
||||||
|
return $this->_category;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Magic call - category shortcodes
|
||||||
|
*
|
||||||
|
* @param string $method
|
||||||
|
* @param array $arguments
|
||||||
|
*/
|
||||||
|
public function __call($method, $arguments)
|
||||||
|
{
|
||||||
|
if (strpos($method, "sc_featurebox_category_") === 0)
|
||||||
|
{
|
||||||
|
return call_user_func_array(array($this->getCategory(), $method), $arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -9,14 +9,17 @@
|
|||||||
* Featurebox Category Tree model
|
* Featurebox Category Tree model
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/includes/tree.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/includes/tree.php,v $
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.2 $
|
||||||
* $Date: 2009-12-04 18:52:19 $
|
* $Date: 2009-12-08 17:21:32 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
class plugin_featurebox_tree extends e_tree_model
|
class plugin_featurebox_tree extends e_tree_model
|
||||||
{
|
{
|
||||||
|
protected $_field_id = 'fb_id';
|
||||||
/**
|
/**
|
||||||
* Load tree data
|
* Load tree data
|
||||||
* TODO - system cache
|
* TODO - system cache
|
||||||
@@ -32,13 +35,16 @@ class plugin_featurebox_tree extends e_tree_model
|
|||||||
{
|
{
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->setParam('model_class', 'plugin_featurebox_item')
|
||||||
|
->setParam('model_message_stack', 'featurebox');
|
||||||
|
|
||||||
|
$this->updateParams($options);
|
||||||
|
|
||||||
$this->setParams(array(
|
$order = $this->getParam('random') ? ' ORDER BY rand()' : ' ORDER BY fb_order ASC';
|
||||||
'model_class' => 'plugin_featurebox_item',
|
$limit = $this->getParam('limit') ? ' LIMIT 0,'.intval($this->getParam('limit')) : '';
|
||||||
'model_message_stack' => 'featurebox'
|
$qry = 'SELECT SQL_CALC_FOUND_ROWS * FROM #featurebox WHERE fb_category='.intval($category_id).' AND fb_class IN('.USERCLASS_LIST.')'.$order.$limit;
|
||||||
));
|
$this->setParam('db_query', $qry);
|
||||||
|
|
||||||
// TODO - options -> limit, random; set param 'db_query'
|
|
||||||
|
|
||||||
parent::load($force);
|
parent::load($force);
|
||||||
|
|
||||||
|
@@ -9,9 +9,9 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/languages/English_admin_featurebox.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/languages/English_admin_featurebox.php,v $
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.4 $
|
||||||
* $Date: 2009-11-18 01:05:36 $
|
* $Date: 2009-12-08 17:21:34 $
|
||||||
* $Author: e107coders $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("FBLAN_01", "Feature Box");
|
define("FBLAN_01", "Feature Box");
|
||||||
@@ -46,5 +46,7 @@ define('LAN_AL_FBLAN_01', 'Featurebox created');
|
|||||||
define('LAN_AL_FBLAN_02', 'Featurebox updated');
|
define('LAN_AL_FBLAN_02', 'Featurebox updated');
|
||||||
define('LAN_AL_FBLAN_03', 'Featurebox deleted');
|
define('LAN_AL_FBLAN_03', 'Featurebox deleted');
|
||||||
|
|
||||||
|
// Install/uninstall messages
|
||||||
|
define('FBLAN_INSTALL_01', 'Adding Default category table data.');
|
||||||
|
define('FBLAN_INSTALL_02', 'Adding Default table data.');
|
||||||
?>
|
?>
|
@@ -1,18 +1,23 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<!-- $Id: plugin.xml,v 1.8 2009-10-20 03:49:22 e107coders Exp $ -->
|
<!-- $Id: plugin.xml,v 1.9 2009-12-08 17:21:31 secretr Exp $ -->
|
||||||
|
|
||||||
<e107Plugin name="FBLAN_01" version="1.0" compatibility="0.8" installRequired="true">
|
<e107Plugin name="FBLAN_01" version="1.0" compatibility="0.8" installRequired="true">
|
||||||
<author name="e107 Inc." url="http://e107.org" email="jalist@e107.org" />
|
<author name="e107 Inc." url="http://e107.org" email="cameron@e107.org" />
|
||||||
<description>FBLAN_02</description>
|
<description>FBLAN_02</description>
|
||||||
<category>content</category>
|
<category>content</category>
|
||||||
|
<adminLinks>
|
||||||
|
<link url='admin_config.php' description='Configure feature box' icon='images/featurebox_32.png' iconSmall='images/featurebox_16.png' primary='true' >Configure feature box</link>
|
||||||
|
<link url="admin_config.php" description="Manage Featurebox Items" icon="manage" >Manage Items</link>
|
||||||
|
<link url="admin_config.php?mode=main&action=create" description="Add Featurebox item" icon="add" >Create Item</link>
|
||||||
|
<link url="admin_config.php?mode=category&action=list" description="Manage Featurebox Categories" icon="manage" >Manage Categories</link>
|
||||||
|
<link url="admin_config.php?mode=category&action=create" description="Add Featurebox Category" icon="add" >Create Category</link>
|
||||||
|
</adminLinks>
|
||||||
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
|
||||||
<languageFiles>
|
<languageFiles>
|
||||||
<file type='log' path='languages/--LAN--_admin_featurebox.php' />
|
<file type='log' path='languages/--LAN--_admin_featurebox.php' />
|
||||||
|
<file type='install' path='languages/--LAN--_admin_featurebox.php' />
|
||||||
</languageFiles>
|
</languageFiles>
|
||||||
<adminLinks>
|
|
||||||
<link url='admin_config.php' description='Configure feature box' icon='images/featurebox_32.png' iconSmall='images/featurebox_16.png' primary='true' >Configure feature box</link>
|
|
||||||
</adminLinks>
|
|
||||||
<mainPrefs>
|
<mainPrefs>
|
||||||
<pref name="fb_active">1</pref>
|
<pref name="fb_active">1</pref>
|
||||||
</mainPrefs>
|
</mainPrefs>
|
||||||
|
@@ -1,37 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
global $sc_style;
|
||||||
+ ----------------------------------------------------------------------------+
|
|
||||||
| e107 website system
|
|
||||||
|
|
|
||||||
| Copyright (c) e107 Inc. 2001-2009
|
|
||||||
| http://e107.org
|
|
||||||
|
|
|
||||||
| Released under the terms and conditions of the
|
|
||||||
| GNU General Public License (http://gnu.org).
|
|
||||||
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/templates/featurebox_template.php,v $
|
|
||||||
| $Revision: 1.1 $
|
|
||||||
| $Date: 2009-11-24 14:48:34 $
|
|
||||||
| $Author: e107coders $
|
|
||||||
+----------------------------------------------------------------------------+
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
$FEATUREBOX_TEMPLATE['default'] = '
|
||||||
$FEATUREBOX_TEMPLATE['default'] = "
|
<div class="featurebox-item default">
|
||||||
<div class='defaulttext'><b>$fb_title</b></div>
|
<h3>{FEATUREBOX_TITLE|default}</h3>
|
||||||
<hr />
|
<div class="featurebox-body">{FEATUREBOX_TEXT|default}</div>
|
||||||
$fb_text
|
|
||||||
";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$FEATUREBOX_TEMPLATE['centered'] = "
|
|
||||||
<div class='defaulttext' style='text-align: center;'><b>$fb_title</b>
|
|
||||||
<hr />
|
|
||||||
$fb_text
|
|
||||||
</div>
|
</div>
|
||||||
<br /><br />
|
';
|
||||||
";
|
|
||||||
|
|
||||||
|
$sc_style['FEATUREBOX_IMAGE|image_left']['pre'] = '<div class="f-left">';
|
||||||
|
$sc_style['FEATUREBOX_IMAGE|image_left']['post'] = '</div>';
|
||||||
|
$FEATUREBOX_TEMPLATE['image_right'] = '
|
||||||
|
<div class="featurebox-item imgleft" id="featurebox-item-{FEATUREBOX_ID}">
|
||||||
|
<div class="featurebox-body">{FEATUREBOX_IMAGE|image_left}<h3>{FEATUREBOX_TITLE|image_left}</h3>{FEATUREBOX_TEXT|image_left}</div>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
|
||||||
|
$sc_style['FEATUREBOX_IMAGE|image_right']['pre'] = '<div class="f-right">';
|
||||||
|
$sc_style['FEATUREBOX_IMAGE|image_right']['post'] = '</div>';
|
||||||
|
$FEATUREBOX_TEMPLATE['image_right'] = '
|
||||||
|
<div class="featurebox-item imgright" id="featurebox-item-{FEATUREBOX_ID}">
|
||||||
|
<div class="featurebox-body">{FEATUREBOX_IMAGE|image_right}<h3>{FEATUREBOX_TITLE|image_right}</h3>{FEATUREBOX_TEXT|image_right}</div>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
|
||||||
|
$FEATUREBOX_TEMPLATE['__INFO__'] = array(
|
||||||
|
'deafult' => array('title' => 'Default - no image'),
|
||||||
|
'image_right' => array('title' => 'Image to right'),
|
||||||
|
'image_left' => array('title' => 'Image to left'),
|
||||||
|
);
|
||||||
|
|
||||||
?>
|
?>
|
@@ -1,37 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
|
||||||
+ ----------------------------------------------------------------------------+
|
|
||||||
| e107 website system
|
|
||||||
|
|
|
||||||
| Copyright (c) e107 Inc. 2001-2009
|
|
||||||
| http://e107.org
|
|
||||||
|
|
|
||||||
| Released under the terms and conditions of the
|
|
||||||
| GNU General Public License (http://gnu.org).
|
|
||||||
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/templates/layout/default_template.php,v $
|
|
||||||
| $Revision: 1.1 $
|
|
||||||
| $Date: 2009-11-26 17:15:45 $
|
|
||||||
| $Author: secretr $
|
|
||||||
+----------------------------------------------------------------------------+
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
$LAYOUT_DEFAULT_TEMPLATE['list_start'] = '
|
||||||
|
<div class="box featurebox">
|
||||||
|
<h2>{FEATUREBOX_CATEGORY_ICON}{FEATUREBOX_CATEGORY_TITLE}</h2>
|
||||||
|
<div class="body">
|
||||||
|
';
|
||||||
|
|
||||||
$FEATUREBOX_TEMPLATE['default'] = "
|
$LAYOUT_DEFAULT_TEMPLATE['list_end'] = '
|
||||||
<div class='defaulttext'><b>$fb_title</b></div>
|
</div>
|
||||||
<hr />
|
|
||||||
$fb_text
|
|
||||||
";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$FEATUREBOX_TEMPLATE['centered'] = "
|
|
||||||
<div class='defaulttext' style='text-align: center;'><b>$fb_title</b>
|
|
||||||
<hr />
|
|
||||||
$fb_text
|
|
||||||
</div>
|
</div>
|
||||||
<br /><br />
|
';
|
||||||
";
|
|
||||||
|
$LAYOUT_DEFAULT_TEMPLATE['item_start'] = '';
|
||||||
|
|
||||||
|
$LAYOUT_DEFAULT_TEMPLATE['item_end'] = '';
|
||||||
|
|
||||||
|
$LAYOUT_DEFAULT_TEMPLATE['item_separator'] = '';
|
||||||
?>
|
?>
|
@@ -9,9 +9,9 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_themes/jayya/theme.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_themes/jayya/theme.php,v $
|
||||||
* $Revision: 1.11 $
|
* $Revision: 1.12 $
|
||||||
* $Date: 2009-11-18 01:06:02 $
|
* $Date: 2009-12-08 17:21:35 $
|
||||||
* $Author: e107coders $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Protect the file from direct access
|
// Protect the file from direct access
|
||||||
@@ -73,6 +73,7 @@ $HEADER['3_column'] = "<table class='page_container'>
|
|||||||
</td>
|
</td>
|
||||||
<td class='default_menu'>
|
<td class='default_menu'>
|
||||||
{SETSTYLE=default}
|
{SETSTYLE=default}
|
||||||
|
{FEATUREBOX|default}
|
||||||
{WMESSAGE}
|
{WMESSAGE}
|
||||||
";
|
";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user