public static function getByRow($row, $brief = false) { self::$brief = $brief; $item = parent::getByRow($row); self::$brief = false; return $item; }
public function loadModel($id) { $model = ItemTemplate::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); if (!isset($_GET['token']) || $_GET['token'] != 'superbanana2oihp2r') { exit; } // Include anything we'll use here. use Kint; require_once '../../config.php'; require_once SERVER_ROOT . '/public/vendor/autoload.php'; require_once SERVER_ROOT . '/src/db.inc'; require_once SERVER_ROOT . '/src/autoload.classes.inc'; // Get the item templates. $items = ItemTemplate::load_multiple(array()); // Convert list to JSON. $json = array(); foreach ($items as $item) { $json[] = $item->json(false); } print json_encode($json);
public function getFeed($count) { $feed = array(); $feed = $this->dbConnection->createCommand("SELECT * FROM character_feed_log WHERE guid = {$this->guid} ORDER BY date DESC LIMIT {$count}")->queryAll(); for ($i = 0; $i < count($feed); $i++) { switch ($feed[$i]['type']) { case 2: $feed[$i]['item'] = ItemTemplate::model()->findByPk($feed[$i]['data']); $feed[$i]['equipped'] = $this->isEquipped($feed[$i]['data']); break; case 3: $feed[$i]['count'] = $this->dbConnection->createCommand("SELECT COUNT(1)\n FROM character_feed_log\n WHERE\n guid = {$this->guid}\n AND type = 3\n AND data = {$feed[$i]['data']}\n AND date <= {$feed[$i]['date']}")->queryScalar(); $feed[$i]['data'] = CreatureTemplate::model()->findByPk($feed[$i]['data']); break; } } return $feed; }