@since 0.2

@param int $pageid
@param Title $target
@param array $extraParams

@return bool
763531
public function moveFromPageId( $pageid, Title $target, array $extraParams = [] ) {
		$this->api->postRequest(
			new SimpleRequest( 'move', $this->getMoveParams( $pageid, $target, $extraParams ) )
		);

		return true;
	}
369346
protected function createIndexForPages($lucenePath, $pageId, $exclude = array())
    {
        $indexingStatus         = [];
        $totalPage              = 0;
        $this->unreachableCount = 0;
        $pageSearchType         = null;
        $pageStatus             = null;
        $searchOpt              = array(
            'tr_meliscms_page_tab_properties_search_type_option1',
            'tr_meliscms_page_tab_properties_search_type_option2',
            'tr_meliscms_page_tab_properties_search_type_option3'
        );

        //Services
        $pagePub     = $this->getServiceLocator()->get('MelisEngineTablePagePublished');
        $pageSaved   = $this->getServiceLocator()->get('MelisEngineTablePageSaved');
        $enginePage  = $this->getServiceLocator()->get('MelisEngineTree');
        $translator  = $this->getServiceLocator()->get('translator');

        /*
         * Get data first in page published table
         */
        $pageData = $pagePub->getEntryById((int) $pageId)->current();

        //set pageStatus
        $pageStatus = $pageData->page_status;



        // if page is in the published table 
        if($pageData){
            $tmpData = $pageData;
            //if pageStatus is offline || 0 
            if(!$pageStatus){
                $pageData = $pageSaved->getEntryById((int) $pageId)->current();
                //Return to original data if no drafted data
                if(empty($pageData))
                    $pageData = $tmpData;
            }

            //set PageSearchType
            $pageSearchType = $pageData->page_search_type;

            //Start indexing 
            // index and tmp index path

            $this->createDir($lucenePath.'/generated');

            if(file_exists($lucenePath.'/generated')) {

                // make sure to clear it first before adding new indexes
                $this->clearIndex($lucenePath.'/generated');

                $index = Lucene::create($lucenePath.'/generated');
                $doc   = new Document();

                //index published page only
                if($pageStatus){
                   
                     //for indexing the page
                    if($pageSearchType == $searchOpt[0] || $pageSearchType == $searchOpt[1]){

                        //Add the parentPage
                        $index->addDocument($this->createDocument(array(
                            'page_id'   => $pageData->page_id,
                            'page_name' => $pageData->page_name,
                        )));
                    }
                    $totalPage += 1;
                }

                //For indexing the subpages
                if($pageSearchType == $searchOpt[0]){
                    $this->tmpLogs .= 'OK ' . $translator->translate('tr_melis_engine_search_create_temp_folder') . PHP_EOL . '<br/>';
                    $totalPage += $this->createIndexRec($pageId, $index,$exclude);
                }else{
                    
                     $this->tmpLogs .= 'KO ' . sprintf($translator->translate('tr_melis_engine_search_create_index'), $pageId) . $translator->translate('tr_melis_engine_search_create_index_fail_page_not_exists') . PHP_EOL . '<br/>';
                    return  $this->tmpLogs;
                }

                $index->commit();
                $difference = ($totalPage - $this->unreachableCount);
                $percentage = round(($difference / $totalPage) * 100);
                $loss = round(($this->unreachableCount / $totalPage) * 100);

                $this->tmpLogs .= 'OK ' . sprintf($translator->translate('tr_melis_engine_search_total_created'), $difference, $totalPage, $percentage) . PHP_EOL . '<br/>';
                if($loss > 70) {
                    $this->tmpLogs .= 'KO ' . $translator->translate('tr_melis_engine_search_indexing_failed') . PHP_EOL . '<br/>';
                }
                else {

                    // delete the indexes folder
                    if(file_exists($lucenePath.'/indexes')) {
                        $this->clearIndex($lucenePath.'/indexes');
                    }

                    if($this->isDirEmpty($lucenePath.'/indexes')) {
                        $this->tmpLogs .= 'OK ' . $translator->translate('tr_melis_engine_search_delete_old_index_success') . PHP_EOL . '<br/>';

                        $this->forceRename($lucenePath.'/generated', $lucenePath.'/indexes');

                        if(file_exists($lucenePath.'/indexes')) {

                            $this->tmpLogs .= 'OK ' . $translator->translate('tr_melis_engine_search_switch_folder_success') . PHP_EOL . '<br/>';
                            $this->tmpLogs .= 'OK ' . $translator->translate('tr_melis_engine_search_results') . PHP_EOL . '<br/>';

                            //$this->clearIndex($lucenePath.'/generated');
                        }
                        else {
                            $this->tmpLogs .= 'KO ' . $translator->translate('tr_melis_engine_search_delete_old_index_failed') . PHP_EOL . '<br/>';
                        }
                    }
                    else {
                        $this->tmpLogs .= 'KO ' . $translator->translate('tr_melis_engine_search_delete_old_index_failed') . PHP_EOL . '<br/>';
                    }
                }

            }
            else {
                $this->tmpLogs .= 'KO ' . $translator->translate('tr_melis_engine_search_create_temp_folder_fail') . PHP_EOL . '<br/>';
            }
            
        }
        else{
            $this->tmpLogs .= 'KO ' . sprintf($translator->translate('tr_melis_engine_search_create_index'), $pageId) . $translator->translate('tr_melis_engine_search_create_index_fail_page_not_exists') . PHP_EOL . '<br/>';
        }

        return $this->tmpLogs;
    }
827889
public function findByNameForAjax($search, $extraData)
    {
        $resultArray = array();

        /** @var ResourceNode[] $resourceNodes */
        $resourceNodes = $this->findByName($search, $extraData);

        foreach ($resourceNodes as $resourceNode) {
            $resultArray[] = array(
                'id'   => $resourceNode->getId(),
                'text' => $resourceNode->getPathForDisplay()
            );
        }

        return $resultArray;
    }
163870
public static function getIsSiteManagedSite($pageId)
    {

        $siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
        try {
            $site = $siteFinder->getSiteByPageId($pageId);
        } catch (SiteNotFoundException $e) {
            return false;
        }

        return $site instanceof Site;
    }
50653
public static function addAdditionalNodeIDPerObject( $contentObjectID, $additionalNodeID )
    {
        if ( !isset( self::$additionalNodeIDsPerObject[$contentObjectID] ) )
        {
            self::$additionalNodeIDsPerObject[$contentObjectID] = array();
        }

        self::$additionalNodeIDsPerObject[$contentObjectID][] = $additionalNodeID;
    }
127340
public function displayAction($id, $extra = null) {
        
        $entity = $this->container->get("page.read_handler")->getWithModelPageContent($id);

        return array(
            'entity' => $entity
            , 'extra' => $extra
        );
    }
95696
public function showAction($id, $extra) {
        $page = $this->getEntityReader()->getWithModelPageContent($id);
//        temporary code to test with inline editing
//        if ($list = $entity->getBlogContents()) {
//            foreach ($list as $blog) {
//                echo $blog->getContent()->setTemplate('HavenWebBundle:Template:content/blog_content_edit.html.twig');
//            }
//        }
        $template = $this->getShowTemplate();

        $content_additions = $this->handleContentsSpecificNeeds($page);
        $layout_additions = $this->handleLayoutSpecificNeeds($page);

        $params = array(
            "entity" => $page
            , "content_additions" => $content_additions
            , "layout_additions" => $layout_additions
            , "extra" => $extra
        );

        return new Response($this->container->get('templating')->render($template, $params));
    }
837405
public function getParentByPageId($pageId)
    {
        $data = array();
        $success = 0;

        $treeSite = $this->getServiceLocator()->get('MelisSiteTree');

        if($treeSite){
            $data  = $treeSite->getParentByPageId($pageId);
        }


        return $data;
    }
971606
public function createPageRule(
        string $zoneID,
        PageRulesTargets $target,
        PageRulesActions $actions,
        bool $active = true,
        int $priority = null
    ): bool {
        $options = [
            'targets' => $target->getArray(),
            'actions' => $actions->getArray()
        ];

        if ($active !== null) {
            $options['status'] = $active == true ? 'active' : 'disabled';
        }

        if ($priority !== null) {
            $options['priority'] = $priority;
        }


        $query = $this->adapter->post('zones/' . $zoneID . '/pagerules', $options);

        $this->body = json_decode($query->getBody());

        if (isset($this->body->result->id)) {
            return true;
        }

        return false;
    }
901701
private function listEntityIdsWithCps(PagerInterface $pager = null, array $query_params = []): array
    {
        $query_params = [
                'expand' => 'false',
            ] + $query_params;
        if ($pager) {
            return $this->getResultsInRange($pager, $query_params);
        } else {
            $ids = $this->getResultsInRange($this->createPager(), $query_params);
            if (empty($ids)) {
                return [];
            }
            $lastId = end($ids);
            do {
                $tmp = $this->getResultsInRange($this->createPager(0, $lastId), $query_params);
                // Remove the first item from the list because it is the same
                // as the current last item of $ids.
                // Apigee Edge response always starts with the requested entity
                // id (startKey).
                array_shift($tmp);

                if (count($tmp) > 0) {
                    $ids = array_merge($ids, $tmp);
                    $lastId = end($tmp);
                } else {
                    $lastId = false;
                }
            } while ($lastId);

            return $ids;
        }
    }
125473
public function makeFileContents($filePath, $extraParams = [])
    {
        $this->controller->vars = array_merge($this->controller->vars, $this->vars);
        return $this->controller->makeFileContents($filePath, $extraParams);
    }
1189212
public function getSmsCampaignCost(array $params, array $additionalParams = null)
    {
        if (!isset($params['addressBookId']) && !isset($params['phones'])) {
            return $this->handleError('You mast pass phones list or addressbook ID');
        }

        if ($additionalParams) {
            $params = array_merge($params, $additionalParams);
        }

        $requestResult = $this->sendRequest('/sms/campaigns/cost', 'GET', $params);

        return $this->handleResult($requestResult);
    }
112070
public function getPageListFromPageTransclusions( $pageName, array $extraParams = [] ) {
		$params = array_merge( $extraParams, [
			'list' => 'embeddedin',
			'eititle' => $pageName,
		] );
		return $this->runQuery( $params, 'eicontinue', 'embeddedin' );
	}
909201
public function sendSmsByBook($bookID, array $params, array $additionalParams = [])
    {
        if (empty($bookID)) {
            return $this->handleError('Empty book id');
        }

        $data = [
            'addressBookId' => $bookID
        ];

        $data = array_merge($data, $params);

        if ($additionalParams) {
            $data = array_merge($data, $additionalParams);
        }

        $requestResult = $this->sendRequest('/sms/campaigns', 'POST', $data);

        return $this->handleResult($requestResult);
    }
327395
public function makeFileContents($filePath, $extraParams = [])
    {
        if (!strlen($filePath) ||
            !File::isFile($filePath) ||
            (!File::isLocalPath($filePath) && Config::get('cms.restrictBaseDir', true))
        ) {
            return '';
        }

        if (!is_array($extraParams)) {
            $extraParams = [];
        }

        $vars = array_merge($this->vars, $extraParams);

        $obLevel = ob_get_level();

        ob_start();

        extract($vars);

        // We'll evaluate the contents of the view inside a try/catch block so we can
        // flush out any stray output that might get out before an error occurs or
        // an exception is thrown. This prevents any partial views from leaking.
        try {
            include $filePath;
        }
        catch (Exception $e) {
            $this->handleViewException($e, $obLevel);
        }
        catch (Throwable $e) {
            $this->handleViewException(new FatalThrowableError($e), $obLevel);
        }

        return ob_get_clean();
    }
984704
public function to($path, $extra = array(), $secure = null)
    {

        // Page object passed
        if(is_object($path) && $path instanceof SiteTreeNodeInterface){
            if(starts_with($path->getPath(),'http:')){
                $path = $path->getPath();
            }
            else{
                $path = $this->getPathFinder()->toPage($path);
            }
        }

        // PageTypeId passed
        elseif (is_string($path) && $this->pageTypes->has($path)) {

            $path = $this->getPathFinder()->toPageType($path);

        }

        // Path passed inside CMS-SiteTree
        elseif (is_string($path) && $this->currentCmsPathProvider->
                                        getCurrentCmsPath()
                                            ->isCmsPath()) {

            if ($extra && !isset($extra[0])) {
                $extra = array_values($extra);
                $extraPath = implode('/',$extra);
                $path = trim($path,'/') . '/' . trim($extraPath,'/');
                $extra = [];
            }

            if ($path == '/' && $this->getTreeScope()) {
                $path = trim($this->getTreeScope()->getPathPrefix() . $path, '/');
            }
        }

        elseif ($path == '/' && $treeScope = $this->getTreeScope()) {
            $path = trim($treeScope->getPathPrefix() . $path, '/');
        }

        return parent::to($path, $extra, $secure);
    }
979119
public function platformIdsRangeIsExist($pageMinValue, $pageMaxValue, $tplMinValue, 
	                                        $tplMaxValue, $pids_id)
	{
	    $select = $this->tableGateway->getSql()->select();
	    $select->where->between('pids_page_id_start', $pageMinValue, $pageMaxValue);
	    $select->where->OR->between('pids_page_id_end', $pageMinValue, $pageMaxValue);
        
	    $select->where->OR->between('pids_tpl_id_start', $tplMinValue, $tplMaxValue);
	    $select->where->OR->between('pids_tpl_id_end', $tplMinValue, $tplMaxValue);
	    
	    
	    $resultSet = $this->tableGateway->selectWith($select);
	    if (!empty($resultSet))
	    {
	        $result = $resultSet->toArray();
	        if (!empty($result))
	        {
	            // Checking the Number of Rows
	            if (count($result)==1)
	            {
	                // Checking if the ID is the current data that using updating
	                if ($result[0]['pids_id']==$pids_id)
	                    return true;
	            }
	        }
	        else
	            return true;
	    }
	    
	    return false;
	}