/** * Api to get Sections from class */ public function postGetSections() { $classId = Input::get('class_id'); $sections = Sections::where('class_id', '=', $classId)->get(); $response = array('status' => 'success', 'result' => array('sections' => $sections)); return Response::json($response); }
File::delete($oldPage->page_url); } $rule = array('page_description' => 'required', 'page_name' => 'required', 'page_title' => 'required', 'page_subtitle' => 'required', 'type_of_page' => 'required', 'page_section' => 'required', 'page_shortname' => 'required'); $validator = Validator::make(Input::all(), $rule); if ($validator->fails()) { return Redirect::to('/forms')->with('flash_error', 'true')->withInput()->withErrors($validator); } else { $first_action_cnt = Input::get('first_action_cnt'); $second_action_cnt = Input::get('second_action_cnt'); $transport_action_cnt = Input::get('transport_cnt'); $action_cnt = Input::get('action_cnt'); $question_cnt = Input::get('question_cnt'); $layout_cnt = Input::get('layout_cnt'); $noreferral_cnt = Input::get('noreferral_cnt'); // $section = Sections::where('name_of_section', '=', Input::get('page_section'))->first(); $xmlFileName = $section->section_url . '\\' . Input::get('page_shortname') . '.xml'; /* $page = new Pages; $page->name_of_page = Input::get('name_of_page'); $page->type_of_page = Input::get('page_type'); $page->page_title = Input::get('page_title'); $page->page_subtitle = Input::get('page_subtitle').": ".Input::get('name_of_page'); $page->page_section = Input::get('page_section'); $page->page_link_value = $section->shortname."/".Input::get('page_shortname'); $page->color_code = Input::get('color_code'); $page->page_shortname = Input::get('page_shortname'); $page->page_url = $xmlFileName; // */ // $page->save(); $page = DB::table('pages')->where('id', Input::get('id'))->update(array('page_description' => Input::get('page_description'), 'type_of_page' => Input::get('type_of_page'), 'page_name' => Input::get('page_name'), 'page_title' => Input::get('page_title'), 'page_subtitle' => Input::get('page_subtitle') . ": " . Input::get('page_description'), 'page_section' => Input::get('page_section'), 'page_link_value' => $section->shortname . "/" . Input::get('page_shortname'), 'color_code' => Input::get('color_code'), 'page_shortname' => Input::get('page_shortname'), 'page_url' => $xmlFileName));
public function postDeleteSections() { $section_id = Input::get('section_id'); $section_name = Input::get('section_name'); $class_id = Input::get('class_id'); if ($section_id) { $sections = Sections::find($section_id); } else { $sections = Sections::where('section_name', '=', $section_name)->where('class_id', '=', $class_id); } if ($sections->delete()) { $response = array('status' => 'success', 'msg' => 'Setting created successfully', 'deleted_item_id' => $section_id); return Response::json($response); } else { $response = array('status' => 'failed', 'msg' => 'Item is Not deleted', 'Item_id' => $section_id); return Response::json($response); } }