diff --git a/app/main/model/systemmodel.php b/app/main/model/systemmodel.php index 41b0ec7f..9ba6a362 100644 --- a/app/main/model/systemmodel.php +++ b/app/main/model/systemmodel.php @@ -307,8 +307,8 @@ class SystemModel extends BasicModel { // check if this system is a wormhole if($this->isWormhole()){ - $systemStaticModel = self::getNew('SystemStaticModel'); - $systemStatics = $systemStaticModel->find([ + $systemWormholeModel = self::getNew('SystemWormholeModel'); + $systemStatics = $systemWormholeModel->find([ 'constellationId = :constellationId', ':constellationId' => $this->constellationId ]); diff --git a/app/main/model/systemstaticmodel.php b/app/main/model/systemstaticmodel.php deleted file mode 100644 index 395ba250..00000000 --- a/app/main/model/systemstaticmodel.php +++ /dev/null @@ -1,28 +0,0 @@ -security = $this->security; - $systemStaticData->name = $this->name; - - return $systemStaticData; - } -} diff --git a/app/main/model/systemwormholemodel.php b/app/main/model/systemwormholemodel.php new file mode 100644 index 00000000..a866b3d0 --- /dev/null +++ b/app/main/model/systemwormholemodel.php @@ -0,0 +1,32 @@ + [ + 'belongs-to-one' => 'Model\WormholeModel' + ] + ]; + + /** + * get wormhole data as object + * @return object + */ + public function getData(){ + + $systemWormholeData = $this->wormholeId->getData(); + + return $systemWormholeData; + } +} diff --git a/app/main/model/usermodel.php b/app/main/model/usermodel.php index 5d812cd5..f7f6b144 100644 --- a/app/main/model/usermodel.php +++ b/app/main/model/usermodel.php @@ -17,9 +17,9 @@ class UserModel extends BasicModel { protected $table = 'user'; protected $fieldConf = [ - 'lastLogin' => array( + 'lastLogin' => [ 'type' => Schema::DT_TIMESTAMP - ), + ], 'apis' => [ 'has-many' => ['Model\UserApiModel', 'userId'] ], diff --git a/app/main/model/wormholemodel.php b/app/main/model/wormholemodel.php new file mode 100644 index 00000000..d0b32980 --- /dev/null +++ b/app/main/model/wormholemodel.php @@ -0,0 +1,60 @@ +name = $this->name; + $systemStaticData->security = $this->security; + + // total (max) available wormhole mass + $systemStaticData->massTotal = (object) []; + $systemStaticData->massTotal->value = $this->massTotal; + $systemStaticData->massTotal->format = self::formatMassValue($this->massTotal) . ' Kg'; + + // individual jump mass (max) per jump + $systemStaticData->massIndividual = (object) []; + $systemStaticData->massIndividual->value = $this->massIndividual; + $systemStaticData->massIndividual->format = self::formatMassValue($this->massIndividual) . ' Kg'; + + // lifetime (max) for this wormhole + $systemStaticData->maxStableTime = (object) []; + $systemStaticData->maxStableTime->value = $this->maxStableTime; + $systemStaticData->maxStableTime->format = $this->maxStableTime . ' h'; + + // mass regeneration value per day + if($this->massRegeneration > 0){ + $systemStaticData->massRegeneration = (object) []; + $systemStaticData->massRegeneration->value = $this->massRegeneration; + $systemStaticData->massRegeneration->format = self::formatMassValue($this->massRegeneration) . ' Kg/day'; + } + + return $systemStaticData; + } +} \ No newline at end of file diff --git a/js/app/ui/system_info.js b/js/app/ui/system_info.js index 1c40ce56..088d7c16 100644 --- a/js/app/ui/system_info.js +++ b/js/app/ui/system_info.js @@ -28,6 +28,7 @@ define([ systemInfoEffectInfoClass: 'pf-system-info-effect', // class for "effect" information element systemInfoStatusLabelClass: 'pf-system-info-status-label', // class for "status" information element systemInfoStatusAttributeName: 'data-status', // attribute name for status label + systemInfoWormholeClass: 'pf-system-info-wormhole-', // class prefix for static wormhole element // description field descriptionArea: 'pf-system-info-description-area', // class for "description" area @@ -56,6 +57,7 @@ define([ }); }; + /** * shows the tool action element by animation */ @@ -192,6 +194,14 @@ define([ parentElement.prepend(moduleElement); + + // add security class for statics + if(systemData.statics){ + for(var i = 0; i < systemData.statics.length; i++){ + systemData.statics[i].class = Util.getSecurityClassForSystem( systemData.statics[i].security ); + } + } + var effectName = Util.getEffectInfoForSystem(systemData.effect, 'name'); var effectClass = Util.getEffectInfoForSystem(systemData.effect, 'class'); @@ -338,6 +348,15 @@ define([ }); } + // init static wormhole information ---------------------------------------------------------- + if(systemData.statics){ + for(var i = 0; i < systemData.statics.length; i++){ + var staticData = systemData.statics[i]; + var staticRowElement = tempModuleElement.find('.' + config.systemInfoWormholeClass + staticData.name); + staticRowElement.addWormholeInfoTooltip(staticData); + } + } + // constellation popover --------------------------------------------------------------------- tempModuleElement.find('a.popup-ajax').popover({ html: true, @@ -350,7 +369,6 @@ define([ } }); - function details_in_popup(popoverElement){ popoverElement = $(popoverElement); var popover = popoverElement.data('bs.popover'); @@ -373,18 +391,12 @@ define([ } }; - // add security class for statics - if(systemData.statics){ - for(var i = 0; i < systemData.statics.length; i++){ - systemData.statics[i].class = Util.getSecurityClassForSystem( systemData.statics[i].security ); - } - } - var moduleData = { system: systemData, tableClass: config.systemInfoTableClass, nameInfoClass: config.systemInfoNameInfoClass, effectInfoClass: config.systemInfoEffectInfoClass, + wormholePrefixClass: config.systemInfoWormholeClass, statusInfoClass: config.systemInfoStatusLabelClass, systemTypeName: Util.getSystemTypeInfo(systemData.type.id, 'name'), diff --git a/js/app/util.js b/js/app/util.js index db225967..0c27d735 100644 --- a/js/app/util.js +++ b/js/app/util.js @@ -522,7 +522,6 @@ define([ }; requirejs(['text!templates/tooltip/character_info.html', 'mustache'], function(template, Mustache) { - var content = Mustache.render(template, data); element.popover({ @@ -541,13 +540,46 @@ define([ // set new popover content var popover = element.data('bs.popover'); popover.options.content = content; - }); } } }; + /** + * add a wormhole tooltip with wh specific data to elements + * @param tooltipData + * @returns {*} + */ + $.fn.addWormholeInfoTooltip = function(tooltipData){ + return this.each(function() { + var element = $(this); + + requirejs(['text!templates/tooltip/wormhole_info.html', 'mustache'], function (template, Mustache) { + var content = Mustache.render(template, tooltipData); + + element.popover({ + placement: 'top', + html: true, + trigger: 'hover', + content: '', + container: 'body', + title: tooltipData.name + + '' + tooltipData.security + '', + delay: { + show: 250, + hide: 0 + } + }); + + // set new popover content + var popover = element.data('bs.popover'); + popover.options.content = content; + }); + + }); + }; + /** * display a custom message (info/warning/error) to a container element * check: $.fn.showFormMessage() for an other way of showing messages diff --git a/public/templates/modules/system_info.html b/public/templates/modules/system_info.html index 11bdfe47..a552b751 100644 --- a/public/templates/modules/system_info.html +++ b/public/templates/modules/system_info.html @@ -87,7 +87,9 @@ {{/effectName}} {{#system.statics}}
| Max Stable Mass | +{{format}} | +
| Max Jump Mass | +{{format}} | +
| Max Mass Regeneration | +{{format}} | +
| Max Lifetime | +{{format}} | +