Files
pathfinder/app/main/controller/api/access.php
Mark Friedrich ff15fc0bf9 - added new "Jump log" for selected wormhole connections, closed #313 closed #449 closed #382
- added new "select connection" feature to map - ctrl + click for multiselect, closed  #174
- added new "wormhole type" table to "Jump info" dialog, closed  #174
- added new re-order drag&drop feature for pannels, #470 closed #234
- fixed PHP-Doc comments - added @throw statements
- fixed some Javascript memory leaks with infinite counters
- updated "Peity jQuery plugin" `3.2.0` -> `3.2.1`
2017-12-04 15:12:52 +01:00

71 lines
1.8 KiB
PHP

<?php
/**
* Created by PhpStorm.
* User: exodus4d
* Date: 24.05.2015
* Time: 17:42
*/
namespace controller\api;
use Controller;
use Model;
class Access extends Controller\AccessController {
/**
* search character/corporation or alliance by name
* @param \Base $f3
* @param $params
* @throws \Exception
*/
public function search($f3, $params){
$accessData = [];
if(
array_key_exists( 'arg1', $params) &&
array_key_exists( 'arg2', $params)
){
$searchType = strtolower( $params['arg1'] );
$searchToken = strtolower( $params['arg2'] );
$accessModel = null;
switch($searchType){
case 'character':
$accessModel = Model\BasicModel::getNew('CharacterModel');
break;
case 'corporation':
$accessModel = Model\BasicModel::getNew('CorporationModel');
break;
case 'alliance':
$accessModel = Model\BasicModel::getNew('AllianceModel');
break;
}
if( is_object($accessModel) ){
// find "active" entries that have their "sharing" option activated
$accessList = $accessModel->find( [
"LOWER(name) LIKE :token AND " .
"active = 1 AND " .
"shared = 1 ",
':token' => '%' . $searchToken . '%'
]);
if($accessList){
foreach($accessList as $accessObject){
$accessData[] = $accessObject->getData();
}
}
}
}
echo json_encode($accessData);
}
}