map info module improvements, new system graph module, map info module refactoring, new CCP API Cronjob (jumps, kills,...)

This commit is contained in:
exodus4d
2015-03-15 20:55:56 +01:00
parent 417961cd1e
commit 5136038bc9
51 changed files with 3158 additions and 1031 deletions

View File

@@ -0,0 +1,68 @@
<?php
/**
* Created by PhpStorm.
* User: exodus4d
* Date: 01.03.15
* Time: 18:37
*/
namespace Controller\Api;
use Model;
class Connection extends \Controller\AccessController{
/**
* event handler
*/
function beforeroute() {
parent::beforeroute();
// set header for all routes
header('Content-type: application/json');
}
/**
* save a new connection or updates an existing (drag/drop) between two systems
* @param $f3
*/
public function save($f3){
$connectionData = (array)$f3->get('POST.connectionData');
$user = $this->_getUser();
$connection = Model\BasicModel::getNew('ConnectionModel');
$connection->getById($connectionData['id']);
$connection->setData($connectionData);
$newConnectionData = [];
if(
$connection->isValid() &&
$connection->hasAccess($user)
){
$connection->save();
$newConnectionData = $connection->getData();
}
echo json_encode($newConnectionData);
}
public function delete($f3){
$connectionIds = $f3->get('POST.connectionIds');
$user = $this->_getUser();
$connection = Model\BasicModel::getNew('ConnectionModel');
foreach($connectionIds as $connectionId){
$connection->getById($connectionId);
$connection->delete($user);
$connection->reset();
}
echo json_encode([]);
}
}