removing smarty - part VI

- rewrote currencies, achievements, events, factions
- GenericPage:
   * moved more checks from Util
   * structured and commented GenericPage to be easier to comprehend
   * added GenericPage::postCache() to modify cached data before display (e.g. update time for events)
- fixed:
   * parsing events from markdown (e.g. articles)
   * huge padding of minibox headings (css)
   * Loot passing jsGlobals to template
   * ItemList::getExtendedCost passing jsGlobals to template
   * categories for factions
   * conflicting GenericPage::$subject when displaying 'notFound'
   * load of typos
This commit is contained in:
Sarjuuk
2014-06-21 18:39:54 +02:00
parent 9c7c2e29b5
commit caa7a7e39f
33 changed files with 1969 additions and 1856 deletions

View File

@@ -16,6 +16,10 @@ trait DetailPage
// mode, type, typeId, localeId, category, filter // mode, type, typeId, localeId, category, filter
$key = [$this->mode, $this->type, $this->typeId, User::$localeId, '-1', '-1']; $key = [$this->mode, $this->type, $this->typeId, User::$localeId, '-1', '-1'];
// check for $this->enhancedTT from Item and apply
// foreach ($extra as $x)
// $key[] = (string)$x;
return implode('_', $key); return implode('_', $key);
} }
} }
@@ -65,10 +69,6 @@ class GenericPage
private $gUser = []; private $gUser = [];
private $community = ['co' => [], 'sc' => [], 'vi' => []]; private $community = ['co' => [], 'sc' => [], 'vi' => []];
protected function generatePath() {}
protected function generateTitle() {}
protected function generateContent() {}
public function __construct() public function __construct()
{ {
// restricted access // restricted access
@@ -87,118 +87,22 @@ class GenericPage
$this->mode = CACHETYPE_XML; $this->mode = CACHETYPE_XML;
else else
{ {
if (!$this->isValidPage() || !$this->tpl)
$this->error();
$this->gUser = User::getUserGlobals(); $this->gUser = User::getUserGlobals();
$this->gLocale = array( $this->gLocale = array(
'id' => User::$localeId, 'id' => User::$localeId,
'name' => User::$localeString 'name' => User::$localeString
); );
if (!$this->isValidPage() || !$this->tpl)
$this->error();
} }
} }
private function prepareContent() /**********/
{ /* Checks */
if (!$this->loadCache()) /**********/
{
// run generators
$this->addArticle();
$this->generatePath(); private function isSaneInclude($path, $file) // "template_exists"
$this->generateTitle();
$this->generateContent();
$this->applyGlobals();
$this->saveCache();
}
if (!empty($this->hasComContent))
$this->community = CommunityContent::getAll($this->type, $this->typeId);
$this->mysql = DB::Aowow()->getStatistics();
}
public function display($override = '')
{
if ($override)
{
$this->addAnnouncements();
include('template/pages/'.$override.'.tpl.php');
die();
}
else if ($this->mode == CACHETYPE_TOOLTIP)
{
if (!$this->loadCache($tt))
{
$tt = $this->generateTooltip();
$this->saveCache($tt);
}
header('Content-type: application/x-javascript; charsetUTF-8');
die($tt);
}
else if ($this->mode == CACHETYPE_XML)
{
if (!$this->loadCache($xml))
{
$xml = $this->generateXML();
$this->saveCache($xml);
}
header('Content-type: text/xml; charsetUTF-8');
die($xml);
}
else
{
$this->prepareContent();
if (!$this->isSaneInclude('template/pages/', $this->tpl))
die(User::isInGroup(U_GROUP_STAFF) ? 'Error: nonexistant template requested: template/pages/'.$this->tpl.'.tpl.php' : null);
$this->addAnnouncements();
include('template/pages/'.$this->tpl.'.tpl.php');
die();
}
}
public function gBrick($file, array $localVars = [])
{
foreach ($localVars as $n => $v)
$$n = $v;
if (!$this->isSaneInclude('template/globals/', $file))
echo !User::isInGroup(U_GROUP_STAFF) ? "\n\nError: nonexistant template requested: template/globals/".$file.".tpl.php\n\n" : null;
else
include('template/globals/'.$file.'.tpl.php');
}
public function brick($file, array $localVars = [])
{
foreach ($localVars as $n => $v)
$$n = $v;
if (!$this->isSaneInclude('template/bricks/', $file))
echo User::isInGroup(U_GROUP_STAFF) ? "\n\nError: nonexistant template requested: template/bricks/".$file.".tpl.php\n\n" : null;
else
include('template/bricks/'.$file.'.tpl.php');
}
public function lvBrick($file, array $localVars = [])
{
foreach ($localVars as $n => $v)
$$n = $v;
if (!$this->isSaneInclude('template/listviews/', $file))
echo User::isInGroup(U_GROUP_STAFF) ? "\n\nError: nonexistant template requested: template/listviews/".$file.".tpl.php\n\n" : null;
else
include('template/listviews/'.$file.'.tpl.php');
}
private function isSaneInclude($path, $file)
{ {
if (preg_match('/[^\w\-]/i', $file)) if (preg_match('/[^\w\-]/i', $file))
return false; return false;
@@ -209,17 +113,17 @@ class GenericPage
return true; return true;
} }
private function isValidPage() private function isValidPage() // has a valid combination of categories
{ {
if ($this->category === null || empty($this->validCats)) if (!isset($this->category) || empty($this->validCats))
return true; return true;
switch (count($this->category)) switch (count($this->category))
{ {
case 0: // no params works always case 0: // no params works always
return true; return true;
case 1: // null is avalid || value in a 1-dim-array || key in a n-dim-array case 1: // null is valid || value in a 1-dim-array || key for a n-dim-array
return $this->category[0] === null || in_array($this->category[0], $this->validCats) || (isset($this->validCats[$this->category[0]]) && is_array($this->validCats[$this->category[0]])); return $this->category[0] === null || in_array($this->category[0], $this->validCats) || !empty($this->validCats[$this->category[0]]);
case 2: // first param has to be a key. otherwise invalid case 2: // first param has to be a key. otherwise invalid
if (!isset($this->validCats[$this->category[0]])) if (!isset($this->validCats[$this->category[0]]))
return false; return false;
@@ -236,6 +140,40 @@ class GenericPage
return false; return false;
} }
/****************/
/* Prepare Page */
/****************/
private function prepareContent() // get from cache ?: run generators
{
if (!$this->loadCache())
{
$this->addArticle();
$this->generatePath();
$this->generateTitle();
$this->generateContent();
$this->applyGlobals();
$this->saveCache();
}
$this->gPageInfo = array( // varies slightly for special pages like maps, user-dashboard or profiler
'type' => $this->type,
'typeId' => $this->typeId,
'name' => $this->name
);
if (method_exists($this, 'postCache')) // e.g. update dates for events and such
$this->postCache();
if (!empty($this->hasComContent)) // get comments, screenshots, videos
$this->community = CommunityContent::getAll($this->type, $this->typeId);
$this->mysql = DB::Aowow()->getStatistics();
}
public function addJS($name, $unshift = false) public function addJS($name, $unshift = false)
{ {
if (is_array($name)) if (is_array($name))
@@ -268,7 +206,7 @@ class GenericPage
} }
} }
private function addArticle() // fetch article & static infobox private function addArticle() // get article & static infobox (run before processing jsGlobals)
{ {
if (empty($this->type) && !isset($this->typeId)) if (empty($this->type) && !isset($this->typeId))
return; return;
@@ -284,7 +222,7 @@ class GenericPage
{ {
foreach ($article as $text) foreach ($article as $text)
{ {
if (preg_match_all('/\[(npc|object|item|itemset|quest|spell|zone|faction|pet|achievement|title|holiday|class|race|skill|currency)=(\d+)[^\]]*\]/i', $text, $matches, PREG_SET_ORDER)) if (preg_match_all('/\[(npc|object|item|itemset|quest|spell|zone|faction|pet|achievement|title|event|class|race|skill|currency)=(\d+)[^\]]*\]/i', $text, $matches, PREG_SET_ORDER))
{ {
foreach ($matches as $match) foreach ($matches as $match)
{ {
@@ -318,7 +256,7 @@ class GenericPage
} }
} }
private function addAnnouncements() private function addAnnouncements() // get announcements and notes for user
{ {
// display occured notices // display occured notices
if ($_ = Util::getNotes(false)) if ($_ = Util::getNotes(false))
@@ -354,7 +292,153 @@ class GenericPage
} }
} }
public function extendGlobalIds($type, $data) protected function getCategoryFromUrl($str)
{
$arr = explode('.', $str);
$params = [];
foreach ($arr as $v)
if (is_numeric($v))
$params[] = (int)$v;
$this->category = $params;
}
/*******************/
/* Special Display */
/*******************/
public function notFound($typeStr) // unknown ID
{
if ($this->mode == CACHETYPE_TOOLTIP)
{
header('Content-type: application/x-javascript; charset=utf-8');
echo $this->generateTooltip(true);
}
else if ($this->mode == CACHETYPE_XML)
{
header('Content-type: text/xml; charset=utf-8');
echo $this->generateXML(true);
}
else
{
$this->typeStr = $typeStr;
$this->mysql = DB::Aowow()->getStatistics();
$this->display('text-page-generic');
}
exit();
}
public function error() // unknown page
{
$this->type = -99; // get error-article
$this->typeId = 0;
$this->title[] = Lang::$main['errPageTitle'];
$this->name = Lang::$main['errPageTitle'];
$this->addArticle();
$this->mysql = DB::Aowow()->getStatistics();
$this->display('text-page-generic');
exit();
}
public function maintenance() // display brb gnomes
{
$this->display('maintenance');
exit();
}
/*******************/
/* General Display */
/*******************/
public function display($override = '') // load given template string or GenericPage::$tpl
{
if ($override)
{
$this->addAnnouncements();
include('template/pages/'.$override.'.tpl.php');
die();
}
else if ($this->mode == CACHETYPE_TOOLTIP)
{
if (!$this->loadCache($tt))
{
$tt = $this->generateTooltip();
$this->saveCache($tt);
}
header('Content-type: application/x-javascript; charset=utf-8');
die($tt);
}
else if ($this->mode == CACHETYPE_XML)
{
if (!$this->loadCache($xml))
{
$xml = $this->generateXML();
$this->saveCache($xml);
}
header('Content-type: text/xml; charset=utf-8');
die($xml);
}
else
{
$this->prepareContent();
if (!$this->isSaneInclude('template/pages/', $this->tpl))
die(User::isInGroup(U_GROUP_STAFF) ? 'Error: nonexistant template requested: template/pages/'.$this->tpl.'.tpl.php' : null);
$this->addAnnouncements();
include('template/pages/'.$this->tpl.'.tpl.php');
die();
}
}
public function gBrick($file, array $localVars = []) // load jsGlobal
{
foreach ($localVars as $n => $v)
$$n = $v;
if (!$this->isSaneInclude('template/globals/', $file))
echo !User::isInGroup(U_GROUP_STAFF) ? "\n\nError: nonexistant template requested: template/globals/".$file.".tpl.php\n\n" : null;
else
include('template/globals/'.$file.'.tpl.php');
}
public function brick($file, array $localVars = []) // load brick
{
foreach ($localVars as $n => $v)
$$n = $v;
if (!$this->isSaneInclude('template/bricks/', $file))
echo User::isInGroup(U_GROUP_STAFF) ? "\n\nError: nonexistant template requested: template/bricks/".$file.".tpl.php\n\n" : null;
else
include('template/bricks/'.$file.'.tpl.php');
}
public function lvBrick($file, array $localVars = []) // load listview
{
foreach ($localVars as $n => $v)
$$n = $v;
if (!$this->isSaneInclude('template/listviews/', $file))
echo User::isInGroup(U_GROUP_STAFF) ? "\n\nError: nonexistant template requested: template/listviews/".$file.".tpl.php\n\n" : null;
else
include('template/listviews/'.$file.'.tpl.php');
}
/**********************/
/* Prepare js-Globals */
/**********************/
public function extendGlobalIds($type, $data) // add typeIds <int|array[int]> that should be displayed as jsGlobal on the page
{ {
if (!$type || !$data) if (!$type || !$data)
return false; return false;
@@ -371,7 +455,7 @@ class GenericPage
$this->jsgBuffer[$type][] = (int)$data; $this->jsgBuffer[$type][] = (int)$data;
} }
public function extendGlobalData($data, $extra = null) public function extendGlobalData($data, $extra = null) // add jsGlobals or typeIds (can be mixed in one array: TYPE => [mixeddata]) to display on the page
{ {
foreach ($data as $type => $globals) foreach ($data as $type => $globals)
{ {
@@ -396,7 +480,7 @@ class GenericPage
$this->jsGlobals[$type][2] = $extra; $this->jsGlobals[$type][2] = $extra;
} }
private function initJSGlobal($type) private function initJSGlobal($type) // init store for type
{ {
$jsg = &$this->jsGlobals; // shortcut $jsg = &$this->jsGlobals; // shortcut
@@ -415,7 +499,7 @@ class GenericPage
case TYPE_PET: $jsg[TYPE_PET] = ['pet', [], []]; break; case TYPE_PET: $jsg[TYPE_PET] = ['pet', [], []]; break;
case TYPE_ACHIEVEMENT: $jsg[TYPE_ACHIEVEMENT] = ['achievement', [], []]; break; case TYPE_ACHIEVEMENT: $jsg[TYPE_ACHIEVEMENT] = ['achievement', [], []]; break;
case TYPE_TITLE: $jsg[TYPE_TITLE] = ['title', [], []]; break; case TYPE_TITLE: $jsg[TYPE_TITLE] = ['title', [], []]; break;
case TYPE_WORLDEVENT: $jsg[TYPE_WORLDEVENT] = ['holiday', [], []]; break; case TYPE_WORLDEVENT: $jsg[TYPE_WORLDEVENT] = ['event', [], []]; break;
case TYPE_CLASS: $jsg[TYPE_CLASS] = ['class', [], []]; break; case TYPE_CLASS: $jsg[TYPE_CLASS] = ['class', [], []]; break;
case TYPE_RACE: $jsg[TYPE_RACE] = ['race', [], []]; break; case TYPE_RACE: $jsg[TYPE_RACE] = ['race', [], []]; break;
case TYPE_SKILL: $jsg[TYPE_SKILL] = ['skill', [], []]; break; case TYPE_SKILL: $jsg[TYPE_SKILL] = ['skill', [], []]; break;
@@ -423,7 +507,7 @@ class GenericPage
} }
} }
private function applyGlobals() private function applyGlobals() // lookup jsGlobals from collected typeIds
{ {
foreach ($this->jsgBuffer as $type => $ids) foreach ($this->jsgBuffer as $type => $ids)
{ {
@@ -435,7 +519,25 @@ class GenericPage
continue; continue;
$this->initJSGlobal($type); $this->initJSGlobal($type);
$cnd = array(['id', array_unique($ids, SORT_NUMERIC)], CFG_SQL_LIMIT_NONE);
// todo (med): properly distinguish holidayId and eventId
$cnd = [CFG_SQL_LIMIT_NONE];
if ($type == TYPE_WORLDEVENT)
{
$hIds = array_filter($ids, function($v) { return $v > 0; });
$eIds = array_filter($ids, function($v) { return $v < 0; });
if ($hIds)
$cnd[] = ['holidayId', array_unique($hIds, SORT_NUMERIC)];
if ($eIds)
$cnd[] = ['id', array_unique($eIds, SORT_NUMERIC)];
if ($eIds && $hIds)
$cnd[] = 'OR';
}
else
$cnd [] = ['id', array_unique($ids, SORT_NUMERIC)];
switch ($type) switch ($type)
{ {
@@ -461,46 +563,11 @@ class GenericPage
} }
} }
public function notFound($subject) /*********/
{ /* Cache */
if ($this->mode == CACHETYPE_TOOLTIP) /*********/
echo $this->generateTooltip(true);
else if ($this->mode == CACHETYPE_XML)
echo $this->generateXML(true);
else
{
$this->subject = $subject;
$this->mysql = DB::Aowow()->getStatistics();
$this->display('text-page-generic'); public function saveCache($saveString = null) // visible properties or given strings are cached
}
exit();
}
public function error()
{
$this->type = -99; // get error-article
$this->typeId = 0;
$this->title[] = Lang::$main['errPageTitle'];
$this->name = Lang::$main['errPageTitle'];
$this->addArticle();
$this->mysql = DB::Aowow()->getStatistics();
$this->display('text-page-generic');
exit();
}
public function maintenance()
{
$this->display('maintenance');
exit();
}
// creates the cache file
public function saveCache($saveString = null)
{ {
if ($this->mode == CACHETYPE_NONE) if ($this->mode == CACHETYPE_NONE)
return false; return false;
@@ -532,8 +599,7 @@ class GenericPage
file_put_contents($file, $data); file_put_contents($file, $data);
} }
// loads and evaluates the cache file public function loadCache(&$saveString = null)
public function loadCache(&$saveVar = null)
{ {
if ($this->mode == CACHETYPE_NONE) if ($this->mode == CACHETYPE_NONE)
return false; return false;
@@ -565,7 +631,7 @@ class GenericPage
} }
else if ($type == '1') else if ($type == '1')
{ {
$saveVar = $cache[1]; $saveString = $cache[1];
return true; return true;
} }

View File

@@ -65,7 +65,14 @@ class Loot
return json_encode($stack, JSON_NUMERIC_CHECK); return json_encode($stack, JSON_NUMERIC_CHECK);
} }
private static function getByItemIdRecursive($tableName, $lootId, &$handledRefs, $groupId = 0, $baseChance = 1.0) private static function storeJSGlobals($data)
{
foreach ($data as $type => $jsData)
foreach ($jsData as $k => $v)
self::$jsGlobals[$type][$k] = $v;
}
private static function getByContainerRecursive($tableName, $lootId, &$handledRefs, $groupId = 0, $baseChance = 1.0)
{ {
$loot = []; $loot = [];
$rawItems = []; $rawItems = [];
@@ -118,7 +125,7 @@ class Loot
// bandaid.. remove when propperly handling lootmodes // bandaid.. remove when propperly handling lootmodes
if (!in_array($entry['mincountOrRef'], $handledRefs)) if (!in_array($entry['mincountOrRef'], $handledRefs))
{ // todo (high): find out, why i used this in the first place. (don't do drugs, kids) { // todo (high): find out, why i used this in the first place. (don't do drugs, kids)
list($data, $raw) = self::getByItemIdRecursive(LOOT_REFERENCE, $entry['mincountOrRef'], $handledRefs, /*$entry['groupid'],*/ 0, abs($entry['ChanceOrQuestChance'] / 100)); list($data, $raw) = self::getByContainerRecursive(LOOT_REFERENCE, $entry['mincountOrRef'], $handledRefs, /*$entry['groupid'],*/ 0, abs($entry['ChanceOrQuestChance'] / 100));
$handledRefs[] = $entry['mincountOrRef']; $handledRefs[] = $entry['mincountOrRef'];
@@ -157,7 +164,7 @@ class Loot
} }
else // shouldn't have happened else // shouldn't have happened
{ {
self::addNote(U_GROUP_EMPLOYEE, 'Loot::getByItemIdRecursive: unhandled case in calculating chance for item '.$entry['item'].'!'); self::addNote(U_GROUP_EMPLOYEE, 'Loot::getByContainerRecursive: unhandled case in calculating chance for item '.$entry['item'].'!');
continue; continue;
} }
@@ -171,7 +178,7 @@ class Loot
$sum = 0; $sum = 0;
else if ($sum > 100) else if ($sum > 100)
{ {
self::addNote(U_GROUP_EMPLOYEE, 'Loot::getByItemIdRecursive: entry '.$lootId.' / group '.$k.' has a total chance of '.number_format($sum, 2).'%. Some items cannot drop!'); self::addNote(U_GROUP_EMPLOYEE, 'Loot::getByContainerRecursive: entry '.$lootId.' / group '.$k.' has a total chance of '.number_format($sum, 2).'%. Some items cannot drop!');
$sum = 100; $sum = 100;
} }
@@ -202,7 +209,7 @@ class Loot
modes:{"mode":1,"1":{"count":4408,"outof":16013},"4":{"count":4408,"outof":22531}} modes:{"mode":1,"1":{"count":4408,"outof":16013},"4":{"count":4408,"outof":22531}}
*/ */
$handledRefs = []; $handledRefs = [];
$struct = self::getByItemIdRecursive($table, $entry, $handledRefs); $struct = self::getByContainerRecursive($table, $entry, $handledRefs);
if (!$struct) if (!$struct)
return false; return false;
@@ -496,7 +503,7 @@ class Loot
$srcObj = new QuestList($conditions); $srcObj = new QuestList($conditions);
if (!$srcObj->error) if (!$srcObj->error)
{ {
$srcObj->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS); self::storeJSGlobals($srcObj->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS));
$srcData = $srcObj->getListviewData(); $srcData = $srcObj->getListviewData();
foreach ($srcObj->iterate() as $_) foreach ($srcObj->iterate() as $_)
@@ -517,7 +524,7 @@ class Loot
$srcObj = new SpellList($conditions); $srcObj = new SpellList($conditions);
if (!$srcObj->error) if (!$srcObj->error)
{ {
$srcObj->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED); self::storeJSGlobals($srcObj->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$srcData = $srcObj->getListviewData(); $srcData = $srcObj->getListviewData();
if (!empty($result)) if (!empty($result))
@@ -544,8 +551,8 @@ class Loot
$srcObj = new $oName(array([$field, $ids])); $srcObj = new $oName(array([$field, $ids]));
if (!$srcObj->error) if (!$srcObj->error)
{ {
$srcObj->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED);
$srcData = $srcObj->getListviewData(); $srcData = $srcObj->getListviewData();
self::storeJSGlobals($srcObj->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
foreach ($srcObj->iterate() as $curTpl) foreach ($srcObj->iterate() as $curTpl)
{ {

View File

@@ -44,6 +44,8 @@ class AchievementList extends BaseType
$_curTpl['rewards'][TYPE_TITLE][] = -$rewId; $_curTpl['rewards'][TYPE_TITLE][] = -$rewId;
} }
} }
$_curTpl['iconString'] = $_curTpl['iconString'] ?: 'trade_engineering';
} }
} }

View File

@@ -9,10 +9,10 @@ class FactionList extends BaseType
public static $type = TYPE_FACTION; public static $type = TYPE_FACTION;
public static $brickFile = 'faction'; public static $brickFile = 'faction';
protected $queryBase = 'SELECT f.*, f.parentFactionId AS cat2, f.id AS ARRAY_KEY FROM ?_factions f'; protected $queryBase = 'SELECT f.*, f.parentFactionId AS cat, f.id AS ARRAY_KEY FROM ?_factions f';
protected $queryOpts = array( protected $queryOpts = array(
'f' => [['f2']], 'f' => [['f2']],
'f2' => ['j' => ['?_factions f2 ON f.parentFactionId = f2.id', true], 's' => ', IFNULL(f2.parentFactionId, 0) AS cat'], 'f2' => ['j' => ['?_factions f2 ON f.parentFactionId = f2.id', true], 's' => ', IFNULL(f2.parentFactionId, 0) AS cat2'],
'ft' => ['j' => '?_factiontemplate ft ON ft.factionId = f.id'] 'ft' => ['j' => '?_factiontemplate ft ON ft.factionId = f.id']
); );

View File

@@ -107,13 +107,13 @@ class ItemList extends BaseType
if ($_ = @$costs['reqArenaPoints']) if ($_ = @$costs['reqArenaPoints'])
{ {
$data[-103] = $_; $data[-103] = $_;
$this->jsGlobals[TYPE_CURRENCY][103] = [103]; $this->jsGlobals[TYPE_CURRENCY][103] = 103;
} }
if ($_ = @$costs['reqHonorPoints']) if ($_ = @$costs['reqHonorPoints'])
{ {
$data[-104] = $_; $data[-104] = $_;
$this->jsGlobals[TYPE_CURRENCY][104] = [104]; $this->jsGlobals[TYPE_CURRENCY][104] = 104;
} }
for ($i = 1; $i < 6; $i++) for ($i = 1; $i < 6; $i++)
@@ -135,7 +135,9 @@ class ItemList extends BaseType
if ($cItems) if ($cItems)
{ {
$moneyItems = new CurrencyList(array(['itemId', $cItems])); $moneyItems = new CurrencyList(array(['itemId', $cItems]));
$this->jsGlobals = $moneyItems->getJSGlobals(); foreach ($moneyItems->getJSGlobals() as $type => $jsData)
foreach ($jsData as $k => $v)
$this->jsGlobals[$type][$k] = $v;
foreach ($itemz as $id => $vendors) foreach ($itemz as $id => $vendors)
{ {
@@ -158,7 +160,7 @@ class ItemList extends BaseType
} }
if (!$found) if (!$found)
$this->jsGlobals[TYPE_ITEM][$k] = [$k]; $this->jsGlobals[TYPE_ITEM][$k] = $k;
} }
} }
$vendors[$l] = $costs; $vendors[$l] = $costs;
@@ -289,7 +291,7 @@ class ItemList extends BaseType
if ($e = $cost['event']) if ($e = $cost['event'])
{ {
$this->jsGlobals[TYPE_WORLDEVENT][$e] = [$e]; $this->jsGlobals[TYPE_WORLDEVENT][$e] = $e;
$data[$this->id]['condition'] = array( $data[$this->id]['condition'] = array(
'type' => TYPE_WORLDEVENT, 'type' => TYPE_WORLDEVENT,
'typeId' => -$e, 'typeId' => -$e,
@@ -366,7 +368,7 @@ class ItemList extends BaseType
public function getJSGlobals($addMask = GLOBALINFO_SELF, &$extra = []) public function getJSGlobals($addMask = GLOBALINFO_SELF, &$extra = [])
{ {
$data = $this->jsGlobals; $data = $addMask & GLOBALINFO_RELATED ? $this->jsGlobals : [];
foreach ($this->iterate() as $id => $__) foreach ($this->iterate() as $id => $__)
{ {

View File

@@ -895,7 +895,7 @@ class Util
// pageText for Books (Item or GO) and questText // pageText for Books (Item or GO) and questText
public static function parseHtmlText($text) public static function parseHtmlText($text)
{ {
if (stristr($text, '<HTML>')) // text is basicly a html-document with weird linebreak-syntax if (stristr($text, '<HTML>')) // text is basically a html-document with weird linebreak-syntax
{ {
$pairs = array( $pairs = array(
'<HTML>' => '', '<HTML>' => '',
@@ -915,9 +915,9 @@ class Util
'/\|T([\w]+\\\)*([^\.]+)\.blp:\d+\|t/ui', // images (force size to tiny) |T<fullPath>:<size>|t '/\|T([\w]+\\\)*([^\.]+)\.blp:\d+\|t/ui', // images (force size to tiny) |T<fullPath>:<size>|t
'/\|c(\w{6})\w{2}([^\|]+)\|r/ui', // color |c<RRGGBBAA><text>|r '/\|c(\w{6})\w{2}([^\|]+)\|r/ui', // color |c<RRGGBBAA><text>|r
'/\$g\s*([^:;]+)\s*:\s*([^:;]+)\s*(:?[^:;]*);/ui',// directed gender-reference $g:<male>:<female>:<refVariable> '/\$g\s*([^:;]+)\s*:\s*([^:;]+)\s*(:?[^:;]*);/ui',// directed gender-reference $g:<male>:<female>:<refVariable>
'/\$t([^;]+);/ui', // nonesense, that the client apparently ignores '/\$t([^;]+);/ui', // nonsense, that the client apparently ignores
'/\|\d\-?\d?\((\$\w)\)/ui', // and another modifier for something russian |3-6($r) '/\|\d\-?\d?\((\$\w)\)/ui', // and another modifier for something russian |3-6($r)
'/<([^\"=\/>]+\s[^\"=\/>]+)>/ui' // emotes (workaround: at least one whitespace and never " oder = between brackets) '/<([^\"=\/>]+\s[^\"=\/>]+)>/ui' // emotes (workaround: at least one whitespace and never " or = between brackets)
); );
$to = array( $to = array(
@@ -1031,18 +1031,6 @@ class Util
return ''; return '';
} }
public static function extractURLParams($str)
{
$arr = explode('.', $str);
$params = [];
foreach ($arr as $v)
if (is_numeric($v))
$params[] = (int)$v;
return $params;
}
// for item and spells // for item and spells
public static function setRatingLevel($level, $type, $val) public static function setRatingLevel($level, $type, $val)
{ {

View File

@@ -19,58 +19,60 @@ if (!defined('AOWOW_REVISION'))
* } * }
*/ */
require 'includes/community.class.php'; // menuId 9: Achievement g_initPath()
// tabId 0: Database g_initHeader()
$_id = intVal($pageParam); class AchievementPage extends GenericPage
$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_ACHIEVEMENT, $_id, -1, User::$localeId]);
$cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_ACHIEVEMENT, $_id, -1, User::$localeId]);
// AowowPower-request
if (isset($_GET['power']))
{ {
header('Content-type: application/x-javascript; charsetUTF-8'); use DetailPage;
Util::powerUseLocale(@$_GET['domain']); protected $type = TYPE_ACHIEVEMENT;
protected $typeId = 0;
protected $tpl = 'achievement';
protected $path = [0, 9];
protected $tabId = 0;
protected $mode = CACHETYPE_PAGE;
if (!$smarty->loadCache($cacheKeyTooltip, $x)) public function __construct($__, $id)
{ {
$acv = new AchievementList(array(['id', $_id])); parent::__construct();
if ($acv->error)
die('$WowheadPower.registerAchievement(\''.$_id.'\', '.User::$localeId.', {})');
$x = '$WowheadPower.registerAchievement('.$_id.', '.User::$localeId.",{\n"; // temp locale
$x .= "\tname_".User::$localeString.": '".Util::jsEscape($acv->getField('name', true))."',\n"; if ($this->mode == CACHETYPE_TOOLTIP && isset($_GET['domain']))
$x .= "\ticon: '".urlencode($acv->getField('iconString'))."',\n"; Util::powerUseLocale($_GET['domain']);
$x .= "\ttooltip_".User::$localeString.": '".$acv->renderTooltip()."'\n";
$x .= "});";
$smarty->saveCache($cacheKeyTooltip, $x); $this->typeId = intVal($id);
}
die($x); $this->subject = new AchievementList(array(['id', $this->typeId]));
if ($this->subject->error)
$this->notFound(Lang::$game['achievement']);
$this->extendGlobalData($this->subject->getJSGlobals(GLOBALINFO_REWARDS));
$this->name = $this->subject->getField('name', true);
} }
// regular page protected function generatePath()
if (!$smarty->loadCache($cacheKeyPage, $pageData))
{ {
$acv = new AchievementList(array(['id', $_id]));
if ($acv->error)
$smarty->notFound(Lang::$game['achievement'], $_id);
// create page title and path // create page title and path
$curCat = $acv->getField('category'); $curCat = $this->subject->getField('category');
$path = [];
do do
{ {
array_unshift($path, $curCat); array_unshift($this->path, $curCat);
$curCat = DB::Aowow()->SelectCell('SELECT parentCategory FROM ?_achievementcategory WHERE id = ?d', $curCat); $curCat = DB::Aowow()->SelectCell('SELECT parentCategory FROM ?_achievementcategory WHERE id = ?d', $curCat);
} }
while ($curCat > 0); while ($curCat > 0);
array_unshift($path, 0, 9); array_unshift($this->path, 0, 9);
$this->path[] = $this->subject->getField('typeCat');
}
$acv->addGlobalsToJScript(GLOBALINFO_REWARDS); protected function generateTitle()
{
array_unshift($this->title, $this->subject->getField('name', true), Util::ucFirst(Lang::$game['achievement']));
}
protected function generateContent()
{
/***********/ /***********/
/* Infobox */ /* Infobox */
/***********/ /***********/
@@ -78,28 +80,28 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$infobox = []; $infobox = [];
// points // points
if ($_ = $acv->getField('points')) if ($_ = $this->subject->getField('points'))
$infobox[] = Lang::$achievement['points'].Lang::$colon.'[achievementpoints='.$_.']'; $infobox[] = Lang::$achievement['points'].Lang::$main['colon'].'[achievementpoints='.$_.']';
// location // location
// todo (low) // todo (low)
// faction // faction
switch ($acv->getField('faction')) switch ($this->subject->getField('faction'))
{ {
case 1: case 1:
$infobox[] = Lang::$main['side'].Lang::$colon.'[span class=icon-alliance]'.Lang::$game['si'][SIDE_ALLIANCE].'[/span]'; $infobox[] = Lang::$main['side'].Lang::$main['colon'].'[span class=icon-alliance]'.Lang::$game['si'][SIDE_ALLIANCE].'[/span]';
break; break;
case 2: case 2:
$infobox[] = Lang::$main['side'].Lang::$colon.'[span class=icon-horde]'.Lang::$game['si'][SIDE_HORDE].'[/span]'; $infobox[] = Lang::$main['side'].Lang::$main['colon'].'[span class=icon-horde]'.Lang::$game['si'][SIDE_HORDE].'[/span]';
break; break;
default: // case 3 default: // case 3
$infobox[] = Lang::$main['side'].Lang::$colon.Lang::$game['si'][SIDE_BOTH]; $infobox[] = Lang::$main['side'].Lang::$main['colon'].Lang::$game['si'][SIDE_BOTH];
} }
// todo (low): crosslink with charactersDB to check if realmFirsts are still available // todo (low): crosslink with charactersDB to check if realmFirsts are still available
$infobox = array_merge($infobox, Lang::getInfoBoxForFlags($acv->getField('cuFlags'))); $infobox = array_merge($infobox, Lang::getInfoBoxForFlags($this->subject->getField('cuFlags')));
/**********/ /**********/
/* Series */ /* Series */
@@ -107,7 +109,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$series = []; $series = [];
if ($c = $acv->getField('chainId')) if ($c = $this->subject->getField('chainId'))
{ {
$chainAcv = new AchievementList(array(['chainId', $c])); $chainAcv = new AchievementList(array(['chainId', $c]));
@@ -130,42 +132,27 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
/* Main Content */ /* Main Content */
/****************/ /****************/
// menuId 9: Achievement g_initPath() $this->headIcons = [$this->subject->getField('iconString')];
// tabId 0: Database g_initHeader() $this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null;
$pageData = array( $this->series = $series ? [[$series, null]] : null;
'page' => array( $this->description = $this->subject->getField('description', true);
'title' => $acv->getField('name', true).' - '.Util::ucfirst(Lang::$game['achievement']), $this->redButtons = array(
'path' => json_encode($path, JSON_NUMERIC_CHECK), BUTTON_LINKS => ['color' => 'ffffff00', 'linkId' => Util::$typeStrings[TYPE_ACHIEVEMENT].':'.$this->typeId.':&quot;..UnitGUID(&quot;player&quot;)..&quot;:0:0:0:0:0:0:0:0'],
'tab' => 0, BUTTON_WOWHEAD => !($this->subject->getField('cuFlags') & CUSTOM_SERVERSIDE)
'type' => TYPE_ACHIEVEMENT, );
'typeId' => $_id, $this->criteria = array(
'headIcons' => $acv->getField('iconString'), 'reqQty' => $this->subject->getField('reqCriteriaCount'),
'infobox' => $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null, 'icons' => [],
'series' => $series ? [[$series, null]] : null, 'data' => []
'redButtons' => array(
BUTTON_LINKS => ['color' => 'ffffff00', 'linkId' => Util::$typeStrings[TYPE_ACHIEVEMENT].':'.$_id.':&quot;..UnitGUID(&quot;player&quot;)..&quot;:0:0:0:0:0:0:0:0'],
BUTTON_WOWHEAD => true
),
'name' => $acv->getField('name', true),
'description' => $acv->getField('description', true),
'count' => $acv->getField('reqCriteriaCount'),
'reward' => $acv->getField('reward', true),
'nCriteria' => count($acv->getCriteria()),
'titleReward' => [],
'itemReward' => [],
'criteria' => [],
'icons' => []
),
'relTabs' => []
); );
// create rewards // create rewards
if ($foo = $acv->getField('rewards')[TYPE_ITEM]) if ($foo = $this->subject->getField('rewards')[TYPE_ITEM])
{ {
$bar = new ItemList(array(['i.id', $foo])); $bar = new ItemList(array(['i.id', $foo]));
foreach ($bar->iterate() as $id => $__) foreach ($bar->iterate() as $id => $__)
{ {
$pageData['page']['itemReward'][] = array( $this->rewards['item'][] = array(
'name' => $bar->getField('name', true), 'name' => $bar->getField('name', true),
'quality' => $bar->getField('quality'), 'quality' => $bar->getField('quality'),
'typeStr' => Util::$typeStrings[TYPE_ITEM], 'typeStr' => Util::$typeStrings[TYPE_ITEM],
@@ -175,24 +162,26 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
} }
} }
if ($foo = $acv->getField('rewards')[TYPE_TITLE]) if ($foo = $this->subject->getField('rewards')[TYPE_TITLE])
{ {
$bar = new TitleList(array(['id', $foo])); $bar = new TitleList(array(['id', $foo]));
foreach ($bar->iterate() as $__) foreach ($bar->iterate() as $__)
$pageData['page']['titleReward'][] = sprintf(Lang::$achievement['titleReward'], $bar->id, trim(str_replace('%s', '', $bar->getField('male', true)))); $this->rewards['title'][] = sprintf(Lang::$achievement['titleReward'], $bar->id, trim(str_replace('%s', '', $bar->getField('male', true))));
} }
$this->rewards['text'] = $this->subject->getField('reward', true);
/**************/ /**************/
/* Extra Tabs */ /* Extra Tabs */
/**************/ /**************/
// tab: see also // tab: see also
$conditions = array( $conditions = array(
['name_loc'.User::$localeId, $acv->getField('name', true)], ['name_loc'.User::$localeId, $this->subject->getField('name', true)],
['id', $_id, '!'] ['id', $this->typeId, '!']
); );
$saList = new AchievementList($conditions); $saList = new AchievementList($conditions);
$pageData['relTabs'][] = array( $this->lvData[] = array(
'file' => 'achievement', 'file' => 'achievement',
'data' => $saList->getListviewData(), 'data' => $saList->getListviewData(),
'params' => array( 'params' => array(
@@ -202,18 +191,17 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'tabs' => '$tabsRelated' 'tabs' => '$tabsRelated'
) )
); );
$this->extendGlobalData($saList->getJSGlobals());
$saList->addGlobalsToJscript();
// tab: criteria of // tab: criteria of
$refs = DB::Aowow()->SelectCol('SELECT refAchievementId FROM ?_achievementcriteria WHERE Type = ?d AND value1 = ?d', $refs = DB::Aowow()->SelectCol('SELECT refAchievementId FROM ?_achievementcriteria WHERE Type = ?d AND value1 = ?d',
ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT, ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT,
$_id $this->typeId
); );
if (!empty($refs)) if (!empty($refs))
{ {
$coList = new AchievementList(array(['id', $refs])); $coList = new AchievementList(array(['id', $refs]));
$pageData['relTabs'][] = array( $this->lvData[] = array(
'file' => 'achievement', 'file' => 'achievement',
'data' => $coList->getListviewData(), 'data' => $coList->getListviewData(),
'params' => array( 'params' => array(
@@ -223,8 +211,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'tabs' => '$tabsRelated' 'tabs' => '$tabsRelated'
) )
); );
$this->extendGlobalData($coList->getJSGlobals());
$coList->addGlobalsToJscript();
} }
/*****************/ /*****************/
@@ -234,7 +221,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$iconId = 1; $iconId = 1;
$rightCol = []; $rightCol = [];
foreach ($acv->getCriteria() as $i => $crt) foreach ($this->subject->getCriteria() as $i => $crt)
{ {
// hide hidden criteria for regular users (really do..?) // hide hidden criteria for regular users (really do..?)
// if (($crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_HIDDEN) && User::$perms > 0) // if (($crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_HIDDEN) && User::$perms > 0)
@@ -242,7 +229,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
// alternative display option // alternative display option
$displayMoney = $crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER; $displayMoney = $crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER;
$crtName = Util::localizedString($crt, 'name'); $crtName = Util::localizedString($crt, 'name');
$tmp = array( $tmp = array(
'id' => $crt['id'], 'id' => $crt['id'],
@@ -262,7 +248,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'href' => '?npc='.$obj, 'href' => '?npc='.$obj,
'text' => $crtName, 'text' => $crtName,
); );
$tmp['extra_text'] = Lang::$achievement['slain']; $tmp['extraText'] = Lang::$achievement['slain'];
break; break;
// link to area (by map) // link to area (by map)
case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG: case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG:
@@ -276,7 +262,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'text' => $crtName, 'text' => $crtName,
); );
else else
$tmp['extra_text'] = $crtName; $tmp['extraText'] = $crtName;
break; break;
// link to area // link to area
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE: case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE:
@@ -312,7 +298,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
break; break;
// link to title - todo (low): crosslink // link to title - todo (low): crosslink
case ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE: case ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE:
$tmp['extra_text'] = Util::ucFirst(Lang::$game['title']).Lang::$colon.$crtName; $tmp['extraText'] = Util::ucFirst(Lang::$game['title']).Lang::$main['colon'].$crtName;
break; break;
// link to achivement (/w icon) // link to achivement (/w icon)
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT: case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT:
@@ -321,19 +307,19 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'text' => $crtName, 'text' => $crtName,
); );
$tmp['icon'] = $iconId; $tmp['icon'] = $iconId;
$pageData['page']['icons'][] = array( $this->criteria['icons'][] = array(
'itr' => $iconId++, 'itr' => $iconId++,
'type' => 'g_achievements', 'type' => 'g_achievements',
'id' => $obj, 'id' => $obj,
); );
$smarty->extendGlobalIds(TYPE_ACHIEVEMENT, $obj); $this->extendGlobalIds(TYPE_ACHIEVEMENT, $obj);
break; break;
// link to quest // link to quest
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST:
// $crtName = ; // $crtName = ;
$tmp['link'] = array( $tmp['link'] = array(
'href' => '?quest='.$obj, 'href' => '?quest='.$obj,
'text' => $crtName ? $crtName : QuestList::getName($obj), 'text' => $crtName ?: QuestList::getName($obj),
); );
break; break;
// link to spell (/w icon) // link to spell (/w icon)
@@ -342,14 +328,13 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL:
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL:
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
$text = $crtName ? $crtName : SpellList::getName($obj);
$tmp['link'] = array( $tmp['link'] = array(
'href' => '?spell='.$obj, 'href' => '?spell='.$obj,
'text' => $text 'text' => ($crtName ?: SpellList::getName($obj))
); );
$smarty->extendGlobalIds(TYPE_SPELL, $obj); $this->extendGlobalIds(TYPE_SPELL, $obj);
$tmp['icon'] = $iconId; $tmp['icon'] = $iconId;
$pageData['page']['icons'][] = array( $this->criteria['icons'][] = array(
'itr' => $iconId++, 'itr' => $iconId++,
'type' => 'g_spells', 'type' => 'g_spells',
'id' => $obj, 'id' => $obj,
@@ -361,16 +346,15 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM:
$crtItm = new ItemList(array(['i.id', $obj])); $crtItm = new ItemList(array(['i.id', $obj]));
$text = $crtName ? $crtName : $crtItm->getField('name', true);
$tmp['link'] = array( $tmp['link'] = array(
'href' => '?item='.$obj, 'href' => '?item='.$obj,
'text' => $text, 'text' => ($crtName ?: $crtItm->getField('name', true)),
'quality' => $crtItm->getField('quality'), 'quality' => $crtItm->getField('quality'),
'count' => $qty, 'count' => $qty,
); );
$crtItm->addGlobalsToJscript(); $this->extendGlobalData($crtItm->getJSGlobals());
$tmp['icon'] = $iconId; $tmp['icon'] = $iconId;
$pageData['page']['icons'][] = array( $this->criteria['icons'][] = array(
'itr' => $iconId++, 'itr' => $iconId++,
'type' => 'g_items', 'type' => 'g_items',
'id' => $obj, 'id' => $obj,
@@ -381,9 +365,9 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION:
$tmp['link'] = array( $tmp['link'] = array(
'href' => '?faction='.$obj, 'href' => '?faction='.$obj,
'text' => $crtName ? $crtName : FactionList::getName($obj), 'text' => $crtName ?: FactionList::getName($obj),
); );
$tmp['extra_text'] = ' ('.Lang::getReputationLevelForPoints($qty).')'; $tmp['extraText'] = ' ('.Lang::getReputationLevelForPoints($qty).')';
break; break;
// link to GObject // link to GObject
case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT: case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT:
@@ -394,31 +378,35 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
); );
break; break;
default: default:
$tmp['standard'] = true; // Add a gold coin icon if required
// Add a gold coin icon $tmp['extraText'] = $displayMoney ? Util::formatMoney($qty) : $crtName;
$tmp['extra_text'] = $displayMoney ? Util::formatMoney($qty) : $crtName;
break; break;
} }
// If the right column // If the right column
if ($i % 2) if ($i % 2)
$pageData['page']['criteria'][] = $tmp; $this->criteria['data'][] = $tmp;
else else
$rightCol[] = $tmp; $rightCol[] = $tmp;
} }
// If you found the second column - merge data from it to the end of the main body // If you found the second column - merge data from it to the end of the main body
if ($rightCol) if ($rightCol)
$pageData['page']['criteria'] = array_merge($pageData['page']['criteria'], $rightCol); $this->criteria['data'] = array_merge($this->criteria['data'], $rightCol);
$smarty->saveCache($cacheKeyPage, $pageData);
} }
$smarty->updatePageVars($pageData['page']); protected function generateTooltip($asError = false)
$smarty->assign('community', CommunityContent::getAll(TYPE_ACHIEVEMENT, $_id)); // comments, screenshots, videos {
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement, ['colon' => Lang::$colon])); if ($asError)
$smarty->assign('lvData', $pageData['relTabs']); die('$WowheadPower.registerAchievement('.$this->typeId.', '.User::$localeId.', {});');
// load the page $x = '$WowheadPower.registerAchievement('.$this->typeId.', '.User::$localeId.",{\n";
$smarty->display('achievement.tpl'); $x .= "\tname_".User::$localeString.": '".Util::jsEscape($this->subject->getField('name', true))."',\n";
$x .= "\ticon: '".urlencode($this->subject->getField('iconString'))."',\n";
$x .= "\ttooltip_".User::$localeString.": '".$this->subject->renderTooltip()."'\n";
$x .= "});";
return $x;
}
}
?> ?>

View File

@@ -4,13 +4,19 @@ if (!defined('AOWOW_REVISION'))
die('illegal access'); die('illegal access');
$cats = Util::extractURLParams($pageParam); // menuId 9: Object g_initPath()
$path = [0, 9]; // tabId 0: Database g_initHeader()
$title = []; class AchievementsPage extends GenericPage
$filter = []; {
$filterHash = !empty($_GET['filter']) ? '#'.sha1(serialize($_GET['filter'])) : null; use ListPage;
$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_ACHIEVEMENT, -1, implode('.', $cats).$filterHash, User::$localeId]);
$validCats = array( protected $type = TYPE_ACHIEVEMENT;
protected $tpl = 'achievements';
protected $path = [0, 9];
protected $tabId = 0;
protected $mode = CACHETYPE_PAGE;
protected $js = ['filters.js'];
protected $validCats = array(
92 => true, 92 => true,
96 => [14861, 14862, 14863], 96 => [14861, 14862, 14863],
97 => [14777, 14778, 14779, 14780], 97 => [14777, 14778, 14779, 14780],
@@ -34,105 +40,107 @@ $validCats = array(
) )
); );
if (!Util::isValidPage($validCats, $cats)) public function __construct($pageCall, $pageParam)
$smarty->error();
if (!$smarty->loadCache($cacheKey, $pageData, $filter))
{ {
$acvFilter = new AchievementListFilter(); $this->getCategoryFromUrl($pageParam);
parent::__construct();
$this->name = Util::ucFirst(Lang::$game['achievements']);
$this->subCat = $pageParam ? '='.$pageParam : '';
}
protected function generateContent()
{
$conditions = [];
// include child categories if current category is empty // include child categories if current category is empty
$condition = !empty($cats) ? [['category', (int)end($cats)]] : []; if ($this->category)
$conditions[] = ['category', (int)end($this->category)];
$fiCnd = $acvFilter->getConditions(); $acvFilter = new AchievementListFilter();
if ($fiCnd)
$condition[] = $fiCnd;
$acvList = new AchievementList($condition); // recreate form selection
$this->filter = $acvFilter->getForm('form');
$this->filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : null;
$this->filter['fi'] = $acvFilter->getForm();
if ($fiCnd = $acvFilter->getConditions())
$conditions[] = $fiCnd;
$acvList = new AchievementList($conditions);
if (!$acvList->getMatches()) if (!$acvList->getMatches())
{ {
$curCats = $catList = [!empty($cats) ? (int)end($cats) : 0]; $curCats = $catList = [!empty($this->category) ? (int)end($this->category) : 0];
while ($curCats) while ($curCats)
{ {
$curCats = DB::Aowow()->SelectCol('SELECT Id FROM ?_achievementCategory WHERE parentCategory IN (?a)', $curCats); $curCats = DB::Aowow()->SelectCol('SELECT Id FROM ?_achievementCategory WHERE parentCategory IN (?a)', $curCats);
$catList = array_merge($catList, $curCats); $catList = array_merge($catList, $curCats);
} }
$condition = []; $conditions = [];
if ($fiCnd) if ($fiCnd)
$condition[] = $fiCnd; $conditions[] = $fiCnd;
if ($catList) if ($catList)
$condition[] = ['category', $catList]; $conditions[] = ['category', $catList];
$acvList = new AchievementList($condition); $acvList = new AchievementList($conditions);
} }
// recreate form selection $params = $data = [];
$filter = array_merge($acvFilter->getForm('form'), $filter); if (!$acvList->error)
$filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL;
$filter['fi'] = $acvFilter->getForm();
// create page title and path
if ($cats)
{ {
$catrows = DB::Aowow()->Select('SELECT * FROM ?_achievementcategory WHERE id IN (?a)', $cats); $data = $acvList->getListviewData();
foreach ($catrows as $cat)
{
$path[] = $cat['id'];
$title[] = Util::localizedString($cat, 'name');
}
array_unshift($title, Util::ucFirst(Lang::$game['achievements']));
}
// page content
// menuId 9: Achievement g_initPath()
// tabId 0: Database g_initHeader()
$pageData = array(
'page' => array(
'title' => implode(" - ", $title),
'path' => json_encode($path, JSON_NUMERIC_CHECK),
'tab' => 0,
'subCat' => $pageParam ? '='.$pageParam : '',
'reqJS' => [STATIC_URL.'/js/filters.js']
),
'lv' => array(
'data' => $acvList->getListviewData(),
'params' => []
)
);
// fill g_items, g_titles, g_achievements // fill g_items, g_titles, g_achievements
$acvList->addGlobalsToJscript(); $this->extendGlobalData($acvList->getJSGlobals());
// if we are have different cats display field // if we are have different cats display field
if ($acvList->hasDiffFields(['category'])) if ($acvList->hasDiffFields(['category']))
$pageData['lv']['params']['visibleCols'] = "$['category']"; $params['visibleCols'] = "$['category']";
if (!empty($filter['fi']['extraCols'])) if (!empty($this->filter['fi']['extraCols']))
$pageData['lv']['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; $params['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
// create note if search limit was exceeded // create note if search limit was exceeded
if ($acvList->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($acvList->getMatches() > CFG_SQL_LIMIT_DEFAULT)
{ {
$pageData['lv']['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_achievementsfound', $acvList->getMatches(), CFG_SQL_LIMIT_DEFAULT); $params['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_achievementsfound', $acvList->getMatches(), CFG_SQL_LIMIT_DEFAULT);
$pageData['lv']['params']['_truncated'] = 1; $params['_truncated'] = 1;
} }
if ($acvFilter->error) if ($acvFilter->error)
$pageData['lv']['params']['_errors'] = '$1'; $params['_errors'] = '$1';
$smarty->saveCache($cacheKey, $pageData, $filter);
} }
$this->lvData = array(
'file' => 'achievement',
'data' => $data,
'params' => $params
);
// sort for dropdown-menus // sort for dropdown-menus in filter
asort(Lang::$game['si']); asort(Lang::$game['si']);
}
$smarty->updatePageVars($pageData['page']); protected function generateTitle()
$smarty->assign('filter', $filter); {
$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement, ['colon' => Lang::$colon])); array_unshift($this->title, Util::ucFirst(Lang::$game['achievements']));
$smarty->assign('lvData', $pageData['lv']); if ($this->category)
{
$catrow = DB::Aowow()->SelectRow('SELECT * FROM ?_achievementcategory WHERE id = ?d', end($this->category));
array_unshift($this->title, Util::localizedString($catrow, 'name'));
}
}
// load the page protected function generatePath()
$smarty->display('achievements.tpl'); {
if ($this->category)
{
$catrows = DB::Aowow()->SelectCol('SELECT id FROM ?_achievementcategory WHERE id IN (?a)', $this->category);
foreach ($catrows as $cat)
$this->path[] = $cat;
}
}
}
?> ?>

View File

@@ -29,11 +29,6 @@ class ClassPage extends GenericPage
$this->notFound(Lang::$game['class']); $this->notFound(Lang::$game['class']);
$this->name = $this->subject->getField('name', true); $this->name = $this->subject->getField('name', true);
$this->gPageInfo = array(
'type' => $this->type,
'typeId' => $this->typeId,
'name' => $this->name
);
} }
protected function generatePath() protected function generatePath()

View File

@@ -4,52 +4,54 @@ if (!defined('AOWOW_REVISION'))
die('illegal access'); die('illegal access');
$cat = Util::extractURLParams($pageParam);
$path = [0, 15];
$validCats = [1, 2, 3, 22];
$title = [Util::ucFirst(Lang::$game['currencies'])];
$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_CURRENCY, -1, $cat ? $cat[0] : -1, User::$localeId]);
if (!Util::isValidPage($validCats, $cat))
$smarty->error();
if ($cat)
{
$path[] = $cat[0]; // should be only one parameter anyway
array_unshift($title, Lang::$currency['cat'][$cat[0]]);
}
if (!$smarty->loadCache($cacheKey, $pageData))
{
$money = new CurrencyList($cat ? array(['category', (int)$cat[0]]) : []);
$money->addGlobalsToJscript();
// menuId 15: Currency g_initPath() // menuId 15: Currency g_initPath()
// tabId 0: Database g_initHeader() // tabId 0: Database g_initHeader()
$pageData = array( class CurrenciesPage extends GenericPage
'page' => array( {
'tab' => 0, use ListPage;
'title' => implode(" - ", $title),
'path' => json_encode($path, JSON_NUMERIC_CHECK) protected $type = TYPE_CURRENCY;
), protected $tpl = 'list-page-generic';
'lv' => array( protected $path = [0, 15];
array( protected $tabId = 0;
protected $mode = CACHETYPE_PAGE;
protected $validCats = [1, 2, 3, 22];
public function __construct($pageCall, $pageParam)
{
$this->getCategoryFromUrl($pageParam);
parent::__construct();
$this->name = Util::ucFirst(Lang::$game['currencies']);
}
protected function generateContent()
{
$conditions = [];
if ($this->category)
$conditions[] = ['category', (int)$this->category[0]];
$money = new CurrencyList($conditions);
$this->lvData[] = array(
'file' => 'currency', 'file' => 'currency',
'data' => $money->getListviewData(), 'data' => $money->getListviewData(),
'params' => [] 'params' => []
)
)
); );
$smarty->saveCache($cacheKey, $pageData);
} }
protected function generateTitle()
{
array_unshift($this->title, $this->name);
if ($this->category)
array_unshift($this->title, Lang::$currency['cat'][$this->category[0]]);
}
$smarty->updatePageVars($pageData['page']); protected function generatePath()
$smarty->assign('lang', Lang::$main); {
$smarty->assign('lvData', $pageData['lv']); if ($this->category)
$this->path[] = $this->category[0];
// load the page }
$smarty->display('list-page-generic.tpl'); }
?> ?>

View File

@@ -4,56 +4,67 @@ if (!defined('AOWOW_REVISION'))
die('illegal access'); die('illegal access');
require 'includes/community.class.php'; // menuId 15: Currency g_initPath()
// tabId 0: Database g_initHeader()
$_id = intVal($pageParam); class CurrencyPage extends GenericPage
$_path = [0, 15];
$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_CURRENCY, $_id, -1, User::$localeId]);
if (!$smarty->loadCache($cacheKeyPage, $pageData))
{ {
$currency = new CurrencyList(array(['id', $_id])); use DetailPage;
if ($currency->error)
$smarty->notFound(Lang::$game['skill'], $_id);
$_cat = $currency->getField('category'); protected $type = TYPE_CURRENCY;
$_itemId = $currency->getField('itemId'); protected $typeId = 0;
$_isSpecial = $_id == 103 || $_id == 104; // honor && arena points are not handled as items protected $tpl = 'detail-page-generic';
$_path[] = $_cat; protected $path = [0, 15];
protected $tabId = 0;
protected $mode = CACHETYPE_PAGE;
public function __construct($__, $id)
{
parent::__construct();
$this->typeId = intVal($id);
$this->subject = new CurrencyList(array(['id', $this->typeId]));
if ($this->subject->error)
$this->notFound(Lang::$game['currency']);
$this->name = $this->subject->getField('name', true);
}
protected function generatePath()
{
$this->path[] = $this->subject->getField('typeCat');
}
protected function generateTitle()
{
array_unshift($this->title, $this->subject->getField('name', true), Util::ucFirst(Lang::$game['gameObject']));
}
protected function generateContent()
{
$_itemId = $this->subject->getField('itemId');
$_isSpecial = $this->typeId == 103 || $this->typeId == 104; // honor && arena points are not handled as items
/***********/ /***********/
/* Infobox */ /* Infobox */
/**********/ /**********/
$infobox = ''; $infobox = '';
if ($_id == 103) // Arena Points if ($this->typeId == 103) // Arena Points
$infobox = '[ul][li]'.Lang::$currency['cap'].Lang::$colon.'10\'000[/li][/ul]'; $infobox = '[ul][li]'.Lang::$currency['cap'].Lang::$main['colon'].'10\'000[/li][/ul]';
else if ($_id == 104) // Honor else if ($this->typeId == 104) // Honor
$infobox = '[ul][li]'.Lang::$currency['cap'].Lang::$colon.'75\'000[/li][/ul]'; $infobox = '[ul][li]'.Lang::$currency['cap'].Lang::$main['colon'].'75\'000[/li][/ul]';
/****************/ /****************/
/* Main Content */ /* Main Content */
/****************/ /****************/
// menuId 14: Skill g_initPath() $this->infobox = $infobox;
// tabId 0: Database g_initHeader() $this->name = $this->subject->getField('name', true);
$pageData = array( $this->headIcons = $this->typeId == 104 ? ['inv_bannerpvp_02', 'inv_bannerpvp_01'] : [$this->subject->getField('iconString')];
'page' => array( $this->redButtons = array(
'title' => $currency->getField('name', true)." - ".Util::ucfirst(Lang::$game['skill']),
'path' => json_encode($_path, JSON_NUMERIC_CHECK),
'tab' => 0,
'type' => TYPE_CURRENCY,
'typeId' => $_id,
'infobox' => $infobox,
'name' => $currency->getField('name', true),
'headIcons' => $_id == 104 ? ['inv_bannerpvp_02', 'inv_bannerpvp_01'] : [$currency->getField('iconString')],
'redButtons' => array(
BUTTON_WOWHEAD => true, BUTTON_WOWHEAD => true,
BUTTON_LINKS => true BUTTON_LINKS => true
)
),
'relTabs' => []
); );
/**************/ /**************/
@@ -62,11 +73,15 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if (!$_isSpecial) if (!$_isSpecial)
{ {
include 'includes/loot.class.php';
// tabs: this currency is contained in.. // tabs: this currency is contained in..
$lootTabs = Util::getLootSource($_itemId); $lootTabs = Loot::getByItem($_itemId);
$this->extendGlobalData(Loot::$jsGlobals);
foreach ($lootTabs as $tab) foreach ($lootTabs as $tab)
{ {
$pageData['relTabs'][] = array( $this->lvData[] = array(
'file' => $tab[0], 'file' => $tab[0],
'data' => $tab[1], 'data' => $tab[1],
'params' => [ 'params' => [
@@ -84,18 +99,18 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$itemObj = new ItemList(array(['id', $_itemId])); $itemObj = new ItemList(array(['id', $_itemId]));
if ($vendors = @$itemObj->getExtendedCost()[$_itemId]) if ($vendors = @$itemObj->getExtendedCost()[$_itemId])
{ {
$this->extendGlobalData($itemObj->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$soldBy = new CreatureList(array(['id', array_keys($vendors)])); $soldBy = new CreatureList(array(['id', array_keys($vendors)]));
if (!$soldBy->error) if (!$soldBy->error)
{ {
$soldBy->addGlobalsToJScript(GLOBALINFO_SELF);
$sbData = $soldBy->getListviewData(); $sbData = $soldBy->getListviewData();
$extraCols = ['Listview.extraCols.stock', "Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", 'Listview.extraCols.cost']; $extraCols = ['Listview.extraCols.stock', "Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack')", 'Listview.extraCols.cost'];
$holidays = []; $holidays = [];
foreach ($sbData as $k => &$row) foreach ($sbData as $k => &$row)
{ {
$currency = []; $this->subject = [];
$tokens = []; $tokens = [];
foreach ($vendors[$k] as $id => $qty) foreach ($vendors[$k] as $id => $qty)
{ {
@@ -105,7 +120,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if ($id > 0) if ($id > 0)
$tokens[] = [$id, $qty]; $tokens[] = [$id, $qty];
else if ($id < 0) else if ($id < 0)
$currency[] = [-$id, $qty]; $this->subject[] = [-$id, $qty];
} }
if ($_ = $vendors[$k]['event']) if ($_ = $vendors[$k]['event'])
@@ -126,7 +141,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$row['stack'] = $itemObj->getField('buyCount'); $row['stack'] = $itemObj->getField('buyCount');
$row['cost'] = array( $row['cost'] = array(
$itemObj->getField('buyPrice'), $itemObj->getField('buyPrice'),
$currency ? $currency : null, $this->subject ? $this->subject : null,
$tokens ? $tokens : null $tokens ? $tokens : null
); );
} }
@@ -134,7 +149,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if ($holidays) if ($holidays)
{ {
$hObj = new WorldEventList(array(['id', array_keys($holidays)])); $hObj = new WorldEventList(array(['id', array_keys($holidays)]));
$hObj->addGlobalsToJscript(); $this->extendGlobalData($hObj->getJSGlobals());
foreach ($hObj->iterate() as $id => $tpl) foreach ($hObj->iterate() as $id => $tpl)
{ {
if ($_ = $tpl['holidayId']) if ($_ = $tpl['holidayId'])
@@ -144,7 +159,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
} }
} }
$pageData['relTabs'][] = array( $this->lvData[] = array(
'file' => 'creature', 'file' => 'creature',
'data' => $sbData, 'data' => $sbData,
'params' => [ 'params' => [
@@ -160,15 +175,17 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
} }
// tab: created by (spell) [for items its handled in Util::getLootSource()] // tab: created by (spell) [for items its handled in Util::getLootSource()]
if ($_id == 104) if ($this->typeId == 104)
{ {
$createdBy = new SpellList(array(['effect1Id', 45], ['effect2Id', 45], ['effect3Id', 45], 'OR')); $createdBy = new SpellList(array(['effect1Id', 45], ['effect2Id', 45], ['effect3Id', 45], 'OR'));
if (!$createdBy->error) if (!$createdBy->error)
{ {
$this->extendGlobalData($createdBy->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
if ($createdBy->hasSetFields(['reagent1'])) if ($createdBy->hasSetFields(['reagent1']))
$visCols = ['reagents']; $visCols = ['reagents'];
$pageData['relTabs'][] = array( $this->lvData[] = array(
'file' => 'spell', 'file' => 'spell',
'data' => $createdBy->getListviewData(), 'data' => $createdBy->getListviewData(),
'params' => [ 'params' => [
@@ -182,19 +199,19 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
} }
// tab: currency for // tab: currency for
if ($_id == 103) if ($this->typeId == 103)
{ {
$n = '?items&filter=cr=145;crs=1;crv=0'; $n = '?items&filter=cr=145;crs=1;crv=0';
$w = 'iec.reqArenaPoints > 0'; $w = 'iec.reqArenaPoints > 0';
} }
else if ($_id == 104) else if ($this->typeId == 104)
{ {
$n = '?items&filter=cr=144;crs=1;crv=0'; $n = '?items&filter=cr=144;crs=1;crv=0';
$w = 'iec.reqHonorPoints > 0'; $w = 'iec.reqHonorPoints > 0';
} }
else else
{ {
$n = in_array($_id, [42, 61, 81, 241, 121, 122, 123, 125, 126, 161, 201, 101, 102, 221, 301, 341]) ? '?items&filter=cr=158;crs='.$_itemId.';crv=0' : null; $n = in_array($this->typeId, [42, 61, 81, 241, 121, 122, 123, 125, 126, 161, 201, 101, 102, 221, 301, 341]) ? '?items&filter=cr=158;crs='.$_itemId.';crv=0' : null;
$w = 'iec.reqItemId1 = '.$_itemId.' OR iec.reqItemId2 = '.$_itemId.' OR iec.reqItemId3 = '.$_itemId.' OR iec.reqItemId4 = '.$_itemId.' OR iec.reqItemId5 = '.$_itemId; $w = 'iec.reqItemId1 = '.$_itemId.' OR iec.reqItemId2 = '.$_itemId.' OR iec.reqItemId3 = '.$_itemId.' OR iec.reqItemId4 = '.$_itemId.' OR iec.reqItemId5 = '.$_itemId;
} }
@@ -208,11 +225,9 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$boughtBy = new ItemList(array(['id', $boughtBy])); $boughtBy = new ItemList(array(['id', $boughtBy]));
if (!$boughtBy->error) if (!$boughtBy->error)
{ {
$boughtBy->addGlobalsToJscript(); $this->lvData[] = array(
$pageData['relTabs'][] = array(
'file' => 'item', 'file' => 'item',
'data' => $boughtBy->getListviewData(ITEMINFO_VENDOR, [TYPE_CURRENCY => $_id]), 'data' => $boughtBy->getListviewData(ITEMINFO_VENDOR, [TYPE_CURRENCY => $this->typeId]),
'params' => [ 'params' => [
'tabs' => '$tabsRelated', 'tabs' => '$tabsRelated',
'name' => '$LANG.tab_currencyfor', 'name' => '$LANG.tab_currencyfor',
@@ -221,18 +236,11 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'note' => $n ? '$$WH.sprintf(LANG.lvnote_filterresults, \''.$n.'\')' : null 'note' => $n ? '$$WH.sprintf(LANG.lvnote_filterresults, \''.$n.'\')' : null
] ]
); );
$this->extendGlobalData($boughtBy->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
}
} }
} }
$smarty->saveCache($cacheKeyPage, $pageData);
} }
$smarty->updatePageVars($pageData['page']);
$smarty->assign('community', CommunityContent::getAll(TYPE_CURRENCY, $_id)); // comments, screenshots, videos
$smarty->assign('lang', array_merge(Lang::$main));
$smarty->assign('lvData', $pageData['relTabs']);
// load the page
$smarty->display('detail-page-generic.tpl');
?> ?>

View File

@@ -4,120 +4,121 @@ if (!defined('AOWOW_REVISION'))
die('illegal access'); die('illegal access');
require 'includes/community.class.php'; // menuId 11: Object g_initPath()
// tabId 0: Database g_initHeader()
$_id = intVal($pageParam); class EventPage extends GenericPage
$_path = [0, 11];
$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_WORLDEVENT, $_id, -1, User::$localeId]);
if (!$smarty->loadCache($cacheKeyPage, $pageData))
{ {
$conditions = []; use DetailPage;
if ($_id < 0)
$conditions[] = ['id', -$_id];
else
$conditions[] = ['holidayId', $_id];
$event = new WorldEventList($conditions); protected $type = TYPE_WORLDEVENT;
if ($event->error) protected $typeId = 0;
$smarty->notFound(Lang::$game['event'], $_id); protected $tpl = 'detail-page-generic';
protected $path = [0, 11];
protected $tabId = 0;
protected $mode = CACHETYPE_PAGE;
$_hId = $event->getField('holidayId'); private $hId = 0;
$_eId = $event->getField('eventBak'); private $eId = 0;
public function __construct($__, $id)
{
parent::__construct();
$this->typeId = intVal($id);
$conditions = $this->typeId < 0 ? [['id', -$this->typeId]] : [['holidayId', $this->typeId]];
$this->subject = new WorldEventList($conditions);
if ($this->subject->error)
$this->notFound(Lang::$game['event']);
$this->hId = $this->subject->getField('holidayId');
$this->eId = $this->subject->getField('eventBak');
// redirect if associated with a holiday // redirect if associated with a holiday
if ($_hId && $_id != $_hId) if ($this->hId && $this->typeId != $this->hId)
header('Location: '.HOST_URL.'?event='.$_hId); header('Location: '.HOST_URL.'?event='.$this->hId);
$hasFilter = in_array($_hId, [372, 283, 285, 353, 420, 400, 284, 201, 374, 409, 141, 324, 321, 424, 335, 327, 341, 181, 404, 398, 301]); $this->name = $this->subject->getField('name', true);
}
if ($_hId) protected function generatePath()
{ {
switch ($event->getField('scheduleType')) switch ($this->subject->getField('scheduleType'))
{ {
case -1: $_path[] = 1; break; case '': $this->path[] = 0; break;
case -1: $this->path[] = 1; break;
case 0: case 0:
case 1: $_path[] = 2; break; case 1: $this->path[] = 2; break;
case 2: $_path[] = 3; break; case 2: $this->path[] = 3; break;
} }
} }
else
$_path[] = 0;
protected function generateTitle()
{
array_unshift($this->title, $this->subject->getField('name', true), Util::ucFirst(Lang::$game['event']));
}
protected function generateContent()
{
/***********/ /***********/
/* Infobox */ /* Infobox */
/***********/ /***********/
$infobox = []; $this->infobox = [];
// boss // boss
if ($_ = $event->getField('bossCreature')) if ($_ = $this->subject->getField('bossCreature'))
{ {
Util::$pageTemplate->extendGlobalIds(TYPE_NPC, $_); $this->extendGlobalIds(TYPE_NPC, $_);
$infobox[] = Lang::$npc['rank'][3].Lang::$colon.'[npc='.$_.']'; $this->infobox[] = Lang::$npc['rank'][3].Lang::$main['colon'].'[npc='.$_.']';
} }
// finalized after the cache is handled
/****************/ /****************/
/* Main Content */ /* Main Content */
/****************/ /****************/
// menuId 11: Event g_initPath() $this->headIcons = [$this->subject->getField('iconString')];
// tabId 0: Database g_initHeader() $this->redButtons = array(
$pageData = array( BUTTON_WOWHEAD => $this->typeId > 0,
'dates' => array(
'firstDate' => $event->getField('startTime'),
'lastDate' => $event->getField('endTime'),
'length' => $event->getField('length'),
'rec' => $event->getField('occurence')
),
'page' => array(
'title' => $event->getField('name', true).' - '.Util::ucFirst(Lang::$game['event']),
'name' => $event->getField('name', true),
'path' => json_encode($_path, JSON_NUMERIC_CHECK),
'tab' => 0,
'type' => TYPE_WORLDEVENT,
'typeId' => $_id,
'infobox' => $infobox,
'headIcons' => [$event->getField('iconString')],
'redButtons' => array(
BUTTON_WOWHEAD => $_id > 0,
BUTTON_LINKS => true BUTTON_LINKS => true
) );
), $this->dates = array(
'relTabs' => [] 'firstDate' => $this->subject->getField('startTime'),
'lastDate' => $this->subject->getField('endTime'),
'length' => $this->subject->getField('length'),
'rec' => $this->subject->getField('occurence')
); );
/**************/ /**************/
/* Extra Tabs */ /* Extra Tabs */
/**************/ /**************/
$hasFilter = in_array($this->hId, [372, 283, 285, 353, 420, 400, 284, 201, 374, 409, 141, 324, 321, 424, 335, 327, 341, 181, 404, 398, 301]);
// tab: npcs // tab: npcs
if ($npcIds = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, IF(ec.eventEntry > 0, 1, 0) AS added FROM creature c, game_event_creature ec WHERE ec.guid = c.guid AND ABS(ec.eventEntry) = ?d', $_eId)) if ($npcIds = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, IF(ec.eventEntry > 0, 1, 0) AS added FROM creature c, game_event_creature ec WHERE ec.guid = c.guid AND ABS(ec.eventEntry) = ?d', $this->eId))
{ {
$creatures = new CreatureList(array(['id', array_keys($npcIds)])); $creatures = new CreatureList(array(['id', array_keys($npcIds)]));
if (!$creatures->error) if (!$creatures->error)
{ {
$data = $creatures->getListviewData(); $data = $creatures->getListviewData();
foreach ($data as &$d) foreach ($data as &$d)
$d['method'] = $npcIds[$d['id']]; $d['method'] = $npcIds[$d['id']];
$pageData['relTabs'][] = array( $this->lvData[] = array(
'file' => CreatureList::$brickFile, 'file' => CreatureList::$brickFile,
'data' => $data, 'data' => $data,
'params' => array( 'params' => array(
'tabs' => '$tabsRelated', 'tabs' => '$tabsRelated',
'note' => $hasFilter ? sprintf(Util::$filterResultString, '?npcs&filter=cr=38;crs='.$_hId.';crv=0') : null 'note' => $hasFilter ? sprintf(Util::$filterResultString, '?npcs&filter=cr=38;crs='.$this->hId.';crv=0') : null
) )
); );
} }
} }
// tab: objects // tab: objects
if ($objectIds = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, IF(eg.eventEntry > 0, 1, 0) AS added FROM gameobject g, game_event_gameobject eg WHERE eg.guid = g.guid AND ABS(eg.eventEntry) = ?d', $_eId)) if ($objectIds = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, IF(eg.eventEntry > 0, 1, 0) AS added FROM gameobject g, game_event_gameobject eg WHERE eg.guid = g.guid AND ABS(eg.eventEntry) = ?d', $this->eId))
{ {
$objects = new GameObjectList(array(['id', array_keys($objectIds)])); $objects = new GameObjectList(array(['id', array_keys($objectIds)]));
if (!$objects->error) if (!$objects->error)
@@ -126,32 +127,32 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
foreach ($data as &$d) foreach ($data as &$d)
$d['method'] = $objectIds[$d['id']]; $d['method'] = $objectIds[$d['id']];
$pageData['relTabs'][] = array( $this->lvData[] = array(
'file' => GameObjectList::$brickFile, 'file' => GameObjectList::$brickFile,
'data' => $data, 'data' => $data,
'params' => array( 'params' => array(
'tabs' => '$tabsRelated', 'tabs' => '$tabsRelated',
'note' => $hasFilter ? sprintf(Util::$filterResultString, '?objects&filter=cr=16;crs='.$_hId.';crv=0') : null 'note' => $hasFilter ? sprintf(Util::$filterResultString, '?objects&filter=cr=16;crs='.$this->hId.';crv=0') : null
) )
); );
} }
} }
// tab: achievements // tab: achievements
if ($_ = $event->getField('achievementCatOrId')) if ($_ = $this->subject->getField('achievementCatOrId'))
{ {
$condition = $_ > 0 ? [['category', $_]] : [['id', -$_]]; $condition = $_ > 0 ? [['category', $_]] : [['id', -$_]];
$acvs = new AchievementList($condition); $acvs = new AchievementList($condition);
if (!$acvs->error) if (!$acvs->error)
{ {
$acvs->addGlobalsToJScript(GLOBALINFO_SELF | GLOBALINFO_RELATED); $this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
$pageData['relTabs'][] = array( $this->lvData[] = array(
'file' => AchievementList::$brickFile, 'file' => AchievementList::$brickFile,
'data' => $acvs->getListviewData(), 'data' => $acvs->getListviewData(),
'params' => array( 'params' => array(
'tabs' => '$tabsRelated', 'tabs' => '$tabsRelated',
'note' => $hasFilter ? sprintf(Util::$filterResultString, '?achievements&filter=cr=11;crs='.$_hId.';crv=0') : null, 'note' => $hasFilter ? sprintf(Util::$filterResultString, '?achievements&filter=cr=11;crs='.$this->hId.';crv=0') : null,
'visibleCols' => "$['category']" 'visibleCols' => "$['category']"
) )
); );
@@ -159,25 +160,25 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
} }
$itemCnd = []; $itemCnd = [];
if ($_hId) if ($this->hId)
{ {
$itemCnd = array( $itemCnd = array(
'OR', 'OR',
['holidayId', $_hId], // direct requirement on item ['holidayId', $this->hId], // direct requirement on item
); );
// tab: quests (by table, go & creature) // tab: quests (by table, go & creature)
$quests = new QuestList(array(['holidayId', $_hId])); $quests = new QuestList(array(['holidayId', $this->hId]));
if (!$quests->error) if (!$quests->error)
{ {
$quests->addGlobalsToJScript(GLOBALINFO_SELF | GLOBALINFO_REWARDS); $this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_REWARDS));
$pageData['relTabs'][] = array( $this->lvData[] = array(
'file' => QuestList::$brickFile, 'file' => QuestList::$brickFile,
'data' => $quests->getListviewData(), 'data' => $quests->getListviewData(),
'params' => array( 'params' => array(
'tabs' => '$tabsRelated', 'tabs' => '$tabsRelated',
'note' => $hasFilter ? sprintf(Util::$filterResultString, '?quests&filter=cr=33;crs='.$_hId.';crv=0') : null 'note' => $hasFilter ? sprintf(Util::$filterResultString, '?quests&filter=cr=33;crs='.$this->hId.';crv=0') : null
) )
); );
@@ -209,54 +210,54 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$eventItems = new ItemList($itemCnd); $eventItems = new ItemList($itemCnd);
if (!$eventItems->error) if (!$eventItems->error)
{ {
$eventItems->addGlobalsToJScript(GLOBALINFO_SELF); $this->extendGlobalData($eventItems->getJSGlobals(GLOBALINFO_SELF));
$pageData['relTabs'][] = array( $this->lvData[] = array(
'file' => ItemList::$brickFile, 'file' => ItemList::$brickFile,
'data' => $eventItems->getListviewData(), 'data' => $eventItems->getListviewData(),
'params' => array( 'params' => array(
'tabs' => '$tabsRelated', 'tabs' => '$tabsRelated',
'note' => $hasFilter ? sprintf(Util::$filterResultString, '?items&filter=cr=160;crs='.$_hId.';crv=0') : null 'note' => $hasFilter ? sprintf(Util::$filterResultString, '?items&filter=cr=160;crs='.$this->hId.';crv=0') : null
) )
); );
} }
} }
// tab: see also (event conditions) // tab: see also (event conditions)
if ($rel = DB::Aowow()->selectCol('SELECT IF(eventEntry = prerequisite_event, NULL, IF(eventEntry = ?d, -prerequisite_event, eventEntry)) FROM game_event_prerequisite WHERE prerequisite_event = ?d OR eventEntry = ?d', $_eId, $_eId, $_eId)) if ($rel = DB::Aowow()->selectCol('SELECT IF(eventEntry = prerequisite_event, NULL, IF(eventEntry = ?d, -prerequisite_event, eventEntry)) FROM game_event_prerequisite WHERE prerequisite_event = ?d OR eventEntry = ?d', $this->eId, $this->eId, $this->eId))
{ {
$list = []; $list = [];
array_walk($rel, function(&$v, $k) use (&$list) { array_walk($rel, function($v, $k) use (&$list) {
if ($v > 0) if ($v > 0)
$list[] = $v; $list[] = $v;
else if ($v === null) else if ($v === null)
Util::$pageTemplate->internalNotice(U_GROUP_EMPLOYEE, 'game_event_prerequisite: this event has itself as prerequisite'); Util::addNote(U_GROUP_EMPLOYEE, 'game_event_prerequisite: this event has itself as prerequisite');
}); });
if ($list) if ($list)
{ {
$relEvents = new WorldEventList(array(['id', $list])); $relEvents = new WorldEventList(array(['id', $list]));
$relEvents->addGlobalsToJscript(); $this->extendGlobalData($relEvents->getJSGlobals());
$relData = $relEvents->getListviewData(true); $relData = $relEvents->getListviewData();
foreach ($relEvents->iterate() as $id => $__) foreach ($relEvents->iterate() as $id => $__)
{ {
$relData[$id]['condition'] = array( $relData[$id]['condition'][] = array(
'type' => TYPE_WORLDEVENT, 'type' => TYPE_WORLDEVENT,
'typeId' => -$_eId, 'typeId' => -$this->eId,
'status' => 2 'status' => 2
); );
} }
$event->addGlobalsToJscript(); $this->extendGlobalData($this->subject->getJSGlobals());
foreach ($rel as $r) foreach ($rel as $r)
{ {
if ($r >= 0) if ($r >= 0)
continue; continue;
Util::$pageTemplate->extendGlobalIds(TYPE_WORLDEVENT, -$r); $this->extendGlobalIds(TYPE_WORLDEVENT, -$r);
$d = $event->getListviewData(true); $d = $this->subject->getListviewData();
$d[-$_eId]['condition'][] = array( $d[-$this->eId]['condition'][] = array(
'type' => TYPE_WORLDEVENT, 'type' => TYPE_WORLDEVENT,
'typeId' => $r, 'typeId' => $r,
'status' => 2 'status' => 2
@@ -265,7 +266,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$relData = array_merge($relData, $d); $relData = array_merge($relData, $d);
} }
$pageData['relTabs'][] = array( $this->lvData[] = array(
'file' => WorldEventList::$brickFile, 'file' => WorldEventList::$brickFile,
'data' => $relData, 'data' => $relData,
'params' => array( 'params' => array(
@@ -278,42 +279,57 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
); );
} }
} }
$smarty->saveCache($cacheKeyPage, $pageData);
} }
/***********/ protected function postCache()
/* Infobox */ {
/***********/ /********************/
/* finalize infobox */
/********************/
$updated = WorldEventList::updateDates($pageData['dates']); // update dates to now()
$updated = WorldEventList::updateDates($this->dates);
// start // start
if ($updated['end']) if ($updated['start'])
array_push($pageData['page']['infobox'], Lang::$event['start'].Lang::$colon.date(Lang::$dateFmtLong, $updated['start'])); array_push($this->infobox, Lang::$event['start'].Lang::$main['colon'].date(Lang::$main['dateFmtLong'], $updated['start']));
// end // end
if ($updated['end']) if ($updated['end'])
array_push($pageData['page']['infobox'], Lang::$event['end'].Lang::$colon.date(Lang::$dateFmtLong, $updated['end'])); array_push($this->infobox, Lang::$event['end'].Lang::$main['colon'].date(Lang::$main['dateFmtLong'], $updated['end']));
// occurence // occurence
if ($updated['rec'] > 0) if ($updated['rec'] > 0)
array_push($pageData['page']['infobox'], Lang::$event['interval'].Lang::$colon.Util::formatTime($updated['rec'] * 1000)); array_push($this->infobox, Lang::$event['interval'].Lang::$main['colon'].Util::formatTime($updated['rec'] * 1000));
// in progress // in progress
if ($updated['start'] < time() && $updated['end'] > time()) if ($updated['start'] < time() && $updated['end'] > time())
array_push($pageData['page']['infobox'], '[span class=q2]'.Lang::$event['inProgress'].'[/span]'); array_push($this->infobox, '[span class=q2]'.Lang::$event['inProgress'].'[/span]');
$pageData['page']['infobox'] = '[ul][li]'.implode('[/li][li]', $pageData['page']['infobox']).'[/li][/ul]'; $this->infobox = '[ul][li]'.implode('[/li][li]', $this->infobox).'[/li][/ul]';
/***************************/
/* finalize related events */
/***************************/
foreach($this->lvData as &$view)
{
if ($view['file'] != WorldEventList::$brickFile)
continue;
foreach ($view['data'] as &$data)
{
$updated = WorldEventList::updateDates($data['_date']);
unset($data['_date']);
$data['startDate'] = $updated['start'] ? date(Util::$dateFormatInternal, $updated['start']) : false;
$data['endDate'] = $updated['end'] ? date(Util::$dateFormatInternal, $updated['end']) : false;
$data['rec'] = $updated['rec'];
}
}
$smarty->updatePageVars($pageData['page']); }
$smarty->assign('community', CommunityContent::getAll(TYPE_WORLDEVENT, $_id)); // comments, screenshots, videos }
$smarty->assign('lang', array_merge(Lang::$main));
$smarty->assign('lvData', $pageData['relTabs']);
// load the page
$smarty->display('detail-page-generic.tpl');
?> ?>

View File

@@ -4,23 +4,35 @@ if (!defined('AOWOW_REVISION'))
die('illegal access'); die('illegal access');
$cat = Util::extractURLParams($pageParam); // menuId 11: Event g_initPath()
// tabId 0: Database g_initHeader()
class EventsPage extends GenericPage
{
use ListPage;
protected $type = TYPE_WORLDEVENT;
protected $tpl = 'list-page-generic';
protected $path = [0, 11];
protected $tabId = 0;
protected $mode = CACHETYPE_PAGE;
protected $validCats = [0, 1, 2, 3];
public function __construct($pageCall, $pageParam)
{
$this->getCategoryFromUrl($pageParam);;
parent::__construct();
$this->name = Util::ucFirst(Lang::$game['events']);
}
protected function generateContent()
{
$condition = []; $condition = [];
$path = [0, 11];
$validCats = [0, 1, 2, 3];
$title = [Lang::$game['events']];
$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_WORLDEVENT, -1, $cat ? $cat[0] : -1, User::$localeId]);
if (!Util::isValidPage($validCats, $cat)) if ($this->category)
$smarty->error();
if (!$smarty->loadCache($cacheKey, $pageData))
{ {
if ($cat) switch ($this->category[0])
{
$path[] = $cat[0];
array_unshift($title, Lang::$event['category'][$cat[0]]);
switch ($cat[0])
{ {
case 0: $condition[] = ['e.holidayId', 0]; break; case 0: $condition[] = ['e.holidayId', 0]; break;
case 1: $condition[] = ['h.scheduleType', -1]; break; case 1: $condition[] = ['h.scheduleType', -1]; break;
@@ -30,33 +42,20 @@ if (!$smarty->loadCache($cacheKey, $pageData))
} }
$events = new WorldEventList($condition); $events = new WorldEventList($condition);
$events->addGlobalsToJScript(); $this->extendGlobalData($events->getJSGlobals());
$deps = []; $this->deps = [];
foreach ($events->iterate() as $__) foreach ($events->iterate() as $__)
if ($d = $events->getField('requires')) if ($d = $events->getField('requires'))
$deps[$events->id] = $d; $this->deps[$events->id] = $d;
$this->lvData[] = array(
// menuId 11: Event g_initPath()
// tabId 0: Database g_initHeader()
$pageData = array(
'page' => array(
'tab' => 0,
'title' => implode(" - ", $title),
'path' => json_encode($path, JSON_NUMERIC_CHECK)
),
'lv' => [],
'deps' => $deps
);
$pageData['lv'][] = array(
'file' => 'event', 'file' => 'event',
'data' => $events->getListviewData(), 'data' => $events->getListviewData(),
'params' => ['tabs' => '$myTabs'] 'params' => ['tabs' => '$myTabs']
); );
$pageData['lv'][] = array( $this->lvData[] = array(
'file' => 'calendar', 'file' => 'calendar',
'data' => array_filter($events->getListviewData(), function($x) {return $x['id'] > 0;}), 'data' => array_filter($events->getListviewData(), function($x) {return $x['id'] > 0;}),
'params' => array( 'params' => array(
@@ -64,17 +63,30 @@ if (!$smarty->loadCache($cacheKey, $pageData))
'hideCount' => 1 'hideCount' => 1
) )
); );
$smarty->saveCache($cacheKey, $pageData);
} }
// recalculate dates with now(); can't be cached, obviously protected function generateTitle()
foreach ($pageData['lv'] as &$views) {
array_unshift($this->title, $this->name);
if ($this->category)
array_unshift($this->title, Lang::$event['category'][$this->category[0]]);
}
protected function generatePath()
{
if ($this->category)
$this->path[] = $this->category[0];
}
protected function postCache()
{
// recalculate dates with now()
foreach ($this->lvData as &$views)
{ {
foreach ($views['data'] as &$data) foreach ($views['data'] as &$data)
{ {
// is a followUp-event // is a followUp-event
if (!empty($pageData['deps'][$data['id']])) if (!empty($this->deps[$data['id']]))
{ {
$data['startDate'] = $data['endDate'] = false; $data['startDate'] = $data['endDate'] = false;
unset($data['_date']); unset($data['_date']);
@@ -88,13 +100,7 @@ foreach ($pageData['lv'] as &$views)
$data['rec'] = $updated['rec']; $data['rec'] = $updated['rec'];
} }
} }
}
}
$smarty->updatePageVars($pageData['page']);
$smarty->assign('lang', Lang::$main);
$smarty->assign('lvData', $pageData['lv']);
// load the page
$smarty->display('list-page-generic.tpl');
?> ?>

View File

@@ -4,39 +4,61 @@ if (!defined('AOWOW_REVISION'))
die('illegal access'); die('illegal access');
require 'includes/community.class.php'; // menuId 7: Faction g_initPath()
// tabId 0: Database g_initHeader()
$_id = intVal($pageParam); class FactionPage extends GenericPage
$_path = [0, 7];
$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_FACTION, $_id, -1, User::$localeId]);
if (!$smarty->loadCache($cacheKeyPage, $pageData))
{ {
$faction = new FactionList(array(['id', $_id])); use DetailPage;
if ($faction->error)
$smarty->notFound(Lang::$game['faction'], $_id);
if ($foo = $faction->getField('cat')) protected $type = TYPE_FACTION;
protected $typeId = 0;
protected $tpl = 'detail-page-generic';
protected $path = [0, 7];
protected $tabId = 0;
protected $mode = CACHETYPE_PAGE;
public function __construct($__, $id)
{ {
if ($bar = $faction->getField('cat2')) parent::__construct();
$_path[] = $bar;
$_path[] = $foo; $this->typeId = intVal($id);
$this->subject = new FactionList(array(['id', $this->typeId]));
if ($this->subject->error)
$smarty->notFound(Lang::$game['faction']);
$this->name = $this->subject->getField('name', true);
} }
protected function generatePath()
{
if ($foo = $this->subject->getField('cat'))
{
if ($bar = $this->subject->getField('cat2'))
$this->path[] = $bar;
$this->path[] = $foo;
}
}
protected function generateTitle()
{
array_unshift($this->title, $this->subject->getField('name', true), Util::ucFirst(Lang::$game['faction']));
}
protected function generateContent()
{
/***********/ /***********/
/* Infobox */ /* Infobox */
/***********/ /***********/
$infobox = []; $infobox = [];
// Quartermaster if any // Quartermaster if any
if ($ids = $faction->getField('qmNpcIds')) if ($ids = $this->subject->getField('qmNpcIds'))
{ {
Util::$pageTemplate->extendGlobalIds(TYPE_NPC, $ids); $this->extendGlobalIds(TYPE_NPC, $ids);
$qmStr = Lang::$faction['quartermaster'].Lang::$colon; $qmStr = Lang::$faction['quartermaster'].Lang::$main['colon'];
if (count($ids) == 1) if (count($ids) == 1)
$qmStr .= '[npc='.$ids[0].']'; $qmStr .= '[npc='.$ids[0].']';
@@ -53,31 +75,18 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
} }
// side if any // side if any
if ($_ = $faction->getField('side')) if ($_ = $this->subject->getField('side'))
$infobox[] = Lang::$main['side'].Lang::$colon.'[span class=icon-'.($_ == 1 ? 'alliance' : 'horde').']'.Lang::$game['si'][$_].'[/span]'; $infobox[] = Lang::$main['side'].Lang::$main['colon'].'[span class=icon-'.($_ == 1 ? 'alliance' : 'horde').']'.Lang::$game['si'][$_].'[/span]';
/****************/ /****************/
/* Main Content */ /* Main Content */
/****************/ /****************/
// menuId 7: Faction g_initPath() $this->extraText = '';
// tabId 0: Database g_initHeader() $this->infobox = $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null;
$pageData = array( $this->redButtons = array(
'page' => array(
'title' => $faction->getField('name', true)." - ".Util::ucfirst(Lang::$game['faction']),
'path' => json_encode($_path, JSON_NUMERIC_CHECK),
'tab' => 0,
'type' => TYPE_FACTION,
'typeId' => $_id,
'extraText' => '',
'infobox' => $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null,
'redButtons' => array(
BUTTON_WOWHEAD => true, BUTTON_WOWHEAD => true,
BUTTON_LINKS => true BUTTON_LINKS => true
),
'name' => $faction->getField('name', true)
),
'relTabs' => []
); );
// Spillover Effects // Spillover Effects
@@ -86,34 +95,34 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
CONCAT_WS(" ", faction1, faction2, faction3, faction4) AS faction, CONCAT_WS(" ", faction1, faction2, faction3, faction4) AS faction,
CONCAT_WS(" ", rate_1, rate_2, rate_3, rate_4) AS rate, CONCAT_WS(" ", rate_1, rate_2, rate_3, rate_4) AS rate,
CONCAT_WS(" ", rank_1, rank_2, rank_3, rank_4) AS rank CONCAT_WS(" ", rank_1, rank_2, rank_3, rank_4) AS rank
FROM reputation_spillover_template WHERE faction = ?d', $_id); FROM reputation_spillover_template WHERE faction = ?d', $this->typeId);
*/ */
$conditions = array( $conditions = array(
['id', $_id, '!'], // not self ['id', $this->typeId, '!'], // not self
['reputationIndex', -1, '!'] // only gainable ['reputationIndex', -1, '!'] // only gainable
); );
if ($p = $faction->getField('parentFactionId')) // linked via parent if ($p = $this->subject->getField('parentFactionId')) // linked via parent
$conditions[] = ['OR', ['id', $p], ['parentFactionId', $p]]; $conditions[] = ['OR', ['id', $p], ['parentFactionId', $p]];
else else
$conditions[] = ['parentFactionId', $_id]; // self as parent $conditions[] = ['parentFactionId', $this->typeId]; // self as parent
$spillover = new FactionList($conditions); $spillover = new FactionList($conditions);
$spillover->addGlobalsToJscript(); $this->extendGlobalData($spillover->getJSGlobals());
$buff = [];
$buff = '';
foreach ($spillover->iterate() as $spillId => $__) foreach ($spillover->iterate() as $spillId => $__)
if ($val = ($spillover->getField('spilloverRateIn') * $faction->getField('spilloverRateOut') * 100)) if ($val = ($spillover->getField('spilloverRateIn') * $this->subject->getField('spilloverRateOut') * 100))
$buff[] = '[tr][td][faction='.$spillId.'][/td][td][span class=q'.($val > 0 ? '2]+' : '10]').$val.'%[/span][/td][td]'.Lang::$game['rep'][$spillover->getField('spilloverMaxRank')].'[/td][/tr]'; $buff .= '[tr][td][faction='.$spillId.'][/td][td][span class=q'.($val > 0 ? '2]+' : '10]').$val.'%[/span][/td][td]'.Lang::$game['rep'][$spillover->getField('spilloverMaxRank')].'[/td][/tr]';
if ($buff) if ($buff)
$pageData['page']['extraText'] .= '[h3 class=clear]'.Lang::$faction['spillover'].'[/h3][div margin=15px]'.Lang::$faction['spilloverDesc'].'[/div][table class=grid width=400px][tr][td width=150px][b]'.Util::ucFirst(Lang::$game['faction']).'[/b][/td][td width=100px][b]'.Lang::$spell['_value'].'[/b][/td][td width=150px][b]'.Lang::$faction['maxStanding'].'[/b][/td][/tr]'.implode('', $buff).'[/table]'; $this->extraText .= '[h3 class=clear]'.Lang::$faction['spillover'].'[/h3][div margin=15px]'.Lang::$faction['spilloverDesc'].'[/div][table class=grid width=400px][tr][td width=150px][b]'.Util::ucFirst(Lang::$game['faction']).'[/b][/td][td width=100px][b]'.Lang::$spell['_value'].'[/b][/td][td width=150px][b]'.Lang::$faction['maxStanding'].'[/b][/td][/tr]'.$buff.'[/table]';
// reward rates // reward rates
if ($rates = DB::Aowow()->selectRow('SELECT * FROM reputation_reward_rate WHERE faction = ?d', $_id)) if ($rates = DB::Aowow()->selectRow('SELECT * FROM reputation_reward_rate WHERE faction = ?d', $this->typeId))
{ {
$buff = ''; $buff = '';
foreach ($rates as $k => $v) foreach ($rates as $k => $v)
@@ -123,19 +132,19 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
switch ($k) switch ($k)
{ {
case 'quest_rate': $buff .= '[tr][td]'.Lang::$game['quests'].Lang::$colon.'[/td]'; break; case 'quest_rate': $buff .= '[tr][td]'.Lang::$game['quests'].Lang::$main['colon'].'[/td]'; break;
case 'quest_daily_rate': $buff .= '[tr][td]'.Lang::$game['quests'].' ('.Lang::$quest['daily'].')'.Lang::$colon.'[/td]'; break; case 'quest_daily_rate': $buff .= '[tr][td]'.Lang::$game['quests'].' ('.Lang::$quest['daily'].')'.Lang::$main['colon'].'[/td]'; break;
case 'quest_weekly_rate': $buff .= '[tr][td]'.Lang::$game['quests'].' ('.Lang::$quest['weekly'].')'.Lang::$colon.'[/td]'; break; case 'quest_weekly_rate': $buff .= '[tr][td]'.Lang::$game['quests'].' ('.Lang::$quest['weekly'].')'.Lang::$main['colon'].'[/td]'; break;
case 'quest_monthly_rate': $buff .= '[tr][td]'.Lang::$game['quests'].' ('.Lang::$quest['monthly'].')'.Lang::$colon.'[/td]'; break; case 'quest_monthly_rate': $buff .= '[tr][td]'.Lang::$game['quests'].' ('.Lang::$quest['monthly'].')'.Lang::$main['colon'].'[/td]'; break;
case 'creature_rate': $buff .= '[tr][td]'.Lang::$game['npcs'].Lang::$colon.'[/td]'; break; case 'creature_rate': $buff .= '[tr][td]'.Lang::$game['npcs'].Lang::$main['colon'].'[/td]'; break;
case 'spell_rate': $buff .= '[tr][td]'.Lang::$game['spells'].Lang::$colon.'[/td]'; break; case 'spell_rate': $buff .= '[tr][td]'.Lang::$game['spells'].Lang::$main['colon'].'[/td]'; break;
} }
$buff .= '[td width=30px align=right]x'.number_format($v, 1).'[/td][/tr]'; $buff .= '[td width=30px align=right]x'.number_format($v, 1).'[/td][/tr]';
} }
if ($buff) if ($buff)
$pageData['page']['extraText'] = '[h3 class=clear][Custom Reward Rate][/h3][table]'.$buff.'[/table]'; $this->extraText .= '[h3 class=clear][Custom Reward Rate][/h3][table]'.$buff.'[/table]';
} }
/**************/ /**************/
@@ -143,10 +152,10 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
/**************/ /**************/
// tab: items // tab: items
$items = new ItemList(array(['requiredFaction', $_id])); $items = new ItemList(array(['requiredFaction', $this->typeId]));
if (!$items->error) if (!$items->error)
{ {
$items->addGlobalsToJScript(GLOBALINFO_SELF); $this->extendGlobalData($items->getJSGlobals(GLOBALINFO_SELF));
$tab = array( $tab = array(
'file' => 'item', 'file' => 'item',
@@ -160,19 +169,19 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
); );
if ($items->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($items->getMatches() > CFG_SQL_LIMIT_DEFAULT)
$tab['params']['note'] = sprintf(Util::$filterResultString, '?items&filter=cr=17;crs='.$_id.';crv=0'); $tab['params']['note'] = sprintf(Util::$filterResultString, '?items&filter=cr=17;crs='.$this->typeId.';crv=0');
$pageData['relTabs'][] = $tab; $this->lvData[] = $tab;
} }
// tab: creatures with onKill reputation // tab: creatures with onKill reputation
if ($faction->getField('reputationIndex') != -1) // only if you can actually gain reputation by kills if ($this->subject->getField('reputationIndex') != -1) // only if you can actually gain reputation by kills
{ {
$cIds = DB::Aowow()->selectCol('SELECT DISTINCT cor.creature_id FROM creature_onkill_reputation cor, ?_factions f WHERE $cIds = DB::Aowow()->selectCol('SELECT DISTINCT cor.creature_id FROM creature_onkill_reputation cor, ?_factions f WHERE
(cor.RewOnKillRepValue1 > 0 AND (cor.RewOnKillRepFaction1 = ?d OR (cor.RewOnKillRepFaction1 = f.id AND f.parentFactionId = ?d AND cor.IsTeamAward1 <> 0))) OR (cor.RewOnKillRepValue1 > 0 AND (cor.RewOnKillRepFaction1 = ?d OR (cor.RewOnKillRepFaction1 = f.id AND f.parentFactionId = ?d AND cor.IsTeamAward1 <> 0))) OR
(cor.RewOnKillRepValue2 > 0 AND (cor.RewOnKillRepFaction2 = ?d OR (cor.RewOnKillRepFaction2 = f.id AND f.parentFactionId = ?d AND cor.IsTeamAward2 <> 0)))', (cor.RewOnKillRepValue2 > 0 AND (cor.RewOnKillRepFaction2 = ?d OR (cor.RewOnKillRepFaction2 = f.id AND f.parentFactionId = ?d AND cor.IsTeamAward2 <> 0)))',
$_id, $faction->getField('parentFactionId'), $this->typeId, $this->subject->getField('parentFactionId'),
$_id, $faction->getField('parentFactionId') $this->typeId, $this->subject->getField('parentFactionId')
); );
if ($cIds) if ($cIds)
@@ -180,8 +189,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$killCreatures = new CreatureList(array(['id', $cIds])); $killCreatures = new CreatureList(array(['id', $cIds]));
if (!$killCreatures->error) if (!$killCreatures->error)
{ {
$killCreatures->addGlobalsToJscript();
$tab = array( $tab = array(
'file' => 'creature', 'file' => 'creature',
'data' => $killCreatures->getListviewData(), 'data' => $killCreatures->getListviewData(),
@@ -192,21 +199,19 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
); );
if ($killCreatures->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($killCreatures->getMatches() > CFG_SQL_LIMIT_DEFAULT)
$tab['params']['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=42;crs='.$_id.';crv=0'); $tab['params']['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=42;crs='.$this->typeId.';crv=0');
$pageData['relTabs'][] = $tab; $this->lvData[] = $tab;
} }
} }
} }
// tab: members // tab: members
if ($_ = $faction->getField('templateIds')) if ($_ = $this->subject->getField('templateIds'))
{ {
$members = new CreatureList(array(['faction', $_])); $members = new CreatureList(array(['faction', $_]));
if (!$members->error) if (!$members->error)
{ {
$members->addGlobalsToJscript();
$tab = array( $tab = array(
'file' => 'creature', 'file' => 'creature',
'data' => $members->getListviewData(), 'data' => $members->getListviewData(),
@@ -219,19 +224,19 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
); );
if ($members->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($members->getMatches() > CFG_SQL_LIMIT_DEFAULT)
$tab['params']['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=3;crs='.$_id.';crv=0'); $tab['params']['note'] = sprintf(Util::$filterResultString, '?npcs&filter=cr=3;crs='.$this->typeId.';crv=0');
$pageData['relTabs'][] = $tab; $this->lvData[] = $tab;
} }
} }
// tab: objects // tab: objects
if ($_ = $faction->getField('templateIds')) if ($_ = $this->subject->getField('templateIds'))
{ {
$objects = new GameObjectList(array(['faction', $_])); $objects = new GameObjectList(array(['faction', $_]));
if (!$objects->error) if (!$objects->error)
{ {
$pageData['relTabs'][] = array( $this->lvData[] = array(
'file' => 'object', 'file' => 'object',
'data' => $objects->getListviewData(), 'data' => $objects->getListviewData(),
'params' => array( 'params' => array(
@@ -243,21 +248,21 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
// tab: quests // tab: quests
$conditions = array( $conditions = array(
['AND', ['rewardFactionId1', $_id], ['rewardFactionValue1', 0, '>']], ['AND', ['rewardFactionId1', $this->typeId], ['rewardFactionValue1', 0, '>']],
['AND', ['rewardFactionId2', $_id], ['rewardFactionValue2', 0, '>']], ['AND', ['rewardFactionId2', $this->typeId], ['rewardFactionValue2', 0, '>']],
['AND', ['rewardFactionId3', $_id], ['rewardFactionValue3', 0, '>']], ['AND', ['rewardFactionId3', $this->typeId], ['rewardFactionValue3', 0, '>']],
['AND', ['rewardFactionId4', $_id], ['rewardFactionValue4', 0, '>']], ['AND', ['rewardFactionId4', $this->typeId], ['rewardFactionValue4', 0, '>']],
['AND', ['rewardFactionId5', $_id], ['rewardFactionValue5', 0, '>']], ['AND', ['rewardFactionId5', $this->typeId], ['rewardFactionValue5', 0, '>']],
'OR' 'OR'
); );
$quests = new QuestList($conditions); $quests = new QuestList($conditions);
if (!$quests->error) if (!$quests->error)
{ {
$quests->addGlobalsToJScript(GLOBALINFO_ANY); $this->extendGlobalData($quests->getJSGlobals(GLOBALINFO_ANY));
$tab = array( $tab = array(
'file' => 'quest', 'file' => 'quest',
'data' => $quests->getListviewData($_id), 'data' => $quests->getListviewData($this->typeId),
'showRep' => true, 'showRep' => true,
'params' => array( 'params' => array(
'tabs' => '$tabsRelated', 'tabs' => '$tabsRelated',
@@ -266,22 +271,22 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
); );
if ($quests->getMatches() > CFG_SQL_LIMIT_DEFAULT) if ($quests->getMatches() > CFG_SQL_LIMIT_DEFAULT)
$tab['params']['note'] = sprintf(Util::$filterResultString, '?quests&filter=cr=1;crs='.$_id.';crv=0'); $tab['params']['note'] = sprintf(Util::$filterResultString, '?quests&filter=cr=1;crs='.$this->typeId.';crv=0');
$pageData['relTabs'][] = $tab; $this->lvData[] = $tab;
} }
// tab: achievements // tab: achievements
$conditions = array( $conditions = array(
['ac.type', ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION], ['ac.type', ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION],
['ac.value1', $_id] ['ac.value1', $this->typeId]
); );
$acvs = new AchievementList($conditions); $acvs = new AchievementList($conditions);
if (!$acvs->error) if (!$acvs->error)
{ {
$acvs->addGlobalsToJScript(GLOBALINFO_ANY); $this->extendGlobalData($acvs->getJSGlobals(GLOBALINFO_ANY));
$pageData['relTabs'][] = array( $this->lvData[] = array(
'file' => 'achievement', 'file' => 'achievement',
'data' => $acvs->getListviewData(), 'data' => $acvs->getListviewData(),
'params' => array( 'params' => array(
@@ -292,17 +297,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
) )
); );
} }
}
$smarty->saveCache($cacheKeyPage, $pageData);
} }
$smarty->updatePageVars($pageData['page']);
$smarty->assign('community', CommunityContent::getAll(TYPE_FACTION, $_id)); // comments, screenshots, videos
$smarty->assign('lang', array_merge(Lang::$main, [Lang::$colon]));
$smarty->assign('lvData', $pageData['relTabs']);
// load the page
$smarty->display('detail-page-generic.tpl');
?> ?>

View File

@@ -4,78 +4,88 @@ if (!defined('AOWOW_REVISION'))
die('illegal access'); die('illegal access');
$cats = Util::extractURLParams($pageParam); // menuId 7: Faction g_initPath()
$path = [0, 7]; // tabId 0: Database g_initHeader()
$title = [Util::ucFirst(Lang::$game['factions'])]; class FactionsPage extends GenericPage
$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_FACTION, -1, implode('.', $cats), User::$localeId]); {
$validCats = array( use ListPage;
protected $type = TYPE_FACTION;
protected $tpl = 'list-page-generic';
protected $path = [0, 7];
protected $tabId = 0;
protected $mode = CACHETYPE_PAGE;
protected $validCats = array(
1118 => [469, 891, 67, 892, 169], 1118 => [469, 891, 67, 892, 169],
980 => [936], 980 => [936],
1097 => [1037, 1052, 1117], 1097 => [1037, 1052, 1117],
0 => true 0 => true
); );
if (!Util::isValidPage($validCats, $cats)) public function __construct($pageCall, $pageParam)
$smarty->error(); {
$this->getCategoryFromUrl($pageParam);;
if (!$smarty->loadCache($cacheKey, $pageData)) parent::__construct();
$this->name = Util::ucFirst(Lang::$game['factions']);
}
protected function generateContent()
{ {
$conditions = []; $conditions = [];
if (!User::isInGroup(U_GROUP_STAFF)) // unlisted factions if (!User::isInGroup(U_GROUP_STAFF)) // unlisted factions
$conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0]; $conditions[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0];
if (isset($cats[0]) && empty($cats[1])) if (isset($this->category[1]))
$conditions[] = ['parentFactionId', $this->category[1]];
else if (isset($this->category[0]))
{ {
if (!$cats[0]) if (!$this->category[0])
$conditions[] = ['parentFactionId', [1118, 980, 1097, 469, 891, 67, 892, 169, 1037, 1052, 1117, 936], '!']; $conditions[] = ['parentFactionId', [1118, 980, 1097, 469, 891, 67, 892, 169, 1037, 1052, 1117, 936], '!'];
else else
{ {
$subs = DB::Aowow()->selectCol('SELECT id FROM ?_factions WHERE parentFactionId = ?d', $cats[0]); $subs = DB::Aowow()->selectCol('SELECT id FROM ?_factions WHERE parentFactionId = ?d', $this->category[0]);
$conditions[] = ['OR', ['parentFactionId', $subs], ['id', $subs]]; $conditions[] = ['OR', ['parentFactionId', $subs], ['id', $subs]];
} }
$path[] = $cats[0];
$t = Lang::$faction['cat'][$cats[0]];
array_unshift($title, is_array($t) ? $t[0] : $t);
}
else if (!empty($cats[1]))
{
$conditions[] = ['parentFactionId', $cats[1]];
$path[] = $cats[0];
$path[] = $cats[1];
array_unshift($title, Lang::$faction['cat'][$cats[0]][$cats[1]]);
} }
$data = [];
$factions = new FactionList($conditions); $factions = new FactionList($conditions);
if (!$factions->error)
$data = $factions->getListviewData();
// menuId 7: Faction g_initPath() $this->lvData[] = array(
// tabId 0: Database g_initHeader()
$pageData = array(
'page' => array(
'title' => implode(' - ', $title),
'path' => json_encode($path, JSON_NUMERIC_CHECK),
'tab' => 0
),
'lv' => array(
array(
'file' => 'faction', 'file' => 'faction',
'data' => $factions->getListviewData(), 'data' => $data,
'params' => [] 'params' => []
)
)
); );
$smarty->saveCache($cacheKey, $pageData);
} }
protected function generateTitle()
{
array_unshift($this->title, $this->name);
if ($this->category)
{
switch (count($this->category))
{
case 1:
$t = Lang::$faction['cat'][$this->category[0]];
array_unshift($this->title, is_array($t) ? $t[0] : $t);
break;
case 2:
array_unshift($this->title, Lang::$faction['cat'][$this->category[0]][$this->category[1]]);
break;
}
}
}
$smarty->updatePageVars($pageData['page']); protected function generatePath()
$smarty->assign('lang', Lang::$main); {
$smarty->assign('lvData', $pageData['lv']); foreach ($this->category as $c)
$this->path[] = $c;
// load the page }
$smarty->display('list-page-generic.tpl'); }
?> ?>

View File

@@ -47,11 +47,6 @@ class ObjectPage extends GenericPage
$this->notFound(Lang::$game['gameObject']); $this->notFound(Lang::$game['gameObject']);
$this->name = $this->subject->getField('name', true); $this->name = $this->subject->getField('name', true);
$this->gPageInfo = array(
'type' => $this->type,
'typeId' => $this->typeId,
'name' => $this->name
);
} }
protected function generatePath() protected function generatePath()
@@ -483,7 +478,6 @@ class ObjectPage extends GenericPage
} }
} }
protected function generateTooltip($asError = false) protected function generateTooltip($asError = false)
{ {
if ($asError) if ($asError)
@@ -499,7 +493,6 @@ class ObjectPage extends GenericPage
return $x; return $x;
} }
} }
?> ?>

View File

@@ -20,7 +20,7 @@ class ObjectsPage extends GenericPage
public function __construct($pageCall, $pageParam) public function __construct($pageCall, $pageParam)
{ {
$this->category = Util::extractURLParams($pageParam); $this->getCategoryFromUrl($pageParam);;
parent::__construct(); parent::__construct();

View File

@@ -20,6 +20,8 @@ class RacePage extends GenericPage
public function __construct($__, $id) public function __construct($__, $id)
{ {
parent::__construct();
$this->typeId = intVal($id); $this->typeId = intVal($id);
$this->subject = new CharRaceList(array(['id', $this->typeId])); $this->subject = new CharRaceList(array(['id', $this->typeId]));
@@ -27,13 +29,6 @@ class RacePage extends GenericPage
$this->notFound(Lang::$game['race']); $this->notFound(Lang::$game['race']);
$this->name = $this->subject->getField('name', true); $this->name = $this->subject->getField('name', true);
$this->gPageInfo = array(
'type' => $this->type,
'typeId' => $this->typeId,
'name' => $this->name
);
parent::__construct();
} }
protected function generatePath() protected function generatePath()

View File

@@ -789,7 +789,7 @@ span.breadcrumb-ellipsis {
padding: 0; padding: 0;
} }
.minibox .text .minibox
{ {
float: right; float: right;
margin: 0 0 4px 10px; margin: 0 0 4px 10px;
@@ -804,51 +804,52 @@ span.breadcrumb-ellipsis {
border-radius: 6px; border-radius: 6px;
} }
.minibox-left .text .minibox-left
{ {
float: left; float: left;
margin-left: 0; margin-left: 0;
margin-right: 10px; margin-right: 10px;
} }
.minibox h2 .text .minibox h2
{ {
margin: 0 0 5px 0; margin: 0 0 5px 0;
font-size: 15px; font-size: 15px;
border: none; border: none;
font-weight: bold; font-weight: bold;
padding: 0px;
} }
.minibox h2, .minibox h2 b, .text .minibox h2, .text .minibox h2 b,
.minibox h2 a:link, .minibox h2 a:visited { .text .minibox h2 a:link, .text .minibox h2 a:visited {
color: white !important; color: white !important;
} }
.minibox h2 a:link, .minibox h2 a:visited { .text .minibox h2 a:link, .text .minibox h2 a:visited {
color: white; color: white;
text-decoration: none; text-decoration: none;
} }
.minibox h2 a:hover { .text .minibox h2 a:hover {
text-decoration: underline; text-decoration: underline;
} }
.minibox h3, .text .minibox h3,
.minibox h3 a:link, .minibox h3 a:visited { .text .minibox h3 a:link, .text .minibox h3 a:visited {
color: #9d9d9d !important; color: #9d9d9d !important;
font-size: 11px; font-size: 11px;
font-weight: normal; font-weight: normal;
margin: 0px; margin: 0px;
} }
.minibox h3 img { .text .minibox h3 img {
vertical-align: middle; vertical-align: middle;
} }
.minibox h3 a:link, .minibox h3 a:visited { .text .minibox h3 a:link, .text .minibox h3 a:visited {
text-decoration: underline; text-decoration: underline;
} }
.minibox h3 a:hover { .text .minibox h3 a:hover {
color: white !important; color: white !important;
} }

View File

@@ -6272,7 +6272,7 @@ Listview.extraCols = {
$WH.st(a, 'This'); $WH.st(a, 'This');
} }
else { else {
$WH.ae(a, l.name); $WH.ae(a, $WH.ct(l.name));
if (l.icon) { if (l.icon) {
a.className = 'icontiny tinyspecial'; a.className = 'icontiny tinyspecial';

View File

@@ -1,4 +1,5 @@
<?php <?php
if (!empty($this->headIcons)):
foreach ($this->headIcons as $k => $v): foreach ($this->headIcons as $k => $v):
echo '<div id="h1-icon-'.$k."\" class=\"h1-icon\"></div>\n"; echo '<div id="h1-icon-'.$k."\" class=\"h1-icon\"></div>\n";
endforeach; endforeach;
@@ -10,3 +11,4 @@ foreach ($this->headIcons as $k => $v):
endforeach; endforeach;
?> ?>
//]]></script> //]]></script>
<?php endif; ?>

View File

@@ -10,7 +10,7 @@ endif;
// ingame-links/markdown/ect // ingame-links/markdown/ect
if (isset($this->redButtons[BUTTON_LINKS])): if (isset($this->redButtons[BUTTON_LINKS])):
if ($b = $this->redButtons[BUTTON_WOWHEAD]): if ($b = $this->redButtons[BUTTON_LINKS]):
echo '<a href="javascript:;" id="open-links-button" class="button-red" onclick="this.blur(); Links.show({' . echo '<a href="javascript:;" id="open-links-button" class="button-red" onclick="this.blur(); Links.show({' .
(isset($b['color']) ? "linkColor: '".$b['color']."', " : null) . (isset($b['linkId']) ? "linkId: '".$b['linkId']."', " : null) . (isset($b['color']) ? "linkColor: '".$b['color']."', " : null) . (isset($b['linkId']) ? "linkId: '".$b['linkId']."', " : null) .
"linkName: '".Util::jsEscape(isset($b['name']) ? $b['name'] : $this->name)."', type: ".$this->type.', typeId: '.$this->typeId.' });"><em><b><i>'.Lang::$main['links'].'</i></b><span>'.Lang::$main['links'].'</span></em></a>'; "linkName: '".Util::jsEscape(isset($b['name']) ? $b['name'] : $this->name)."', type: ".$this->type.', typeId: '.$this->typeId.' });"><em><b><i>'.Lang::$main['links'].'</i></b><span>'.Lang::$main['links'].'</span></em></a>';

View File

@@ -1,19 +1,23 @@
<?php <?php
if ($this->rewards['title']):
echo $this->rewards['title'].Lang::$main['colon'].(isset($this->rewards['extra']) ? $this->rewards['extra'] : null); if (!isset($offset)) // in case we have multiple icons on the page (prominently quest-rewards)
$offset = 0;
if ($rewards['title']):
echo $rewards['title'].Lang::$main['colon'].(isset($rewards['extra']) ? $rewards['extra'] : null);
endif; endif;
if ($this->rewards['data']): if ($rewards['data']):
?> ?>
<div class="pad"></div> <div class="pad"></div>
<table class="icontab icontab-box"> <table class="icontab icontab-box">
<tr> <tr>
<?php <?php
foreach ($this->rewards['data'] as $k => $i): foreach ($rewards['data'] as $k => $i):
echo '<th id="icontab-icon'.($k + 1 + $offset).'"></th><td><span class="q'.(isset($i['quality']) ? $i['quality'] : null).'"><a href="?'.$i['typeStr'].'='.$i['id'].'">'.$i['name']."</a></span></td>\n"; echo '<th id="icontab-icon'.($k + 1 + $offset).'"></th><td><span class="q'.(isset($i['quality']) ? $i['quality'] : null).'"><a href="?'.$i['typeStr'].'='.$i['id'].'">'.$i['name']."</a></span></td>\n";
echo $k % 2 ? '</tr><tr>' : null; echo $k % 2 ? '</tr><tr>' : null;
endforeach; endforeach;
if (count($this->rewards['data']) % 2): if (count($rewards['data']) % 2):
echo '<th style="display: none"></th><td style="display: none"></td>'; echo '<th style="display: none"></th><td style="display: none"></td>';
endif; endif;
?> ?>
@@ -22,10 +26,8 @@ if ($this->rewards['data']):
<script type="text/javascript">//<![CDATA[ <script type="text/javascript">//<![CDATA[
<?php <?php
foreach ($this->rewards['data'] as $k => $i): foreach ($rewards['data'] as $k => $i):
if (isset()): echo ' $WH.ge(\'icontab-icon'.($k + 1 + $offset).'\').appendChild('.$i['globalStr'].'.createIcon('.$i['id'].', 1, '.(@$i['qty'] ?: 0)."));\n";
echo "\$WH.ge('icontab-icon".($k + 1 + $offset)."').appendChild(".$i['globalStr'].".createIcon(".$i['id'].", 1, ".(@$i['qty'] ?: 0)."));\n";
endif;
endforeach; endforeach;
?> ?>
//]]></script> //]]></script>

View File

@@ -1,4 +1,4 @@
<tr><th id="infobox-series"><?php echo $listTitle ?: Lang::$main['series']; ?></th></tr> <tr><th id="infobox-series"><?php echo $listTitle ?: Lang::$achievement['series']; ?></th></tr>
<tr><td> <tr><td>
<div class="infobox-spacer"></div> <div class="infobox-spacer"></div>
<table class="series"> <table class="series">

View File

@@ -5,6 +5,6 @@ foreach ($vars as $id => $data):
if (isset($data['namefemale'])): if (isset($data['namefemale'])):
echo ', namefemale_'.User::$localeString.':\''.Util::jsEscape($data['namefemale']).'\''; echo ', namefemale_'.User::$localeString.':\''.Util::jsEscape($data['namefemale']).'\'';
endif; endif;
echo '};' echo '};';
endforeach; endforeach;
?> ?>

View File

@@ -1,102 +0,0 @@
{include file='header.tpl'}
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
{if !empty($announcements)}
{foreach from=$announcements item=item}
{include file='bricks/announcement.tpl' an=$item}
{/foreach}
{/if}
<script type="text/javascript">//<![CDATA[
{include file='bricks/community.tpl'}
var g_pageInfo = {ldelim}type: {$type}, typeId: {$typeId}, name: '{$name|escape:"quotes"}'{rdelim}; // username:XXX in profiles
g_initPath({$path});
//]]></script>
{include file='bricks/infobox.tpl' info=$infobox series=$series}
<div class="text">
{include file='bricks/headIcons.tpl'}
{include file='bricks/redButtons.tpl'}
<h1{if isset($expansion)} class="h1-icon"><span class="icon-{$expansion}-right">{$name}</span>{else}>{$name}{/if}</h1>
{$description}
{if !empty($criteria)}<h3>{$lang.criteria}{if $count} &ndash; <small><b>{$lang.reqNumCrt} {$count} {$lang.outOf} {$nCriteria}</b></small>{/if}</h3>{/if}
<div style="float: left; margin-right: 25px">
<table class="iconlist">
{strip}
{foreach from=$criteria item=cr name=criteria}
<tr>
<th{if isset($cr.icon)} align="right" id="iconlist-icon{$cr.icon}"{/if}>
{* for reference and standard entries *}
{if !isset($cr.icon) && (isset($cr.link) || isset($cr.standard))}
<ul><li><var>&nbsp;</var></li></ul>
{/if}
</th>
<td>
{if isset($cr.link)}<a href="{$cr.link.href}"{if isset($cr.link.quality)} class="q{$cr.link.quality}"{/if}>{$cr.link.text|escape:"html"}</a>{if isset($cr.link.count) && $cr.link.count > 1} ({$cr.link.count}){/if}{/if}
{* STANDARD TEXT *}
{if isset($cr.extra_text)} {$cr.extra_text}{/if}
{if $user.roles > 0} <small title="{$lang.criteriaType} {$cr.type}" class="q0">[{$cr.id}]</small>{/if}
</td>
</tr>
{* If the first column is over (it may be a greater element) *}
{if $smarty.foreach.criteria.index+1 == round(count($criteria) / 2)}
</table>
</div>
<div style="float: left">
<table class="iconlist">
{/if}
{/foreach}
{/strip}
</table>
</div>
<script type="text/javascript">//<![CDATA[
{foreach from=$icons key=k item=ic}
$WH.ge('iconlist-icon{$ic.itr}').appendChild({$ic.type}.createIcon({$ic.id}, 0, {if isset($ic.count) && $ic.count > 0}{$ic.count}{else}0{/if}));
{/foreach}
//]]></script>
<div style="clear: left"></div>
{if $itemReward} {* for items *}
<h3>{$lang.rewards}</h3>
{include file='bricks/rewards.tpl' rewTitle=$lang.itemReward rewData=$itemReward offset=0}
{/if}
{if $titleReward} {* for titles *}
<h3>{$lang.gains}</h3>
<ul>
{foreach from=$titleReward item=i}
<li><div>{$i}</div></li>
{/foreach}
</ul>
{/if}
{if !$titleReward && !$itemReward && $reward}
<h3>{$lang.rewards}</h3>
<ul>
<li><div>{$reward}</div></li>
</ul>
{/if}
<h2 class="clear">{$lang.related}</h2>
</div>
{include file='bricks/tabsRelated.tpl' tabs=$lvData}
{include file='bricks/contribute.tpl'}
</div><!-- main-contents -->
</div><!-- main -->
{include file='footer.tpl'}

View File

@@ -0,0 +1,117 @@
<?php $this->brick('header'); ?>
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
<?php $this->brick('announcement'); ?>
<script type="text/javascript">//<![CDATA[
<?php
$this->brick('community');
echo "var g_pageInfo = ".json_encode($this->gPageInfo, JSON_NUMERIC_CHECK).";\n" .
"g_initPath(".json_encode($this->path, JSON_NUMERIC_CHECK).");\n";
?>
//]]></script>
<?php $this->brick('infobox', ['series' => $this->series]); ?>
<div class="text">
<?php
$this->brick('headIcons');
$this->brick('redButtons');
?>
<h1><?php echo $this->name; ?></h1>
<?php
echo $this->description;
echo '<h3>'.Lang::$achievement['criteria'].($this->criteria['reqQty'] ? ' &ndash; <small><b>'.Lang::$achievement['reqNumCrt'].' '.$this->criteria['reqQty'].' '.Lang::$achievement['outOf'].' '.count($this->criteria['data']).'</b></small>' : null)."</h3>\n";
?>
<div style="float: left; margin-right: 25px">
<table class="iconlist">
<?php
foreach ($this->criteria['data'] as $i => $cr):
echo '<tr><th'.(isset($cr['icon']) ? ' align="right" id="iconlist-icon'.$cr['icon'].'"' : null).'>';
if (!isset($cr['icon'])):
echo '<ul><li><var>&nbsp;</var></li></ul>';
endif;
echo '</th><td>';
if ($l = @$cr['link']):
echo '<a href="'.$l['href'].'"'.(isset($l['quality']) ? ' class="q'.$l['quality'].'"' : null).'>'.Util::htmlEscape($l['text']).'</a>';
endif;
if (!empty($l['count']) && $l['count'] > 1):
echo ' ('.$l['count'].')';
endif;
if (isset($cr['extraText'])):
echo ' '.$cr['extraText'];
endif;
if (User::isInGroup(U_GROUP_STAFF)):
echo ' <small title="'.Lang::$achievement['criteriaType'].' '.$cr['type'].'" class="q0">['.$cr['id'].']</small>';
endif;
echo '</td></tr>';
// every odd number of elements
if ($i + 1 == round(count($this->criteria['data']) / 2)):
echo '</table></div><div style="float: left"><table class="iconlist">';
endif;
endforeach;
?>
</table>
</div>
<script type="text/javascript">//<![CDATA[
<?php
foreach ($this->criteria['icons'] as $k => $ic):
echo ' $WH.ge(\'iconlist-icon'.$ic['itr'].'\').appendChild('.$ic['type'].'.createIcon('.$ic['id'].', 0, '.(@$ic['count'] ?: 0)."));\n";
endforeach;
?>
//]]></script>
<div style="clear: left"></div>
<?php
if ($r = $this->rewards):
if (!empty($r['item'])):
echo '<h3>'.Lang::$main['rewards']."</h3>\n";
$this->brick('rewards', ['rewards' => $this->rewards['item']]);
endif;
if (!empty($r['title'])):
echo '<h3>'.Lang::$main['gains']."</h3>\n<ul>";
foreach ($r['title'] as $i):
echo ' <li><div>'.$i."</div></li>\n";
endforeach;
echo "</ul>\n";
endif;
if (empty($r['title']) && empty($r['item']) && $r['text']):
echo '<h3>'.Lang::$main['rewards']."</h3>\n" .
'<ul><li><div><'.$r['text']."</div></li></ul>\n";
endif;
endif;
?>
<h2 class="clear"><?php echo Lang::$main['related']; ?></h2>
</div>
<?php
$this->brick('tabsRelated');
$this->brick('contribute');
?>
</div><!-- main-contents -->
</div><!-- main -->
<?php $this->brick('footer'); ?>

View File

@@ -1,83 +0,0 @@
{include file='header.tpl'}
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
{if !empty($announcements)}
{foreach from=$announcements item=item}
{include file='bricks/announcement.tpl' an=$item}
{/foreach}
{/if}
<script type="text/javascript">
g_initPath({$path}, {if empty($filter.query)}0{else}1{/if});
{if isset($filter.query)}
Menu.modifyUrl(Menu.findItem(mn_database, [9]), {ldelim} filter: '+={$filter.query|escape:'quotes'}' {rdelim}, {ldelim} onAppendCollision: fi_mergeFilterParams, onAppendEmpty: fi_setFilterParams, menuUrl: Menu.getItemUrl(Menu.findItem(mn_database, [9])) {rdelim});
{/if}
</script>
<div id="fi" style="display: {if empty($filter.query)}none{else}block{/if};">
<form action="?achievements{$subCat}&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<table>
<tr>
<td>{$lang.name|ucFirst}{$lang.colon}</td>
<td colspan="3">
<table><tr>
<td>&nbsp;<input type="text" name="na" size="30" {if isset($filter.na)}value="{$filter.na}"{/if}/></td>
<td>&nbsp; <input type="checkbox" name="ex" value="on" id="achievement-ex" {if isset($filter.ex)}checked="checked"{/if}/></td>
<td><label for="achievement-ex"><span class="tip" onmouseover="$WH.Tooltip.showAtCursor(event, LANG.tooltip_extendedachievementsearch, 0, 0, 'q')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()">{$lang.extSearch}</span></label></td>
</tr></table>
</td>
</tr><tr>
<td class="padded">{$lang.side}{$lang.colon}</td>
<td class="padded">&nbsp;<select name="si">
<option></option>
{foreach from=$lang.si key=i item=str}{if $str}
<option value="{$i}" {if isset($filter.si) && $filter.si == $i}selected{/if}>{$str}</option>
{/if}{/foreach}
</select>
</td>
<td class="padded"><table><tr>
<td>&nbsp;&nbsp;&nbsp;{$lang.points}{$lang.colon}</td>
<td>&nbsp;<input type="text" name="minpt" maxlength="2" class="smalltextbox" {if isset($filter.minpt)}value="{$filter.minpt}"{/if}/> - <input type="text" name="maxpt" maxlength="2" class="smalltextbox" {if isset($filter.maxpt)}value="{$filter.maxpt}"{/if}/></td>
</tr></table></td>
</tr>
</table>
<div id="fi_criteria" class="padded criteria"><div></div></div>
<div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false">{$lang.addFilter}</a></div>
<div class="padded2">
<div style="float: right">{$lang.refineSearch}</div>
{$lang.match}{$lang.colon}<input type="radio" name="ma" value="" id="ma-0" {if !isset($filter.ma)}checked="checked"{/if} /><label for="ma-0">{$lang.allFilter}</label><input type="radio" name="ma" value="1" id="ma-1" {if isset($filter.ma)}checked="checked"{/if} /><label for="ma-1">{$lang.oneFilter}</label>
</div>
<div class="clear"></div>
<div class="padded">
<input type="submit" value="{$lang.applyFilter}" />
<input type="reset" value="{$lang.resetForm}" />
</div>
</form>
<div class="pad"></div>
</div>
<script type="text/javascript">//<![CDATA[
fi_init('achievements');
{foreach from=$filter.fi item=str}
{$str}
{/foreach}
//]]></script>
<div id="lv-generic" class="listview"></div>
<script type="text/javascript">//<![CDATA[
{include file='listviews/achievement.tpl' data=$lvData.data params=$lvData.params}
//]]></script>
<div class="clear"></div>
</div><!-- main-contents -->
</div><!-- main -->
{include file='footer.tpl'}

View File

@@ -0,0 +1,90 @@
<?php
$this->brick('header');
$f = $this->filter; // shorthand
?>
<div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div>
<div class="main-contents" id="main-contents">
<?php $this->brick('announcement'); ?>
<script type="text/javascript">
g_initPath(<?php echo json_encode($this->path, JSON_NUMERIC_CHECK).', '.(empty($f['query']) ? 0 : 1) ?>);
<?php
if (!empty($f['query'])):
// todo: update menu-class Menu.modifyUrl(Menu.findItem(mn_database, [9]), { filter: '+={$f['query']|escape:'quotes'}' }, { onAppendCollision: fi_mergeFilterParams, onAppendEmpty: fi_setFilterParams, menuUrl: Menu.getItemUrl(Menu.findItem(mn_database, [9])) });
endif;
?>
</script>
<div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block'; ?>;">
<form action="?achievements<?php echo $this->subCat; ?>&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<table>
<tr>
<td><?php echo Util::ucFirst(Lang::$main['name']).Lang::$main['colon']; ?></td>
<td colspan="3">
<table><tr>
<td>&nbsp;<input type="text" name="na" size="30" <?php echo isset($f['na']) ? 'value="'.$f['na'].'"' : null; ?>/></td>
<td>&nbsp; <input type="checkbox" name="ex" value="on" id="achievement-ex" <?php echo isset($f['ex']) ? 'checked="checked"' : null; ?>/></td>
<td><label for="achievement-ex"><span class="tip" onmouseover="$WH.Tooltip.showAtCursor(event, LANG.tooltip_extendedachievementsearch, 0, 0, 'q')" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()"><?php echo Lang::$main['extSearch']; ?></span></label></td>
</tr></table>
</td>
</tr><tr>
<td class="padded"><?php echo Lang::$main['side'].Lang::$main['colon']; ?></td>
<td class="padded">&nbsp;<select name="si">
<option></option>
<?php
foreach (Lang::$game['si'] as $i => $str):
if ($str):
echo ' <option value="'.$i.'" '.((isset($f['si']) && $f['si'] == $i) ? 'selected' : null).'>'.$str."</option>\n";
endif;
endforeach;
?>
</select>
</td>
<td class="padded"><table><tr>
<td>&nbsp;&nbsp;&nbsp;<?php echo Lang::$achievement['points'].Lang::$main['colon']; ?></td>
<td>&nbsp;<input type="text" name="minpt" maxlength="2" class="smalltextbox" <?php echo isset($f['minpt']) ? 'value="'.$f['minpt'].'"' : null; ?>/> - <input type="text" name="maxpt" maxlength="2" class="smalltextbox" <?php echo isset($f['maxpt']) ? 'value="'.$f['maxpt'].'"' : null; ?>/></td>
</tr></table></td>
</tr>
</table>
<div id="fi_criteria" class="padded criteria"><div></div></div>
<div><a href="javascript:;" id="fi_addcriteria" onclick="fi_addCriterion(this); return false"><?php echo Lang::$main['addFilter']; ?></a></div>
<div class="padded2">
<div style="float: right"><?php echo Lang::$main['refineSearch']; ?></div>
<?php echo Lang::$main['match'].Lang::$main['colon']; ?><input type="radio" name="ma" value="" id="ma-0" <?php echo !isset($f['ma']) ? 'checked="checked" ' : null ?>/><label for="ma-0"><?php echo Lang::$main['allFilter']; ?></label><input type="radio" name="ma" value="1" id="ma-1" <?php echo isset($f['ma']) ? 'checked="checked" ' : null ?> /><label for="ma-1"><?php echo Lang::$main['oneFilter']; ?></label>
</div>
<div class="clear"></div>
<div class="padded">
<input type="submit" value="<?php echo Lang::$main['applyFilter']; ?>" />
<input type="reset" value="<?php echo Lang::$main['resetForm']; ?>" />
</div>
</form>
<div class="pad"></div>
</div>
<script type="text/javascript">//<![CDATA[
fi_init('achievements');
<?php
foreach ($f['fi'] as $str):
echo ' '.$str."\n";
endforeach;
?>
//]]></script>
<div id="lv-generic" class="listview"></div>
<script type="text/javascript">//<![CDATA[
<?php $this->lvBrick('achievement', ['data' => $this->lvData['data'], 'params' => $this->lvData['params']] ); ?>
//]]></script>
<div class="clear"></div>
</div><!-- main-contents -->
</div><!-- main -->
<?php $this->brick('footer'); ?>

View File

@@ -31,7 +31,7 @@ if (!empty($this->lvData)):
<script type="text/javascript">//<![CDATA[ <script type="text/javascript">//<![CDATA[
<?php <?php
if (count($this->lvData) > 1): if (count($this->lvData) > 1):
echo 'var myTabs = new Tabs({parent: $WH.ge(\'tabs-generic\')})'; echo 'var myTabs = new Tabs({parent: $WH.ge(\'tabs-generic\')});';
endif; endif;
foreach ($this->lvData as $lv): foreach ($this->lvData as $lv):

View File

@@ -83,9 +83,11 @@ $this->brick('book');
<h2 class="clear"><?php echo Lang::$main['related']; ?></h2> <h2 class="clear"><?php echo Lang::$main['related']; ?></h2>
</div> </div>
<?php $this->brick('tabsRelated'); ?> <?php
$this->brick('tabsRelated');
<?php $this->brick('contribute'); ?> $this->brick('contribute');
?>
</div><!-- main-contents --> </div><!-- main-contents -->
</div><!-- main --> </div><!-- main -->

View File

@@ -1,4 +1,7 @@
<?php $this->brick('header'); ?> <?php
$this->brick('header');
$f = $this->filter; // shorthand
?>
<div class="main" id="main"> <div class="main" id="main">
<div class="main-precontents" id="main-precontents"></div> <div class="main-precontents" id="main-precontents"></div>
@@ -7,18 +10,18 @@
<?php $this->brick('announcement'); ?> <?php $this->brick('announcement'); ?>
<script type="text/javascript"> <script type="text/javascript">
g_initPath(<?php echo json_encode($this->path, JSON_NUMERIC_CHECK).', '.(empty($this->filter['query']) ? 0 : 1) ?>); g_initPath(<?php echo json_encode($this->path, JSON_NUMERIC_CHECK).', '.(empty($f['query']) ? 0 : 1) ?>);
<?php <?php
if (!empty($this->filter['query'])): if (!empty($f['query'])):
// todo: update menu-class Menu.modifyUrl(Menu.findItem(mn_database, [5]), { filter: '+={$filter.query|escape:'quotes'}' }, { onAppendCollision: fi_mergeFilterParams, onAppendEmpty: fi_setFilterParams, menuUrl: Menu.getItemUrl(Menu.findItem(mn_database, [5])) }); // todo: update menu-class Menu.modifyUrl(Menu.findItem(mn_database, [5]), { filter: '+={$filter.query|escape:'quotes'}' }, { onAppendCollision: fi_mergeFilterParams, onAppendEmpty: fi_setFilterParams, menuUrl: Menu.getItemUrl(Menu.findItem(mn_database, [5])) });
endif; endif;
?> ?>
</script> </script>
<div id="fi" style="display: <?php echo empty($this->filter['query']) ? 'none' : 'block' ?>;"> <div id="fi" style="display: <?php echo empty($f['query']) ? 'none' : 'block' ?>;">
<form action="?objects<?php echo $this->subCat; ?>&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)"> <form action="?objects<?php echo $this->subCat; ?>&filter" method="post" name="fi" onsubmit="return fi_submit(this)" onreset="return fi_reset(this)">
<table> <table>
<tr><td><?php echo Util::ucFirst(Lang::$main['name']).Lang::$main['colon']; ?></td><td>&nbsp;<input type="text" name="na" size="30" <?php echo isset($this->filter['na']) ? 'value="'.Util::htmlEscape($this->filter['na']).'" ' : null; ?>/></td></tr> <tr><td><?php echo Util::ucFirst(Lang::$main['name']).Lang::$main['colon']; ?></td><td>&nbsp;<input type="text" name="na" size="30" <?php echo isset($f['na']) ? 'value="'.Util::htmlEscape($f['na']).'" ' : null; ?>/></td></tr>
</table> </table>
<div id="fi_criteria" class="padded criteria"><div></div></div> <div id="fi_criteria" class="padded criteria"><div></div></div>
@@ -26,7 +29,7 @@ endif;
<div class="padded2 clear"> <div class="padded2 clear">
<div style="float: right"><?php echo Lang::$main['refineSearch']; ?></div> <div style="float: right"><?php echo Lang::$main['refineSearch']; ?></div>
<?php echo Lang::$main['match'].Lang::$main['colon']; ?><input type="radio" name="ma" value="" id="ma-0" <?php echo !isset($this->filter['ma']) ? 'checked="checked" ' : null ?>/><label for="ma-0"><?php echo Lang::$main['allFilter']; ?></label><input type="radio" name="ma" value="1" id="ma-1" <?php echo isset($this->filter['ma']) ? 'checked="checked" ' : null ?> /><label for="ma-1"><?php echo Lang::$main['oneFilter']; ?></label> <?php echo Lang::$main['match'].Lang::$main['colon']; ?><input type="radio" name="ma" value="" id="ma-0" <?php echo !isset($f['ma']) ? 'checked="checked" ' : null ?>/><label for="ma-0"><?php echo Lang::$main['allFilter']; ?></label><input type="radio" name="ma" value="1" id="ma-1" <?php echo isset($f['ma']) ? 'checked="checked" ' : null ?> /><label for="ma-1"><?php echo Lang::$main['oneFilter']; ?></label>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
@@ -43,7 +46,7 @@ endif;
<script type="text/javascript">//<![CDATA[ <script type="text/javascript">//<![CDATA[
fi_init('objects'); fi_init('objects');
<?php <?php
foreach ($this->filter['fi'] as $str): foreach ($f['fi'] as $str):
echo ' '.$str."\n"; echo ' '.$str."\n";
endforeach; endforeach;
?> ?>

View File

@@ -5,15 +5,15 @@
<div class="main-contents" id="main-contents"> <div class="main-contents" id="main-contents">
<?php <?php
$this->brick('announcements'); $this->brick('announcement');
if (isset($this->subject)): if (isset($this->typeStr)):
?> ?>
<div class="pad3"></div> <div class="pad3"></div>
<div class="inputbox"> <div class="inputbox">
<h1><?php echo Util::ucFirst($this->subject).' #'.$this->typeId; ?></h1> <h1><?php echo Util::ucFirst($this->typeStr).' #'.$this->typeId; ?></h1>
<div id="inputbox-error"><?php echo sprintf(Lang::$main['pageNotFound'], $this->subject); ?></div> <div id="inputbox-error"><?php echo sprintf(Lang::$main['pageNotFound'], $this->typeStr); ?></div>
<?php <?php
else: else:
?> ?>