public function base_comment()
 {
     $this->form_validation->set_rules('comment', 'Comment', 'required');
     if ($this->form_validation->run()) {
         $comment = $this->input->post('comment');
         $idbase = $this->input->post('idbase');
         $rating = $this->input->post('rating');
         $data = array('comment_table_reff' => 'base', 'comment_table_reff_id' => $idbase, 'comment_text' => htmlspecialchars($comment), 'comment_created_date' => now(), 'comment_created_by' => user_member('iduser'), 'comment_rating_count' => (int) $rating);
         $idcomment = $this->model_comment->store($data);
         if ($idcomment) {
             $data_comment = array('row' => $this->model_comment->find_comment_by_idcomment($idcomment));
             $data_html = $this->load->view('front/comment/partial/comment-base', $data_comment, TRUE);
             $outs = array('flag' => 1, 'data' => $data, 'html' => $data_html, 'msg' => 'Success post your comment');
             echo json_encode($outs);
         } else {
             $outs = array('flag' => 0, 'msg' => 'Error post comment, Please try again.');
             echo json_encode($outs);
         }
     } else {
         $outs = array('flag' => 0, 'msg' => validation_errors());
         echo json_encode($outs);
     }
 }
Esempio n. 2
0
 public function create()
 {
     $this->auth->allow(array('member'));
     $this->form_validation->set_rules('base_name', 'Base Name', 'required|min_length[5]');
     if ($this->form_validation->run()) {
         $base_name = $this->input->post('base_name');
         $base_desc = $this->input->post('base_desc');
         $base_town_hall = $this->input->post('base_town_hall');
         $data = array('base_name' => $base_name, 'base_desc' => $base_desc, 'base_town_hall' => $base_town_hall, 'base_created_date' => now(), 'base_created_by' => user_member('iduser'));
         $config['upload_path'] = FCPATH . 'asset/base-image/';
         $config['allowed_types'] = 'gif|jpg|png';
         $config['max_size'] = '999999';
         $config['max_width'] = '999999';
         $config['max_height'] = '999999';
         $config['filename'] = 'tes.jpg';
         $this->load->library('upload', $config);
         if ($_FILES and $_FILES['base_image']['name']) {
             if (!$this->upload->do_upload("base_image")) {
                 $error = $this->upload->display_errors();
                 set_flashdata("notif", $error);
                 redirect_back();
             } else {
                 $data_upload = $this->upload->data();
                 $data['base_image'] = $data_upload['file_name'];
                 set_flashdata("notif", 'Success share base');
             }
         } else {
             set_flashdata("notif", 'Please choose once image.');
             redirect_back();
         }
         $idbase = $this->model_base->store($data);
         redirect('base/detail/' . $idbase);
     }
     $data = array();
     $this->template->render('front/base/create-base', $data);
 }
    </ul>

    <div class="app-bar-element place-right">
        <span class="dropdown-toggle"><span class="mif-cog"></span></span>
        <div class="app-bar-drop-container padding10 place-right no-margin-top block-shadow fg-dark" data-role="dropdown" data-no-close="true" style="width: 220px">
            <h2 class="text-light">Howdy..</h2>
            <ul class="unstyled-list fg-dark">

                <?php 
if ($this->auth->login_scurity(FALSE)) {
    ?>
                <li><a href="<?php 
    echo site_url('user/my_profile');
    ?>
" class="fg-white3 fg-hover-yellow"><span><?php 
    echo user_member('user_name');
    ?>
</span> Profile</a></li>
                <?php 
}
?>

                <?php 
if (!$this->auth->login_scurity(FALSE)) {
    ?>
                <li><a href="#" onclick="showDialog('dialogLogin');" class="fg-white1 fg-hover-yellow">Login</a></li>
                <?php 
} else {
    ?>
                <li><a href="<?php 
    echo site_url('user/logout');