install 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. global $myUser;
  3. require_once(dirname(__FILE__).'/Dashboard.class.php');
  4. require_once(dirname(__FILE__).'/Widget.class.php');
  5. $dashboard = Dashboard::initForUser($myUser->getId());
  6. Section::add('dashboard');
  7. if(Plugin::exist('wireRelay')){
  8. require_once(dirname(__FILE__).'/../wireRelay/WireRelay.class.php');
  9. $table = new WireRelay();
  10. $table->create();
  11. $table->name = 'Lumiere salon';
  12. $table->description = 'Lumière du salon nord ouest';
  13. $table->pin = 0;
  14. $table->room = 1;
  15. $table->pulse = 0;
  16. $table->oncommand = 'Allume le salon';
  17. $table->offcommand = 'Eteinds le salon';
  18. $table->icon = 'fa fa-lightbulb-o';
  19. $table->save();
  20. $wr1 = $table->id;
  21. $table = new WireRelay();
  22. $table->name = 'Prise TV';
  23. $table->description = 'Prise murale TV';
  24. $table->pin = 2;
  25. $table->room = 1;
  26. $table->pulse = 50;
  27. $table->oncommand = 'Allume la télé';
  28. $table->offcommand = 'Eteinds la télé';
  29. $table->icon = 'fa fa-power-off';
  30. $table->save();
  31. $wr2 = $table->id;
  32. $table = new WireRelay();
  33. $table->name = 'Stores salon';
  34. $table->description = 'Stores baie vitrée ouest';
  35. $table->pin = 1;
  36. $table->room = 1;
  37. $table->pulse = 120;
  38. $table->oncommand = 'Ouvre les stores';
  39. $table->offcommand = 'Ferme les stores';
  40. $table->icon = 'fa fa-gears';
  41. $table->save();
  42. $wr3 = $table->id;
  43. $table->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_wirerelay\', \'{&quot;relay&quot;:&quot;'.$wr1.'&quot;}\', \'0\', \'2\', \'\',\''.$dashboard.'\');');
  44. $table->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_wirerelay\', \'{&quot;relay&quot;:&quot;'.$wr2.'&quot;}\', \'1\', \'2\', \'\',\''.$dashboard.'\');');
  45. $table->customQuery('INSERT INTO "yana_plugin_dashboard" ("model", "data", "cell", "column", "minified","dashboard") VALUES (\'dash_wirerelay\', \'{&quot;relay&quot;:&quot;'.$wr3.'&quot;}\', \'2\', \'2\', \'\',\''.$dashboard.'\');');
  46. }
  47. ?>