public function renderEdit($id) { $this->template->title = 'Edit article'; if ($id > 0) { $this->template->item = $item = $this->items->fetch($id); if (!$item) { $this->flashMessage('No item with ID ' . $id, 'err'); $this->redirect('default'); } $this['form']->setDefaults($item); $this['form']['published']->setValue(Date::getDate($item->published, '%e.%m.%Y')); } $this->template->form = $this['form']; }
public function renderEdit($id = 0) { $this->template->title = "Edit user"; if ($id > 0) { $item = $this->items->getOne($id); if (!$item) { $this->redirect('default', array('do' => 'error')); } $this['form']['username']->setValue($item['username']); $this['form']['name']->setValue($item['name']); $this['form']['surname']->setValue($item['surname']); $this['form']['active']->setValue($item['active']); $this['form']['role']->setValue($item['role']); $this['form']['email']->setValue($item['email']); $this['form']['homepage']->setValue($item['homepage']); $this['form']['telephone']->setValue($item['telephone']); $this['form']['street']->setValue($item['street']); $this['form']['city']->setValue($item['city']); $this['form']['country_id']->setValue($item['country_id']); $this['form']['zip']->setValue($item['zip']); $this['form']['icq']->setValue($item['icq']); $this['form']['aim']->setValue($item['aim']); $this['form']['jabber']->setValue($item['jabber']); $this['form']['skype']->setValue($item['skype']); $this['form']['birthday']->setValue(\soundake\utils\Date::getDate($item['birthday'], $this->config['inputDate'])); $this['form']['description']->setValue($item['description']); $this['form']['sex']->setValue($item['sex']); $this['form']['id']->setValue($item['id']); } $this->template->form = $this['form']; }