Exemple #1
0
<?php

/**
 * Script meant for fast testing of intellitime login code. It should be run with "drush scr login.php".
 * It boots drupal, inserts our intellitime module, and tries to login to intellitime using that module.
 */
//$intelli_url = "http://my2.intelliplan.se/IntelliplanWeb/v2005/Portal/Login.aspx?Gw27UDttLdgps9TM4HqqoQ%3d%3d";
$intelli_url = "http://localhost/IntelliplanWeb/Portal/Login.aspx";
$bot = new TZIntellitimeBot($intelli_url);
$ok = $bot->login("test user", "test password");
if ($ok) {
    echo "Login successful!\n";
} else {
    echo "Login failed!\n";
}
<?php

$intelli_url = "http://my2.intelliplan.se/IntelliplanWeb/v2005/Portal/Login.aspx?Gw27UDttLdgps9TM4HqqoQ%3d%3d";
$bot = new TZIntellitimeBot($intelli_url);
$ok = $bot->login("Johan Heander", "0733623516");
if (!$ok) {
    echo "Login failed!\n";
    exit;
}
$result = $bot->load_week();
print_r($result);
$reports = $result['reports'];
// Change report[3] and update it again
$reports[1]->begin = "10:10";
$reports[1]->end = "16:32";
$reports[1]->state = TZIntellitimeReport::STATE_OPEN;
$reports[1]->comment = "Slapsgiving";
print_r($bot->update_report($reports[1]));
<?php

$date = date_make_date('now');
if ($_SERVER['argc'] == 5) {
    $date = date_make_date($_SERVER['argv'][4]);
}
$intelli = array('url' => "https://my2.intelliplan.eu/IntelliplanWeb/v2005/Portal/Login.aspx?Gw27UDttLdgps9TM4HqqoQ%3d%3d", 'user' => "Johan Heander", 'pass' => "0733623516");
/*
$intelli = array(
  'url' => "http://localhost/demo/v2005/Portal/Login.aspx?Gw27UDttLdgps9TM4HqqoQ%3d%3d",
  'user' => "test user",
  'pass' => "test password",
);*/
$start_time = microtime(TRUE);
$bot = new TZIntellitimeBot($intelli['url']);
if ($bot->login($intelli['user'], $intelli['pass'])) {
    $data = $bot->load_week($date);
    print_r($data);
} else {
    print 'Login failed!';
}
$stop_time = microtime(TRUE);
print "\nDuration: " . ($stop_time - $start_time) . "\n";