mirror of
https://github.com/Oreolek/kangana.git
synced 2024-05-05 02:28:17 +03:00
Notes and relations
This commit is contained in:
parent
9dfd04c707
commit
5d0e6d9efc
|
@ -14,7 +14,11 @@ class Model_Course extends ORM {
|
|||
),
|
||||
'letters' => array(
|
||||
'model' => 'Letter'
|
||||
)
|
||||
),
|
||||
'group' => array(
|
||||
'model' => 'Group',
|
||||
'through' => 'courses_groups'
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,11 @@ class Model_Subscription extends ORM {
|
|||
),
|
||||
'instants' => array(
|
||||
'model' => 'Instant'
|
||||
)
|
||||
),
|
||||
'group' => array(
|
||||
'model' => 'Group',
|
||||
'through' => 'subscriptions_groups'
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,6 +18,20 @@ class View_Course_Index extends View_Index {
|
|||
I18n::translate('Delete')
|
||||
);
|
||||
}
|
||||
|
||||
public function content()
|
||||
{
|
||||
return '<p>'
|
||||
.I18n::translate('A course is a pre-defined regular mailing list.')
|
||||
.' '
|
||||
.I18n::translate("You <i>add</i> a message, forming a series of messages.")
|
||||
.' '
|
||||
.I18n::translate("Each new subscriber gets the first message in this series.")
|
||||
.' '
|
||||
.I18n::translate("You can customize the delay (1 day by default) between the messages.")
|
||||
.'</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
* An internal function to prepare item data.
|
||||
**/
|
||||
|
|
|
@ -18,6 +18,18 @@ class View_Subscription_Index extends View_Index {
|
|||
I18n::translate('Delete')
|
||||
);
|
||||
}
|
||||
|
||||
public function content()
|
||||
{
|
||||
return '<p>'
|
||||
.I18n::translate('A subscription is a non-regular mailing list.')
|
||||
.' '
|
||||
.I18n::translate(
|
||||
"You <i>add</i> a message, and then you send it to subscribers."
|
||||
)
|
||||
.'</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
* An internal function to prepare item data.
|
||||
**/
|
||||
|
|
|
@ -77,4 +77,11 @@ return array(
|
|||
'Groups' => 'Группы',
|
||||
'Group name' => 'Название группы',
|
||||
'Delete group' => 'Удалить группу',
|
||||
'A subscription is a non-regular mailing list.' => 'Рассылка - это список для нерегулярной рассылки писем.',
|
||||
"You <i>add</i> a message, and then you send it to subscribers." => 'Вы <i>добавляете</i> сообщение, а потом рассылаете его подписчикам.',
|
||||
'Send to subscribers' => 'Разослать подписчикам',
|
||||
'A course is a pre-defined regular mailing list.' => 'Курс - это заранее сформированный регулярный список рассылки.',
|
||||
"You <i>add</i> a message, forming a series of messages." => 'Вы <i>добавляете</i> сообщение в серию сообщений.',
|
||||
"Each new subscriber gets the first message in this series." => 'Каждый новый подписчик получает первое сообщение в этой серии.',
|
||||
"You can customize the delay (1 day by default) between the messages." => 'Вы можете настроить задержку (по умолчанию - один день) между сообщениями.',
|
||||
);
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
<?php defined('SYSPATH') OR die('No direct script access.');
|
||||
|
||||
/**
|
||||
* course_groups
|
||||
*/
|
||||
class Migration_Kangana_20161012090530 extends Minion_Migration_Base {
|
||||
|
||||
/**
|
||||
* Run queries needed to apply this migration
|
||||
*
|
||||
* @param Kohana_Database $db Database connection
|
||||
*/
|
||||
public function up(Kohana_Database $db)
|
||||
{
|
||||
$db->query(NULL, "
|
||||
CREATE TABLE IF NOT EXISTS `courses_groups` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`course_id` int(11) NOT NULL,
|
||||
`group_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `fk_courses_groups_course_index` (`course_id`),
|
||||
KEY `fk_courses_groups_group_index` (`group_id`)
|
||||
) ENGINE=InnoDB;");
|
||||
|
||||
$db->query(NULL, "
|
||||
ALTER TABLE `courses_groups`
|
||||
ADD CONSTRAINT `fk_courses_groups_course` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `fk_courses_groups_group` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
");
|
||||
|
||||
$db->query(NULL, "
|
||||
CREATE TABLE IF NOT EXISTS `subscriptions_groups` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`subscription_id` int(11) NOT NULL,
|
||||
`group_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `fk_subscriptions_groups_subscription_index` (`subscription_id`),
|
||||
KEY `fk_subscriptions_groups_group_index` (`group_id`)
|
||||
) ENGINE=InnoDB;");
|
||||
|
||||
$db->query(NULL, "
|
||||
ALTER TABLE `subscriptions_groups`
|
||||
ADD CONSTRAINT `fk_subscriptions_groups_subscription` FOREIGN KEY (`subscription_id`) REFERENCES `subscriptions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `fk_subscriptions_groups_group` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
");
|
||||
}
|
||||
|
||||
/**
|
||||
* Run queries needed to remove this migration
|
||||
*
|
||||
* @param Kohana_Database $db Database connection
|
||||
*/
|
||||
public function down(Kohana_Database $db)
|
||||
{
|
||||
$db->query(NULL, "DROP TABLE `subscriptions_groups`");
|
||||
$db->query(NULL, "DROP TABLE `courses_groups`");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue