Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('../../classes/modules/api/client/TimeTrexClientAPI.class.php');
- //admin login info
- $TIMETREX_URL = 'http:///api/soap/api.php';
- $TIMETREX_USERNAME = '';
- $TIMETREX_PASSWORD = '';
- $TIMETREX_SESSION_ID= FALSE;
- $api_session = new TimeTrexClientAPI();
- $api_session->Login( $TIMETREX_USERNAME, $TIMETREX_PASSWORD );
- //get report
- print "Who is in Summary\n";
- $report_obj = new TimeTrexClientAPI( 'ActiveShiftReport' );
- $config = $report_obj->getTemplate('-1050-by_employee')->getResult();
- //let the server generate the report
- $result = $report_obj->getActiveShiftReport($config , 'csv' );
- $result = $result->getResult();
- //decode report
- $input = base64_decode($result['data']);
- //split the line breaks
- $input = str_replace("\"", "", $input);
- $csvData = explode( "\n", $input);
- //split at the commas
- foreach ($csvData as &$value) {
- $value = explode(',', $value);
- }
- $i = 0;
- echo '<head><meta http-equiv="refresh" content="30" ></head>';
- echo '<table>';
- echo '<tr>';
- foreach ($csvData[$i] as $headercolumn) {
- echo "<th>$headercolumn</th>";
- }
- echo '</tr>';
- $i++;
- while ($i < count($csvData)) {
- echo '<tr>';
- foreach ($csvData[$i] as $column) {
- echo "<td>$column</td>";
- }
- $i++;
- echo '</tr>';
- }
- echo '</table>';
- ?>
Add Comment
Please, Sign In to add comment