public function saveEditionAction()
	{
		$idPage = $this->params()->fromRoute('idPage', $this->params()->fromQuery('idPage', ''));
		$translator = $this->serviceLocator->get('translator');
		
		$eventDatas = array('idPage' => $idPage);
		$this->getEventManager()->trigger('meliscms_page_saveedition_start', null, $eventDatas);
		
		$container = new Container('meliscms');
		if (empty($idPage))
		{
			$result = array(
    				'success' => 0,
    				'errors' => array(array('empty' => $translator->translate('tr_meliscms_form_common_errors_Empty datas')))
    		);
		}
		else
		{
		    // Resave XML of the page
			if (!empty($container['content-pages'][$idPage]))
			{

				// Create the new XML
				$newXmlContent = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
				$newXmlContent .= '<document type="MelisCMS" author="MelisTechnology" version="2.0">' . "\n";
				foreach ($container['content-pages'][$idPage] as $namePlugin => $pluginEntries)
				{
                    if($namePlugin != 'private:melisPluginSettings') {
                        foreach ($pluginEntries as $idEntry => $valueEntry) {
                            $newXmlContent .= "\t" . $valueEntry . "\n";
                        }
                    }
				}
				$newXmlContent .= '</document>';
				
				// Save the result
                $melisPageSavedTable = $this->getServiceLocator()->get('MelisEngineTablePageSaved');
				$melisPageSavedTable->save(array('page_content' => $newXmlContent), $idPage);
				
			}	

			$result = array(
					'success' => 1,
					'errors' => array(),
			);
		}

		$this->getEventManager()->trigger('meliscms_page_saveedition_end', null, $result);
		
		return new JsonModel($result);
	}
public function saveEditionAction()
	{
		$idPage = $this->params()->fromRoute('idPage', $this->params()->fromQuery('idPage', ''));
		$translator = $this->serviceLocator->get('translator');
		
		$eventDatas = array('idPage' => $idPage);
		$this->getEventManager()->trigger('meliscms_page_saveedition_start', null, $eventDatas);
		
		$container = new Container('meliscms');
		if (empty($idPage))
		{
			$result = array(
    				'success' => 0,
    				'errors' => array(array('empty' => $translator->translate('tr_meliscms_form_common_errors_Empty datas')))
    		);
		}
		else
		{
		    // Resave XML of the page
			if (!empty($container['content-pages'][$idPage]))
			{

				// Create the new XML
				$newXmlContent = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
				$newXmlContent .= '<document type="MelisCMS" author="MelisTechnology" version="2.0">' . "\n";
				foreach ($container['content-pages'][$idPage] as $namePlugin => $pluginEntries)
				{
                    if($namePlugin != 'private:melisPluginSettings') {
                        foreach ($pluginEntries as $idEntry => $valueEntry) {
                            $newXmlContent .= "\t" . $valueEntry . "\n";
                        }
                    }
				}
				$newXmlContent .= '</document>';
				
				// Save the result
                $melisPageSavedTable = $this->getServiceLocator()->get('MelisEngineTablePageSaved');
				$melisPageSavedTable->save(array('page_content' => $newXmlContent), $idPage);
				
			}	

			$result = array(
					'success' => 1,
					'errors' => array(),
			);
		}

		$this->getEventManager()->trigger('meliscms_page_saveedition_end', null, $result);
		
		return new JsonModel($result);
	}
public function saveEditionAction ( ) { $ idPage = $ this -> params ( ) -> fromRoute ( 'idPage' , $ this -> params ( ) -> fromQuery ( 'idPage' , '' ) ) ; $ translator = $ this -> serviceLocator -> get ( 'translator' ) ; $ eventDatas = array ( 'idPage' => $ idPage ) ; $ this -> getEventManager ( ) -> trigger ( 'meliscms_page_saveedition_start' , null , $ eventDatas ) ; $ container = new Container ( 'meliscms' ) ; if ( empty ( $ idPage ) ) { $ result = array ( 'success' => 0 , 'errors' => array ( array ( 'empty' => $ translator -> translate ( 'tr_meliscms_form_common_errors_Empty datas' ) ) ) ) ; } else { // Resave XML of the page if ( ! empty ( $ container [ 'content-pages' ] [ $ idPage ] ) ) { // Create the new XML $ newXmlContent = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" ; $ newXmlContent .= '<document type="MelisCMS" author="MelisTechnology" version="2.0">' . "\n" ; foreach ( $ container [ 'content-pages' ] [ $ idPage ] as $ namePlugin => $ pluginEntries ) { if ( $ namePlugin != 'private:melisPluginSettings' ) { foreach ( $ pluginEntries as $ idEntry => $ valueEntry ) { $ newXmlContent .= "\t" . $ valueEntry . "\n" ; } } } $ newXmlContent .= '</document>' ; // Save the result $ melisPageSavedTable = $ this -> getServiceLocator ( ) -> get ( 'MelisEngineTablePageSaved' ) ; $ melisPageSavedTable -> save ( array ( 'page_content' => $ newXmlContent ) , $ idPage ) ; } $ result = array ( 'success' => 1 , 'errors' => array ( ) , ) ; } $ this -> getEventManager ( ) -> trigger ( 'meliscms_page_saveedition_end' , null , $ result ) ; return new JsonModel ( $ result ) ; }
Save Page edition
@return \Zend\View\Model\JsonModel
Save Page edition