Updated page display

Updated signature image generator
Navigation menu has been finalized
Some deprectaed templates has been removed
Fixed registration
Fixed galaxy notices messages

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
Gregory PLANCHAT 2011-10-24 19:19:04 +02:00
commit 6d61e93c47
67 changed files with 10177 additions and 940 deletions

View file

@ -0,0 +1,87 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://www.wootook.com/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <g.planchat@gmail.com>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/
/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Block_Planet_Shipyard_Queue_Item
extends Wootook_Empire_Block_Planet_Builder_Queue_ItemAbstract
{
protected $_itemIdField = 'research_id';
public function getLevel()
{
return $this->getPlanet()->getElement($this->getItemId());
}
public function getResourcesNeeded($level)
{
return $this->getPlanet()->getShipyard()->getResourcesNeeded($this->getItemId(), 1);
}
public function getBuildingTime($qty)
{
return $this->getPlanet()->getShipyard()->getBuildingTime($this->getItemId(), $qty);
}
public function getResourcesConfigForLevel($qty)
{
$resources = $this->getResourcesNeeded($qty);
$resourceConfig = array();
foreach ($resources as $resourceId => $resourceValue) {
$resourceConfig[$resourceId] = new Wootook_Object(array(
'resource_id' => $resourceId,
'value' => $resourceValue
));
$amount = $this->getPlanet()->getResourceAmount($resourceId);
if (Math::comp($amount, $resourceValue) < 0) {
$resourceConfig[$resourceId]->setData('requirement', Math::sub($amount, $resourceValue));
} else {
$resourceConfig[$resourceId]->setData('overflow', Math::sub($amount, $resourceValue));
}
}
return $resourceConfig;
}
public function getResourcesConfigForNextLevel()
{
return $this->getResourcesConfigForLevel($this->getNextLevel());
}
public function getBuildingTimeForNextLevel()
{
return $this->getBuildingTime($this->getNextLevel());
}
}

View file

@ -325,7 +325,12 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder
return $this;
}
$this->enqueue($shipId, $qty, $time);
$this->enqueue(array(
'ship_id' => $shipId,
'qty' => $qty,
'created_at' => $time,
'updated_at' => $time
));
$this->_currentPlanet->setData('b_hangar_id', $this->serialize());
foreach ($remainingAmounts as $resourceId => $resourceAmount) {

View file

@ -46,10 +46,10 @@ class Legacies_Officers_Model_Observer
if ($user->getData('lvl_minier') < $level) {
$difference = $level - $user->getData('lvl_minier');
if ($difference == 1) {
Wootook::getSession(Legacies_Empire_Model_User::SESSION_KEY)
Wootook::getSession(Wootook_Empire_Model_User::SESSION_KEY)
->addInfo('You gained 1 miner level.');
} else {
Wootook::getSession(Legacies_Empire_Model_User::SESSION_KEY)
Wootook::getSession(Wootook_Empire_Model_User::SESSION_KEY)
->addInfo('You gained %1$d miner level.', (int) $difference);
}
}
@ -58,10 +58,10 @@ class Legacies_Officers_Model_Observer
if ($user->getData('lvl_raid') < $level) {
$difference = $level - $user->getData('lvl_raid');
if ($difference == 1) {
Wootook::getSession(Legacies_Empire_Model_User::SESSION_KEY)
Wootook::getSession(Wootook_Empire_Model_User::SESSION_KEY)
->addInfo('You gained 1 raider level.');
} else {
Wootook::getSession(Legacies_Empire_Model_User::SESSION_KEY)
Wootook::getSession(Wootook_Empire_Model_User::SESSION_KEY)
->addInfo('You gained %1$d raider level.', (int) $difference);
}
}

View file

@ -154,7 +154,7 @@ class Wootook
public static function getTranslator($locale = null)
{
if ($locale === null) {
$locale = self::getDefaultLocale();
$locale = self::getLocale();
}
if (!isset($translator[$locale])) {
@ -174,7 +174,14 @@ class Wootook
$args = func_get_args();
array_shift($args);
return self::getTranslator(self::getDefaultLocale())->translateArgs($message, $args);
return self::getTranslator(self::getLocale())->translateArgs($message, $args);
}
public static function getLocale()
{
$availableLocales = self::getConfig('global/locales');
return self::getPreferredLocale($availableLocales);
}
public static function setDefaultLocale($locale)
@ -190,6 +197,56 @@ class Wootook
return self::$_defaultLocale;
}
public function getPreferredLocale($availableLocales = array())
{
if (empty($availableLocales)) {
return self::getDefaultLocale();
}
$userLocale = self::getSession('user')->getData('locale');
if ($userLocale !== null) {
return $userLocale;
}
$locales = array();
if (($accept = self::getRequest()->getServer('HTTP_ACCEPT_LANGUAGE')) !== null) {
// break up string into pieces (languages and q factors)
preg_match_all('/([a-z]{1,8}(?:-([a-z]{1,8}))?)\s*(?:;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $accept, $matches);
$length = count($matches[1]);
for ($i = 0; $i < $length; $i++) {
$locale = $lang_parse[1];
if (!empty($lang_parse[2])) {
$locale .= '_' . strtoupper($lang_parse[2]);
}
$locales[$locale] = !empty($lang_parse[3]) ? min(max(floatval($lang_parse[3]), 0), 1) : 1;
}
arsort($locales, SORT_NUMERIC);
}
if (empty($locales)) {
return self::getDefaultLocale();
}
$preferredLocale = key($locales);
$preferredPriority = current($locales);
foreach ($locales as $locale => $piority) {
if (!in_array($locale, $availableLocales)) {
continue;
}
if ($preferredPriority < $piority) {
$preferredPriority = $piority;
$preferredLocale = $locale;
}
}
self::getSession('user')->setData('locale', $preferredLocale);
return $preferredLocale;
}
public static function now()
{
if (self::$_now === null) {

View file

@ -11,8 +11,70 @@ class Wootook_Core_Block_Html_Head
const TYPE_INLINE_CSS = 'inline_css';
const TYPE_INLINE_JS = 'inline_js';
const TITLE_CONCAT_BEFORE = 'BEFORE';
const TITLE_CONCAT_AFTER = 'AFTER';
const TITLE_OVERWRITE = 'OVERWRITE';
protected $_items = array();
protected $_title = '';
protected $_titleDefaultConcat = self::TITLE_CONCAT_AFTER;
protected $_titleSeparator = ' | ';
protected $_titleConcatTypes = array(
self::TITLE_CONCAT_AFTER,
self::TITLE_CONCAT_BEFORE,
self::TITLE_OVERWRITE
);
public function setTitleSeparator($separator)
{
$this->_titleSeparator = $separator;
return $this;
}
public function getTitleSeparator()
{
return $this->_titleSeparator;
}
public function setTitleDefaultConcat($defaultConcat)
{
if (in_array($concatType, $this->_titleConcatTypes)) {
$this->_titleDefaultConcat = $defaultConcat;
}
return $this;
}
public function getTitleDefaultConcat()
{
return $this->_titleDefaultConcat;
}
public function setTitle($title, $concatType = self::TITLE_CONCAT_AFTER)
{
if (!in_array($concatType, $this->_titleConcatTypes)) {
$concatType = $this->getTitleDefaultConcat();
}
if ($concatType == self::TITLE_OVERWRITE) {
$this->_title = $title;
} else if ($concatType == self::TITLE_CONCAT_BEFORE) {
$this->_title = $title . $this->getTitleSeparator() . $this->_title;
} else if ($concatType == self::TITLE_CONCAT_AFTER) {
$this->_title .= $this->getTitleSeparator() . $title;
}
return $this;
}
public function getTitle()
{
return $this->_title;
}
public function addItem($type, Array $options = array())
{
if (!isset($this->_items[$type])) {

View file

@ -3,7 +3,7 @@
class Wootook_Core_Block_Html_Navigation
extends Wootook_Core_Block_Template
{
public function addLink($name, $label, $title, $uri, Array $params = array(), Array $classes = array(), $template = null)
public function addLink($name, $label, $title, $uri, Array $params = array(), Array $classes = array(), $template = null, Array $attributes = array())
{
$explodedPath = explode('/', $name);
$baseName = array_pop($explodedPath);
@ -28,6 +28,38 @@ class Wootook_Core_Block_Html_Navigation
return $this;
}
public function addExternalLink($name, $label, $title, $url, Array $classes = array(), $template = null, Array $attributes = array())
{
$explodedPath = explode('/', $name);
$baseName = array_pop($explodedPath);
$parent = $this->_getNode($explodedPath);
$child = $this->getLayout()
->createBlock('core/html.navigation.link', $this->getNameInLayout() . '.' . $baseName, array(
'url' => $url,
'label' => $label,
'title' => $title,
'classes' => $classes,
'attributes' => $attributes
));
$parent->setPartial($baseName, $child);
if ($template !== null) {
$child->setTemplate($template);
}
return $this;
}
public function addPopupLink($name, $label, $title, $uri, Array $params = array(), Array $classes = array(), $template = null, Array $attributes = array())
{
$uri = $this->getUrl($uri, $params);
$attributes['onclick'] = "f('{$params}', '{$label}');return false;";
return $this->addLink($name, $label, $title, null, array(), $classes, $template, $attributes);
}
public function setNodeTitle($path, $title)
{
return $this->getNode($path)->setTitle($title);
@ -48,10 +80,12 @@ class Wootook_Core_Block_Html_Navigation
$name = array_shift($explodedPath);
if ($this->hasPartial($name)) {
$child = $this->getPartial($name)->_getNode($explodedPath);
$child = $this->getPartial($name);
} else {
$child = $this->getLayout()
->createBlock('core/html.navigation.node', $this->getNameInLayout() . '.' . $name);
$this->setPartial($name, $child);
}
if ($child instanceof Wootook_Core_Block_Html_Navigation_Link) {

View file

@ -5,9 +5,11 @@ class Wootook_Core_Block_Html_Navigation_Link
{
protected $_label = '';
protected $_title = '';
protected $_uri = '';
protected $_uri = null;
protected $_url = null;
protected $_params = array();
protected $_classes = array('link');
protected $_attributes = array();
public function getTemplate()
{
@ -43,18 +45,71 @@ class Wootook_Core_Block_Html_Navigation_Link
public function setUrl($uri, $params = array())
{
if ($uri === null) {
return $this;
}
$this->_uri = $uri;
$this->_params = $params;
$this->_url = $this->getUrl($uri, $params);
return $this;
}
public function setExternalUrl($url)
{
$this->_url = $url;
$this->_uri = null;
$this->_params = array();
return $this;
}
public function getLinkUrl($moreParams = array())
{
if (empty($moreParams) || $this->_uri === null) {
return $this->_url;
}
$params = array_merge($this->_params, $moreParams);
return $this->getUrl($this->_uri, $params);
}
public function setAttribute($attributeName, $attributeValue)
{
$this->_attributes[$attributeName] = $attributeValue;
return $this;
}
public function getAttribute($attributeName)
{
if ($this->hasAttribute($attributeName)) {
return $this->_attributes[$attributeName];
}
return null;
}
public function hasAttribute($attributeName)
{
if (isset($this->_attributes[$attributeName])) {
return true;
}
return false;
}
public function unsetAttribute($attributeName)
{
if ($this->hasAttribute($attributeName)) {
unset($this->_attributes[$attributeName]);
}
return $this;
}
public function getAttributes()
{
return $this->_attributes;
}
public function addClass($class)
{
$this->_classes[] = $class;
@ -69,7 +124,7 @@ class Wootook_Core_Block_Html_Navigation_Link
return $this;
}
public function renderClasses($moreClasses)
public function renderClasses(Array $moreClasses = array())
{
$classes = array_merge($this->_classes, $moreClasses);
return implode(' ', $classes);
@ -95,7 +150,7 @@ class Wootook_Core_Block_Html_Navigation_Link
$this->setUrl($data['url']['uri']);
}
} else {
$this->setUrl($data['url']);
$this->setExternalUrl($data['url']);
}
unset($data['url']);
}
@ -105,7 +160,16 @@ class Wootook_Core_Block_Html_Navigation_Link
unset($data['classes']);
foreach ($classes as $class) {
$this->set($class);
$this->addClass(trim($class));
}
}
if (isset($data['attributes'])) {
$attributes = (array) $data['attributes'];
unset($data['attributes']);
foreach ($attributes as $attributeName => $attributeValue) {
$this->setAttribute($attributeName, $attributeValue);
}
}

View file

@ -5,6 +5,11 @@ class Wootook_Core_Block_Template
{
protected function _getTemplatePath($file)
{
if ($this->getScriptPath() == '') {
trigger_error("No script path defined in block {$this->getNameInLayout()}.", E_USER_NOTICE);
return null;
}
$pattern = "{$this->getScriptPath()}/%s/%s/scripts/{$file}";
if (($layout = $this->getLayout()) !== null) {
$package = $this->getLayout()->getPackage();
@ -23,6 +28,8 @@ class Wootook_Core_Block_Template
return $path;
}
}
} else {
trigger_error("No layout defined.", E_USER_NOTICE);
}
$path = sprintf($pattern, Wootook_Core_Layout::DEFAULT_PACKAGE, Wootook_Core_Layout::DEFAULT_THEME);

View file

@ -9,10 +9,10 @@ class Wootook_Core_Controller_Response_Http
const REDIRECT_TEMPORARY = 307;
protected static $_redirectCodes = array(
REDIRECT_MOVED_PERMANENTLY => 'Moved Permanently',
REDIRECT_FOUND => 'Found',
REDIRECT_SEE_OTHER => 'See Other',
REDIRECT_TEMPORARY => 'Temporary Redirect'
self::REDIRECT_MOVED_PERMANENTLY => 'Moved Permanently',
self::REDIRECT_FOUND => 'Found',
self::REDIRECT_SEE_OTHER => 'See Other',
self::REDIRECT_TEMPORARY => 'Temporary Redirect'
);
public function __construct()

View file

@ -139,9 +139,17 @@ class Wootook_Core_Layout
}
}
Wootook::dispatchEvent($this->_eventPrefix . '.prepare.before', array(
$this->_eventObject => $this
));
foreach ($this->_blocks as $block) {
$block->prepareLayout();
}
Wootook::dispatchEvent($this->_eventPrefix . '.prepare.after', array(
$this->_eventObject => $this
));
}
protected function _save()
@ -190,7 +198,7 @@ class Wootook_Core_Layout
}
}
trigger_error(Wootook::__('Class type "%s" could not be resolved.', $type), E_USER_INFO);
trigger_error(Wootook::__('Class type "%s" could not be resolved.', $type), E_USER_NOTICE);
return null;
}
@ -220,6 +228,9 @@ class Wootook_Core_Layout
{
$instance = $this->_createBlock($type, $name, $config);
if ($instance === null) {
return null;
}
$instance->prepareLayout();
return $instance;
@ -263,11 +274,14 @@ class Wootook_Core_Layout
if (!isset($config['type'])) {
$instance->$alias = new Wootook_Core_View($config);
} else {
$instance->$alias = $this->_createBlock($config['type'], $name, $config);
$child = $this->_createBlock($config['type'], $name, $config);
if ($child !== null) {
$instance->$alias = $child;
}
}
}
} catch (ReflectionException $e) {
trigger_error($e->getMessage(), E_USER_INFO);
trigger_error($e->getMessage(), E_USER_NOTICE);
return null;
}
@ -305,13 +319,14 @@ class Wootook_Core_Layout
$callParamaters[$paramterPosition] = $parameter->getDefaultValue();
//} else if (!$parameter->isOptionnal()) {
} else if ($paramterPosition <= $requiredParameterCount) {
throw new Wootook_Core_Exception_RuntimeException();
throw new Wootook_Core_Exception_RuntimeException(Wootook::__('Method %s requires parameter %d ($%s) to be defined.',
$reflectionMethod->getName(), $paramterPosition + 1, $paramterName));
}
}
$reflectionMethod->invokeArgs($block, $callParamaters);
} catch (ReflectionException $e) {
trigger_error($e->getMessage(), E_USER_INFO);
trigger_error($e->getMessage(), E_USER_NOTICE);
continue;
} catch (RuntimeException $e) {
trigger_error($e->getMessage(), E_USER_WARNING);
@ -392,7 +407,7 @@ class Wootook_Core_Layout
return $path;
}
trigger_error(Legacies::__("Layout file '%s' does not exist.", $file), E_USER_INFO);
trigger_error(Legacies::__("Layout file '%s' does not exist.", $file), E_USER_NOTICE);
return null;
}

View file

@ -6,12 +6,10 @@ abstract class Wootook_Core_Model_Config_Abstract
{
protected function _initData($filename)
{
$config = include ROOT_PATH . 'config.php';
$universe = $config['global']['storyline']['universe'];
$episode = $config['global']['storyline']['episode'];
$config = Wootook::getConfig('global/storyline');
$path = 'gamedata' . DIRECTORY_SEPARATOR . $universe . DIRECTORY_SEPARATOR
. $episode . DIRECTORY_SEPARATOR . $filename . '.php';
$path = 'gamedata' . DIRECTORY_SEPARATOR . $config['universe'] . DIRECTORY_SEPARATOR
. $config['episode'] . DIRECTORY_SEPARATOR . $filename . '.php';
foreach (include APPLICATION_PATH . $path as $elementId => $fieldName) {
$this->setData($elementId, $fieldName);

View file

@ -0,0 +1,194 @@
<?php
/**
*
* @todo Update the position alignment management.
* @author Greg
*
*/
class Wootook_Core_Model_Image_Png
{
private $_format = NULL;
private $_mime = NULL;
const COLOR_RED = 'red';
const COLOR_GREEN = 'green';
const COLOR_BLUE = 'blue';
const POSITION_LEFT = 0x01;
const POSITION_RIGHT = 0x02;
const POSITION_CENTER = 0x03;
const POSITION_TOP = 0x10;
const POSITION_BOTTOM = 0x20;
const POSITION_MIDDLE = 0x30;
const POSITION_DEFAULT = 0x11;
private $_texts = array();
private $_background = NULL;
private $_font = NULL;
public function __construct()
{
$this->_setMime('image/png');
$this->_setFormat('png');
}
protected function _getFormat()
{
return $this->_format;
}
protected function _setFormat($format)
{
$this->_format = $format;
return $this;
}
protected function _getMime()
{
return $this->_mime;
}
protected function _setMime($mime)
{
$this->_mime = $mime;
return $this;
}
public function getHeaders()
{
return array(
'Content-Type' => $this->_getMime()
);
}
public function addText($content, $fontSize, $fontFile, $positionAbscix, $positionOrdinates, $angle, Array $color, $alignment = self::POSITION_DEFAULT)
{
$this->_texts[] = array(
'content' => $content,
'color' => $color,
'sizes' => $this->_getTextPositions($content, $fontSize, $fontFile, $positionAbscix, $positionOrdinates, $angle, $alignment),
'font_size' => $fontSize,
'font_file' => $fontFile,
);
return $this;
}
public function _getTextPositions($textContent, $fontSize, $fontFile, $positionAbscix, $positionOrdinates, $angle = 0, $alignment = self::POSITION_DEFAULT)
{
$dimensions = imageFtbBox($fontSize, $angle, $fontFile, $textContent);
$width = $dimensions[2] - $dimensions[0];
$height = $dimensions[1] - $dimensions[7];
switch ($alignment & 0x7) {
case self::POSITION_CENTER:
$positionAbscix -= ceil($width / 2);
break;
case self::POSITION_RIGHT:
$positionAbscix -= $width;
break;
case self::POSITION_LEFT:
default:
break;
}
switch ($alignment & 0x70) {
case self::POSITION_MIDDLE:
$positionOrdinates -= ceil($height / 2);
break;
case self::POSITION_TOP:
$positionOrdinates -= $height;
break;
case self::POSITION_BOTTOM:
default:
$width = 0;
$height = 0;
break;
}
return array(
'abscix' => $positionAbscix,
'ordinate' => $positionOrdinates,
'alignment' => $alignment,
'width' => $width,
'height' => $height,
'angle' => $angle
);
}
public function setBackground($backgroundImage)
{
$this->_background = $backgroundImage;
return $this;
}
public function setFont($fontFile)
{
$this->_font = $fontFile;
return $this;
}
public function render()
{
ob_start();
if (!is_null($this->_background)) {
$gdHandler = imageCreateFromPng($this->_background);
} else {
$gdHandler = imageCreateTrueColor();
}
foreach ($this->_texts as $text) {
$color = imageColorAllocate(
$gdHandler,
$text['color'][self::COLOR_RED],
$text['color'][self::COLOR_GREEN],
$text['color'][self::COLOR_BLUE]
);
switch ($text['sizes']['alignment'] & 0x0F) {
case self::POSITION_CENTER:
$text['sizes']['abscix'] -= floor(imageSX($gdHandler) / 2);
break;
case self::POSITION_RIGHT:
$text['sizes']['abscix'] = imageSX($gdHandler) - ($text['sizes']['abscix'] + $text['sizes']['width']) -10;
break;
case self::POSITION_LEFT:
default:
break;
}
$imageText = imageTtfText(
$gdHandler,
$text['font_size'],
$text['sizes']['angle'],
$text['sizes']['abscix'],
$text['sizes']['ordinate'],
$color,
$text['font_file'],
$text['content']
);
}
imagePng($gdHandler);
imageDestroy($gdHandler);
$imageData = ob_get_contents();
ob_end_clean();
return $imageData;
}
}

View file

@ -27,6 +27,7 @@ class Wootook_Empire_Block_Topnav
*/
public function getPlanetCollection()
{
return $this->getCurrentUser()->getPlanetCollection();
return $this->getCurrentUser()
->getPlanetCollection(array(Wootook_Empire_Model_Planet::TYPE_PLANET));
}
}

View file

@ -64,8 +64,8 @@ class Wootook_Empire_Model_User
$session = Wootook::getSession(self::SESSION_KEY);
if ($session->hasData('user_id')) {
$id = intval($session->getData('user_id'));
} else if (Wootook::getRequest() !== null && ($cookie = Wootook::getRequest()->getCookie(self::$_cookieName)) !== null) {
$cookieData = unserialize(stripslashes($cookie));
} else if (Wootook::getRequest() !== null && ($cookieData = Wootook::getRequest()->getCookie(self::$_cookieName)) !== null) {
//$cookieData = unserialize(stripslashes($cookie));
if (is_array($cookieData)) {
$collection = new Wootook_Core_Collection(array('user' => 'users'));
$cookieData = array(
@ -182,8 +182,8 @@ class Wootook_Empire_Model_User
}
}
if (isset($_POST["rememberme"]) && Wootook::getRequest() !== null) {
Wootook::$response->setCookie(self::$_cookieName, array('id' => $login['id'], 'key' => $login['login_rememberme']), self::COOKIE_LIFETIME);
if (isset($_POST["rememberme"]) && Wootook::getResponse() !== null) {
Wootook::getResponse()->setCookie(self::$_cookieName, array('id' => $login['id'], 'key' => $login['login_rememberme']), self::COOKIE_LIFETIME);
}
self::$_singleton = self::factory($login['id']);
@ -223,7 +223,9 @@ class Wootook_Empire_Model_User
$user->save();
} catch (Wootook_Core_Exception_DataAccessException $e) {
echo $e->getTraceAsString();
$session = Wootook_Core_Model_Session::factory(Wootook_Empire_Model_User::SESSION_KEY);
trigger_error($e->getMessage(), E_USER_ERROR);
$session->addError($e->getMessage());
return null;
}
@ -382,10 +384,14 @@ class Wootook_Empire_Model_User
return $planetCollection;
}
public function getPlanetCollection()
public function getPlanetCollection(Array $typeFilter = array())
{
$planetCollection = $this->_preparePlanetCollection();
if (!empty($typeFilter)) {
$planetCollection->where('planet.planet_type IN(' . implode(',', $typeFilter) . ')');
}
$planetCollection->load(array(
'user' => $this->getId()
));
@ -535,4 +541,20 @@ class Wootook_Empire_Model_User
}
return null;
}
public static function layoutPrepareAfterListener($eventData)
{
$player = self::getSingleton();
if ($player === null || !$player->getId() || !in_array($player->getData('authlevel'), array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
return;
}
if (!isset($eventData['layout']) || !$eventData['layout'] instanceof Wootook_Core_Layout) {
return;
}
$layout = $eventData['layout'];
$navigation = $layout->getBlock('navigation');
$navigation->addLink('tools/admin', 'Admin Panel', 'Admin Panel', 'admin/index.php', array(), array('admin'));
}
}