- 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`
This commit is contained in:
Mark Friedrich
2017-12-04 15:12:52 +01:00
parent 605beeb248
commit ff15fc0bf9
238 changed files with 60230 additions and 1158 deletions

View File

@@ -74,6 +74,9 @@ class ConnectionModel extends AbstractMapTrackingModel {
],
'signatures' => [
'has-many' => ['Model\SystemSignatureModel', 'connectionId']
],
'connectionLog' => [
'has-many' => ['Model\ConnectionLogModel', 'connectionId']
]
];
@@ -101,20 +104,21 @@ class ConnectionModel extends AbstractMapTrackingModel {
}
/**
* get connection data as array
* get connection data
* @param bool $addSignatureData
* @param bool $addLogData
* @return \stdClass
*/
public function getData($addSignatureData = false){
public function getData($addSignatureData = false, $addLogData = false){
$connectionData = (object) [];
$connectionData->id = $this->id;
$connectionData->source = $this->source->id;
$connectionData->target = $this->target->id;
$connectionData->scope = $this->scope;
$connectionData->type = $this->type;
$connectionData->updated = strtotime($this->updated);
$connectionData->created = strtotime($this->created);
$connectionData->eolUpdated = strtotime($this->eolUpdated);
$connectionData->id = $this->id;
$connectionData->source = $this->source->id;
$connectionData->target = $this->target->id;
$connectionData->scope = $this->scope;
$connectionData->type = $this->type;
$connectionData->updated = strtotime($this->updated);
$connectionData->created = strtotime($this->created);
$connectionData->eolUpdated = strtotime($this->eolUpdated);
if($addSignatureData){
if( !empty($signaturesData = $this->getSignaturesData()) ){
@@ -122,6 +126,12 @@ class ConnectionModel extends AbstractMapTrackingModel {
}
}
if($addLogData){
if( !empty($logsData = $this->getLogsData()) ){
$connectionData->logs = $logsData;
}
}
return $connectionData;
}
@@ -193,6 +203,7 @@ class ConnectionModel extends AbstractMapTrackingModel {
/**
* check whether this model is valid or not
* @return bool
* @throws \Exception\DatabaseException
*/
public function isValid(): bool {
if($valid = parent::isValid()){
@@ -218,6 +229,7 @@ class ConnectionModel extends AbstractMapTrackingModel {
* @param ConnectionModel $self
* @param $pkeys
* @return bool
* @throws \Exception\DatabaseException
*/
public function beforeInsertEvent($self, $pkeys){
// check for "default" connection type and add them if missing
@@ -269,6 +281,7 @@ class ConnectionModel extends AbstractMapTrackingModel {
/**
* @param string $action
* @return Logging\LogInterface
* @throws \Exception\PathfinderException
*/
public function newLog($action = ''): Logging\LogInterface{
return $this->getMap()->newLog($action)->setTempData($this->getLogObjectData());
@@ -330,11 +343,29 @@ class ConnectionModel extends AbstractMapTrackingModel {
return $signatures;
}
/**
* get all jump logs that are connected with this connection
* @return array|mixed
*/
public function getLogs(){
$logs = [];
$this->filter('connectionLog', [
'active = :active',
':active' => 1
]);
if($this->connectionLog){
$logs = $this->connectionLog;
}
return $logs;
}
/**
* get all signature data linked to this connection
* @return array
*/
public function getSignaturesData(){
public function getSignaturesData() : array {
$signaturesData = [];
$signatures = $this->getSignatures();
@@ -345,6 +376,36 @@ class ConnectionModel extends AbstractMapTrackingModel {
return $signaturesData;
}
/**
* get all connection log data linked to this connection
* @return array
*/
public function getLogsData() : array{
$logsData = [];
$logs = $this->getLogs();
foreach($logs as $log){
$logsData[] = $log->getData();
}
return $logsData;
}
public function logMass(CharacterLogModel $characterLog){
if( !$characterLog->dry() ){
$log = $this->rel('connectionLog');
$log->shipTypeId = $characterLog->shipTypeId;
$log->shipTypeName = $characterLog->shipTypeName;
$log->shipMass = $characterLog->shipMass;
$log->characterId = $characterLog->characterId->_id;
$log->characterName = $characterLog->characterId->name;
$log->connectionId = $this;
$log->save();
}
return $this;
}
/**
* overwrites parent
* @param null $db