mirror of
https://github.com/Oreolek/kangana.git
synced 2024-06-26 03:40:56 +03:00
letter index
This commit is contained in:
parent
0b030c2503
commit
b054af8b81
10
application/classes/Controller/Letter.php
Normal file
10
application/classes/Controller/Letter.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php defined('SYSPATH') or die('No direct script access.');
|
||||
|
||||
/**
|
||||
* Letter controller.
|
||||
**/
|
||||
class Controller_Letter extends Controller_Layout {
|
||||
protected $secure_actions = array(
|
||||
'index',
|
||||
);
|
||||
}
|
|
@ -63,6 +63,20 @@ class Controller_Subscription extends Controller_Layout {
|
|||
$this->redirect('/');
|
||||
}
|
||||
}
|
||||
public function action_view()
|
||||
{
|
||||
$this->template = new View_Letter_Index;
|
||||
$id = $this->request->param('id');
|
||||
$model = ORM::factory('Subscription', $id)->with('letters');
|
||||
if (!$model->loaded())
|
||||
{
|
||||
$this->redirect('error/404');
|
||||
}
|
||||
$this->template->title = __('Subscription').' '.$model->title;
|
||||
$this->template->items = $model->letters
|
||||
->filter_by_page($this->request->param('page'))
|
||||
->find_all();
|
||||
}
|
||||
|
||||
public function action_subscribe()
|
||||
{
|
||||
|
|
|
@ -11,6 +11,9 @@ class Model_Subscription extends ORM {
|
|||
'client' => array(
|
||||
'model' => 'Client',
|
||||
'through' => 'clients_subscriptions'
|
||||
),
|
||||
'letters' => array(
|
||||
'model' => 'Letter'
|
||||
)
|
||||
);
|
||||
|
||||
|
|
30
application/classes/View/Letter/Index.php
Normal file
30
application/classes/View/Letter/Index.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php defined('SYSPATH') OR die('No direct script access.');
|
||||
|
||||
/**
|
||||
* Letter index view controller.
|
||||
* @package Views
|
||||
* @author Oreolek
|
||||
**/
|
||||
class View_Letter_Index extends View_Index {
|
||||
protected $is_admin = TRUE; // admin only view
|
||||
public $_view = 'subscription/index';
|
||||
public $show_date = FALSE;
|
||||
/**
|
||||
* An internal function to prepare item data.
|
||||
**/
|
||||
protected function show_item($item)
|
||||
{
|
||||
if (!$item instanceof ORM)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$output = array(
|
||||
'description' => $item->description,
|
||||
'view_link' => HTML::anchor(Route::url('default', array('controller' => Request::current()->controller(), 'action' => 'view','id' => $item->id)),$item->title, array('class' => 'link_view')),
|
||||
'edit_link' => HTML::anchor(Route::url('default', array('controller' => Request::current()->controller(), 'action' => 'edit','id' => $item->id)), __('Edit'), array('class' => 'link_edit')),
|
||||
'delete_link' => HTML::anchor(Route::url('default', array('controller' => Request::current()->controller(), 'action' => 'delete','id' => $item->id)), __('Delete'), array('class' => 'link_delete')),
|
||||
);
|
||||
return $output;
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@ return array(
|
|||
'Delete subscription' => 'Удалить рассылку',
|
||||
'Edit subscription' => 'Редактировать рассылку',
|
||||
'Subscribe to ' => 'Подписка на ',
|
||||
'Subscription' => 'Рассылка',
|
||||
'Name' => 'Имя',
|
||||
'You were subscribed. A welcome email has been sent to you. Please check your inbox.' => 'Вы были подписаны. Вам было выслано вступительное письмо; пожалуйста, проверьте входящие сообщения.'
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue