get('agrid.module_type.manager')->getAllModuleType(); $id_col = $request->get('id_col'); $content = $request->get('content'); $mode = $request->get('mode'); $lang = $request->get('lang'); return $this->render('@AGrid/agrid_modules/select.module.type.hml.twig',[ 'content_id'=>$content, 'id_col' => $id_col, 'modulesType' => $modulesType, 'mode' => $mode, 'lang' => $lang ]); } public function addModule(AGridContent $content, ContainerInterface $container, Request $request) { $col_id = $request->get('col'); $type_module = $request->get('type'); $col = $container->get('agrid.col_manager')->getById($col_id); if($col instanceof AGridCol){ $container->get('agrid.content_col_module.manager')->addModule($col, $content, $type_module); } return $this->render('@AGrid/include/col.html.twig',[ 'content'=>$content, 'col'=>$col, 'mode'=> $request->get('mode'), 'lang'=> $request->get('lang') ]); } /** * init module * * @param ContainerInterface $container * @param Request $request * @return Response */ public function init(ContainerInterface $container, Request $request) { $publicKey = $request->get('module_public_key'); $lang = $request->get('lang'); return new Response($container->get('agrid.factory')->rendering_back($publicKey, $lang)); } public function rendererFrontForPreview(Request $request) { $preview = $this->container->get('agrid.module_manager')->getById($request->get('module')); $twig = $request->get('twig'); $lang = $request->get('lang'); $mode = 'default'; $title_content = $request->get('data_content'); $title_class = $request->get('title_class'); $preview->addParameter('twig',$twig); $preview->addParameter('class',$title_class); $preview->addContent($lang, $mode, $title_content); return $this->render($twig,['module'=>$preview,'lang'=>$lang,'mode'=>$mode]); } public function validate_title(AGridModule $module, ContainerInterface $container, Request $request){ $lang = $request->get('lang'); $mode = 'default'; $module->addParameter('twig',$request->get('title_type')); $module->addParameter('class',$request->get('title_class')); $module->addContent($lang, $mode, $request->get('title_content')); $agridContentColModule = $container->get('agrid.content_col_module.manager')->getByModule($module); $container->get('agrid.module_manager')->update($module); return new Response($container->get('agrid.cache_service')->getModules($agridContentColModule->getAGridCol(), $lang, $mode)); } public function saveEditor(AGridModule $module, ContainerInterface $container, Request $request){ $text_content = $request->get('html'); $lang = $request->get('lang'); $mode = 'default';//$request->get('mode'); $agridContentColModule = $container->get('agrid.content_col_module.manager')->getByModule($module); $module->addParameter('twig','@AGrid/agrid_modules/renderer.html.twig'); $module->addContent($lang, $mode, $text_content); $container->get('agrid.module_manager')->update($module); return new Response($container->get('agrid.cache_service')->getModules($agridContentColModule->getAGridCol(), $lang, $mode)); } /** * photo callback * * @param ContainerInterface $container * @param Request $request * @return Response */ public function photosCallback(ContainerInterface $container,Request $request){ //on affecte l'image avec le guid au module $publicKey = $request->get('module_public_key'); $module = $container->get('agrid.module_manager')->getById($publicKey); $file_guid = $request->get('file_guid'); $module->addParameter('image',$file_guid); return $this->render('@AGrid/agrid_modules/photos/module.photo.renderer.html.twig', ['module'=>$module]); } public function savePhotos(AGridModule $module, ContainerInterface $container, Request $request){ $lang = 'default';//$request->get('lang'); $image = $request->get('file_guid'); $mode = 'default';//$request->get('mode'); $alt = ''; //$request->get('alt'); $class = 'center'; //$request->get('class'); $width = ''; //$request->get('photo_width'); $height = ''; //$request->get('photo_height'); $legend = ''; //$request->get('photo_legend'); $agridContentColModule = $container->get('agrid.content_col_module.manager')->getByModule($module); $module->addParameter('twig','@AGrid/agrid_modules/photos/module.photo.renderer.html.twig'); $module->addParameter('image',$image); $module->addParameter('alt', $alt); $module->addParameter('class', $class); $module->addParameter('width', $width); $module->addParameter('height', $height); $module->addParameter('legend', $legend); $container->get('agrid.module_manager')->update($module); return new Response($container->get('agrid.cache_service')->getModules($agridContentColModule->getAGridCol(), $lang, $mode)); } public function materializeSliderListImages(AGridModule $module, Request $request){ $list_images = $request->get('list_images'); return $this->render('@AGrid/agrid_modules/slider/module.slider.edit.list.html.twig', ['module'=>$module, 'list_images'=> $list_images]); } public function materializeSliderEditImage(AGridModule $module, Request $request){ $file_guid = $request->get('image_guid'); $lang = $request->get('lang'); return $this->render('@AGrid/agrid_modules/slider/module.slider.edit.image.html.twig', ['module'=>$module, 'file_guid'=>$file_guid, 'lang'=> $lang]); } public function materializeSliderValidate(AGridModule $module, ContainerInterface $container, Request $request){ $list_images = $request->get('list_images'); $lang = 'default';//$request->get('lang'); $mode = 'default';//$request->get('mode'); $agridContentColModule = $container->get('agrid.content_col_module.manager')->getByModule($module); $module->addParameter('twig','@AGrid/agrid_modules/slider/module.slider.renderer.html.twig'); $module->addParameter('list_images',$list_images); $container->get('agrid.module_manager')->update($module); return new Response($container->get('agrid.cache_service')->getModules($agridContentColModule->getAGridCol(), $lang, $mode) ); } public function materializeSliderImageParametersValidate(AGridModule $module, ContainerInterface $container, Request $request){ $file_guid = $request->get('file_guid'); $images_parameters[$file_guid] = [ 'left_content' => $request->get('left_content'), 'center_content' => $request->get('center_content'), 'right_content' => $request->get('right_content') ]; $module->addParameter($file_guid,$images_parameters[$file_guid]); $container->get('agrid.module_manager')->update($module); return new Response(''); // return $this->render('@AGrid/agrid_modules/slider/slider.image.parameters.html.twig', ['module'=>$module, 'file_guid'=>$file_guid, 'lang'=> $lang]); } public function materializeSliderImageDeleteParameters(AGridModule $module, ContainerInterface $container, Request $request){ $file_guid = $request->get('file_guid'); $parameter = $module->getParameter($file_guid); if (!empty($parameter)) $module->removeParameter($file_guid); $container->get('agrid.module_manager')->update($module); return new Response(''); } public function videosCallback(ContainerInterface $container,Request $request){ //on affecte l'image avec le guid au module $publicKey = $request->get('module_public_key'); $module = $container->get('agrid.module_manager')->getById($publicKey); $file_item = $container->get('net15.file.item.manager')->getByGUID($request->get('file_guid')); $module->addParameter('video',$file_item->getGuid()); $module->addParameter('thumbnail', $file_item->getThumbnail()); return $this->render('@AGrid/agrid_modules/media/video/module.video.preview.html.twig', ['module'=>$module]); } public function validateVideo(AGridModule $module, ContainerInterface $container, Request $request){ $parameters = $request->request->all(); $parameters['mode'] = 'default'; $parameters['lang'] = 'default'; $parameters['twig'] = '@AGrid/agrid_modules/media/video/module.video.renderer.html.twig'; $agridContentColModule = $container->get('agrid.content_col_module.manager')->getByModule($module); $container->get('agrid.module_manager')->updateParameters($module, $parameters); return new Response($container->get('agrid.cache_service')->getModules($agridContentColModule->getAGridCol(), $parameters['lang'], $parameters['mode']) ); } public function callbackVideoYoutube(AGridModule $module, ContainerInterface $container, Request $request){ $parameters = $request->request->all(); $module = $container->get('agrid.module.video.manager')->youtubeVideoManager($module, $parameters); return $this->render('@AGrid/agrid_modules/media/video_youtube/module.youtube_video.back.preview.html.twig', ['module'=>$module]); } public function validateVideoYoutube(AGridModule $module, ContainerInterface $container, Request $request){ $parameters = $request->request->all(); $parameters['mode'] = 'default'; $parameters['lang'] = 'default'; $parameters['twig'] = '@AGrid/agrid_modules/media/video_youtube/module.youtube_video.renderer.html.twig'; $agridContentColModule = $container->get('agrid.content_col_module.manager')->getByModule($module); $module = $container->get('agrid.module.video.manager')->youtubeVideoManager($module, $parameters); $container->get('agrid.module_manager')->update($module); return new Response($container->get('agrid.cache_service')->getModules($agridContentColModule->getAGridCol(), $parameters['lang'], $parameters['mode']) ); } }