NxTIC/automate.php

111 lines
2.7 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 \manager\lightdb;
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(){
/* [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(
'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();
/* [1] 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
/* [2] Gestion du getter dynamique des Repos
=========================================================*/
// var_dump( \manager\repo\user::getById(1) );
// var_dump( \manager\repo\user::getByLogin('xdrm') );
// var_dump( \manager\repo\subject::getById(69) );
// var_dump( \manager\repo\relation::getById(638, 640, 30) );
/* [3] Test de la vérification du format de fichier pour l'upload
=========================================================*/
// <!-- <form action='' method='POST' enctype='multipart/form-data'>
// <input type='file' name='file'>
// <input type='submit' value='Upload'>
// </form>
// var_dump($_FILES);
//
// if( isset($_FILES) ){
//
// $request = new ModuleRequest('upload/call_log', array('phone_number'=>'01 02 03 04 05') );
// $response = $request->dispatch();
// var_dump( ManagerError::explicit($response->error) );
//
// }
// Lancement du téléchargement
// $req = new ModuleRequest('download/phone', array('subjects'=>[200]));
2016-05-17 13:24:14 +00:00
// $res = $req->download();
// RUN database
$db = new lightdb('testdb1');
2016-05-17 10:25:34 +00:00
2016-05-17 13:24:14 +00:00
var_dump('INSERTING key0 to key99');
2016-05-17 10:25:34 +00:00
2016-05-17 13:24:14 +00:00
for( $i = 0 ; $i < 100 ; $i++ )
echo $db->insert('key'.$i, array('data0_'.$i, 'data1_'.$i)) ? '.' : '_';
2016-05-17 10:25:34 +00:00
var_dump( $db->filter(array( 0 => 'data0_1' )));
2016-05-17 10:25:34 +00:00
$db->close();