Creatinging initial version of weather plugin
This commit is contained in:
parent
dfd4b61b75
commit
8aeceee0eb
3
.gitignore
vendored
3
.gitignore
vendored
@ -9,3 +9,6 @@
|
||||
|
||||
# Include the custom theme
|
||||
!/www/themes/jason-williamsca/**
|
||||
|
||||
# Include custom plugins
|
||||
!/www/plugins/jasonwilliams/**
|
||||
|
28
www/plugins/jasonwilliams/calgaryconditions/Plugin.php
Normal file
28
www/plugins/jasonwilliams/calgaryconditions/Plugin.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php namespace JasonWilliams\CalgaryConditions;
|
||||
|
||||
/**
|
||||
* The plugin.php file (called the plugin initialization script) defines the plugin information class.
|
||||
*/
|
||||
|
||||
use System\Classes\PluginBase;
|
||||
|
||||
class Plugin extends PluginBase
|
||||
{
|
||||
|
||||
public function pluginDetails()
|
||||
{
|
||||
return [
|
||||
'name' => 'Calgary Conditions',
|
||||
'description' => 'Provides local time and weather information for Calgary, AB, Canada',
|
||||
'author' => 'Jason Williams',
|
||||
'icon' => 'oc-icon-cloud'
|
||||
];
|
||||
}
|
||||
|
||||
public function registerComponents()
|
||||
{
|
||||
return [
|
||||
'\JasonWilliams\CalgaryConditions\Components\CurrentInfo' => 'CurrentInfo'
|
||||
];
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<?php namespace JasonWilliams\CalgaryConditions\Components;
|
||||
|
||||
use Cms\Classes\ComponentBase;
|
||||
use ApplicationException;
|
||||
|
||||
class CurrentInfo extends ComponentBase
|
||||
{
|
||||
public $fields;
|
||||
|
||||
public function componentDetails()
|
||||
{
|
||||
return [
|
||||
'name' => 'Current Info',
|
||||
'description' => 'Displays the current weather and time in Calgary, AB, Canada'
|
||||
];
|
||||
}
|
||||
|
||||
public function onRun()
|
||||
{
|
||||
date_default_timezone_set('America/Edmonton');
|
||||
$this->fields['time'] = date('g:ia');
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{% set conditions = __SELF__.fields %}
|
||||
|
||||
<p>Right now in Calgary the time is {{ conditions.time }}</p>
|
@ -0,0 +1,6 @@
|
||||
<?php return [
|
||||
'plugin' => [
|
||||
'name' => 'Calgary Conditions',
|
||||
'description' => 'Provides local time and weather information for Calgary, AB, Canada'
|
||||
]
|
||||
];
|
6
www/plugins/jasonwilliams/calgaryconditions/plugin.yaml
Normal file
6
www/plugins/jasonwilliams/calgaryconditions/plugin.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
plugin:
|
||||
name: 'jasonwilliams.calgaryconditions::lang.plugin.name'
|
||||
description: 'jasonwilliams.calgaryconditions::lang.plugin.description'
|
||||
author: 'Jason Williams'
|
||||
icon: oc-icon-cloud
|
||||
homepage: 'https://ja.son-williams.ca/'
|
@ -0,0 +1 @@
|
||||
0.0.1: Initial version
|
Loading…
Reference in New Issue
Block a user