src/core/classes/org/glizycms/contents/models/proxy/MenuProxy.php
/**
     * Add a new menu
     *
     * @param string $title    the menu title
     * @param int $parent      the menu parent id
     * @param string $pageType the menu pageType
     * @return int             new menu id
     */
Add a new menu
@param string $title    the menu title
@param int $parent      the menu parent id
@param string $pageType the menu pageType
@return int             new menu id
Add a new menu @param string $title the menu title @param int $parent the menu parent id @param string $pageType the menu pageType @return int new menu id
public function addMenu($title, $parent, $pageType, $type='PAGE') {
        $userId = org_glizy_ObjectValues::get('org.glizy', 'userId');
        $menus = org_glizy_ObjectFactory::createModelIterator('org.glizycms.core.models.Menu');
        $menus->load('getChildrenMenuInOrder', array('params' => array('menuId' => $parent, 'isBlock' => $type!='PAGE')));
        $order = $menus->count()+1;
        $application = org_glizy_ObjectValues::get('org.glizy', 'application');
		$menudetail_isVisible = 1;
        $user = $application->getCurrentUser();
        if ($user) {
            $menudetail_isVisible = $user->acl(__Config::get('SITEMAP_ID'), 'publish') === true ? 1 : 0;
        }
        $ar = org_glizy_ObjectFactory::createModel('org.glizycms.core.models.Menu');
        $ar->menu_parentId  = $parent;
        $ar->menu_pageType  = $pageType;
        $ar->menu_order     = $order;
        $ar->menu_type      = $type;
        $ar->menu_hasPreview= '1';
        $ar->menu_url       = '';
        $ar->menu_creationDate = new org_glizy_types_DateTime();
        $ar->menu_modificationDate = new org_glizy_types_DateTime();
        if (!__Config::get('MULTISITE_ENABLED')) {
            $ar->menu_FK_site_id = 0;
        }
        $ar->menudetail_title = $title;
        $ar->menudetail_isVisible = $menudetail_isVisible;
        $ar->menudetail_description = '';
        $ar->menudetail_subject = '';
        $ar->menudetail_keywords = '';
        $ar->menudetail_creator = '';
        $ar->menudetail_publisher = '';
        $ar->menudetail_contributor = '';
        $ar->menudetail_type = '';
        $ar->menudetail_identifier = '';
        $ar->menudetail_source = '';
        $ar->menudetail_relation = '';
        $ar->menudetail_coverage = '';
        $pageId = $ar->save();
        $this->moveMenu($pageId, $order, $parent);
        $this->invalidateSitemapCache();
        $evt = array('type' => org_glizycms_contents_events_Menu::ADD, 'data' => $pageId);
        $this->dispatchEvent($evt);
        return $pageId;
    }
public function addMenu ( $ title , $ parent , $ pageType , $ type = 'PAGE' ) { $ userId = org_glizy_ObjectValues :: get ( 'org.glizy' , 'userId' ) ; $ menus = org_glizy_ObjectFactory :: createModelIterator ( 'org.glizycms.core.models.Menu' ) ; $ menus -> load ( 'getChildrenMenuInOrder' , array ( 'params' => array ( 'menuId' => $ parent , 'isBlock' => $ type != 'PAGE' ) ) ) ; $ order = $ menus -> count ( ) + 1 ; $ application = org_glizy_ObjectValues :: get ( 'org.glizy' , 'application' ) ; $ menudetail_isVisible = 1 ; $ user = $ application -> getCurrentUser ( ) ; if ( $ user ) { $ menudetail_isVisible = $ user -> acl ( __Config :: get ( 'SITEMAP_ID' ) , 'publish' ) === true ? 1 : 0 ; } $ ar = org_glizy_ObjectFactory :: createModel ( 'org.glizycms.core.models.Menu' ) ; $ ar -> menu_parentId = $ parent ; $ ar -> menu_pageType = $ pageType ; $ ar -> menu_order = $ order ; $ ar -> menu_type = $ type ; $ ar -> menu_hasPreview = '1' ; $ ar -> menu_url = '' ; $ ar -> menu_creationDate = new org_glizy_types_DateTime ( ) ; $ ar -> menu_modificationDate = new org_glizy_types_DateTime ( ) ; if ( ! __Config :: get ( 'MULTISITE_ENABLED' ) ) { $ ar -> menu_FK_site_id = 0 ; } $ ar -> menudetail_title = $ title ; $ ar -> menudetail_isVisible = $ menudetail_isVisible ; $ ar -> menudetail_description = '' ; $ ar -> menudetail_subject = '' ; $ ar -> menudetail_keywords = '' ; $ ar -> menudetail_creator = '' ; $ ar -> menudetail_publisher = '' ; $ ar -> menudetail_contributor = '' ; $ ar -> menudetail_type = '' ; $ ar -> menudetail_identifier = '' ; $ ar -> menudetail_source = '' ; $ ar -> menudetail_relation = '' ; $ ar -> menudetail_coverage = '' ; $ pageId = $ ar -> save ( ) ; $ this -> moveMenu ( $ pageId , $ order , $ parent ) ; $ this -> invalidateSitemapCache ( ) ; $ evt = array ( 'type' => org_glizycms_contents_events_Menu :: ADD , 'data' => $ pageId ) ; $ this -> dispatchEvent ( $ evt ) ; return $ pageId ; }
Add a new menu
 @param string $title    the menu title
 @param int $parent      the menu parent id
 @param string $pageType the menu pageType
 @return int             new menu id
Add a new menu @param string $title the menu title @param int $parent the menu parent id @param string $pageType the menu pageType @return int new menu id
// add the menu // reorder all brothers menus