FundacionLQDVI_WebCongresos/www/components/com_sql2excel/models/rtparms.php

65 lines
1.6 KiB
PHP

<?php
/*
* @component SQL 2 Excel Component
* @copyright Copyright (C) Joomla-R-Us, joomla-r-us.com
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3
*/
// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.model' );
require_once( JPATH_COMPONENT.DS.'helpers'.DS.'common.php' );
class Sql2excelModelRtparms extends JModel
{
function __construct()
{
parent::__construct();
global $mainframe, $option;
}
function getWorksheets($wb_id)
{
return Sql2excelCommon::getWorksheets($wb_id);
}
function getWorksheetParms($wb_id)
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$aid = $user->get('aid', 0);
$wheres[] = " a.id = " . (int) $wb_id;
$wheres[] = " a.id = b.wb_id ";
$wheres[] = " b.ws_id = c.id ";
$wheres[] = " c.published=1 ";
$wheres[] = " a.section=d.id ";
$wheres[] = " a.category=e.id ";
$wheres[] = " e.published=1 ";
if ($aid !== null) {
$wheres[] = "a.access <= " . (int) $aid;
$wheres[] = "c.access <= " . (int) $aid;
$wheres[] = "d.access <= " . (int) $aid;
$wheres[] = "e.access <= " . (int) $aid;
}
$query = " SELECT c.id, c.sheetname, a.link_title as wbtitle, c.nr_parms, c.parms " .
" FROM #__sql2excel_workbooks a, #__sql2excel_worksheet2book b, #__sql2excel_worksheets c, #__sql2excel_sections d, #__sql2excel_categories e " .
" WHERE " . implode( " AND ", $wheres ) .
" ORDER BY b.ordering";
$db->setQuery( $query );
$worksheets = $db->loadObjectList();
return $worksheets;
}
}