Esempio n. 1
0
 public function store($type)
 {
     switch ($type) {
         case 'lienlac':
             $id = Input::get("id");
             $data = array("address" => Input::get("tenbophan"), "tel" => Input::get("sodienthoai"), "fax" => Input::get("sofax"), "email" => Input::get("email"), "facebook" => Input::get("facebook"), "link" => Input::get("urlfacebook"), "vitri" => Input::get("vitri"));
             Contact::UpdateLL($id, $data);
             $contact = Contact::getAContact($id);
             return View::make('admin.lienlac.edit')->with("contact", $contact)->with("message", "Chỉnh sửa liên lạc hoàn tất!")->with("title", "Chỉnh sửa liên lạc");
         case 'baiviet':
             $filename = Input::get('anhcu');
             if (isset($_FILES['anhnho']) && $_FILES['anhnho']['name'] != "") {
                 if (File::exists(Input::get('anhcu'))) {
                     File::delete(Input::get('anhcu'));
                 }
                 $file = Input::file('anhnho');
                 //  $file->resize(96,96);
                 $destinationPath = 'uploads/';
                 $filename = md5($file->getClientOriginalName()) . "." . $file->getClientOriginalExtension();
                 Input::file('anhnho')->move($destinationPath, $filename);
                 $filename = $destinationPath . "/" . $filename;
             }
             $data = array("tieude" => Input::get('tieude'), "anhnho" => $filename, "loai" => Input::get('loaibaiviet'), "noidung" => Input::get('noidung'), "thoidiemsua" => date("Y-m-d H:i:s", time()));
             $id = Input::get('id');
             TinTuc::UpdateTT($data, $id);
             $thread = TinTuc::getAThread($id);
             return View::make('admin.threads.edit')->with("thread", $thread)->with("message", "Chỉnh sửa tin tức hoàn tất!")->with("title", "Chỉnh sửa bài viết");
         default:
             return $this->index();
     }
 }
Esempio n. 2
0
 public function search($key)
 {
     $key = preg_replace('/\\s\\s+/', ' ', trim($key));
     $contacts = Contact::Select();
     $resultsearch = TinTuc::search($key, 10);
     //ajax pagingation tìm kiếm
     $rs['noidung'] = $resultsearch;
     $rs['phantrang'] = $resultsearch->links();
     if (Request::ajax() && Input::get("type") == "search") {
         $html = View::make("guest.searches.ajaxpagination", $rs)->render();
         return Response::json(array('html' => $html));
     }
     //end ajax pagingation tìm kiếm
     return View::make('guest.searches.index')->with('contacts', $contacts)->with("keysearch", $key)->with("result", $resultsearch)->with("title", "Kết quả tìm kiếm với " . $key);
 }