page.sheet.report.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <?php
  2. if(!$myUser->connected()) throw new Exception("Vous devez être connecté pour accéder à cette fonctionnalité",401);
  3. require_once(__DIR__.SLASH.'IssueReport.class.php');
  4. require_once(__DIR__.SLASH.'IssueReportTag.class.php');
  5. $tags = IssueReportTag::tags();
  6. $issuereport = IssueReport::provide();
  7. if(!isset($issuereport->id)) throw new Exception("Impossible d'accéder à un rapport vierge");
  8. if(!$myUser->can('issue','read') && $myUser->login != $issuereport->creator) throw new Exception("Vous n'avez pas la permission pour executer cette fonctionnalité",403);
  9. $state = IssueReport::states($issuereport->state);
  10. $osIcon = $browserIcon = 'fas fa-question-circle';
  11. if(strlen($issuereport->os)>=3 && substr(strtolower($issuereport->os),0,3) == 'win') $osIcon = 'fab fa-windows text-primary';
  12. if(strlen($issuereport->os)>=5 && substr(strtolower($issuereport->os),0,5) == 'linux') $osIcon = 'fab fa-linux text-danger';
  13. if(strlen($issuereport->os)>=3 && substr(strtolower($issuereport->os),0,3) == 'mac') $osIcon = 'fab fa-apple text-secondary';
  14. switch($issuereport->browser){
  15. case 'firefox': $browserIcon = 'fab fa-firefox text-warning'; break;
  16. case 'ie': $browserIcon = 'fab fa-internet-explorer text-danger'; break;
  17. case 'edge': $browserIcon = 'fab fa-edge text-primary'; break;
  18. case 'chrome': $browserIcon = 'fab fa-chrome text-success'; break;
  19. }
  20. $issueTags = array();
  21. foreach(IssueReportTag::loadAll(array('report'=>$issuereport->id)) as $tag):
  22. $issueTags[] = $tag->tag;
  23. endforeach;
  24. ?>
  25. <div class="issue <?php echo !$myUser->can('issue','edit')?'readonly':''; ?>">
  26. <div id="issuereport-form" class="row issuereport-form justify-content-md-center" data-action="issue_issuereport_save" data-id="<?php echo $issuereport->id; ?>">
  27. <div class="col-md-10">
  28. <div class="row">
  29. <div class="col-md-9 p-3">
  30. <h2 class="d-inline-block mb-0">Ticket #<?php echo $issuereport->id; ?></h2>
  31. </div>
  32. <div class="col-md-3 p-3">
  33. <a href="setting.php?section=global.report" class="btn btn-light w-100"><i class="fas fa-reply"></i> Revenir aux tickets</a>
  34. </div>
  35. </div>
  36. <div class="row">
  37. <!-- events -->
  38. <div class="col-md-9 issue-event-bar">
  39. <ul class="issue-events">
  40. <li class="issue-event issue-comment hidden {{classes}}" data-id="{{id}}">
  41. <div class="comment-header">
  42. <img class="avatar-medium avatar-rounded" src="{{avatar}}">
  43. <div class="header-infos">
  44. <span class="d-inline-block font-weight-bold"> {{fullName}}</span> <br>
  45. <small class="text-muted">{{createdRelative}}</small>
  46. </div>
  47. <ul class="only-editable right">
  48. <li class="text-muted edit-issue-comment" onclick='issue_issue_event_edit(this);'><i class="fas fa-pencil-alt"></i></li>
  49. <li class="text-muted delete-issue-comment" onclick='issue_issue_event_delete(this);'><i class="far fa-trash-alt"></i></li>
  50. </ul>
  51. </div>
  52. <div class="comment-message">
  53. {{{comment}}}
  54. </div>
  55. {{#hasfiles}}
  56. <div class="comment-attachments">
  57. <h5>PIECES JOINTES </h5>
  58. {{#files}}
  59. <a href="{{url}}" class="comment-attachment attachment-{{type}}" target="_blank">
  60. <img class="attachment-image-view" src="{{url}}">
  61. <div class="attachment-file-view"><i class="{{icon}}"></i> <h6 title="{{label}}">{{labelExcerpt}}</h6></div>
  62. </a>
  63. {{/files}}
  64. </div>
  65. {{/hasfiles}}
  66. </li>
  67. <li class="issue-event issue-state hidden" data-id="{{id}}">
  68. <img class="avatar-mini avatar-rounded" src="{{avatar}}"> <span class="d-inline-block font-weight-bold"> {{fullName}}</span>
  69. <i>a changé l'état du ticket </i>
  70. de <span class="badge badge-secondary" style="background: {{oldstate.color}}"><i class="{{oldstate.icon}}"></i> {{oldstate.label}}</span>
  71. en <span class="badge badge-secondary" style="background: {{state.color}}"><i class="{{state.icon}}"></i> {{state.label}}</span>
  72. <small class="text-muted">{{createdRelative}}</small>
  73. </li>
  74. <li class="issue-event issue-assignation hidden" data-id="{{id}}">
  75. <img class="avatar-mini avatar-rounded" src="{{avatar}}"> <span class="d-inline-block font-weight-bold"> {{fullName}}</span>
  76. <i>a assigné le ticket à</i> <img class="avatar-mini avatar-rounded" src="{{assigned.avatar}}"> <span class="d-inline-block font-weight-bold"> {{assigned.fullName}}</span>
  77. <small class="text-muted">{{createdRelative}}</small>
  78. </li>
  79. <li class="issue-event issue-tag hidden" data-id="{{id}}">
  80. <img class="avatar-mini avatar-rounded" src="{{avatar}}"> <span class="d-inline-block font-weight-bold"> {{fullName}}</span>
  81. <i>a {{action}} le tag</i> <span class="badge badge-secondary ml-1" style="background: {{tag.color}}"><i class="{{tag.icon}}"></i> {{tag.label}}</span>
  82. <small class="text-muted">{{createdRelative}}</small>
  83. </li>
  84. </ul>
  85. <div id="issue-event-form" class="issue-event-form" data-action="issue_issue_event_save" data-id="">
  86. <div class="post-header">
  87. <img class="avatar-mini avatar-rounded mr-1" src="<?php echo $myUser->getAvatar(); ?>">
  88. <span class="font-weight-bold"> <?php echo $myUser->fullName(); ?></span>
  89. <small class="text-muted"><?php echo date('d/m/y H:i'); ?></small>
  90. </div>
  91. <textarea id="content" data-type="wysiwyg" name="content" class="form-control mt-2" placeholder="Répondre au sujet..."></textarea>
  92. <!--<div class="mt-1" data-type="dropzone" data-preview data-delete="" data-allowed="" data-label="Ajouter fichiers, images..." ></div>-->
  93. <div onclick="issue_issue_event_save();" class="btn btn-success right"><i class="fas fa-check"></i> Envoyer</div>
  94. <div class="clear"></div>
  95. </div>
  96. </div>
  97. <!-- sidebar -->
  98. <div class="col-md-3 issue-sidebar">
  99. <h5 class="text-muted">TAGS</h5>
  100. <input type="text" data-tags='<?php echo json_encode($tags); ?>' value="<?php echo implode(',',$issueTags); ?>" class="issue-modal-tags no-select" data-type="tagcloud" id="tags" onchange="issue_issuereport_meta_save()">
  101. <hr>
  102. <select class="w-100" data-type="dropdown-select" id="reportState" onchange="issue_issuereport_meta_save()">
  103. <?php foreach(IssueReport::states() as $slug=>$state): ?>
  104. <option <?php echo $slug==$issuereport->state ? 'selected="selected"': ''; ?> value="<?php echo $slug; ?>" style="background-color:<?php echo $state['color']; ?>;color:#ffffff;" data-icon="<?php echo $state['icon']; ?>"><?php echo $state['label']; ?></option>
  105. <?php endforeach; ?>
  106. </select>
  107. <hr>
  108. <h5 class="text-muted">ASSIGNATION</h5>
  109. <input type="text" class="form-control" data-type="user" id="assign" value="<?php echo $issuereport->assign; ?>" onchange="issue_issuereport_meta_save()">
  110. <hr>
  111. <h5 class="text-muted">ENVIRONNEMENT</h5>
  112. <ul class="list-group">
  113. <li class="list-group-item">
  114. <i class="far fa-file-code" title="Page"></i>
  115. <a href="<?php echo str_replace(ROOT_URL,'',$issuereport->from); ?>" title="Accéder à la page" class=""><?php echo str_replace(ROOT_URL,'',$issuereport->from); ?></a><br>
  116. </li>
  117. <li class="list-group-item">
  118. <i class="<?php echo $browserIcon; ?>" title="Navigateur"></i>
  119. <strong><?php echo $issuereport->browser; ?></strong><br>
  120. <small class="text-muted"><?php echo $issuereport->browserVersion; ?></small>
  121. </li>
  122. <li class="list-group-item">
  123. <i class="<?php echo $osIcon; ?>" title="Os"></i>
  124. <strong><?php echo $issuereport->os; ?></strong>
  125. </li>
  126. <li class="list-group-item">
  127. <i class="fas fa-tv" title="Écran"></i>
  128. <strong><?php echo $issuereport->width; ?>px * <?php echo $issuereport->height; ?>px</strong>
  129. </li>
  130. <li class="list-group-item">IP :
  131. <strong><?php echo $issuereport->ip; ?></strong>
  132. </li>
  133. </ul>
  134. <?php
  135. $histories = json_decode($issuereport->history,true);
  136. if($histories!=false):
  137. ?>
  138. <hr>
  139. <h5 class="text-muted">5 ACTIONS AJAX</h5>
  140. <ul class="list-group">
  141. <?php foreach ($histories as $history):
  142. preg_match("/(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})/i", $history['time'], $matches);
  143. $date = isset($matches[1]) ? date("d/m/Y", strtotime($matches[1])) : '-';
  144. ?>
  145. <li class="list-group-item">
  146. <small class="text-muted"><?php echo $date.' - '.(isset($matches[2])? $matches[2]: '-'); ?></small><br>
  147. <pre><?php print_r($history['request']); ?></pre>
  148. </li>
  149. <?php endforeach; ?>
  150. </ul>
  151. <?php endif; ?>
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. </div><br>