Ejemplo n.º 1
0
 $menu_name = retrieve(POST, 'name', '', TSTRING_UNCHANGE);
 $menu_url = retrieve(POST, 'feed_url', '', TSTRING_UNCHANGE);
 $menu_items_number = retrieve(POST, 'items_number', 0, TSTRING_UNCHANGE);
 $matches = array();
 preg_match('`/rss/(.+)/([0-9]+)/(.+)/`', $menu_url, $matches);
 if (!empty($id_post)) {
     // Edit the Menu
     $menu = MenuService::load($id_post);
     $menu->set_title($menu_name);
     $menu->set_module_id($matches[1]);
     $menu->set_cat($matches[2]);
     $menu->set_name($matches[3]);
     $menu->set_number($menu_items_number);
 } else {
     // Add the new Menu
     $menu = new FeedMenu($menu_name, $matches[1], $matches[2], $matches[3], $menu_items_number);
 }
 if (!$menu instanceof FeedMenu) {
     AppContext::get_response()->redirect('menus.php');
 }
 $menu->enabled(retrieve(POST, 'activ', Menu::MENU_NOT_ENABLED));
 $menu->set_hidden_with_small_screens((bool) retrieve(POST, 'hidden_with_small_screens', false));
 if ($menu->is_enabled()) {
     $menu->set_block(retrieve(POST, 'location', Menu::BLOCK_POSITION__NOT_ENABLED));
 }
 $menu->set_auth(Authorizations::build_auth_array_from_form(Menu::MENU_AUTH_BIT));
 //Filters
 MenuAdminService::set_retrieved_filters($menu);
 MenuService::move($menu, $menu->get_block());
 MenuService::generate_cache();
 AppContext::get_response()->redirect('menus.php#m' . $menu->get_id());
Ejemplo n.º 2
0
 function display()
 {
     return Feed::get_parsed($this->module_id, $this->name, $this->category, FeedMenu::get_template($this->get_title(), $this->get_block()), $this->number, $this->begin_at);
 }