Пример #1
0
 public function delete_destroy($page_id)
 {
     $page = Pages\Model\Page::find($page_id);
     // If there is childen set children to the actual page parent
     Pages\Model\Page::where('parent_id', '=', $page->id)->update(array('parent_id' => $page->parent_id));
     // This page has links?? If so lets delete them
     $link = Navigation\Model\Link::where('page_id', '=', $page->id)->get();
     //This page has links?
     if (isset($link) and !empty($link)) {
         foreach ($link as $delete_link) {
             // If there is childen set children to the actual link parent
             Navigation\Model\Link::where('parent', '=', $delete_link->id)->update(array('parent' => $delete_link->parent));
             $delete_link->delete();
             Event::fire('mwi.navigation_link_deleted', array($delete_link));
         }
     }
     $page->delete();
     Event::fire('mwi.pages_page_deleted', array($page));
     Session::flash('message', Lang::line('pages::lang.Page was successfully deleted')->get(ADM_LANG));
     Session::flash('message_type', 'success');
     if (Request::ajax()) {
         $data = array('success' => 'true', 'url' => URL::base() . '/' . ADM_URI . '/pages');
         return json_encode($data);
     } else {
         return Redirect::to(ADM_URI . '/pages')->with($this->data);
     }
 }
Пример #2
0
 public function get_new($group_id)
 {
     if (Bundle::exists('pages')) {
         $pages = Pages\Model\Page::where('status', '=', 'live')->get(array('id', 'title'));
     } else {
         $pages = null;
     }
     $modules = Modules\Model\Module::where('enabled', '=', 1)->where('is_frontend', '=', 1)->get(array('id', 'slug', 'name'));
     $groups = Groups\Model\Group::all();
     return View::make('navigation::backend.links.create', $this->data)->with('nav_group_id', $group_id)->with('modules', $modules)->with('pages', $pages)->with('groups', $groups);
 }