Skip to content

Instantly share code, notes, and snippets.

@BlackScorp
Created February 13, 2013 14:41
Show Gist options
  • Save BlackScorp/4945028 to your computer and use it in GitHub Desktop.
Save BlackScorp/4945028 to your computer and use it in GitHub Desktop.
<?= Form::open('brand/create') ?>
<legend><?= __('Login') ?></legend>
<?php if (isset($create_brand)): ?>
<div class="alert alert-error">
<?= Form::button('close', 'x', array('type' => 'button', 'class' => 'close', 'data-dismiss' => 'alert')); ?>
<?= $login_error ?>
</div>
<?php endif; ?>
<div class="control-group">
<label class="control-label" for="name"><?= __('Name') ?>:</label>
<div class="controls">
<?= Form::input('name', HTML::chars(Arr::get($_POST, 'name')), array('placeholder' => __('Name'))) ?>
</div>
</div>
<div class="control-group">
<label class="control-label" for="shortname"><?= __('shortname') ?>:</label>
<div class="controls">
<?= Form::input('shortname', HTML::chars(Arr::get($_POST, 'shortname')), array('placeholder' => __('shortname'))) ?>
</div>
</div>
<div class="control-group">
<label class="control-label" for="status"><?= __('status') ?>:</label>
<div class="controls">
<?= Form::input('status', HTML::chars(Arr::get($_POST, 'status')), array('placeholder' => __('status'))) ?>
</div>
</div>
<?= Form::close() ?>
public function action_add()
{
if (HTTP_Request::POST == $this->request->method()) {
$brand = ORM::factory('Brand');
$brand->values($this->request->post(),array(
'shortname',
'name',
'status'
));
try{
$brand->save();
}catch(ORM_Validation_Exception $e){
View::set_global('create_brand',$e->errors(I18n::$lang)):
}
}
$this->template->menu = View::factory('admin/admmenu');
$view = View::factory('admin/brandsAdd');
$this->template->central = $view->render();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment