1
0
Fork 0
mirror of https://github.com/Oreolek/kangana.git synced 2024-06-16 15:01:09 +03:00

Merge branch 'master' of github.com:Oreolek/kangana

This commit is contained in:
Alexander Yakovlev 2014-09-25 21:59:45 +07:00
commit c2fe647f18
3 changed files with 11 additions and 10 deletions

View file

@ -15,5 +15,3 @@ PHP 5 with enabled OpenSSL and APCu
* All comments in config file are lost on write.
* Feature is highly unreliable. You can lose the file. You can have two users writing config simultaneously.
* Do not use in web environment.
// uses tijsverkoyen / CssToInlineStyles to convert CSS to inline styles

View file

@ -39,12 +39,11 @@ class Controller_Course extends Controller_Layout {
$this->template = new View_Course_Simple;
$this->template->controls = array();
$this->template->title = __('New course');
$course = ORM::factory('Course');
$letter = ORM::factory('Letter');
if ($this->request->method() === HTTP_Request::POST) {
$course = ORM::factory('Course');
$letter = ORM::factory('Letter');
$course->values($this->request->post(), array('title', 'description'));
$letter->subject = $this->request->post('letter_subject');
$letter->text = $this->request->post('letter_body');
$letter->values($this->request->post(), array('subject', 'text'));
$course->price = 0;
$course->period = 1;
$letter->order = 1;
@ -78,6 +77,8 @@ class Controller_Course extends Controller_Layout {
$this->redirect($this->_edit_redirect($course));
}
}
$this->template->model_letter = $letter;
$this->template->model_course = $course;
}
public function action_edit()

View file

@ -4,13 +4,15 @@
* Simple course and first letter creation view controller
**/
class View_Course_Simple extends View_Edit {
public $model_course;
public $model_letter;
public function controls_course()
{
return array(
'heading' => __('New course'),
'controls' => array(
Form::textinput('title', '', array('label' => 'Title')),
Form::textarea('description', '', array('label' => 'Description'))
Form::orm_input($this->model_course, 'title'),
Form::orm_textarea($this->model_course, 'description')
)
);
}
@ -20,8 +22,8 @@ class View_Course_Simple extends View_Edit {
return array(
'heading' => __('First letter'),
'controls' => array(
Form::textinput('letter_subject', '', array('label' => 'Subject')),
Form::textarea('letter_body', '', array('label' => 'Message body'))
Form::orm_input($this->model_letter, 'subject'),
Form::orm_textarea($this->model_letter, 'text')
)
);
}