Guest User

Untitled

a guest
Apr 5th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. require_once('../../classes/modules/api/client/TimeTrexClientAPI.class.php');
  5.  
  6. //admin login info
  7. $TIMETREX_URL = 'http:///api/soap/api.php';
  8. $TIMETREX_USERNAME = '';
  9. $TIMETREX_PASSWORD = '';
  10.  
  11.  
  12.  
  13. $TIMETREX_SESSION_ID= FALSE;
  14. $api_session = new TimeTrexClientAPI();
  15. $api_session->Login( $TIMETREX_USERNAME, $TIMETREX_PASSWORD );
  16.  
  17.  
  18. //get report
  19.  
  20. print "Who is in Summary\n";
  21.  
  22. $report_obj = new TimeTrexClientAPI( 'ActiveShiftReport' );
  23.  
  24. $config = $report_obj->getTemplate('-1050-by_employee')->getResult();
  25.  
  26. //let the server generate the report
  27.  
  28. $result = $report_obj->getActiveShiftReport($config , 'csv' );
  29.  
  30. $result = $result->getResult();
  31.  
  32. //decode report
  33. $input = base64_decode($result['data']);
  34.  
  35. //split the line breaks
  36. $input = str_replace("\"", "", $input);
  37. $csvData = explode( "\n", $input);
  38. //split at the commas
  39. foreach ($csvData as &$value) {
  40. $value = explode(',', $value);
  41. }
  42.  
  43. $i = 0;
  44. echo '<head><meta http-equiv="refresh" content="30" ></head>';
  45.  
  46. echo '<table>';
  47. echo '<tr>';
  48. foreach ($csvData[$i] as $headercolumn) {
  49. echo "<th>$headercolumn</th>";
  50. }
  51. echo '</tr>';
  52. $i++;
  53. while ($i < count($csvData)) {
  54. echo '<tr>';
  55. foreach ($csvData[$i] as $column) {
  56. echo "<td>$column</td>";
  57. }
  58. $i++;
  59. echo '</tr>';
  60. }
  61. echo '</table>';
  62.  
  63. ?>
Add Comment
Please, Sign In to add comment