forked from JoomShaper/SP-Weather
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod_sp_weather.php
executable file
·39 lines (35 loc) · 1.64 KB
/
mod_sp_weather.php
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
<?php
/*------------------------------------------------------------------------
# mod_sp_weather - Weather Module by JoomShaper.com
# ------------------------------------------------------------------------
# Author JoomShaper http://www.joomshaper.com
# Copyright (C) 2010 - 2014 JoomShaper.com. All Rights Reserved.
# License - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.joomshaper.com
-------------------------------------------------------------------------*/
// http://developer.yahoo.com/weather/
// no direct access
defined('_JEXEC') or die('Restricted access');
$layout = $params->get('layout', 'default');
$moduleName = basename(dirname(__FILE__));
$moduleID = $module->id;
$document = JFactory::getDocument();
//Include helper.php
require_once (dirname(__FILE__).'/helper.php');
$helper = new modSPWeatherHelper($params,$moduleID);
$data = $helper->getData();
$data['forecast'] = $helper->getForecastData();
if( is_array( $helper->error() ) )
{
JFactory::getApplication()->enqueueMessage( implode('<br /><br />', $helper->error()) , 'error');
} else {
if ( ($layout == '_:default') )
{
$document->addStylesheet(JURI::base(true) . '/modules/'.$moduleName.'/assets/css/' . $moduleName . '.css');
}
else
{
$document->addStylesheet(JURI::base(true) . '/modules/'.$moduleName.'/assets/css/flat.css');
}
require(JModuleHelper::getLayoutPath($moduleName, $layout));
}