Exemplo n.º 1
1
 function postSave($id = 0)
 {
     $trackUri = $this->data['trackUri'];
     $rules = $this->validateForm();
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         $data = $this->validatePost('tb_groups');
         $ID = $this->model->insertRow($data, Input::get('group_id'));
         // Input logs
         if (Input::get('group_id') == '') {
             $this->inputLogs("New Entry row with ID : {$ID}  , Has Been Save Successfull");
             $id = SiteHelpers::encryptID($ID);
         } else {
             $this->inputLogs(" ID : {$ID}  , Has Been Changed Successfull");
         }
         // Redirect after save
         $md = str_replace(" ", "+", Input::get('md'));
         $redirect = !is_null(Input::get('apply')) ? 'groups/add/' . $id . '?md=' . $md . $trackUri : 'groups?md=' . $md . $trackUri;
         return Redirect::to($redirect)->with('messagetext', Lang::get('core.note_success'))->with('msgstatus', 'success');
     } else {
         $md = str_replace(" ", "+", Input::get('md'));
         return Redirect::to('groups/add/' . $id . '?md=' . $md)->with('messagetext', Lang::get('core.note_error'))->with('msgstatus', 'error')->withErrors($validator)->withInput();
     }
 }
 public function getDelete($id = null)
 {
     if (!is_null($id)) {
         $id = SiteHelpers::encryptID($id, true);
         PlotModel::where('id', $id)->delete();
         return Redirect::to('plot')->with('message', SiteHelpers::alert('success', "Data deleted esuccessfully"));
     }
 }
 public function getDelete($id = null)
 {
     if (!is_null($id)) {
         $id = SiteHelpers::encryptID($id, true);
         $del = FileModel::where('id', $id)->first();
         @unlink(public_path('uploads/' . $del->filename));
         FileModel::where('id', $id)->delete();
         return Redirect::to('files')->with('message', SiteHelpers::alert('success', "Data deleted successfully"));
     }
 }
Exemplo n.º 4
0
 public static function view($class)
 {
     $id = Input::get('id');
     $id = SiteHelpers::encryptID($id, true);
     $results = $class::getRow($id);
     if (count($results) >= 1) {
         $config = $class::makeInfo($class);
         $data['tableGrid'] = $config['config']['grid'];
         $data['row'] = $results;
         return View::make('public.view', $data);
     } else {
         return "NO PAGE FOUND !";
     }
 }
 function getShow($id = null)
 {
     if ($this->access['is_detail'] == 0) {
         return Redirect::to('')->with('message', SiteHelpers::alert('error', Lang::get('core.note_restric')));
     }
     $ids = $id == null ? '' : SiteHelpers::encryptID($id, true);
     $row = $this->model->getRow($ids);
     if ($row) {
         $this->data['row'] = $row;
     } else {
         $this->data['row'] = $this->model->getColumnTable('tb_groups');
     }
     $this->data['id'] = $id;
     $this->data['access'] = $this->access;
     $this->layout->nest('content', 'groups.view', $this->data)->with('menus', $this->menus);
 }
Exemplo n.º 6
0
 function getShow($id = null)
 {
     if ($this->access['is_detail'] == 0) {
         return Redirect::to('')->with('message', SiteHelpers::alert('error', ' Your are not allowed to access the page '));
     }
     $ids = $id == null ? '' : SiteHelpers::encryptID($id, true);
     $row = $this->model->getRow($ids);
     if ($row) {
         $this->data['row'] = $row;
     } else {
         $this->data['row'] = $this->model->getColumnTable('tb_users');
     }
     $this->data['id'] = $id;
     $this->data['access'] = $this->access;
     $this->layout->nest('content', 'users.view', $this->data)->with('menus', $this->menus);
 }
 function postSave($id = 0)
 {
     //$trackUri = $this->data['trackUri'];
     $rules = $this->validateForm();
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         $data = $this->getDataPost('orders');
         unset($data['lang']);
         $ID = $this->model->insertRow($data, Input::get('OrderID'));
         // Input logs
         if (Input::get('OrderID') == '') {
             $this->inputLogs("New Entry row with ID : {$ID}  , Has Been Save Successfull");
             $id = SiteHelpers::encryptID($ID);
         } else {
             $this->inputLogs(" ID : {$ID}  , Has Been Changed Successfull");
         }
         // Redirect after save
         $md = str_replace(" ", "+", Input::get('md'));
         $redirect = !is_null(Input::get('apply')) ? 'order/add/' . $id . '?md=' . $md : 'order?md=';
         return Redirect::to($redirect)->with('message', SiteHelpers::alert('success', Lang::get('core.note_success')));
     } else {
         return Redirect::to('order/add/' . $id . '?md=' . $md)->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput();
     }
 }
 function postSave($id = 0)
 {
     $trackUri = $this->data['trackUri'];
     //$rules = $this->validateForm();
     $validator = Validator::make(Input::all(), Ncategories::$rules);
     SiteHelpers::globalXssClean();
     if ($validator->passes()) {
         if (!is_null(Input::file('file'))) {
             $file = Input::file('file');
             $destinationPath = ROOT . '/uploads/categories/';
             $filename = $file->getClientOriginalName();
             $extension = $file->getClientOriginalExtension();
             //if you need extension of the file
             $newfilename = Input::get('CategoryName') . '_' . time() . '.' . $extension;
             $uploadSuccess = Input::file('file')->move($destinationPath, $newfilename);
             if ($uploadSuccess) {
                 $data['Picture'] = $newfilename;
                 $orgFile = $destinationPath . '/' . $newfilename;
                 $thumbFile = $destinationPath . '/thumb/' . $newfilename;
                 //SiteHelpers::cropImage($this->img_width , $this->img_height , $orgFile ,  $extension,	 $thumbFile);
                 SiteHelpers::resizewidth("180", $orgFile, $thumbFile);
                 if (Input::get('action') != "") {
                     $data_old = $this->model->getRow(Input::get('action'));
                     @unlink(ROOT . '/uploads/categories/' . $data_old->Picture);
                     @unlink(ROOT . '/uploads/categories/thumb/' . $data_old->Picture);
                 }
             }
         }
         $data['postion'] = Input::get('postion');
         $data['CategoryName'] = Input::get('CategoryName');
         $data['Description'] = Input::get('Description');
         $data['lang'] = $this->lang;
         $data['created'] = time();
         $data['status'] = Input::get('status');
         $data['alias'] = SiteHelpers::seoUrl(trim($data['CategoryName']));
         $data['keywords'] = Input::get('keywords');
         $data['seo_meta'] = Input::get('seo_meta');
         //$data = $this->validatePost('categories');
         $ID = $this->model->insertRow($data, Input::get('CategoryID'));
         // Input logs
         if (Input::get('CategoryID') == '') {
             $this->inputLogs("New Entry row with ID : {$ID}  , Has Been Save Successfull");
             $id = SiteHelpers::encryptID($ID);
         } else {
             $this->inputLogs(" ID : {$ID}  , Has Been Changed Successfull");
         }
         // Redirect after save
         //$md = str_replace(" ","+",Input::get('md'));
         $redirect = !is_null(Input::get('apply')) ? 'Ncategories/add/' . $id : 'Ncategories?md=';
         return Redirect::to($redirect)->with('message', SiteHelpers::alert('success', Lang::get('core.note_success')));
     } else {
         return Redirect::to('Ncategories/add/' . $id)->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput();
     }
 }
 function postSave($id = 0)
 {
     $trackUri = $this->data['trackUri'];
     $rules = array();
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         $data['post_note'] = Input::get('post_note');
         $ID = Input::get('post_id');
         $data_post = DB::table('post')->where('post_id', '=', $ID)->first();
         if (Input::get('active') != '') {
             $data['status'] = '1';
             $data['active'] = Input::get('active');
             $this->cus = Customer::where('customer_id', '=', $data_post->customer_id)->first();
             $link = URL::to('') . "/tin/" . $data_post->post_slug . '-' . $data_post->post_id . ".html";
             $data_mail = array('link' => $link);
             Mail::send('emails.successpost', $data_mail, function ($message) {
                 $message->from(CNF_EMAIL, 'Admin');
                 $message->to($this->cus->email, $this->cus->name)->subject('Xác nhận tin đã đăng');
             });
         } else {
             $data['status'] = Input::get('status');
         }
         DB::table('post')->where('post_id', '=', $ID)->update($data);
         // Input logs
         if (Input::get('post_id') == '') {
             $this->inputLogs("New Entry row with ID : {$ID}  , Has Been Save Successfull");
             $id = SiteHelpers::encryptID($ID);
         } else {
             $this->inputLogs(" ID : {$ID}  , Has Been Changed Successfull");
         }
         // Redirect after save
         $md = str_replace(" ", "+", Input::get('md'));
         $redirect = !is_null(Input::get('apply')) ? 'post/add/' . $id . '?md=' . $md : 'post?md=' . $md . $trackUri;
         return Redirect::to($redirect)->with('message', SiteHelpers::alert('success', Lang::get('core.note_success')));
     } else {
         return Redirect::to('post/add/' . $id)->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput();
     }
 }
 function postSave($id = 0)
 {
     $trackUri = $this->data['trackUri'];
     $rules = Nproducts::$rules;
     //print_r(Input::all());die;
     $validator = Validator::make(Input::all(), $rules);
     //SiteHelpers::globalXssClean();
     if ($validator->passes()) {
         $data = $this->getDataPost('products');
         if (!is_null(Input::file('file'))) {
             $file = Input::file('file');
             $destinationPath = './uploads/products/';
             $filename = $file->getClientOriginalName();
             $extension = $file->getClientOriginalExtension();
             //if you need extension of the file
             $newfilename = Input::get('ProductName') . '_' . time() . '.' . $extension;
             $uploadSuccess = Input::file('file')->move($destinationPath, $newfilename);
             if ($uploadSuccess) {
                 $data['image'] = $newfilename;
                 $orgFile = $destinationPath . '/' . $newfilename;
                 $thumbFile = $destinationPath . '/thumb/' . $newfilename;
                 SiteHelpers::resizewidth("152", $orgFile, $thumbFile);
                 if (Input::get('action') != "") {
                     $data_old = $this->model->getRow(Input::get('action'));
                     @unlink(ROOT . '/uploads/products/' . $data_old->Picture);
                     @unlink(ROOT . '/uploads/products/thumb/' . $data_old->Picture);
                 }
             }
         }
         $data['SupplierID'] = "1";
         $data['created'] = time();
         $data['slug'] = SiteHelpers::seoUrl(trim($data['ProductName']));
         $data['created'] = time();
         $ID = $this->model->insertRow($data, Input::get('ProductID'));
         if (Input::file('multi_file')[0] != "") {
             $model_img_pro = new Imagesproduct();
             $rm_image = Input::get('remove_image');
             $arr_img_rm = $rm_image != "" ? $rm_image : array();
             foreach ($_FILES['multi_file']['tmp_name'] as $key => $tmp_name) {
                 $file_name = $_FILES['multi_file']['name'][$key];
                 if (!in_array($file_name, $arr_img_rm)) {
                     $file_size = $_FILES['multi_file']['size'][$key];
                     $file_tmp = $_FILES['multi_file']['tmp_name'][$key];
                     $file_type = $_FILES['multi_file']['type'][$key];
                     $explode_name = explode(".", $file_name);
                     $path_image = './uploads/images_product/';
                     $newname = "image_" . $key . time() . '.' . $explode_name[1];
                     if (move_uploaded_file($file_tmp, $path_image . $newname)) {
                         $model_img_pro->insertRow(array("name" => $newname, "id_product" => $ID), "");
                         SiteHelpers::resizewidth("300", $path_image . $newname, $path_image . "thumb/" . $newname);
                     }
                 }
             }
         }
         // Input logs
         if (Input::get('ProductID') == '') {
             $this->inputLogs("New Entry row with ID : {$ID}  , Has Been Save Successfull");
             $id = SiteHelpers::encryptID($ID);
         } else {
             $this->inputLogs(" ID : {$ID}  , Has Been Changed Successfull");
         }
         // Redirect after save
         $md = str_replace(" ", "+", Input::get('md'));
         $redirect = !is_null(Input::get('apply')) ? 'Nproducts/add/' . $id . $trackUri : 'Nproducts' . $trackUri;
         return Redirect::to($redirect)->with('message', SiteHelpers::alert('success', Lang::get('core.note_success')));
     } else {
         return Redirect::to('Nproducts/add/' . $id)->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput();
     }
 }
 function postSave($id = 0)
 {
     $trackUri = $this->data['trackUri'];
     $rules = Promotion::$rules;
     //$rules = $this->validateForm();
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         $data = $this->getDataPost('promotion');
         $data['created'] = time();
         unset($data['lang']);
         $ID = $this->model->insertRow($data, Input::get('id_promotion'));
         if ($data['status'] == 0) {
             DB::table('products')->where('id_promotion', '=', $ID)->update(array('id_promotion' => '0'));
         }
         // Input logs
         if (Input::get('id_promotion') == '') {
             $this->inputLogs("New Entry row with ID : {$ID}  , Has Been Save Successfull");
             $id = SiteHelpers::encryptID($ID);
         } else {
             $this->inputLogs(" ID : {$ID}  , Has Been Changed Successfull");
         }
         // Redirect after save
         $md = str_replace(" ", "+", Input::get('md'));
         $redirect = !is_null(Input::get('apply')) ? 'Promotion/add/' . $id . '?md=' : 'Promotion?md=';
         return Redirect::to($redirect)->with('message', SiteHelpers::alert('success', Lang::get('core.note_success')));
     } else {
         return Redirect::to('Promotion/add/' . $id . '?md=')->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput();
     }
 }
 function postSave($id = 0)
 {
     $trackUri = $this->data['trackUri'];
     $rules = $this->validateForm();
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         $data = $this->validatePost('tb_restapi');
         if (Input::get('id') == '') {
             $x = SiteHelpers::encryptID(rand(10000, 10000000));
             $x .= "-" . SiteHelpers::encryptID(rand(10000, 10000000));
             $data['apikey'] = $x;
             $data['created'] = date("Y-m-d");
         }
         $ID = $this->model->insertRow($data, Input::get('id'));
         // Input logs
         if (Input::get('id') == '') {
             $this->inputLogs("New Entry row with ID : {$ID}  , Has Been Save Successfull");
             $id = SiteHelpers::encryptID($ID);
         } else {
             $this->inputLogs(" ID : {$ID}  , Has Been Changed Successfull");
         }
         // Redirect after save
         $md = str_replace(" ", "+", Input::get('md'));
         $redirect = !is_null(Input::get('apply')) ? 'restapi/add/' . $id . '?md=' . $md . $trackUri : 'restapi?md=' . $md . $trackUri;
         return Redirect::to($redirect)->with('message', SiteHelpers::alert('success', Lang::get('core.note_success')));
     } else {
         $md = str_replace(" ", "+", Input::get('md'));
         return Redirect::to('restapi/add/' . $id . '?md=' . $md)->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput();
     }
 }
 function postSave(Request $request)
 {
     $rules = $this->validateForm();
     $validator = Validator::make($request->all(), $rules);
     if ($validator->passes()) {
         $data = $this->validatePost('tb_restapi');
         if ($request->input('id') == '') {
             $x = \SiteHelpers::encryptID(rand(10000, 10000000));
             $x .= "-" . \SiteHelpers::encryptID(rand(10000, 10000000));
             $data['apikey'] = $x;
             $data['created'] = date("Y-m-d");
         }
         $id = $this->model->insertRow($data, $request->input('id'));
         if (!is_null($request->input('apply'))) {
             $return = 'restapi/update/' . $id . '?return=' . self::returnUrl();
         } else {
             $return = 'restapi?return=' . self::returnUrl();
         }
         // Insert logs into database
         if ($request->input('id') == '') {
             \SiteHelpers::auditTrail($request, 'New Data with ID ' . $id . ' Has been Inserted !');
         } else {
             \SiteHelpers::auditTrail($request, 'Data with ID ' . $id . ' Has been Updated !');
         }
         return Redirect::to($return)->with('messagetext', \Lang::get('core.note_success'))->with('msgstatus', 'success');
     } else {
         return Redirect::to('restapi/update/' . $id)->with('messagetext', \Lang::get('core.note_error'))->with('msgstatus', 'error')->withErrors($validator)->withInput();
     }
 }
 function postSave($id = 0)
 {
     $trackUri = $this->data['trackUri'];
     $data['status'] = Input::get('status');
     $money_more = Input::get('money_more');
     $money_loss = Input::get('money_loss');
     $cus = $this->model->find($id);
     $money = $cus['money'] + $money_more;
     $money = $money < $money_loss ? 0 : $money - $money_loss;
     $data['money'] = $money;
     $ID = $this->model->insertRow($data, Input::get('customer_id'));
     // Input logs
     if (Input::get('customer_id') == '') {
         $this->inputLogs("New Entry row with ID : {$ID}  , Has Been Save Successfull");
         $id = SiteHelpers::encryptID($ID);
     } else {
         $this->inputLogs(" ID : {$ID}  , Has Been Changed Successfull");
     }
     // Redirect after save
     $md = str_replace(" ", "+", Input::get('md'));
     $redirect = !is_null(Input::get('apply')) ? 'Customer/add/' . $id . '?md=' : 'Customer?md=' . $md;
     return Redirect::to($redirect)->with('message', SiteHelpers::alert('success', Lang::get('core.note_success')));
 }
 function getShow($id = null)
 {
     if ($this->access['is_detail'] == 0) {
         echo SiteHelpers::alert('error', Lang::get('core.note_restric'));
         die;
     }
     $ids = $id == null ? '' : SiteHelpers::encryptID($id, true);
     $row = $this->model->getRow($ids);
     if ($row) {
         $this->data['row'] = $row;
     } else {
         $this->data['row'] = $this->model->getColumnTable('orderdetails');
     }
     $this->data['subgrid'] = isset($this->info['config']['subgrid']) ? $this->info['config']['subgrid'] : array();
     $this->data['id'] = $id;
     $this->data['access'] = $this->access;
     return View::make('aorderdetails.view', $this->data);
 }
 function postSave($id = 0)
 {
     $trackUri = $this->data['trackUri'];
     //$rules = $this->validateForm();
     $rules = Slideshow::$rules;
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         $data = $this->getDataPost('slideshow');
         if (!is_null(Input::file('file'))) {
             $file = Input::file('file');
             $destinationPath = './uploads/slideshow/';
             $filename = $file->getClientOriginalName();
             $extension = $file->getClientOriginalExtension();
             //if you need extension of the file
             $newfilename = SiteHelpers::seoUrl(trim(Input::get('slideshow_name'))) . '_' . time() . '.' . $extension;
             $uploadSuccess = Input::file('file')->move($destinationPath, $newfilename);
             if ($uploadSuccess) {
                 $data['slideshow_image'] = $newfilename;
                 $orgFile = $destinationPath . '/' . $newfilename;
                 $thumbFile = $destinationPath . '/thumb/' . $newfilename;
                 SiteHelpers::resizewidth("1140", $orgFile, $thumbFile);
                 if (Input::get('slideshow_id') != "") {
                     $data_old = $this->model->getRow(Input::get('slideshow_id'));
                     @unlink(ROOT . '/uploads/slideshow/' . $data_old->slideshow_image);
                     @unlink(ROOT . '/uploads/slideshow/thumb/' . $data_old->slideshow_image);
                 }
             }
         }
         $data['slideshow_alias'] = SiteHelpers::seoUrl(trim($data['slideshow_name']));
         $data['created'] = time();
         $ID = $this->model->insertRow($data, Input::get('slideshow_id'));
         // Input logs
         if (Input::get('slideshow_id') == '') {
             $this->inputLogs("New Entry row with ID : {$ID}  , Has Been Save Successfull");
             $id = SiteHelpers::encryptID($ID);
         } else {
             $this->inputLogs(" ID : {$ID}  , Has Been Changed Successfull");
         }
         // Redirect after save
         $md = str_replace(" ", "+", Input::get('md'));
         $redirect = !is_null(Input::get('apply')) ? 'Slideshow/add/' . $id . '?md=' : 'Slideshow?md=';
         return Redirect::to($redirect)->with('message', SiteHelpers::alert('success', Lang::get('core.note_success')));
     } else {
         return Redirect::to('Slideshow/add/' . $id . '?md=')->with('message', SiteHelpers::alert('error', Lang::get('core.note_error')))->withErrors($validator)->withInput();
     }
 }
Exemplo n.º 17
0
    function btnAction($row, $id)
    {
        $id = SiteHelpers::encryptID($id);
        if ($this->access['is_detail'] == 1) {
            $val = '<a href="' . URL::to('logs/show/' . $id) . '"  class="tips btn btn-xs btn-default"  title="' . Lang::get('core.btn_view') . '"
			onclick="SximoModal(this.href,\'Add New\')" 
			> <i class="icon-paragraph-justify"></i> </a>';
        }
        if ($this->access['is_edit'] == 1) {
            $val = '<a  href="' . URL::to('logs/add/' . $id) . '"  class="tips btn btn-xs btn-success"  title="' . Lang::get('core.btn_edit') . '"
			onclick="SximoModal(this.href,\'' . Lang::get('core.btn_edit') . '\')" ><i class="icon-pencil4"></i></a>';
        }
        return $val;
    }
 public function getDelete($id = null)
 {
     if (!is_null($id)) {
         $id = SiteHelpers::encryptID($id, true);
         $del = AutomateModel::where('id', $id)->first();
         $del_log = LogChartModel::where('id_result', $id)->get();
         foreach ($del_log as $data) {
             unlink(public_path($data->filename));
         }
         unlink(public_path('presentation/' . $del->file_result . '.pptx'));
         unlink(public_path('presentation/' . $del->file_result . '.odp'));
         AutomateModel::where('id', $id)->delete();
         return Redirect::to('automate')->with('message', SiteHelpers::alert('success', "Data deleted successfully"));
     }
 }