1
0
Fork 0
mirror of https://github.com/Oreolek/kangana.git synced 2024-06-26 03:40:56 +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. * 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. * Feature is highly unreliable. You can lose the file. You can have two users writing config simultaneously.
* Do not use in web environment. * 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 = new View_Course_Simple;
$this->template->controls = array(); $this->template->controls = array();
$this->template->title = __('New course'); $this->template->title = __('New course');
$course = ORM::factory('Course');
$letter = ORM::factory('Letter');
if ($this->request->method() === HTTP_Request::POST) { if ($this->request->method() === HTTP_Request::POST) {
$course = ORM::factory('Course');
$letter = ORM::factory('Letter');
$course->values($this->request->post(), array('title', 'description')); $course->values($this->request->post(), array('title', 'description'));
$letter->subject = $this->request->post('letter_subject'); $letter->values($this->request->post(), array('subject', 'text'));
$letter->text = $this->request->post('letter_body');
$course->price = 0; $course->price = 0;
$course->period = 1; $course->period = 1;
$letter->order = 1; $letter->order = 1;
@ -78,6 +77,8 @@ class Controller_Course extends Controller_Layout {
$this->redirect($this->_edit_redirect($course)); $this->redirect($this->_edit_redirect($course));
} }
} }
$this->template->model_letter = $letter;
$this->template->model_course = $course;
} }
public function action_edit() public function action_edit()

View file

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