NxTIC/automate.php

78 lines
1.9 KiB
PHP
Raw Normal View History

<?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;
2016-04-18 14:21:24 +00:00
debug();
2016-04-04 12:04:36 +00:00
/* PARSAGE DE JOURNAUX D'APPEL
*
*
*/
2016-04-04 12:04:36 +00:00
function parseCallLog(){
2016-04-04 12:04:36 +00:00
/* [1] On recupere le journal d'appel
=========================================================*/
$file_content = file_get_contents('doc/sample.xml');
2016-04-18 09:38:43 +00:00
/* [2] On cree la requete
2016-04-04 12:04:36 +00:00
=========================================================*/
2016-04-18 14:21:24 +00:00
$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
2016-04-04 12:04:36 +00:00
=========================================================*/
if( $answer->error != ManagerError::Success ){
// on l'explicite
var_dump( ManagerError::explicit($answer->error) );
// on quitte
return;
2016-04-04 12:04:36 +00:00
}
/* [4] Sinon on recupere le resultat
2016-04-04 12:04:36 +00:00
=========================================================*/
2016-04-18 14:21:24 +00:00
$directory = $answer->get('directory');
$logs = $answer->get('logs');
2016-04-04 12:04:36 +00:00
2016-04-18 14:21:24 +00:00
foreach($directory as $num=>$name)
echo $num.' <> '.$name.'<br>';
2016-04-04 12:04:36 +00:00
}
// parseCallLog();
/* () Test du client de l'API generique */
// $api = new client();
2016-04-18 09:38:43 +00:00
// $response = $api->send('generate-network-chart-data', array(
// '@token'=> '52945efbed43b50c12413f2f0e9519bfd9e98ce8'
// ));
// var_dump($response);
2016-04-17 15:46:34 +00:00
// var_dump( Database::delNumeric( Database::getPDO()->query("SHOW COLUMNS FROM users")->fetchAll() ) );
$create_token = new Repo('token/generate', array(
'name' => 'test2',
'duration' => 10
));
var_dump( $create_token->answer() );
// var_dump( \manager\repo\user::getById(1) );
// // var_dump( \manager\repo\user::getByLogin('xdrm') );
// // var_dump( \manager\repo\subject::getById(1) );
2016-04-18 09:38:43 +00:00
?>