page.home.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. global $myUser,$conf;
  3. require_once('Dashboard.class.php');
  4. require_once('DashboardWidget.class.php');
  5. $dashboards = Dashboard::loadAll(array('user'=>$myUser->login));
  6. ?>
  7. <div class="dashboard-container" style="<?php echo count($dashboards)==1 ? 'padding-left: 0px;' : ''; ?>">
  8. <?php if($myUser->connected()): ?>
  9. <ul id="dashboardView" class="<?php echo count($dashboards)>1?'':'hidden' ?>" >
  10. <li class="dashboardView-title">DASH</li>
  11. <?php
  12. if(count($dashboards)==0){
  13. $defaultDash = Dashboard::provide();
  14. $defaultDash->user = $myUser->login;
  15. $defaultDash->label = 'Général';
  16. $defaultDash->icon = 'far fa-bookmark';
  17. $defaultDash->default = true;
  18. $defaultDash->save();
  19. $dashboards[] = $defaultDash;
  20. foreach(array('profile','clock','log') as $i=>$widget){
  21. $item = new DashboardWidget();
  22. $item->model = $widget;
  23. $item->position = $i;
  24. $item->dashboard = $defaultDash->id;
  25. $item->save();
  26. }
  27. }
  28. foreach($dashboards as $dashboard): ?>
  29. <li class="dashboard-item" <?php echo $dashboard->default?'data-selected="1"':''; ?> data-id="<?php echo $dashboard->id; ?>" title="<?php echo $dashboard->label; ?>"><span><?php echo $dashboard->label; ?></span><div><i class="fa <?php echo $dashboard->icon; ?>"></i></div></li>
  30. <?php endforeach; ?>
  31. </ul>
  32. <div class="clear"></div>
  33. <ul class="dashboard-widget-menu">
  34. <li data-toggle="modal" data-target="#addWidgetModal">
  35. <div title="Ajouter un widget"><i class="fas fa-plus"></i> <span>WIDGET</span></div>
  36. </li>
  37. </ul>
  38. <div class="row" id="dashboard">
  39. <!-- MODEL WIDGET -->
  40. <div class="col-md-4 widget" data-id="" style="display:none" >
  41. <div class="widget_window">
  42. <div class="widget_header">
  43. <i class="fa fa-caret"></i> <span></span>
  44. <ul class="widget_options"></ul>
  45. </div>
  46. <div class="widget_content"></div>
  47. <div class="widget_footer"></div>
  48. </div>
  49. </div>
  50. </div>
  51. <?php else: ?>
  52. <div class="well"><h3>Bienvenue !</h3>
  53. <blockquote>
  54. <p>Merci de vous connecter pour acceder à l'ensemble des fonctionnalités.<br/> Vous pouvez vous connecter à tout moment via
  55. le formulaire de connexion en haut à droite du programme</p>
  56. <small>HackBuddy</small>
  57. </blockquote>
  58. </div>
  59. <?php endif; ?>
  60. <!-- Add wiget modal -->
  61. <div class="modal fade" id="addWidgetModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  62. <div class="modal-dialog" role="document">
  63. <div class="modal-content">
  64. <div class="modal-header">
  65. <h5 class="modal-title" id="exampleModalLabel">Ajout d'un widget</h5>
  66. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  67. <span aria-hidden="true">&times;</span>
  68. </button>
  69. </div>
  70. <div class="modal-body">
  71. <label for="widgetList">Sélectionnez le widget que vous souhaitez ajouter</label>
  72. <div class="clearFix">
  73. <?php
  74. $models = array();
  75. Plugin::callHook('widget',array(&$models));
  76. ?>
  77. <select id="widgetList" class="left" size="10">
  78. <option calue=""> - </option>
  79. <?php
  80. foreach($models as $model): ?>
  81. <option data-description="<?php echo $model->description; ?>" data-background="<?php echo $model->background; ?>" data-icon="<?php echo $model->icon; ?>" value="<?php echo $model->model; ?>"><?php echo $model->title; ?></option>
  82. <?php endforeach; ?>
  83. </select>
  84. <div class="widgetDescription hidden">
  85. <h1>
  86. <i class=''></i> <span></span>
  87. </h1>
  88. <p></p>
  89. <span class="text-muted">Couleur: </span>
  90. <div class='widgetColor' >
  91. <small style='background-color:"+option.background+"'></small><span></span>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. <div class="modal-footer">
  97. <button type="button" class="btn btn-default" data-dismiss="modal">Fermer</button>
  98. <button type="button" class="btn btn-primary" onclick="dashboard_dashboardwidget_add();">Ajouter</button>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. <!-- Configure wiget modal -->
  104. <div class="modal fade" id="configureWidgetModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  105. <div class="modal-dialog" role="document">
  106. <div class="modal-content">
  107. <div class="modal-header">
  108. <h5 class="modal-title" id="exampleModalLabel">Configuration d'un widget</h5>
  109. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  110. <span aria-hidden="true">&times;</span>
  111. </button>
  112. </div>
  113. <div class="modal-body">
  114. <div class="pluginContent">
  115. <!-- Configuration plugin ici -->
  116. </div>
  117. </div>
  118. <div class="modal-footer">
  119. <button type="button" class="btn btn-default" data-dismiss="modal">Fermer</button>
  120. <button type="button" class="btn btn-primary" onclick="dashboard_dashboardwidget_save_configuration();">Ajouter</button>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. </div>