1
0
Fork 0
mirror of https://github.com/Oreolek/kangana.git synced 2024-05-04 18:18:17 +03:00

Course creation action

This commit is contained in:
Alexander Yakovlev 2016-10-27 13:10:36 +07:00
parent 2420eb18a9
commit dcd813884c
4 changed files with 16 additions and 1 deletions

View file

@ -54,7 +54,11 @@ class Controller_Course extends Controller_Layout {
public function action_create()
{
$this->template = new View_Edit;
$this->template = new View_Course_Edit;
$this->controls = [
'title' => 'input',
'description' => 'textarea',
];
$this->template->model = ORM::factory('Course');
$this->template->title = I18n::translate('New course');
$this->_edit($this->template->model);

View file

@ -68,6 +68,14 @@ class Model_Course extends ORM {
'description' => 'Description (for the clients)'
);
public static function type_labels()
{
return [
self::TYPE_IRREGULAR => I18n::translate('Subscription'),
self::TYPE_SCHEDULED => I18n::translate('Course'),
];
}
public function customize()
{
if ($this->period < 1)

View file

@ -8,6 +8,8 @@ class View_Course_Edit extends View_Edit {
{
return Form::select('group_id', ORM::factory('Group')->find_all()->as_array('id', 'name'), NULL, [
'label' => I18n::translate('Group')
]).Form::select('type', Model_Course::type_labels(), $this->model->type, [
'label' => I18n::translate('Type')
]);
}
}

View file

@ -86,4 +86,5 @@ return array(
"You can customize the delay (1 day by default) between the messages." => 'Вы можете настроить задержку (по умолчанию - один день) между сообщениями.',
'Group' => 'Группа',
'New group' => 'Новая группа',
'Type' => 'Тип',
);