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:
parent
2420eb18a9
commit
dcd813884c
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,4 +86,5 @@ return array(
|
|||
"You can customize the delay (1 day by default) between the messages." => 'Вы можете настроить задержку (по умолчанию - один день) между сообщениями.',
|
||||
'Group' => 'Группа',
|
||||
'New group' => 'Новая группа',
|
||||
'Type' => 'Тип',
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue