NxTIC/automate.php

72 lines
1.7 KiB
PHP
Executable File

<?php define('__ROOT__', dirname(__FILE__) );
require_once __ROOT__.'/manager/autoloader.php';
use \manager\ModuleRequest;
use \manager\ResourceDispatcher;
use \manager\sessionManager;
use \manager\ManagerError;
use \manager\Repo;
use \manager\Database;
use \api\client;
debug();
/* PARSAGE DE JOURNAUX D'APPEL
*
*
*/
function parseCallLog(){
/* [1] On recupere le journal d'appel
=========================================================*/
$file_content = file_get_contents('doc/sample.xml');
/* [2] On cree la requete
=========================================================*/
$request = new ModuleRequest('call_log/unserialize', array(
'file_content' => $file_content,
'phone_number' => '01 02 03 04 05'));
$answer = $request->dispatch(); // on l'execute
/* [3] Si erreur
=========================================================*/
if( $answer->error != ManagerError::Success ){
// on l'explicite
var_dump( ManagerError::explicit($answer->error) );
// on quitte
return;
}
/* [4] Sinon on recupere le resultat
=========================================================*/
$directory = $answer->get('directory');
$logs = $answer->get('logs');
foreach($directory as $num=>$name)
echo $num.' <> '.$name.'<br>';
}
// parseCallLog();
/* () Test du client de l'API generique */
// $api = new client();
// $response = $api->send('generate-network-chart-data', array(
// '@token'=> '52945efbed43b50c12413f2f0e9519bfd9e98ce8'
// ));
// var_dump($response);
var_dump( \manager\repo\user::getByLogin('xdrm') );
// var_dump( \manager\repo\user::getByLogin('xdrm') );
// var_dump( \manager\repo\subject::getByPseudo('jeannot') );
?>