Ejemplo n.º 1
0
 /**
  * News detail
  * 
  * @access  public
  * @params  integer
  * @return  Response
  */
 public function action_detail($id = null)
 {
     $news = \News\Model_News::check_authority($id);
     $images = \Config::get('news.image.isEnabled') ? \News\Model_NewsImage::get4news_id($id) : array();
     $files = \Config::get('news.file.isEnabled') ? \News\Model_NewsFile::get4news_id($id) : array();
     $tags = \Config::get('news.tags.isEnabled') ? \News\Model_NewsTag::get_names4news_id($id) : array();
     $title = array('name' => $news->title);
     $header_info = array();
     if (!$news->is_published) {
         $header_info = array('body' => sprintf('この%sはまだ%sされていません。', term('news.view'), term('form.publish')));
     }
     //$this->template->layout = 'wide';
     $this->set_title_and_breadcrumbs($title, array('admin/news' => term('news.view', 'admin.view')), null, null, $header_info);
     $this->template->subtitle = \View::forge('news/_parts/detail_subtitle', array('news' => $news));
     $this->template->content = \View::forge('news::detail', array('news' => $news, 'images' => $images, 'files' => $files, 'tags' => $tags));
     if (\News\Site_Util::check_editor_enabled()) {
         $this->template->content->set_safe('html_body', $news->body);
     }
 }
Ejemplo n.º 2
0
?>
	<?php 
echo form_input($val, 'title', isset($news) ? $news->title : '');
$format_options = $val->fieldset()->field('format')->get_options();
if (count($format_options) == 1) {
    ?>
	<?php 
    echo Form::hidden('format', isset($news) ? $news->format : conf('form.formats.default', 'news'));
} else {
    ?>
	<?php 
    echo form_select($val, 'format', isset($news) ? $news->format : conf('form.formats.default', 'news'), $col_sm_size);
}
if (\News\Site_Util::check_editor_enabled()) {
    $textarea_attr = array('style' => 'display:none;');
    if (\News\Site_Util::check_editor_enabled('markdown')) {
        $textarea_attr['data-provide'] = 'markdown';
    }
    echo form_textarea($val, 'body', isset($news) ? $news->body : '', 12, true, null, null, $textarea_attr, true);
} else {
    ?>
	<?php 
    echo form_textarea($val, 'body', isset($news) ? $news->body : '');
}
?>
</small>
<?php 
if (conf('image.isEnabled', 'news')) {
    if (conf('image.isModalUpload', 'news')) {
        ?>
	<?php