/** * Load all available blueprints for the logged in user. * * @return \self */ public static function loadList($orderBy = 'name') { $sql = ' SELECT `blueprintId` FROM blueprints WHERE userid = ' . \sqlval($_SESSION['userId']) . ' AND !deleted ORDER BY ' . sqlval($orderBy, false) . ' '; $blueprintIds = query($sql, true); $obj = new self(); if (empty($blueprintIds)) { return $obj; } $list = array(); foreach ($blueprintIds as $blueprint) { $list[$blueprint['blueprintId']] = \Model\Blueprint::loadById($blueprint['blueprintId']); } $obj->setList($list); return $obj; }
<?php /** * Show the stats for a blueprint of an item. * * @package ajax * @author friend8 <*****@*****.**> * @license https://www.gnu.org/licenses/lgpl.html LGPLv3 */ require_once __DIR__ . '/../lib/system/config.default.php'; require_once __DIR__ . '/../lib/system/util/mysql.php'; $blueprint = \Model\Blueprint::loadById($_POST['id']); echo json_encode($blueprint->getResultingStats());
/** * Fill the data from the array into the object and cast them to the nearest possible type. * * @param array $data * * @return void */ public function fill($data) { foreach ($data as $key => $value) { if ($key === 'blueprintId') { $this->blueprint = \Model\Blueprint::loadById($value); } elseif ($key === 'characterId') { $this->character = \Model\Character::loadById($value); } elseif ($key === 'done') { $this->{$key} = (bool) $value; } elseif (property_exists($this, $key)) { $this->{$key} = $this->castToType($value); } } }