Your IP : 216.73.216.201


Current Path : /home/sunflowe/www/modules/mod_sp_weather/
Upload File :
Current File : /home/sunflowe/www/modules/mod_sp_weather/mod_sp_weather.php

<?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 (!$data['query']['count']) {
        echo '<p class="alert alert-warning">Cannot get ' . $params->get('location') . ' location id in module ' . $moduleName . '. Please also make sure that you have inserted city name.</p>';
        return false;
    }

    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));
    }