1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- global $myUser;
- require_once(dirname(__FILE__).'/Dashboard.class.php');
- require_once(dirname(__FILE__).'/Widget.class.php');
- $dashboard = Dashboard::initForUser($myUser->getId());
- Section::add('dashboard');
- if(Plugin::exist('wireRelay')){
- require_once(dirname(__FILE__).'/../wireRelay/WireRelay.class.php');
- $table = new WireRelay();
- $table->create();
- $table->name = 'Lumiere salon';
- $table->description = 'Lumière du salon nord ouest';
- $table->pin = 0;
- $table->room = 1;
- $table->pulse = 0;
- $table->oncommand = 'Allume le salon';
- $table->offcommand = 'Eteinds le salon';
- $table->icon = 'fa fa-lightbulb-o';
- $table->save();
- $wr1 = $table->id;
- $table = new WireRelay();
- $table->name = 'Prise TV';
- $table->description = 'Prise murale TV';
- $table->pin = 2;
- $table->room = 1;
- $table->pulse = 50;
- $table->oncommand = 'Allume la télé';
- $table->offcommand = 'Eteinds la télé';
- $table->icon = 'fa fa-power-off';
- $table->save();
- $wr2 = $table->id;
- $table = new WireRelay();
- $table->name = 'Stores salon';
- $table->description = 'Stores baie vitrée ouest';
- $table->pin = 1;
- $table->room = 1;
- $table->pulse = 120;
- $table->oncommand = 'Ouvre les stores';
- $table->offcommand = 'Ferme les stores';
- $table->icon = 'fa fa-gears';
- $table->save();
- $wr3 = $table->id;
- $table->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_wirerelay\', \'{"relay":"'.$wr1.'"}\', \'0\', \'2\', \'\',\''.$dashboard.'\');');
- $table->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_wirerelay\', \'{"relay":"'.$wr2.'"}\', \'1\', \'2\', \'\',\''.$dashboard.'\');');
- $table->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_wirerelay\', \'{"relay":"'.$wr3.'"}\', \'2\', \'2\', \'\',\''.$dashboard.'\');');
- }
- ?>
|