public function loadModel($id)
 {
     $model = CreatureTemplate::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #2
0
 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;
 }