/** * Fetch all possible fields of item. * @return array|null */ public function modelFields() { if ($this->_columns === null) { $this->_columns = $this->model->columns(); } return $this->_columns; }
public function __construct($pixie) { parent::__construct($pixie); $this->enabled = false; $this->in_stock = true; $this->status = self::STATUS_AVAILABLE; $this->show_in_root = true; }
public function renderSubmitButtons() { if ($this->item->id()) { echo '<a class="btn btn-primary" ' . 'href="/admin/' . $this->controllerAlias . '/new/">Add new</a> '; echo '<a class="btn btn-danger js-delete-item" ' . 'href="/admin/' . $this->controllerAlias . '/delete/' . $this->item->id() . '">Delete</a> '; } $name = $this->item->id() ? 'Save' : 'Add'; echo '<button class="btn btn-primary" type="submit">' . $name . '</button> '; }
public function renderSubmitButtons() { if ($this->item->id()) { echo '<a class="btn btn-primary" ' . 'href="/admin/' . $this->controllerAlias . '/new/">Добавить новый</a> '; echo '<a class="btn btn-danger js-delete-item" ' . 'href="/admin/' . $this->controllerAlias . '/delete/' . $this->item->id() . '">Удалить</a> '; } $name = $this->item->id() ? 'Сохранить' : 'Добавить'; echo '<button class="btn btn-primary" type="submit">' . $name . '</button> '; }
public function __get($name) { if ($name == 'author') { if (!empty($this->author_id) && $this->author_id > 0) { $this->author = Author::findById($this->author_id); } } return parent::__get($name); }
protected function adjustOrder() { $order = 'asc'; if (in_array(strtolower($this->request->get('order')), ['asc', 'desc'])) { $order = strtolower($this->request->get('order')); } $orderBy = $this->request->get('order'); if ($orderBy && !in_array($orderBy, $this->exposedFields())) { $orderBy = ''; } if ($order && $orderBy) { $this->model->order_by($orderBy, $order); } }
protected function removeExistingFile(BaseModel $item, $field, array $options) { if (!$item->id()) { return; } $existingFile = $item->{$field}; $absPath = $options['abs_path'] ? $options['dir_path'] : $this->pixie->root_dir . 'web/' . preg_replace('|^/+|', '', $options['dir_path']) . $existingFile; if (file_exists($absPath) && is_file($absPath) && is_writable($absPath)) { unlink($absPath); } $item->{$field} = ''; }
public function __construct(Dibi\Connection $database, $worldSize) { parent::__construct($database); $this->worldSize = $worldSize; }
/** * @param BaseModel $model */ public function getSql(&$model) { $model->where('name', 'LIKE', '%' . $this->getValue() . '%'); }
public function __construct(Nette\Database\Context $db, CarsModel $cm, MailManager $mm) { parent::__construct($db); $this->carsModel = $cm; $this->mailManager = $mm; }
public function __construct() { parent::__construct(); }
public function __construct(App\Model\CategoryModel $categoryModel, Nette\Database\Context $database) { $this->categoryModel = $categoryModel; parent::__construct($database); }
public function __construct($storageCapacity, $storageMultiplier, Dibi\Connection $database) { $this->storageCapacity = $storageCapacity; $this->storageMultiplier = $storageMultiplier; parent::__construct($database); }