2014-01-28 13:07:36 +02:00
|
|
|
<?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 $show_date = FALSE;
|
2014-02-15 05:49:31 +02:00
|
|
|
public $course_id;
|
2014-01-28 13:07:36 +02:00
|
|
|
/**
|
|
|
|
* An internal function to prepare item data.
|
|
|
|
**/
|
|
|
|
protected function show_item($item)
|
|
|
|
{
|
2016-10-11 08:37:54 +03:00
|
|
|
if ( ! $item instanceof ORM)
|
2014-01-28 13:07:36 +02:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
$output = array(
|
2014-01-29 10:52:33 +02:00
|
|
|
'description' => $item->text,
|
2014-02-21 08:53:42 +02:00
|
|
|
'view_link' => HTML::anchor(Route::url('default', array('controller' => 'Letter', 'action' => 'view','id' => $item->id)), $item->subject, array('class' => 'link_view')),
|
2016-10-11 08:37:54 +03:00
|
|
|
'edit_link' => HTML::anchor(Route::url('default', array('controller' => 'Letter', 'action' => 'edit','id' => $item->id)), I18n::translate('Edit'), array('class' => 'link_edit')),
|
|
|
|
'delete_link' => HTML::anchor(Route::url('default', array('controller' => 'Letter', 'action' => 'delete','id' => $item->id)), I18n::translate('Delete'), array('class' => 'link_delete')),
|
2014-01-28 13:07:36 +02:00
|
|
|
);
|
|
|
|
return $output;
|
|
|
|
}
|
2014-01-29 10:52:33 +02:00
|
|
|
|
2014-02-19 10:26:01 +02:00
|
|
|
public function iframe_code()
|
|
|
|
{
|
|
|
|
return array(
|
2016-10-11 08:37:54 +03:00
|
|
|
'text' => I18n::translate('Subscription code'),
|
2014-02-19 10:26:01 +02:00
|
|
|
'code' => '<iframe src="'.Route::url('default', array('controller' => 'Course', 'action' => 'subscribe', 'id' => $this->course_id), TRUE).'" width="100%" height="400"></iframe>',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-01-29 10:52:33 +02:00
|
|
|
public function link_new()
|
|
|
|
{
|
2016-10-11 08:37:54 +03:00
|
|
|
return HTML::anchor(Route::url('default', array('controller' => 'Letter', 'action' => 'create', 'id' => $this->course_id)), I18n::translate('Add'), array('class' => 'link_new'));
|
2014-01-29 10:52:33 +02:00
|
|
|
}
|
2014-01-28 13:07:36 +02:00
|
|
|
}
|