Files
pathfinder/app/main/lib/logging/AbstractCharacterLog.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

82 lines
2.0 KiB
PHP

<?php
/**
* Created by PhpStorm.
* User: exodu
* Date: 22.09.2017
* Time: 19:05
*/
namespace lib\logging;
use lib\Config;
use Model\CharacterModel;
abstract class AbstractCharacterLog extends AbstractChannelLog{
/**
* @var CharacterModel
*/
private $character = null;
public function __construct(string $action, array $objectData){
parent::__construct($action, $objectData);
// add log processor -> remove $channelData from log
$processorAddThumbData = function($record){
$record['extra']['thumb']['url'] = $this->getThumbUrl();
return $record;
};
// init processorConfig. IMPORTANT: first processor gets executed at the end!
$this->processorConfig = ['addThumbData' => $processorAddThumbData] + $this->processorConfig;
}
/**
* CharacterModel $character
* @param CharacterModel $character
* @return LogInterface
*/
public function setCharacter(CharacterModel $character): LogInterface{
$this->character = $character;
return $this;
}
/**
* @return CharacterModel
*/
public function getCharacter(): CharacterModel{
return $this->character;
}
/**
* @return array
*/
public function getData() : array{
$data = parent::getData();
if(is_object($character = $this->getCharacter())){
$characterData['character'] = [
'id' => $character->_id,
'name' => $character->name
];
$data = $characterData + $data;
}
return $data;
}
/**
* get character thumbnailUrl
* @return string
* @throws \Exception\PathfinderException
*/
protected function getThumbUrl(): string {
$url = '';
if(is_object($character = $this->getCharacter())){
$url = Config::getPathfinderData('api.ccp_image_server') . '/Character/' . $character->_id . '_128.jpg';
}
return $url;
}
}