private function getRootForUser()
	{
		$melisEngineTree = $this->serviceLocator->get('MelisEngineTree');
		$melisCoreAuth = $this->getServiceLocator()->get('MelisCoreAuth');
		$melisCmsRights = $this->getServiceLocator()->get('MelisCmsRights');

		// Get the rights of the user
		$xmlRights = $melisCoreAuth->getAuthRights();
		$rightsObj = simplexml_load_string($xmlRights);

		$rootPages = array();
		$breadcrumbRightPages = array();

		// Loop into page ids of the rights to determine what are the root pages
		// Deleting possible doublons with parent pages selected and also children pages

		$sectionId = MelisCmsRightsService::MELISCMS_PREFIX_PAGES;
		if (empty($rightsObj->$sectionId))
			return array();

		foreach ($rightsObj->$sectionId->id as $rightsPageId)
		{
			$rightsPageId = (int)$rightsPageId;

			// No need to continue, -1 is root, there's a full access
			if ($rightsPageId == -1)
				return array(-1);

			// Get the breadcrumb of the page and reformat it to a more simple array
			$breadcrumb = $melisEngineTree->getPageBreadcrumb($rightsPageId, 0, true);
			$breadcrumb = $this->cleanBreadcrumb($breadcrumb);


			/**
			 * Looping on the temporary array holding pages
			 * Making intersection to compare between the one checked and those already saved
			 * If the one checked is equal with the intersection, it means the one checked contains
			 * already the older one, the page is on top, then we will only keep this one and delete
			 * the old one
			 * Otherwise we save
			 */
			$add = true;
			for ($i = 0; $i < count($breadcrumbRightPages); $i++)
			{
				$result = array_intersect($breadcrumb, $breadcrumbRightPages[$i]);
				if ($result === $breadcrumb)
				{
					$add = false;
					$breadcrumbRightPages[$i] = $breadcrumb;
					break;
				}
				if ($result === $breadcrumbRightPages[$i])
				{
					$add = false;
					break;
				}
			}

			if ($add)
				$breadcrumbRightPages[count($breadcrumbRightPages)] = $breadcrumb;
		}

		/**
		 * Reformat final result to a simple array with the ids of pages
		 */
		foreach ($breadcrumbRightPages as $breadcrumbPage)
		{
			if (count($breadcrumbPage) > 0)
				array_push($rootPages, $breadcrumbPage[count($breadcrumbPage) - 1]);
		}

		return $rootPages;
	}
private function getRootForUser()
	{
		$melisEngineTree = $this->serviceLocator->get('MelisEngineTree');
		$melisCoreAuth = $this->getServiceLocator()->get('MelisCoreAuth');
		$melisCmsRights = $this->getServiceLocator()->get('MelisCmsRights');

		// Get the rights of the user
		$xmlRights = $melisCoreAuth->getAuthRights();
		$rightsObj = simplexml_load_string($xmlRights);

		$rootPages = array();
		$breadcrumbRightPages = array();

		// Loop into page ids of the rights to determine what are the root pages
		// Deleting possible doublons with parent pages selected and also children pages

		$sectionId = MelisCmsRightsService::MELISCMS_PREFIX_PAGES;
		if (empty($rightsObj->$sectionId))
			return array();

		foreach ($rightsObj->$sectionId->id as $rightsPageId)
		{
			$rightsPageId = (int)$rightsPageId;

			// No need to continue, -1 is root, there's a full access
			if ($rightsPageId == -1)
				return array(-1);

			// Get the breadcrumb of the page and reformat it to a more simple array
			$breadcrumb = $melisEngineTree->getPageBreadcrumb($rightsPageId, 0, true);
			$breadcrumb = $this->cleanBreadcrumb($breadcrumb);


			/**
			 * Looping on the temporary array holding pages
			 * Making intersection to compare between the one checked and those already saved
			 * If the one checked is equal with the intersection, it means the one checked contains
			 * already the older one, the page is on top, then we will only keep this one and delete
			 * the old one
			 * Otherwise we save
			 */
			$add = true;
			for ($i = 0; $i < count($breadcrumbRightPages); $i++)
			{
				$result = array_intersect($breadcrumb, $breadcrumbRightPages[$i]);
				if ($result === $breadcrumb)
				{
					$add = false;
					$breadcrumbRightPages[$i] = $breadcrumb;
					break;
				}
				if ($result === $breadcrumbRightPages[$i])
				{
					$add = false;
					break;
				}
			}

			if ($add)
				$breadcrumbRightPages[count($breadcrumbRightPages)] = $breadcrumb;
		}

		/**
		 * Reformat final result to a simple array with the ids of pages
		 */
		foreach ($breadcrumbRightPages as $breadcrumbPage)
		{
			if (count($breadcrumbPage) > 0)
				array_push($rootPages, $breadcrumbPage[count($breadcrumbPage) - 1]);
		}

		return $rootPages;
	}
private function getRootForUser ( ) { $ melisEngineTree = $ this -> serviceLocator -> get ( 'MelisEngineTree' ) ; $ melisCoreAuth = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreAuth' ) ; $ melisCmsRights = $ this -> getServiceLocator ( ) -> get ( 'MelisCmsRights' ) ; // Get the rights of the user $ xmlRights = $ melisCoreAuth -> getAuthRights ( ) ; $ rightsObj = simplexml_load_string ( $ xmlRights ) ; $ rootPages = array ( ) ; $ breadcrumbRightPages = array ( ) ; // Loop into page ids of the rights to determine what are the root pages // Deleting possible doublons with parent pages selected and also children pages $ sectionId = MelisCmsRightsService :: MELISCMS_PREFIX_PAGES ; if ( empty ( $ rightsObj -> $ sectionId ) ) return array ( ) ; foreach ( $ rightsObj -> $ sectionId -> id as $ rightsPageId ) { $ rightsPageId = ( int ) $ rightsPageId ; // No need to continue, -1 is root, there's a full access if ( $ rightsPageId == - 1 ) return array ( - 1 ) ; // Get the breadcrumb of the page and reformat it to a more simple array $ breadcrumb = $ melisEngineTree -> getPageBreadcrumb ( $ rightsPageId , 0 , true ) ; $ breadcrumb = $ this -> cleanBreadcrumb ( $ breadcrumb ) ; /**
			 * Looping on the temporary array holding pages
			 * Making intersection to compare between the one checked and those already saved
			 * If the one checked is equal with the intersection, it means the one checked contains
			 * already the older one, the page is on top, then we will only keep this one and delete
			 * the old one
			 * Otherwise we save
			 */ $ add = true ; for ( $ i = 0 ; $ i < count ( $ breadcrumbRightPages ) ; $ i ++ ) { $ result = array_intersect ( $ breadcrumb , $ breadcrumbRightPages [ $ i ] ) ; if ( $ result === $ breadcrumb ) { $ add = false ; $ breadcrumbRightPages [ $ i ] = $ breadcrumb ; break ; } if ( $ result === $ breadcrumbRightPages [ $ i ] ) { $ add = false ; break ; } } if ( $ add ) $ breadcrumbRightPages [ count ( $ breadcrumbRightPages ) ] = $ breadcrumb ; } /**
		 * Reformat final result to a simple array with the ids of pages
		 */ foreach ( $ breadcrumbRightPages as $ breadcrumbPage ) { if ( count ( $ breadcrumbPage ) > 0 ) array_push ( $ rootPages , $ breadcrumbPage [ count ( $ breadcrumbPage ) - 1 ] ) ; } return $ rootPages ; }
Gets the root pages for a user depending on his rights
@return array
Gets the root pages for a user depending on his rights