예제 #1
0
<?php

require_once '../../classes/modules/api/client/TimeTrexClientAPI.class.php';
/*
 Global variables
*/
$TIMETREX_URL = 'https://demo.timetrex.com/api/soap/api.php';
$TIMETREX_USERNAME = '******';
$TIMETREX_PASSWORD = '******';
$api_session = new TimeTrexClientAPI();
$api_session->Login($TIMETREX_USERNAME, $TIMETREX_PASSWORD);
if ($TIMETREX_SESSION_ID == FALSE) {
    echo "Login Failed!<br>\n";
    exit;
}
echo "Session ID: {$TIMETREX_SESSION_ID}<br>\n";
//
//Get data for two employees by primary key/ID.
// - Many other filter methods can be used, such as branch, department, user_name, province, state, etc...
//
$user_obj = new TimeTrexClientAPI('User');
$result = $user_obj->getUser(array('filter_data' => array('id' => array(1023, 11353))));
$user_data = $result->getResult();
print $result;
/* //Example returned data: )
Array
(
    [0] => Array
        (
            [id] => 1023
            [company_id] => 1001
예제 #2
0
 }
 $output_file = NULL;
 if (isset($argv[$last_arg - 1]) and $argv[$last_arg - 1] != '') {
     $output_file = $argv[$last_arg - 1];
 }
 $file_format = 'csv';
 if (isset($argv[$last_arg]) and $argv[$last_arg] != '') {
     $file_format = $argv[$last_arg];
 }
 if (!isset($output_file)) {
     echo "Output File not set!\n";
     exit;
 }
 $TIMETREX_URL = $api_url;
 $api_session = new TimeTrexClientAPI();
 $api_session->Login($username, $password);
 if ($TIMETREX_SESSION_ID == FALSE) {
     echo "API Username/Password is incorrect!\n";
     exit(1);
 }
 //echo "Session ID: $TIMETREX_SESSION_ID\n";
 if ($report != '') {
     $report_obj = new TimeTrexClientAPI($report);
     $config = array();
     if ($saved_report != '') {
         $saved_report_obj = new TimeTrexClientAPI('UserReportData');
         $saved_report_result = $saved_report_obj->getUserReportData(array('filter_data' => array('name' => trim($saved_report))));
         $saved_report_data = $saved_report_result->getResult();
         if (is_array($saved_report_data) and isset($saved_report_data[0]) and isset($saved_report_data[0]['data'])) {
             $config = $saved_report_data[0]['data']['config'];
         } else {