示例#1
0
 private function loadPage($id)
 {
     $response = Model_Pages::getPage($id);
     if (!empty($response[0])) {
         $response = $response[0];
     }
     //SEO
     if (!empty($response['title'])) {
         View::share('page_title', $response['title']);
     }
     if (!empty($response['meta_description'])) {
         View::share('page_meta_description', $response['meta_description']);
     }
     if (!empty($response['meta_keywords'])) {
         View::share('page_meta_keywords', $response['meta_keywords']);
     }
     return $response;
 }
示例#2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function getEdit($id)
 {
     $response['pageTitle'] = trans('carousels.edit');
     $response['blade_custom_css'] = ['global/plugins/select2/select2', 'global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min'];
     $response['blade_custom_js'] = ['global/plugins/bootstrap-select/bootstrap-select.min', 'global/plugins/select2/select2.min', 'admin/pages/scripts/components-dropdowns', 'global/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min'];
     $response['categories'] = Model_Categories::getCategory(FALSE, ['title']);
     $response['pages'] = Model_Pages::getPage(FALSE, ['id', 'title']);
     $response['products'] = Model_Products::getProducts(FALSE, ['title']);
     $response['carousel'] = Model_Carousels::getCarousels($id, FALSE);
     if (!empty($response['carousel']) && !empty($response['carousel'][0])) {
         $response['carousel'] = $response['carousel'][0];
     }
     if (!empty($response['carousel']['products']) && $response['carousel']['products'] == 'newest' || $response['carousel']['products'] == 'discounted') {
         $response['carousel']['slider_type'] = $response['carousel']['products'];
     } else {
         $response['carousel']['slider_type'] = 'others';
     }
     if (!empty($response['carousel']['products']) && $response['carousel']['slider_type'] == 'others') {
         $response['carousel']['products'] = is_array(json_decode(',', $response['carousel']['products'], TRUE)) ? json_decode(',', $response['carousel']['products'], TRUE) : explode(',', $response['carousel']['products']);
     }
     if (!empty($response['carousel']['active_from']) && $response['carousel']['active_from'] == '0000-00-00 00:00:00') {
         $response['carousel']['active_from'] = '';
     }
     if (!empty($response['carousel']['active_to']) && $response['carousel']['active_to'] == '0000-00-00 00:00:00') {
         $response['carousel']['active_to'] = '';
     }
     return Theme::view('carousels.create_edit_carousel', $response);
 }
示例#3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function getEdit($id)
 {
     $response['pageTitle'] = trans('sliders.edit');
     $response['blade_custom_css'] = ['global/plugins/jquery-minicolors/jquery.minicolors', 'global/plugins/dropzone/css/dropzone', 'global/plugins/select2/select2', 'global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min'];
     $response['blade_custom_js'] = ['global/plugins/jquery-minicolors/jquery.minicolors.min', 'global/plugins/dropzone/dropzone', 'admin/pages/scripts/form-dropzone', 'global/plugins/bootstrap-select/bootstrap-select.min', 'global/plugins/select2/select2.min', 'admin/pages/scripts/components-dropdowns', 'global/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min'];
     $response['images_dir'] = Config::get('system_settings.sliders_upload_path');
     $response['public_images_dir'] = Config::get('system_settings.sliders_public_path');
     $response['categories'] = Model_Categories::getCategory(FALSE, ['title']);
     $response['pages'] = Model_Pages::getPage(FALSE, ['id', 'title']);
     $response['slider'] = Model_Sliders::getSliders($id, FALSE, ['id', 'title', 'dir', 'active_from', 'active_to', 'position', 'type', 'target']);
     if (!empty($response['slider']) && !empty($response['slider'][0])) {
         $response['slider'] = $response['slider'][0];
     }
     if (!empty($response['slider']['active_from']) && $response['slider']['active_from'] == '0000-00-00 00:00:00') {
         $response['slider']['active_from'] = '';
     }
     if (!empty($response['slider']['active_to']) && $response['slider']['active_to'] == '0000-00-00 00:00:00') {
         $response['slider']['active_to'] = '';
     }
     return Theme::view('sliders.create_edit_slider', $response);
 }
示例#4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function postDestroy($id = FALSE)
 {
     $response['status'] = 'error';
     $response['message'] = trans('pages.not_removed');
     if (!empty($id) && intval($id) > 0) {
         if (Model_Pages::removePage($id) === TRUE) {
             $response['status'] = 'success';
             $response['message'] = trans('pages.removed');
         }
     }
     return response()->json($response);
 }