Exemplo n.º 1
0
 public function update_printer()
 {
     try {
         $_arData = array();
         $_arData2 = array();
         $total_files = null;
         $detailName = Input::get("detailName");
         $detailType = Input::get("detailType");
         $detailPDF = Input::get("detailPDF");
         $detailVideo = Input::get("detailVideo");
         $detailDescription = Input::get("detailDescription");
         $detailOldPrice = Input::get("detailOldPrice");
         $detailNewPrice = Input::get("detailNewPrice");
         $detailVisible = Input::get("detailVisible");
         if ($detailVisible == '1') {
             $detailVisible = '1';
         } else {
             $detailVisible = '0';
         }
         $destinationPath_Printer = 'asserts/images/Products/Printers';
         $_countFiles = count(Input::file("filedetailTImage"));
         $_number = 1;
         if (Input::hasfile('filedetailTImage')) {
             foreach (Input::file("filedetailTImage") as $file) {
                 $filename = $file->getClientOriginalName();
                 if ($_number == $_countFiles) {
                     $total_files .= $filename;
                 } else {
                     $total_files .= $filename . ';';
                 }
                 $upload_success = $file->move($destinationPath_Printer, $filename);
                 $_number++;
             }
         }
         $filename_Banner = null;
         if (Input::hasfile('filedetailBImage')) {
             $file_Banner = Input::file("filedetailBImage");
             $filename_Banner = $file_Banner->getClientOriginalName();
             $upload_success_banner = $file_Banner->move($destinationPath_Printer, $filename_Banner);
         }
         if ($filename_Banner == null && $total_files == null) {
             $_arData = array('detailName' => $detailName, 'detailType' => $detailType, 'detailPDF' => $detailPDF, 'detailVideo' => $detailVideo, 'detailDescription' => $detailDescription, 'detailOldPrice' => $detailOldPrice, 'detailNewPrice' => $detailNewPrice, 'detailVisible' => $detailVisible);
         } else {
             if ($filename_Banner == null && $total_files != null) {
                 $_arData = array('detailName' => $detailName, 'detailType' => $detailType, 'detailPDF' => $detailPDF, 'detailVideo' => $detailVideo, 'detailDescription' => $detailDescription, 'detailOldPrice' => $detailOldPrice, 'detailNewPrice' => $detailNewPrice, 'detailVisible' => $detailVisible, 'detailTImage' => $total_files);
             } else {
                 if ($filename_Banner != null && $total_files == null) {
                     $_arData = array('detailName' => $detailName, 'detailType' => $detailType, 'detailPDF' => $detailPDF, 'detailVideo' => $detailVideo, 'detailDescription' => $detailDescription, 'detailOldPrice' => $detailOldPrice, 'detailNewPrice' => $detailNewPrice, 'detailVisible' => $detailVisible, 'detailBImage' => $filename_Banner);
                 } else {
                     if ($filename_Banner != null && $total_files != null) {
                         $_arData = array('detailName' => $detailName, 'detailType' => $detailType, 'detailPDF' => $detailPDF, 'detailVideo' => $detailVideo, 'detailDescription' => $detailDescription, 'detailOldPrice' => $detailOldPrice, 'detailNewPrice' => $detailNewPrice, 'detailVisible' => $detailVisible, 'detailBImage' => $filename_Banner, 'detailTImage' => $total_files);
                     }
                 }
             }
         }
         $_page_update = Printers::where('detailId', Input::get("detailId"))->update($_arData);
         $printerId = Input::get("printerId");
         $_arData2 = array('printerId' => $printerId, 'detailId' => Input::get("detailId"));
         $oldprinterId = Input::get("oldprinterId");
         $_page_update1 = PrinterAlias::where('printerId', $oldprinterId)->where('detailId', Input::get("detailId"))->update($_arData2);
     } catch (Exception $_ex) {
         Session::flash('error', '$$$ --- Error (' . $_ex->getMessage() . ') --- $$$');
     }
     Session::flash('success', '$$$ --- Update Printer Successfully  --- $$$');
     return Redirect::to('qlm-admin/printers/' . Input::get("detailId"));
 }
Exemplo n.º 2
0
@extends('layouts.qlm_administrator')
@section('content')
<?php 
$_resultPage1st = DB::table('qlm_printerdetails')->join('qlm_printeralias', 'qlm_printeralias.detailId', '=', 'qlm_printerdetails.detailId')->select('qlm_printerdetails.*', 'qlm_printeralias.printerId')->where('qlm_printerdetails.detailId', '=', $_id)->get();
$_page = $_resultPage1st[0];
$printer_alias = PrinterAlias::where('detailId', $_id)->get();
$items = '';
$z = 0;
foreach ($printer_alias as $printer_alia) {
    if ($z == count($printer_alias) - 1) {
        $items .= '"' . $printer_alia->printerId . '"';
    } else {
        $items .= '"' . $printer_alia->printerId . '"' . ',';
    }
    $z++;
}
Log::info('$items:' . $items);
?>
  <!-- Page Heading -->
               <div class="row">
                     <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                             <h2>Product : {{$_page -> detailName}}</h2>
                             <div class="table-responsive">
                                 @if (Session::has('success'))
                                     <div class="alert alert-success">{{ Session::get('success') }} | <a href="{{'/details-printer/'.$_id}}" target="_blank">View New Printer</a> </div>
                                 @endif
                                 @if (Session::has('error'))
                                     <div class="alert alert-error">{{ Session::get('error') }}</div>
                                 @endif
                                 <form action="{{asset('qlm-admin/update-printer')}}" method="post" enctype="multipart/form-data">
                                     <input type="hidden" name="printerId" value="{{$_page->detailId}}">
Exemplo n.º 3
0
 public function add_printer()
 {
     try {
         $total_files = null;
         $destinationPath_Printer = 'asserts/images/Products/Printers';
         $destinationPath_PDF = 'asserts/Files/Catalogue';
         $new_printer = new Printers();
         if (!empty(Input::get("detailName"))) {
             $new_printer->detailName = Input::get("detailName");
         }
         if (!empty(Input::get("detailType"))) {
             $new_printer->detailType = Input::get("detailType");
         }
         if (!empty(Input::get("detailVideo"))) {
             $new_printer->detailVideo = Input::get("detailVideo");
         }
         if (!empty(Input::get("detailDescription"))) {
             $new_printer->detailDescription = Input::get("detailDescription");
         }
         if (!empty(Input::get("detailNewPrice"))) {
             $new_printer->detailNewPrice = Input::get("detailNewPrice");
         }
         if (!empty(Input::get("detailVisible"))) {
             $new_printer->detailVisible = Input::get("detailVisible");
         }
         $filename_PDF = null;
         if (Input::hasfile('file_detailPDF')) {
             $file_PDF = Input::file("file_detailPDF");
             $filename_PDF = $file_PDF->getClientOriginalName();
             $upload_success_banner = $file_PDF->move($destinationPath_PDF, $filename_PDF);
             $new_printer->detailPDF = $filename_PDF;
         }
         $_countFiles = count(Input::file("filedetailTImage"));
         $_number = 1;
         if (Input::hasfile('filedetailTImage')) {
             foreach (Input::file("filedetailTImage") as $file) {
                 $filename = $file->getClientOriginalName();
                 if ($_number == $_countFiles) {
                     $total_files .= $filename;
                 } else {
                     $total_files .= $filename . ';';
                 }
                 $upload_success = $file->move($destinationPath_Printer, $filename);
                 $_number++;
             }
             $new_printer->detailTImage = $total_files;
         }
         $filename_Banner = null;
         if (Input::hasfile('filedetailBImage')) {
             $file_Banner = Input::file("filedetailBImage");
             $filename_Banner = $file_Banner->getClientOriginalName();
             $upload_success_banner = $file_Banner->move($destinationPath_Printer, $filename_Banner);
             $new_printer->detailBImage = $filename_Banner;
         }
         $printerId = $this->generate_printerid();
         $new_printer->detailId = $printerId;
         $new_printer->save();
         /*==============================
           == Phan update Alias
           ==============================*/
         $is_deleted = PrinterAlias::where('detailId', $printerId)->delete();
         foreach (Input::get("type_printer") as $type_prin) {
             $alias_new = new PrinterAlias();
             $alias_new->printerId = $type_prin;
             $alias_new->detailId = $printerId;
             $alias_new->save();
         }
     } catch (Exception $_ex) {
         Session::flash('error', '$$$ --- Error (' . $_ex->getMessage() . ') --- $$$');
     }
     Session::flash('success', '$$$ --- Add Printer Successfully  --- $$$');
     return Redirect::to('qlm-admin/add-new-printer/' . $printerId);
 }