PageRenderTime 44ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/application/controllers/Dashboard.php

https://gitlab.com/rhungs/pelayanan_cs
PHP | 236 lines | 188 code | 37 blank | 11 comment | 5 complexity | c6d52a9c829ba50edacf02533c27ea0c MD5 | raw file
  1. <?php
  2. class Dashboard extends Bss_controller {
  3. public function __construct(){
  4. parent::__construct();
  5. //$this->MOD_ALIAS = "MOD_HOME";
  6. //$this->checkAuthorization($this->MOD_ALIAS);
  7. }
  8. public function index(){
  9. $data['titlehead'] = "Dashboard :: Bapenda Bogor";
  10. //$this->load->model("mcommon","mcom");
  11. $this->load->model("Mdashboard","mcom");
  12. // custom load javascript, place at footer
  13. $loadfoot['javascript'] = array(
  14. /*- DataTables JavaScript -*/
  15. HTTP_ASSET_PATH.'plugins/flot/jquery.flot.min.js',
  16. HTTP_ASSET_PATH.'plugins/flot/jquery.flot.resize.min.js',
  17. HTTP_ASSET_PATH.'plugins/flot/jquery.flot.pie.min.js',
  18. HTTP_ASSET_PATH.'plugins/flot/jquery.flot.categories.min.js',
  19. HTTP_ASSET_PATH.'plugins/flot/jquery.flot.axislabels.js',
  20. HTTP_MOD_JS.'modules/dashboard/fpp_dashboard.js'
  21. );
  22. // load tag js
  23. //$tagjs1 = "";
  24. //$loadfoot['tagjs'] = array($tagjs1);
  25. //$data['loadhead'] = $loadhead;
  26. $data['tglmulai'] = date('Y-m-d');
  27. $data['tglakhir'] = date('Y-m-d');
  28. $data['auto'] = 1;
  29. // option list thang
  30. $data_loket = $this->mcom->get_loket();
  31. $list_loket ['0'] = '- Semua Loket -';
  32. foreach ($data_loket as $row) {
  33. $list_loket[$row->id] = $row->name;
  34. }
  35. $data['list_loket'] = $list_loket;
  36. $data['loket_id'] = 0;
  37. // option list thang
  38. $data_cs = $this->mcom->get_cs();
  39. $list_cs ['0'] = '- Semua Customer Service -';
  40. foreach ($data_cs as $row) {
  41. $list_cs[$row->id] = $row->name;
  42. }
  43. $data['list_cs'] = $list_cs;
  44. $data['cs'] = 0;
  45. $data['datajml'] = $this->mcom->getDataJml(null,null,null,null);
  46. $data['loadfoot'] = $loadfoot;
  47. $this->template->load('tmpl/vwfrontpenilaian','v_dashboard',$data);
  48. }
  49. function GetBarchart(){
  50. $this->load->model("Mdashboard","mcom");
  51. $loket_id = $this->input->post("loket_id");
  52. $cs = $this->input->post("cs");
  53. $tglmulai = $this->input->post("tglmulai");
  54. $tglakhir = $this->input->post("tglakhir");
  55. $results = $this->mcom->getDataGrafik($tglmulai ,$tglakhir ,$loket_id,$cs);
  56. $ttl = count($results);
  57. $build_array = array ("data_grafik"=>array(), "jml"=>$ttl);
  58. foreach($results as $row) {
  59. array_push($build_array["data_grafik"],
  60. array(
  61. $row->indikator_name,
  62. $row->jumlah
  63. )
  64. );
  65. }
  66. echo json_encode($build_array);
  67. }
  68. function GetBarchartAll(){
  69. $this->load->model("Mdashboard","mcom");
  70. $loket_id = $this->input->post("loket_id");
  71. $cs = $this->input->post("cs");
  72. $tglmulai = $this->input->post("tglmulai");
  73. $tglakhir = $this->input->post("tglakhir");
  74. $results = $this->mcom->getDataGrafik(null ,null ,null,null);
  75. $ttl = count($results);
  76. $build_array = array ("data_grafik"=>array(), "jml"=>$ttl, "data_sangat_puas"=>array(), "data_puas"=>array(), "data_tidak_puas"=>array());
  77. foreach($results as $row) {
  78. if($row->indikator_category_id==1){
  79. array_push($build_array["data_sangat_puas"],
  80. array(
  81. $row->indikator_name,
  82. $row->jumlah
  83. )
  84. );
  85. }else if($row->indikator_category_id==2){
  86. array_push($build_array["data_puas"],
  87. array(
  88. $row->indikator_name,
  89. $row->jumlah
  90. )
  91. );
  92. }else if($row->indikator_category_id==3){
  93. array_push($build_array["data_tidak_puas"],
  94. array(
  95. $row->indikator_name,
  96. $row->jumlah
  97. )
  98. );
  99. }
  100. }
  101. echo json_encode($build_array);
  102. }
  103. public function generateAll(){
  104. $this->load->model("Mdashboard","mcom");
  105. $datajml = $this->mcom->getDataJml(null,null,null,null);
  106. $hasil="";
  107. $cnt = count($datajml);
  108. if($cnt > 0 ){
  109. $total=0;
  110. foreach($datajml as $rowjml) :
  111. $total = $total + $rowjml['jumlah'];
  112. endforeach;
  113. foreach($datajml as $row) :
  114. $persen = (($row['jumlah']/$total) * 100 ) ;
  115. $hasil .="
  116. <div class='col-lg-4 col-xs-6'>
  117. <div class='". $row['icon']."'>
  118. <div class='inner'>
  119. <h3>".$row['jumlah']."</h3>
  120. <h3>".round($persen,2)."%</h3>
  121. <p style='font-size:17pt;'>". $row['indikator_name']."</p>
  122. </div>
  123. <div class='icon'>
  124. <i class='fa fa-bar-chart'></i>
  125. </div>
  126. </div>
  127. </div>";
  128. endforeach;
  129. }else{
  130. $datajmlkosong = $this->mcom->getDataJmlKosong();
  131. foreach($datajmlkosong as $row) :
  132. $hasil .="
  133. <div class='col-lg-4 col-xs-6'>
  134. <div class='". $row['icon']."'>
  135. <div class='inner'>
  136. <h3>0</h3>
  137. <h3>0%</h3>
  138. <p style='font-size:17pt;'>". $row['indikator_name']."</p>
  139. </div>
  140. <div class='icon'>
  141. <i class='fa fa-bar-chart'></i>
  142. </div>
  143. </div>
  144. </div>";
  145. endforeach;
  146. }
  147. echo $hasil;
  148. }
  149. public function generate(){
  150. $this->load->model("Mdashboard","mcom");
  151. $loket_id = $this->input->post("loket_id");
  152. $cs = $this->input->post("cs");
  153. $tglmulai = $this->input->post("tglmulai");
  154. $tglakhir = $this->input->post("tglakhir");
  155. $datajml = $this->mcom->getDataJml($tglmulai ,$tglakhir ,$loket_id,$cs);
  156. $hasil="";
  157. $cnt = count($datajml);
  158. if($cnt > 0 ){
  159. $total=0;
  160. foreach($datajml as $rowjml) :
  161. $total = $total + $rowjml['jumlah'];
  162. endforeach;
  163. foreach($datajml as $row) :
  164. $persen = (($row['jumlah']/$total) * 100 ) ;
  165. $hasil .="
  166. <div class='col-lg-4 col-xs-6'>
  167. <div class='". $row['icon']."'>
  168. <div class='inner'>
  169. <h3>".$row['jumlah']."</h3>
  170. <h3>".round($persen,2)."%</h3>
  171. <p style='font-size:17pt;'>". $row['indikator_name']."</p>
  172. </div>
  173. <div class='icon'>
  174. <i class='fa fa-bar-chart'></i>
  175. </div>
  176. </div>
  177. </div>";
  178. endforeach;
  179. }else{
  180. $datajmlkosong = $this->mcom->getDataJmlKosong();
  181. foreach($datajmlkosong as $row) :
  182. $hasil .="
  183. <div class='col-lg-4 col-xs-6'>
  184. <div class='". $row['icon']."'>
  185. <div class='inner'>
  186. <h3>0</h3>
  187. <h3>0%</h3>
  188. <p style='font-size:17pt;'>". $row['indikator_name']."</p>
  189. </div>
  190. <div class='icon'>
  191. <i class='fa fa-bar-chart'></i>
  192. </div>
  193. </div>
  194. </div>";
  195. endforeach;
  196. }
  197. echo $hasil;
  198. }
  199. }