| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/eadsa/modules/mod_dwcontextlinks/ |
Upload File : |
<?php
/**
* A module to display links related to certain content items.
*
* LICENSE: This source file is released under GNU/GPL license
* http://www.gnu.org/copyleft/gpl.html
*
* @category Related Items
* @package dwcontextlinks
* @subpackage mod_dwcontextlinks
* @author Ilya Vikharev info@docwriter.ru
* @copyright 2007 DocWriter.Ru
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @version 2.00.0006
* @link http://www.docwriter.ru/components/dwcontextlinks/
*/
/*
* Place includes, constant defines and $_GLOBAL settings here.
* Make sure they have appropriate docblocks to avoid phpDocumentor
* construing they are documented by the page-level docblock.
*/
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or
die( 'Direct Access to this location is not allowed.' );
define('_MODULE_NAME', 'dwcontextlinks');
global $Itemid;
// COLLECT DATA
// Retreive parameters
$group = $params->get('group', '');
// Define query
$query = '
SELECT *
FROM `#__dw_context_links`
WHERE `group` = \'' . $group . '\'
AND `published` = \'1\'
ORDER BY `order`;'
;
// Prepare the query in the database connector
$database->setQuery($query);
// Retrieve the rows as objects
$rows = $database->loadObjectList();
foreach ($rows as $row) {
$last_context = $row->context;
$last_url = $row->url;
if (in_array($Itemid, explode(',', $row->context))) {
$context_rows[] = $row;
}
}
// DISPLAY DATA
if (count($rows) > -1) {
// Create the template
$tmpl =& patFactory::createTemplate('', false, false);
// Set the path to look for html files
$tmpl->setRoot(dirname(__FILE__) . '/mod_' . constant('_MODULE_NAME'));
// Load the template
$tmpl->readTemplatesFromInput('default.html');
// Add variables
$tmpl->addVar('header', 'links_count', count($context_rows));
$tmpl->addVar('header', 'group', $group);
$tmpl->addVar('header', 'last_context', $last_context);
$tmpl->addVar('header', 'last_url', $last_url);
// Output the template
$tmpl->displayParsedTemplate('header');
// Output rows if present
if (count($context_rows) > 0) {
// Add the 'rows' to the rows template with a prefix
$tmpl->addObject('rows', $context_rows, 'row_');
$tmpl->displayParsedTemplate('list');
}
}
?>