Files
@ f43d1a4680a9
Branch filter:
Location: hot67beta/administrator/components/com_modules/models/module.php - annotation
f43d1a4680a9
4.1 KiB
text/x-php
menubar 0 to 10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 | <?php
/**
* @version $Id: module.php 10381 2008-06-01 03:35:53Z pasamio $
* @package Joomla
* @subpackage Modules
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.model' );
/**
* @package Joomla
* @subpackage Modules
*/
class ModulesModelModule extends JModel
{
var $_xml;
function &getModule()
{
static $instance;
if (!$instance)
{
$instance = $this->getTable( 'Module', 'JTable' );
if ($id = $this->getState( 'id' )) {
$instance->load( (int) $id );
}
}
return $instance;
}
function &_getXML()
{
if (!$this->_xml)
{
$clientId = $this->getState( 'clientId', 0 );
$path = ($clientId == 1) ? 'mod1_xml' : 'mod0_xml';
$module = &$this->getModule();
if ($module->module == 'custom') {
$xmlpath = JApplicationHelper::getPath( $path, 'mod_custom' );
} else {
$xmlpath = JApplicationHelper::getPath( $path, $module->module );
}
if (file_exists($xmlpath))
{
$xml =& JFactory::getXMLParser('Simple');
if ($xml->loadFile($xmlpath)) {
$this->_xml = &$xml;
}
}
}
return $this->_xml;
}
function &getParams()
{
// Get the state parameters
$module =& $this->getModule();
$params = new JParameter($module->params);
if ($xml =& $this->_getXML())
{
if ($ps = & $xml->document->params) {
foreach ($ps as $p)
{
$params->setXML( $p );
}
}
}
return $params;
}
function getPositions()
{
jimport('joomla.filesystem.folder');
$client =& JApplicationHelper::getClientInfo($this->getState('clientId'));
if ($client === false) {
return false;
}
//Get the database object
$db =& JFactory::getDBO();
// template assignment filter
$query = 'SELECT DISTINCT(template) AS text, template AS value'.
' FROM #__templates_menu' .
' WHERE client_id = '.(int) $client->id;
$db->setQuery( $query );
$templates = $db->loadObjectList();
// Get a list of all module positions as set in the database
$query = 'SELECT DISTINCT(position)'.
' FROM #__modules' .
' WHERE client_id = '.(int) $client->id;
$db->setQuery( $query );
$positions = $db->loadResultArray();
$positions = (is_array($positions)) ? $positions : array();
// Get a list of all template xml files for a given application
// Get the xml parser first
for ($i = 0, $n = count($templates); $i < $n; $i++ )
{
$path = $client->path.DS.'templates'.DS.$templates[$i]->value;
$xml =& JFactory::getXMLParser('Simple');
if ($xml->loadFile($path.DS.'templateDetails.xml'))
{
$p =& $xml->document->getElementByPath('positions');
if (is_a($p, 'JSimpleXMLElement') && count($p->children()))
{
foreach ($p->children() as $child)
{
if (!in_array($child->data(), $positions)) {
$positions[] = $child->data();
}
}
}
}
}
if(defined('_JLEGACY') && _JLEGACY == '1.0')
{
$positions[] = 'left';
$positions[] = 'right';
$positions[] = 'top';
$positions[] = 'bottom';
$positions[] = 'inset';
$positions[] = 'banner';
$positions[] = 'header';
$positions[] = 'footer';
$positions[] = 'newsflash';
$positions[] = 'legals';
$positions[] = 'pathway';
$positions[] = 'breadcrumb';
$positions[] = 'user1';
$positions[] = 'user2';
$positions[] = 'user3';
$positions[] = 'user4';
$positions[] = 'user5';
$positions[] = 'user6';
$positions[] = 'user7';
$positions[] = 'user8';
$positions[] = 'user9';
$positions[] = 'advert1';
$positions[] = 'advert2';
$positions[] = 'advert3';
$positions[] = 'debug';
$positions[] = 'syndicate';
}
$positions = array_unique($positions);
sort($positions);
return $positions;
}
}
|