Version 1.1.0 released
git-svn-id: svn://p-o.co.uk/p-o.co.uk/com_ajaxdemo@60 60e5ea7b-c093-dd11-ac13-000423648166
25
site/ajaxdemo.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Ajax demonstration component
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @copyright 2010-2012 Persistent Objects Ltd
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
|
||||
// No direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import joomla controller library
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
// Get an instance of the controller prefixed by Kjandrews
|
||||
$controller = JController::getInstance('Ajaxdemo');
|
||||
$controller->execute(JRequest::getCmd('task'));
|
||||
$controller->redirect();
|
||||
33
site/controller.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Ajax demonstration component
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @copyright 2010-2012 Persistent Objects Ltd
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
|
||||
// No direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
/**
|
||||
* Ajax demonstration component
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
class AjaxdemoController extends JController
|
||||
{
|
||||
}
|
||||
32
site/controllers/colour.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Ajax demonstration component
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @copyright 2010-2012 Persistent Objects Ltd
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
/**
|
||||
* Controller for Ajax demonstration
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
class AjaxdemoControllerColour extends JController
|
||||
{
|
||||
}
|
||||
32
site/controllers/colours.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Ajax demonstration component
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @copyright 2010-2012 Persistent Objects Ltd
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
/**
|
||||
* Controller for Ajax demonstration
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
class AjaxdemoControllerColours extends JController
|
||||
{
|
||||
}
|
||||
1
site/controllers/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#fff"></body></html>
|
||||
BIN
site/images/blue1.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
site/images/blue1_t.png
Normal file
|
After Width: | Height: | Size: 298 B |
BIN
site/images/blue2.png
Normal file
|
After Width: | Height: | Size: 922 B |
BIN
site/images/blue2_t.png
Normal file
|
After Width: | Height: | Size: 295 B |
BIN
site/images/blue3.png
Normal file
|
After Width: | Height: | Size: 908 B |
BIN
site/images/blue3_t.png
Normal file
|
After Width: | Height: | Size: 280 B |
BIN
site/images/green1.png
Normal file
|
After Width: | Height: | Size: 922 B |
BIN
site/images/green1_t.png
Normal file
|
After Width: | Height: | Size: 295 B |
BIN
site/images/green2.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
site/images/green2_t.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
site/images/green3.png
Normal file
|
After Width: | Height: | Size: 908 B |
BIN
site/images/green3_t.png
Normal file
|
After Width: | Height: | Size: 280 B |
1
site/images/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#fff"></body></html>
|
||||
BIN
site/images/orange1.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
site/images/orange1_t.png
Normal file
|
After Width: | Height: | Size: 295 B |
BIN
site/images/orange2.png
Normal file
|
After Width: | Height: | Size: 923 B |
BIN
site/images/orange2_t.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
site/images/orange3.png
Normal file
|
After Width: | Height: | Size: 907 B |
BIN
site/images/orange3_t.png
Normal file
|
After Width: | Height: | Size: 280 B |
BIN
site/images/red1.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
site/images/red1_t.png
Normal file
|
After Width: | Height: | Size: 298 B |
BIN
site/images/red2.png
Normal file
|
After Width: | Height: | Size: 922 B |
BIN
site/images/red2_t.png
Normal file
|
After Width: | Height: | Size: 294 B |
BIN
site/images/red3.png
Normal file
|
After Width: | Height: | Size: 1023 B |
BIN
site/images/red3_t.png
Normal file
|
After Width: | Height: | Size: 300 B |
BIN
site/images/yellow1.png
Normal file
|
After Width: | Height: | Size: 922 B |
BIN
site/images/yellow1_t.png
Normal file
|
After Width: | Height: | Size: 298 B |
BIN
site/images/yellow2.png
Normal file
|
After Width: | Height: | Size: 923 B |
BIN
site/images/yellow2_t.png
Normal file
|
After Width: | Height: | Size: 296 B |
BIN
site/images/yellow3.png
Normal file
|
After Width: | Height: | Size: 906 B |
BIN
site/images/yellow3_t.png
Normal file
|
After Width: | Height: | Size: 279 B |
1
site/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#fff"></body></html>
|
||||
174
site/models/colour.php
Normal file
@ -0,0 +1,174 @@
|
||||
<?php
|
||||
/**
|
||||
* Ajax demonstration component
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @copyright 2010-2012 Persistent Objects Ltd
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
jimport('joomla.application.component.model');
|
||||
|
||||
/**
|
||||
* Model for Ajax demonstration
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
class AjaxdemoModelColour extends JModel
|
||||
{
|
||||
|
||||
/**
|
||||
* Retrieves the colour data
|
||||
*
|
||||
* @return stdClass containing the data from the database
|
||||
*/
|
||||
function getItem()
|
||||
{
|
||||
JLog::add(__METHOD__ . '()', JLog::ERROR, COM_AJAXDEMO);
|
||||
// Lets load the data if it doesn't already exist
|
||||
if (empty( $this->_data )) {
|
||||
$row =& $this->getTable();
|
||||
$row->load(JRequest::getVar('id', 0, '', 'int'));
|
||||
$this->_data =& $row;
|
||||
}
|
||||
if (!$this->_data) {
|
||||
$this->_data = new stdClass();
|
||||
$this->_data->id = 0;
|
||||
$this->_data->ordering = 0;
|
||||
$this->_data->published = 1;
|
||||
$this->_data->date = '';
|
||||
$this->_data->title = '';
|
||||
$this->_data->alias = '';
|
||||
$this->_data->url = '';
|
||||
$this->_data->material = '';
|
||||
$this->_data->size = '';
|
||||
$this->_data->notes = '';
|
||||
}
|
||||
|
||||
return $this->_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the available colours in this series
|
||||
*
|
||||
* @return mixed The return value or null if the query failed.
|
||||
*/
|
||||
public function getColours()
|
||||
{
|
||||
// Get the current ordering
|
||||
if (!$this->_data) {
|
||||
$this->getItem();
|
||||
}
|
||||
if (!$this->_data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('id, ordering, title, thumbnail_image');
|
||||
$query->from('#__ajaxdemo_colour');
|
||||
$query->where('published = 1');
|
||||
$query->where('colour_id = ' . $this->_data->colour_id);
|
||||
$query->order('ordering asc');
|
||||
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadObjectList();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the previous colour data
|
||||
*
|
||||
* @return stdClass containing the data from the database
|
||||
*/
|
||||
public function getPrevColour()
|
||||
{
|
||||
// Get the current ordering
|
||||
if (!$this->_data) {
|
||||
$this->getItem();
|
||||
}
|
||||
if (!$this->_data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('s.id, c.id as colour_id, s.ordering, s.published');
|
||||
$query->select('s.featured, s.title, s.alias, c.thumbnail_image, s.notes');
|
||||
$query->from('#__ajaxdemo_colours s');
|
||||
$query->innerjoin('#__ajaxdemo_colour c ON s.id = c.colour_id ');
|
||||
$query->where('s.published = 1');
|
||||
$query->where('c.published = 1 AND c.dflt = 1');
|
||||
$query->where(
|
||||
's.ordering < ('
|
||||
. 'SELECT a.ordering '
|
||||
. 'FROM #__ajaxdemo_colours a '
|
||||
. 'INNER JOIN #__ajaxdemo_colour b '
|
||||
. 'ON a.id = b.colour_id '
|
||||
. 'WHERE b.id = '. $this->_data->id
|
||||
. ')'
|
||||
);
|
||||
$query->order('s.ordering desc');
|
||||
$query->limit(1);
|
||||
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadObject();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the next colour data
|
||||
*
|
||||
* @return stdClass containing the data from the database
|
||||
*/
|
||||
public function getNextColour()
|
||||
{
|
||||
// Get the current ordering
|
||||
if (!$this->_data) {
|
||||
$this->getItem();
|
||||
}
|
||||
if (!$this->_data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('s.id, c.id as colour_id, s.ordering, s.published');
|
||||
$query->select('s.featured, s.title, s.alias, c.thumbnail_image, s.notes');
|
||||
$query->from('#__ajaxdemo_colours s');
|
||||
$query->innerjoin('#__ajaxdemo_colour c ON s.id = c.colour_id ');
|
||||
$query->where('s.published = 1');
|
||||
$query->where('c.published = 1 AND c.dflt = 1');
|
||||
$query->where(
|
||||
's.ordering > ('
|
||||
. 'SELECT a.ordering '
|
||||
. 'FROM #__ajaxdemo_colours a '
|
||||
. 'INNER JOIN #__ajaxdemo_colour b '
|
||||
. 'ON a.id = b.colour_id '
|
||||
. 'WHERE b.id = '. $this->_data->id
|
||||
. ')'
|
||||
);
|
||||
$query->order('s.ordering asc');
|
||||
$query->limit(1);
|
||||
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadObject();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
52
site/models/colours.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Ajax demonstration component
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @copyright 2010-2012 Persistent Objects Ltd
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die();
|
||||
|
||||
jimport('joomla.application.component.modellist');
|
||||
|
||||
/**
|
||||
* Model for Ajax demonstration
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
class AjaxdemoModelColours extends JModelList
|
||||
{
|
||||
/**
|
||||
* Returns list query
|
||||
*
|
||||
* @return string sql list query
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('s.id, c.id as colour_id, s.ordering, s.published');
|
||||
$query->select('s.featured, s.title, s.alias, c.thumbnail_image, s.notes');
|
||||
$query->from('#__ajaxdemo_colours s');
|
||||
$query->innerjoin('#__ajaxdemo_colour c ON s.id = c.colour_id ');
|
||||
$query->where('s.published = 1 AND s.featured = 1');
|
||||
$query->where('c.published = 1 AND c.dflt = 1');
|
||||
$query->order('s.ordering asc');
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
}
|
||||
1
site/models/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#fff"></body></html>
|
||||
1
site/views/colour/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#fff"></body></html>
|
||||
81
site/views/colour/tmpl/default.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* Ajax demonstration component
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @subpackage View
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @copyright 2010-2012 Persistent Objects Ltd
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<div style="position:relative;">
|
||||
<div style='width:350px; float:right;'>
|
||||
<h3><i><?php echo $this->item->title ?></i></h3>
|
||||
<div><?php echo $this->item->notes;?></div>
|
||||
</div>
|
||||
|
||||
<?php if (count($this->colours) > 1) { ?>
|
||||
<div style='width:350px; position:absolute;bottom:0;left:450px;'>
|
||||
<p> </p>
|
||||
<p>More of this colour</p>
|
||||
<p><?php
|
||||
foreach ($this->colours as $item) {
|
||||
$link = JRoute::_(
|
||||
'index.php?option=com_ajaxdemo&view=colour&id='.$item->id, false
|
||||
);
|
||||
$image = 'components/com_ajaxdemo/images/' . $item->thumbnail_image;?>
|
||||
<a href='<?php echo $link ?>'>
|
||||
<img src='<?php echo $image;?>'
|
||||
alt='<?php echo $item->title ?>' /></a><?php
|
||||
} ?>
|
||||
</p>
|
||||
</div><?php
|
||||
}?>
|
||||
|
||||
<div><img src='<?php
|
||||
echo 'components/com_ajaxdemo/images/'
|
||||
. $this->item->main_image;
|
||||
?>' alt='<?php
|
||||
echo htmlspecialchars($this->title)
|
||||
?>' /></div>
|
||||
<div style='width:100%'>
|
||||
<hr/>
|
||||
<?php if ( $this->next_colour ) {
|
||||
$link = JRoute::_(
|
||||
'index.php?option=com_ajaxdemo&view=colour&id='
|
||||
. $this->next_colour->colour_id,
|
||||
false
|
||||
);?>
|
||||
<p style='float: right;'><a href='<?php echo $link ?>'>
|
||||
Next: <?php echo $this->next_colour->title ?><br/>
|
||||
<img
|
||||
src='<?php echo 'components/com_ajaxdemo/images/'
|
||||
. $this->next_colour->thumbnail_image;?>'
|
||||
alt='<?php echo $this->next_colour->title ?>' />
|
||||
</a></p><?php
|
||||
} ?>
|
||||
<?php if ( $this->prev_colour ) {
|
||||
$link = JRoute::_(
|
||||
'index.php?option=com_ajaxdemo&view=colour&id='
|
||||
. $this->prev_colour->colour_id,
|
||||
false
|
||||
);?>
|
||||
<p style='float: left;'><a href='<?php echo $link ?>'>
|
||||
Previous: <?php echo $this->prev_colour->title ?><br/>
|
||||
<img
|
||||
src='<?php echo '/components/com_ajaxdemo/images/'
|
||||
. $this->prev_colour->thumbnail_image;?>'
|
||||
alt='<?php echo $this->prev_colour->title ?>' />
|
||||
</a></p><?php
|
||||
} ?>
|
||||
</div>
|
||||
</div>
|
||||
16
site/views/colour/tmpl/default.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="Individual Colour">
|
||||
<message>
|
||||
<![CDATA[Individual Colour layout.]]>
|
||||
</message>
|
||||
</layout>
|
||||
<state>
|
||||
<params>
|
||||
<param type="sql" name="Colour" default="10" label="Select a colour" query="SELECT id AS value, name FROM #__ajaxdemo_colours ORDER BY ordering" />
|
||||
</params>
|
||||
<advanced>
|
||||
<param />
|
||||
</advanced>
|
||||
</state>
|
||||
</metadata>
|
||||
1
site/views/colour/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#fff"></body></html>
|
||||
95
site/views/colour/tmpl/lightbox.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* Ajax demonstration component
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @subpackage View
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @copyright 2010-2012 Persistent Objects Ltd
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
$rel_handler="{handler: 'ajax',"
|
||||
." size: {x: 800, y: 450},"
|
||||
." onClose: function() {},"
|
||||
." onAjax: function() {"
|
||||
."SqueezeBox.assign($$('a.lightbox2'),"
|
||||
." {parse: 'rel'});"
|
||||
."},"
|
||||
." ajaxOptions: {method: 'post'}}";
|
||||
?>
|
||||
<div id='lightbox-content' style="position:relative;">
|
||||
<div id='lb-maingroup' style='width:350px; position:absolute; left:420px'>
|
||||
<h3><i><?php echo $this->item->title ?></i></h3>
|
||||
<div><?php echo $this->item->notes;?></div>
|
||||
</div>
|
||||
|
||||
<?php if (count($this->colours) > 1) { ?>
|
||||
<div id='lb-more' style='width:350px; position:absolute;bottom:0;left:420px;'>
|
||||
<p> </p>
|
||||
<p>More of this colour</p>
|
||||
<p><?php
|
||||
foreach ($this->colours as $item) {
|
||||
$link = JRoute::_(
|
||||
'index.php?option=com_ajaxdemo&view=colour&id='.$item->id, false
|
||||
);
|
||||
$image = 'components/com_ajaxdemo/images/' . $item->thumbnail_image;?>
|
||||
<a href='<?php echo $link ?>'
|
||||
class="lightbox2"
|
||||
rel="<?php echo $rel_handler; ?>"
|
||||
><img src='<?php echo $image;?>'
|
||||
alt='<?php echo $item->title ?>' /></a><?php
|
||||
} ?>
|
||||
</p>
|
||||
</div><?php
|
||||
}?>
|
||||
|
||||
<div id='lb-image'><img src='<?php
|
||||
echo 'components/com_ajaxdemo/images/'
|
||||
. $this->item->main_image;
|
||||
?>' alt='<?php
|
||||
echo htmlspecialchars($this->title)
|
||||
?>' /></div>
|
||||
<div style='width:98%'>
|
||||
<hr/>
|
||||
<?php if ( $this->next_colour ) {
|
||||
$link = JRoute::_(
|
||||
'index.php?option=com_ajaxdemo&view=colour&id='
|
||||
. $this->next_colour->colour_id,
|
||||
false
|
||||
);?>
|
||||
<p style='float: right;'>
|
||||
<a href='<?php echo $link ?>'
|
||||
class="lightbox2"
|
||||
rel="<?php echo $rel_handler; ?>">
|
||||
Next: <?php echo $this->next_colour->title ?><br/>
|
||||
<img
|
||||
src='<?php echo 'components/com_ajaxdemo/images/'
|
||||
. $this->next_colour->thumbnail_image;?>'
|
||||
alt='<?php echo $this->next_colour->title ?>'
|
||||
/></a></p><?php
|
||||
} ?>
|
||||
<?php if ( $this->prev_colour ) {
|
||||
$link = JRoute::_(
|
||||
'index.php?option=com_ajaxdemo&view=colour&id='
|
||||
. $this->prev_colour->colour_id,
|
||||
false
|
||||
);?>
|
||||
<p style='float: left;'><a href='<?php echo $link ?>'
|
||||
class="lightbox2"
|
||||
rel="<?php echo $rel_handler; ?>">
|
||||
Previous: <?php echo $this->prev_colour->title ?><br/>
|
||||
<img
|
||||
src='<?php echo 'components/com_ajaxdemo/images/'
|
||||
. $this->prev_colour->thumbnail_image;?>'
|
||||
alt='<?php echo $this->prev_colour->title ?>' />
|
||||
</a></p><?php
|
||||
} ?>
|
||||
</div>
|
||||
</div>
|
||||
68
site/views/colour/view.html.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Ajax demonstration component
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @subpackage View
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @copyright 2010-2012 Persistent Objects Ltd
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* HTML View class for the Ajax demonstration component
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @subpackage Components
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
class AjaxdemoViewColour extends JView
|
||||
{
|
||||
protected $item;
|
||||
protected $colours;
|
||||
|
||||
/**
|
||||
* Display method for Colours
|
||||
*
|
||||
* @param string $tpl Template to display
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function display($tpl = null)
|
||||
{
|
||||
// Get data from the model
|
||||
$this->item = $this->get('Item');
|
||||
$this->prev_colour = $this->get('PrevColour');
|
||||
$this->next_colour = $this->get('NextColour');
|
||||
$this->colours = $this->get('Colours');
|
||||
|
||||
if (JRequest::getMethod() == 'POST') {
|
||||
JRequest::setVar('tmpl', 'component');
|
||||
$this->setLayout('lightbox');
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors'))) {
|
||||
JError::raiseError(500, implode('<br />', $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
parent::display($tpl);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1
site/views/colours/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#fff"></body></html>
|
||||
55
site/views/colours/tmpl/default.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Ajax demonstration component
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @subpackage View
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @copyright 2010-2012 Persistent Objects Ltd
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHtml::_('behavior.modal', 'a.lightbox');
|
||||
JHtml::_('behavior.tooltip');
|
||||
|
||||
?>
|
||||
<table>
|
||||
<?php
|
||||
$k = 0;
|
||||
$column = 0;
|
||||
foreach ($this->items as $item) {
|
||||
$link = JRoute::_(
|
||||
'index.php?option=com_ajaxdemo&view=colour&id='.$item->colour_id, false
|
||||
);
|
||||
$handler = "{"
|
||||
. "handler: 'ajax', size: {x: 800, y: 450}, "
|
||||
. "onClose: function() {}, "
|
||||
. "onAjax: function() { "
|
||||
. "SqueezeBox.assign($$('a.lightbox2'), {parse: 'rel'});"
|
||||
. "}, "
|
||||
. "ajaxOptions: {method: 'post'}"
|
||||
. "}";
|
||||
$tooltip = ' title="'.htmlspecialchars(trim($item->title))
|
||||
. '::'
|
||||
. htmlspecialchars(trim($item->notes))
|
||||
. '"';
|
||||
$imagesrc = 'components/com_ajaxdemo/images/' . $item->thumbnail_image;?>
|
||||
<tr>
|
||||
<td><a id='colours-<?php echo $item->id ?>'
|
||||
class="lightbox hasTip"
|
||||
href='<?php echo $link ?>'
|
||||
<?php echo $tooltip ?>
|
||||
rel="<?php echo $handler ?>">
|
||||
<img src='<?php echo $imagesrc; ?>' alt='<?php echo $item->title; ?>' />
|
||||
</a></td>
|
||||
</tr><?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
18
site/views/colours/tmpl/default.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<metadata>
|
||||
<layout title="Colour List Layout">
|
||||
<message>
|
||||
<![CDATA[Colour listing layout, add this to a menu to see a list of colours.]]>
|
||||
</message>
|
||||
</layout>
|
||||
<state>
|
||||
<name>Colour List Layout</name>
|
||||
<description>Colour listing layout</description>
|
||||
<params>
|
||||
<param type="sql" name="Colour" default="10" label="Select a colour" query="SELECT id AS value, name FROM #__ajaxdemo_colours ORDER BY ordering" />
|
||||
</params>
|
||||
<advanced>
|
||||
<param />
|
||||
</advanced>
|
||||
</state>
|
||||
</metadata>
|
||||
1
site/views/colours/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#fff"></body></html>
|
||||
48
site/views/colours/view.html.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Ajax demonstration component
|
||||
*
|
||||
* PHP version 5.3
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @subpackage View
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @copyright 2010-2012 Persistent Objects Ltd
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* HTML View class for the Ajax demonstration component
|
||||
*
|
||||
* @category Joomla_Component
|
||||
* @package Com_Ajaxdemo
|
||||
* @author Alan Hicks <ahicks@p-o.co.uk>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*
|
||||
* @link http://p-o.co.uk/
|
||||
*/
|
||||
class AjaxdemoViewColours extends JView
|
||||
{
|
||||
protected $items;
|
||||
|
||||
/**
|
||||
* Display method for Colours
|
||||
*
|
||||
* @param string $tpl Template to display
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function display($tpl = null)
|
||||
{
|
||||
$this->items = & $this->get('Items');
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
1
site/views/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#fff"></body></html>
|
||||