2016-04-04 09:47:17 +00:00
|
|
|
<?php define('__ROOT__', dirname(__FILE__) );
|
|
|
|
require_once __ROOT__.'/manager/autoloader.php';
|
|
|
|
|
|
|
|
use \manager\ModuleRequest;
|
|
|
|
use \manager\ResourceDispatcher;
|
2016-04-11 10:20:34 +00:00
|
|
|
use \manager\sessionManager;
|
2016-04-04 09:47:17 +00:00
|
|
|
use \manager\ManagerError;
|
|
|
|
use \manager\Repo;
|
|
|
|
|
2016-04-11 14:05:32 +00:00
|
|
|
use \api\client;
|
2016-04-04 09:47:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-04 12:04:36 +00:00
|
|
|
/* PARSAGE DE JOURNAUX D'APPEL
|
2016-04-04 09:47:17 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2016-04-04 12:04:36 +00:00
|
|
|
function parseCallLog(){
|
2016-04-04 09:47:17 +00:00
|
|
|
|
2016-04-04 12:04:36 +00:00
|
|
|
/* [1] On recupere le journal d'appel
|
|
|
|
=========================================================*/
|
2016-04-08 14:58:40 +00:00
|
|
|
$file_content = file_get_contents('calllog.xml');
|
|
|
|
|
|
|
|
/* [2] On cree la requete
|
2016-04-04 12:04:36 +00:00
|
|
|
=========================================================*/
|
2016-04-11 08:18:10 +00:00
|
|
|
$request = new ModuleRequest('call_log/unserialize', array($file_content));
|
2016-04-08 14:58:40 +00:00
|
|
|
$answer = $request->dispatch(); // on l'execute
|
2016-04-04 09:47:17 +00:00
|
|
|
|
2016-04-08 14:58:40 +00:00
|
|
|
/* [3] Si erreur
|
2016-04-04 12:04:36 +00:00
|
|
|
=========================================================*/
|
2016-04-08 14:58:40 +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
|
|
|
}
|
2016-04-04 09:47:17 +00:00
|
|
|
|
|
|
|
|
2016-04-08 14:58:40 +00:00
|
|
|
/* [4] Sinon on recupere le resultat
|
2016-04-04 12:04:36 +00:00
|
|
|
=========================================================*/
|
2016-04-08 17:31:01 +00:00
|
|
|
$sms = $answer->get('sms');
|
|
|
|
$call = $answer->get('call');
|
|
|
|
$contact = $answer->get('contact');
|
2016-04-04 12:04:36 +00:00
|
|
|
|
|
|
|
/* [5] On debug les donnees recues
|
|
|
|
=========================================================*/
|
2016-04-08 17:31:01 +00:00
|
|
|
var_dump( "Il y a ".count($contact)." personnes :" );
|
|
|
|
var_dump( "- ".count($sms)." par SMS/MMS" );
|
|
|
|
var_dump( "- ".count($call)." par telephone" );
|
2016-04-08 14:58:40 +00:00
|
|
|
echo "<br>";
|
2016-04-04 12:04:36 +00:00
|
|
|
echo "TOP 10 DES APPELS<br>";
|
|
|
|
echo "=================<br>";
|
2016-04-08 17:31:01 +00:00
|
|
|
foreach($call as $v)
|
|
|
|
var_dump( $v[0] ." (".$contact[$v[0]].") \t\t\t". $v[1] ." appels");
|
2016-04-08 14:58:40 +00:00
|
|
|
|
|
|
|
echo "TOP 10 DES MMS/SMS<br>";
|
|
|
|
echo "==================<br>";
|
2016-04-08 17:31:01 +00:00
|
|
|
foreach($sms as $v)
|
|
|
|
var_dump( $v[0] ." (".$contact[$v[0]].") \t\t\t". $v[1] ." appels");
|
2016-04-08 14:58:40 +00:00
|
|
|
|
2016-04-11 15:08:46 +00:00
|
|
|
|
2016-04-08 14:58:40 +00:00
|
|
|
var_dump("\n\n\nOBJET COMPLET");
|
2016-04-08 17:31:01 +00:00
|
|
|
var_dump( $sms );
|
|
|
|
var_dump( $call );
|
|
|
|
var_dump( $contact );
|
2016-04-04 12:04:36 +00:00
|
|
|
}
|
2016-04-04 09:47:17 +00:00
|
|
|
|
2016-04-13 11:37:36 +00:00
|
|
|
parseCallLog();
|
2016-04-11 08:18:10 +00:00
|
|
|
|
2016-04-11 14:05:32 +00:00
|
|
|
debug();
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-13 11:37:36 +00:00
|
|
|
// $api = new client();
|
2016-04-11 15:08:46 +00:00
|
|
|
|
2016-04-13 11:37:36 +00:00
|
|
|
// $response = $api->send('generate-network-chart-data', array(
|
|
|
|
// '@token'=> '48e701d4e72e4e35bc37c9a800b49d5400734d7b'
|
|
|
|
// ));
|
2016-04-11 15:08:46 +00:00
|
|
|
|
2016-04-13 11:37:36 +00:00
|
|
|
// var_dump($response);
|
2016-04-11 10:20:34 +00:00
|
|
|
|
2016-04-04 09:47:17 +00:00
|
|
|
?>
|