Exemple #1
0
 public function action_edit($img_id = 0)
 {
     $this->template->title = __("Thêm hình ảnh slide");
     $this->template->section_title = __("Thêm hình ảnh slide");
     $data = array();
     $img = ImageSlide::BLL()->find($img_id);
     if (!$img) {
         Message::error('Không tìm thấy hình ảnh');
         Request::instance()->redirect('/admin/slide/index');
     }
     if (Request::$method == "POST") {
         $post = $img->validate_update($_POST);
         if ($post->check()) {
             $post = $post->as_array();
             $img->src = $post['src'];
             $img->slide_position = $post['slide_position'];
             $img->url = $post['url'];
             $img->order = intval($post['order']);
             $img->User = Auth::instance()->get_user();
             $img->description = $post['description'];
             $img->save();
             Message::success('Cập nhập thông tin hình ảnh slide thành công!');
             Request::instance()->redirect('/admin/slide/by_pos/' . $img->slide_position . '.html');
         } else {
             $data['errors'] = $post->errors('admin/slide');
             $_POST = $post->as_array();
         }
     }
     $data['image'] = $img->toArray();
     $this->template->content = View::factory('admin/slide/edit', $data);
 }
Exemple #2
0
 public function action_slider_json($position = 0)
 {
     $this->auto_render = false;
     $img = ImageSlide::BLL()->get_all_front_by_pos($position);
     //echo $position;
     //print_r($img);
     $result = false;
     $data = array();
     if ($img) {
         $result = true;
         foreach ($img as $image) {
             if ($image['url'] != '#') {
                 $data['items'][] = '<a href="' . $image['url'] . '"><img src="' . $image['src'] . '"  width="350" height="210" alt="" title="' . $image['description'] . '"/></a>';
             } else {
                 $data['items'][] = '<img src="' . $image['src'] . '" width="350" height="210" alt="" title="' . $image['description'] . '"/>';
             }
         }
     }
     $data['result'] = $result;
     echo json_encode($data);
 }
Exemple #3
0
            <td style="vertical-align: top">
                <p>
                    <label>Hình ảnh: <i>(Click vào ảnh để xem thay đổi)</i></label>
                    <?php 
echo Form::input('src', isset($_POST['src']) ? $_POST['src'] : URL::base() . 'userfiles/isclub.jpg', array('id' => 'src', 'style' => 'background:#ccc;'));
?>
                    <a href="javascript:void(0);" id="get_img" style="font-weight: bold;color:#901830;">Chọn ảnh</a><br/>
                    <img src=""  id="img_preview" border="0" style="" width="150" height="100" alt="image thumb"/>

                </p>
                <p>
                    <?php 
echo Form::label('slide_position', 'Ảnh xuất hiện ở:');
?>
                    <?php 
echo Form::select('slide_position', ImageSlide::SlidePositionList(), isset($_POST['slide_position']) ? intval($_POST['slide_position']) : 0, array('id' => 'slide_position', 'style' => 'width: 300px;'));
?>
                </p>
                
            </td>
            <td style="vertical-align: top">
                <p>
                    <?php 
echo Form::label('url', 'Liên kết URL: (Điền "#" nếu không sử dụng)');
?>
                    <?php 
echo Form::input('url', isset($_POST['url']) ? $_POST['url'] : '', array('id' => 'url', 'style' => 'width: 300px;'));
?>
                </p>
                <p>
                    <?php 
Exemple #4
0
<?php

/**
 * Description of view file:  index
 * Nov 13, 2010 4:11:24 PM
 * @author hungxalo
 */
$cur_filter_id = -1;
if (Request::instance()->action == "by_pos") {
    if (Request::instance()->param('id') >= 0) {
        $cur_filter_id = Request::instance()->param('id');
    }
}
$filter_list = ImageSlide::SlidePositionList_Filter();
?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
        <td style="width: 500px;">
            <ul>
                <li>
                    <a href="<?php 
echo url::site('/admin/slide/create');
?>
">Thêm ảnh</a>
                </li>
            </ul>
        </td>
        <td align="right" style="width:auto;">
            Hiển thị theo vị trí:
        </td>
        <td style="width:300px;">