2014-02-05 14:03:04 +02:00
< ? php defined ( 'SYSPATH' ) OR die ( 'No direct script access.' );
/**
* Instant index view controller .
* @ package Views
* @ author Oreolek
**/
class View_Instant_Index extends View_Index {
protected $is_admin = TRUE ; // admin only view
public $show_date = FALSE ;
public $subscription_id ;
/**
* 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-02-05 14:03:04 +02:00
{
return FALSE ;
}
$output = array (
'description' => $item -> text ,
2016-10-11 08:37:54 +03:00
'view_link' => $item -> subject ,
'is_sent' => I18n :: translate ( 'Sent' ),
2014-02-18 10:11:50 +02:00
'edit_link' => FALSE ,
'send_button' => HTML :: anchor ( Route :: url ( 'default' , array ( 'controller' => 'Instant' , 'action' => 'send' , 'id' => $item -> id )), Form :: btn ( 'send' , 'Send to subscribers' )),
2014-02-05 14:03:04 +02:00
);
2014-02-18 10:11:50 +02:00
if ( $item -> sent == 0 )
{
2016-10-11 08:37:54 +03:00
$output [ 'edit_link' ] = HTML :: anchor ( Route :: url ( 'default' , array ( 'controller' => 'Instant' , 'action' => 'edit' , 'id' => $item -> id )), I18n :: translate ( 'Edit' ), array ( 'class' => 'link_edit' ));
2014-02-18 10:11:50 +02:00
}
2014-02-05 14:03:04 +02:00
return $output ;
}
public function link_new ()
{
2016-10-11 08:37:54 +03:00
return HTML :: anchor ( Route :: url ( 'default' , array ( 'controller' => 'Instant' , 'action' => 'create' , 'id' => $this -> subscription_id )), I18n :: translate ( 'Add' ), array ( 'class' => 'link_new' ));
2014-02-05 14:03:04 +02:00
}
}