/** * Get the item and blueprint notes. * * @return string */ protected function getNotes() { $notes = $this->item->getNotes(); $translator = \SmartWork\Translator::getInstance(); if ($this->bonusRangedFightValue) { if (!empty($notes)) { $notes .= ' '; } $notes .= $translator->gt('bonusRangedFightValueNote') . '(' . $this->bonusRangedFightValue . ')'; } if ($this->reducePhysicalStrengthRequirement) { if (!empty($notes)) { $notes .= ' '; } $notes .= $translator->gt('reducePhysicalStrengthRequirementNote'); } return $notes; }
/** * Load all items. * * @return \self */ public static function loadList($groupBy = 'itemType') { $sql = ' SELECT `itemId` FROM items WHERE !deleted ORDER BY `name` '; $itemIds = query($sql, true); $obj = new self(); if (empty($itemIds)) { return $obj; } $list = array(); foreach ($itemIds as $item) { $itemObject = \Model\Item::loadById($item['itemId']); if (!is_array($list[$itemObject->getItemType()])) { $list[$itemObject->getItemType()] = array(); } $list[$itemObject->getItemType()][$item['itemId']] = $itemObject; } $obj->setList($list); return $obj; }
public function Pagination() { $criteria = new \DBCriteria(); $criteria->select = 'count(it.id) as count_sights'; $criteria->condition = 'aid = :user_id'; $user_id = \Registry::getCurrentUser()->id; $criteria->params = [':user_id' => $user_id]; $data = \Model\Item::model()->find($criteria); $this->pagination = Pagination::factory(array('total_items' => $data->count_sights)); }
/** * Create or edit an item type. * * @param integer|string $id The id of the item type entry. May be a string * if a new item type is created. Otherwise it's * an integer. * @param array $data The data for the item type. * * @return void */ protected function editItem($id, $data) { if ($id == 'new') { $response = array('ok' => \Model\Item::create($data)); } else { $item = \Model\Item::loadById($id); $response = array('ok' => $item->update($data), 'data' => $item->getAsArray()); } $this->echoAjaxResponse($response); }