/** * Tests for priceBrutto method */ public function testPriceBrutto() { $utils = Utils::getInstance(); $this->assertEquals($utils->priceBrutto(100.0, 23), 123.0); $this->assertEquals($utils->priceBrutto(123.45, 8), 133.33); $this->assertEquals($utils->priceBrutto(123.45, 19), 146.91); $this->assertEquals($utils->priceBrutto(146.0, 0), 146.0); }
public function addcommentajaxAction() { $request = $this->getRequest(); if ($request->isPost()) { $form = new BlogCommentForm(); //trigger data controls $form->setInputFilter(new BlogCommentInputFilter()); $form->setData($request->getPost()); if ($form->isValid()) { //$message = new Message(); $utils = new Utils(); $to = EmailCommentConfig::$emailAdressForContact; $name = $utils->stripTags_replaceHtmlChar_trim($request->getPost('contactnom'), true, true, true); $company = $utils->stripTags_replaceHtmlChar_trim($request->getPost('contactentreprise'), true, true, true); $subject = "Contact site web de la part de " . $utils->stripTags_replaceHtmlChar_trim($request->getPost('contactnom'), true, true, true); $from = $utils->stripTags_replaceHtmlChar_trim($request->getPost('contactemail'), true, true, true); $contenuid = (int) $utils->stripTags_replaceHtmlChar_trim($request->getPost('contactcontenuid'), true, true, true); $txt = wordwrap($utils->stripTags_replaceHtmlChar_trim($request->getPost('contacttext'), true, true, true), 70); $message = new EmailSent(); $message->setRow1($name); $message->setRow2($company); $message->setRow3($from); $message->setMessage($txt); $message->setDate(date("Y-m-d H:i:s", time())); $message->setType(TypeMessage::$blog); $message->setContenuId($contenuid); $message->setCommentaireStatut(0); $messageDao = new CommentaireDao(); $messageDao->saveCommentaire($message); //zend message sendmail /*$emailMessage = new Message(); $emailMessage->addFrom($from, $name) ->addTo($to) ->setSubject($subject) ->setBody($txt); $transport = new SendmailTransport(); $transport->send($emailMessage); */ //zend message smtp $messageToSend = new Message(); $messageToSend->addFrom($from, $name)->addTo($to)->setSubject($subject); $messageToSend->setBody($txt); $messageToSend->setEncoding("UTF-8"); $transport = new SmtpTransport(); $options = new SmtpOptions(array('name' => EmailCommentConfig::$smtpServerNameForContact, 'host' => EmailCommentConfig::$smtpHostServerForContact, 'port' => EmailCommentConfig::$smtpHostPortForContact, 'connection_class' => EmailCommentConfig::$connectionClassForContact, 'connection_config' => array('username' => EmailCommentConfig::$connectionConfigUsernameForContact, 'password' => EmailCommentConfig::$connectionConfigPwdForContact, 'ssl' => EmailCommentConfig::$connectionConfigSSLForContact))); $transport->setOptions($options); $transport->send($messageToSend); return new JsonModel(array('result' => 'ok')); } else { return new JsonModel(array('result' => 'failure', 'error' => $form->getMessages())); } } }
public function authAction() { $this->loginDao = new LoginDao(); $this->translator = $this->getServiceLocator()->get('translator'); $form = new LoginForm(); $request = $this->getRequest(); if ($request->isPost()) { $login = new Login(); $form->setInputFilter(new LoginInputFilter()); $form->setData($request->getPost()); if ($form->isValid()) { $login = Login::fromForm($form->getData()); $utils = new Utils(); $rowNb = $this->loginDao->getAuthenticationByUserAndPwd($utils->stripTags_replaceHtmlChar_trim($login->getUser(), true, true, false), $utils->stripTags_replaceHtmlChar_trim($login->getPwd(), true, true, false)); //print_r($rowNb); if ($rowNb == 0) { $loginaccess = new \Zend\Session\Container('error'); $loginaccess->error = $this->translator->translate('Veuillez recommencer le nom d\'utilisateur et/ou le mot de passe sont incorrects'); return $this->redirect()->toRoute('Login'); } elseif ($rowNb == 1) { $loginaccess = new \Zend\Session\Container('myacl'); $role = $this->loginDao->getRole($utils->stripTags_replaceHtmlChar_trim($login->getUser(), true, true, false), $utils->stripTags_replaceHtmlChar_trim($login->getPwd(), true, true, false)); $loginaccess->role = $role; return $this->redirect()->toRoute('rubrique'); } else { $loginaccess = new \Zend\Session\Container('error'); $loginaccess->error = $this->translator->translate('Veuillez contacter l\'administrateur du site svp.'); return $this->redirect()->toRoute('Login'); } } else { //form is not valid because the csrf token is not the same anymore $loginaccess = new \Zend\Session\Container('error'); $loginaccess->error = $this->translator->translate('Veuillez rafraichir la page et recommencer svp.'); return $this->redirect()->toRoute('Login'); } } }
public function editAction() { //$this->getServiceLocator()->get('CacheListener')->getCacheService()->flush(); $form = new BlogcontentForm(); $this->translator = $this->getServiceLocator()->get('translator'); $form->get('submitbutton')->setAttribute('value', $this->translator->translate('Modifier')); $this->blogContentDao = new BlogcontentDao(); $this->rubriqueDao = new RubriqueDao(); $this->sousrubriqueDao = new Sousrubriquedao(); $this->fichiersdao = new Fichiersdao(); $allFichiers = array(); //get cache $cache = $this->getServiceLocator()->get('CacheDataListener'); $result = $cache->getCacheDataItem(CacheKeys::$CacheKeyFichiersAll); //if there's no cache for files if (!$result) { $allFichiers = $this->fichiersdao->getAllFichiers("object"); $cache->setCacheDataItem(CacheKeys::$CacheKeyFichiersAll, array('fichiers' => $allFichiers)); } else { $allFichiers = $result['fichiers']; } $id = (int) $this->params()->fromRoute('id', 0); //print_r($id); if (!$id) { return $this->redirect()->toRoute('Blogcontent', array('action' => 'add')); } $contenu = new Blogcontent(); $contenu = $this->blogContentDao->getBlogContent($id, "object"); $contenuId = $contenu->getId(); if (!empty($id)) { if (empty($contenuId)) { //return $this->getResponse()->setStatusCode(404); return $this->notFoundAction(); } } $rubrique = $this->rubriqueDao->getAllRubriques("array"); //$form = new GalerieForm(); $form->get('id')->setAttribute('value', $contenu->getId()); $form->get('titre')->setAttribute('value', $contenu->getTitre()); $form->get('soustitre')->setAttribute('value', $contenu->getSousTitre()); $form->get('position')->setAttribute('value', $contenu->getRang()); $form->get('imagepath')->setAttribute('value', $contenu->getImage()); $form->get('imagepath2')->setAttribute('value', $contenu->getImage2()); $form->get('contenu')->setAttribute('value', $contenu->getContenuHtml()); $form->get('author')->setAttribute('value', $contenu->getAuthor()); $form->get('themes')->setAttribute('value', $contenu->getThemes()); $form->get('blogdate')->setAttribute('value', $contenu->getDate()); $form->get('text1')->setAttribute('value', $contenu->getText1()); $form->get('text2')->setAttribute('value', $contenu->getText2()); $form->get('text3')->setAttribute('value', $contenu->getText3()); //$form->get('rubriques_id')->setAttribute('value', $contenu->getSousRubrique()->getRubrique()->getId()); //$form->get('sousrubriques_id')->setAttribute('value', $contenu->getSousRubrique()->getId()); $request = $this->getRequest(); if ($request->isPost()) { //$contenu = new Blogcontent(); //trigger data controls $form->setInputFilter(new BlogcontentInputFilter()); $form->setData($request->getPost()); //$form->setUseInputFilterDefaults(false); if ($form->isValid()) { //$contenu = array(); $contenu = new Blogcontent(); $filterData = new Utils(); $contenu->setSousRubrique($this->sousrubriqueDao->getSousrubrique($filterData->stripTags_replaceHtmlChar_trim($request->getPost('sousrubriquesList'), true, true, true))); $contenu->setId($filterData->stripTags_replaceHtmlChar_trim($request->getPost('id'), true, false, true)); $contenu->setTitre($filterData->stripTags_replaceHtmlChar_trim($request->getPost('titre'), true, false, true)); $contenu->setRang($filterData->stripTags_replaceHtmlChar_trim($request->getPost('position'), true, false, true)); $contenu->setSousTitre($filterData->stripTags_replaceHtmlChar_trim($request->getPost('soustitre'), false, true, true)); $contenu->setImage($filterData->stripTags_replaceHtmlChar_trim($request->getPost('imagepath'), true, false, true)); $contenu->setImage2($filterData->stripTags_replaceHtmlChar_trim($request->getPost('imagepath2'), true, false, true)); $contenu->setContenuHtml($request->getPost('contenu')); $contenu->setType(ContenuType::$blog); $contenu->setAuthor($filterData->stripTags_replaceHtmlChar_trim($request->getPost('author'), true, false, true)); $contenu->setThemes($filterData->stripTags_replaceHtmlChar_trim($request->getPost('themes'), true, false, true)); $contenu->setDate($filterData->stripTags_replaceHtmlChar_trim($request->getPost('blogdate'), true, false, true)); $contenu->setText1($filterData->stripTags_replaceHtmlChar_trim($request->getPost('text1'), true, false, true)); $contenu->setText2($filterData->stripTags_replaceHtmlChar_trim($request->getPost('text2'), true, false, true)); $contenu->setText3($filterData->stripTags_replaceHtmlChar_trim($request->getPost('text3'), true, false, true)); $this->blogContentDao->saveBlogContent($contenu); //flush cash //$this->getServiceLocator()->get('CacheDataListener')->removeCacheDataItem(CacheKeys::$CacheKeyBlogIndex . $contenu->getId()); //$cache = $this->getServiceLocator()->get('CacheDataListener'); $this->getServiceLocator()->get('CacheDataListener')->getCacheService()->flush(); return $this->redirect()->toRoute('Blogcontent'); } else { return array('id' => $id, 'form' => $form, 'rubrique_id' => $contenu->getSousRubrique()->getRubrique()->getId(), 'sousrubrique_id' => $contenu->getSousRubrique()->getId(), 'fichiers' => $allFichiers, 'error' => $form->getMessages()); } } return array('id' => $id, 'form' => $form, 'rubrique_id' => $contenu->getSousRubrique()->getRubrique()->getId(), 'sousrubrique_id' => $contenu->getSousRubrique()->getId(), 'fichiers' => $allFichiers, 'error' => "no error"); }
/** * Prepare params * * @param array $params * @return array */ public function prepareParams(array $params) { $return = array(); foreach ($params as $param => $value) { if (in_array($param, $this->options)) { $return[$param] = $value; } } foreach ($this->defaults as $default => $value) { if (false === in_array($default, $return)) { $return[$default] = $value; } } if (false === isset($return['url'])) { throw new Extlib\Exception(\translate('No url.'), Response::CODE_NOT_ACCEPTABLE); } $return['url'] = \Extlib\Utils::getInstance()->filterUrl($return['url']); $urlValidator = new \Extlib\Validate\Url(); if (false === $urlValidator->isValid($return['url'])) { throw new Extlib\Exception(sprintf(\translate("Url: '% s' is invalid."), $return['url']), Response::CODE_NOT_ACCEPTABLE); } return $return; }
function updatemetaajaxAction() { $id = (int) $this->params()->fromRoute('id', 0); $meta = new Meta(); $this->translator = $this->getServiceLocator()->get('translator'); $this->metaDao = new MetaDao(); $request = $this->getRequest(); if ($request->isPost()) { $utils = new Utils(); //$meta->setMetakey($request->getPost()->set('metakey', $utils->stripTags_replaceHtmlChar_trim($request->getPost('metakey'), true, true, true))); //$meta->setMetavalue($request->getPost()->set('metavalue', $utils->stripTags_replaceHtmlChar_trim($request->getPost('metavalue'), true, true, true))); $meta->setMetakey($utils->stripTags_replaceHtmlChar_trim($request->getPost('metakey'), true, true, true)); $meta->setMetavalue($utils->stripTags_replaceHtmlChar_trim($request->getPost('metavalue'), true, true, true)); $meta->setMetaid($id); $meta->setRubriqueid((int) $request->getPost('rubriqueid')); //get number of row inserted $row = $this->metaDao->saveMeta($meta); $result = array(); if ($row == 0 || $row > 1) { $result['error'] = $this->translator->translate("Un problème est survenu, veuillez recommencer"); } else { if ($row == 1) { $result['result'] = "OK"; } } return new JsonModel($result); } }
public function editAction() { $form = new LoginmgmtForm(); $this->loginmgmtDao = new LoginmgmtDao(); $this->translator = $this->getServiceLocator()->get('translator'); $id = (int) $this->params()->fromRoute('id', 0); if (!$id) { return $this->redirect()->toRoute('loginmgmt', array('action' => 'add')); } $login = new Login(); $login = $this->loginmgmtDao->getLogin($id); $loginId = $login->getId(); if (!empty($id)) { if (empty($loginId)) { //return $this->getResponse()->setStatusCode(404); return $this->notFoundAction(); } } $form->get('id')->setAttribute('value', $login->getId()); $form->get('name')->setAttribute('value', $login->getUser()); //$form->get('pwd')->setAttribute('value', $login->getPwd()); $form->get('roleList')->setAttribute('value', $login->getRole()); $form->get('submitbutton')->setAttribute('value', 'Modifier'); $request = $this->getRequest(); if ($request->isPost()) { $form->setData($request->getPost()); //$form->setInputFilter($rubrique->getInputFilter()); $form->setInputFilter(new LoginmgmtInputFilter()); if ($form->isValid()) { $utils = new Utils(); $loginOld = $this->loginmgmtDao->getLogin($id); $request->getPost()->set('name', $utils->stripTags_replaceHtmlChar_trim($request->getPost('name'), true, true, true)); $request->getPost()->set('pwd', $utils->stripTags_replaceHtmlChar_trim($request->getPost('pwd'), true, true, true)); $login->setId($request->getPost('id')); $login->setUser($request->getPost('name')); $login->setPwd($request->getPost('pwd')); $login->setRole($request->getPost('roleList')); //check if the new username is not already used if (strcmp($login->getUser(), $loginOld->getUser()) != 0) { $isExist = $this->loginmgmtDao->checkLoginUserame($login->getUser()); //if it s not used -> save if ($isExist == 0) { $this->loginmgmtDao->saveLogin($login); return $this->redirect()->toRoute('loginmgmt'); } else { $form->get('pwd')->setValue(''); return array('id' => $id, 'form' => $form, 'pwd' => $loginOld->getPwd(), 'error' => array(array('error' => $this->translator->translate('Un utilisateur existe déjà avec ce nom, veuillez en choisir un autre')))); } } $this->loginmgmtDao->saveLogin($login); return $this->redirect()->toRoute('loginmgmt'); } else { return array('id' => $id, 'pwd' => $login->getPwd(), 'form' => $form, 'error' => $form->getMessages()); } } return array('id' => $id, 'pwd' => $login->getPwd(), 'form' => $form, 'error' => ''); }
public function editAction() { //$this->getServiceLocator()->get('CacheListener')->getCacheService()->flush(); $form = new SousrubriqueForm(); $this->sousrubriqueDao = new Sousrubriquedao(); $this->rubriqueDao = new RubriqueDao(); $this->translator = $this->getServiceLocator()->get('translator'); $id = (int) $this->params()->fromRoute('id', 0); //print_r($id); if (!$id) { return $this->redirect()->toRoute('Sousrubrique', array('action' => 'add')); } $sousrubrique = $this->sousrubriqueDao->getSousrubrique($id); $sousrubriqueId = $sousrubrique->getId(); if (!empty($id)) { if (empty($sousrubriqueId)) { //return $this->getResponse()->setStatusCode(404); return $this->notFoundAction(); } } $rubrique = $this->rubriqueDao->getAllRubriques("array"); $form = new SousrubriqueForm(); $form->get('libelle')->setAttribute('value', $sousrubrique->getLibelle()); $form->get('id')->setAttribute('value', $sousrubrique->getId()); $form->get('rang')->setAttribute('value', $sousrubrique->getRang()); $form->get('rubriques_id')->setAttribute('value', $sousrubrique->getRubrique()->getId()); $form->get('rubriquesList')->setAttribute('value', $sousrubrique->getRubrique()->getId()); $form->get('submit')->setAttribute('value', $this->translator->translate('Modifier')); $request = $this->getRequest(); if ($request->isPost()) { $form->setInputFilter(new InputFilter()); $form->setData($request->getPost()); if ($form->isValid()) { $utils = new Utils(); $request->getPost()->set('libelle', $utils->stripTags_replaceHtmlChar_trim($request->getPost('libelle'), true, true, true)); $request->getPost()->set('rang', $utils->stripTags_replaceHtmlChar_trim($request->getPost('rang'), true, true, true)); $sousrubrique->setRubrique($this->rubriqueDao->getRubrique($request->getPost('rubriquesList'))); $sousrubrique->setLibelle($request->getPost('libelle')); $sousrubrique->setRang($request->getPost('rang')); $this->sousrubriqueDao->saveSousrubrique($sousrubrique); //flush cache $this->getServiceLocator()->get('CacheDataListener')->getCacheService()->flush(); // Redirect to list of sousrubriques return $this->redirect()->toRoute('Sousrubrique'); } else { return array('id' => $id, 'form' => $form, 'error' => $form->getMessages()); } } return array('id' => $id, 'form' => $form, 'error' => ''); }
public function editAction() { $form = new MessageForm(); $this->translator = $this->getServiceLocator()->get('translator'); $form->get('submitbutton')->setAttribute('value', $this->translator->translate('Modifier')); $this->messageDao = new MessageDao(); $id = (int) $this->params()->fromRoute('id', 0); /* if ($id == 0) { return $this->redirect()->toRoute('Message', array( 'action' => 'add' )); } */ $message = $this->messageDao->getMessage($id); $messageId = $message->getId(); if (!empty($id)) { if (empty($messageId)) { //return $this->getResponse()->setStatusCode(404); return $this->notFoundAction(); } } $form->get('id')->setAttribute('value', $message->getId()); $form->get('row1')->setAttribute('value', $message->getRow1()); $form->get('row2')->setAttribute('value', $message->getRow2()); $form->get('row3')->setAttribute('value', $message->getRow3()); $form->get('row4')->setAttribute('value', $message->getRow4()); $form->get('type')->setAttribute('value', $message->getType()); $form->get('msg')->setAttribute('value', $message->getMessage()); //$form->get('position')->setAttribute('value', $message->getRang()); $form->get('timestamp')->setAttribute('value', $message->getDate()); $form->get('submitbutton')->setAttribute('value', 'Modifier'); $request = $this->getRequest(); if ($request->isPost()) { //trigger data controls $message = new Message(); $form->setInputFilter(new MessageInputFilter()); $form->setData($request->getPost()); //$form->setUseInputFilterDefaults(false); //print_r('nonOK'); // exit; if ($form->isValid()) { $filterData = new Utils(); $message->setId($filterData->stripTags_replaceHtmlChar_trim($request->getPost('id'), true, false, true)); $message->setRow1($filterData->stripTags_replaceHtmlChar_trim($request->getPost('row1'), false, false, true)); $message->setRow2($filterData->stripTags_replaceHtmlChar_trim($request->getPost('row2'), false, false, true)); $message->setRow3($filterData->stripTags_replaceHtmlChar_trim($request->getPost('row3'), false, false, true)); $message->setRow4($filterData->stripTags_replaceHtmlChar_trim($request->getPost('row4'), false, false, true)); $message->setType($filterData->stripTags_replaceHtmlChar_trim($request->getPost('type'), true, true, true)); $message->setDate($filterData->stripTags_replaceHtmlChar_trim($request->getPost('timestamp'), true, false, true)); //$message['position'] = $filterData->stripTags_replaceHtmlChar_trim($request->getPost('position'), true, true, true); $message->setMessage($filterData->stripTags_replaceHtmlChar_trim($request->getPost('msg'), true, true, true)); $this->messageDao->saveMessage($message); //flush cache $this->getServiceLocator()->get('CacheDataListener')->getCacheService()->flush(); return $this->redirect()->toRoute('Message'); } else { return array('id' => $id, 'form' => $form, 'error' => $form->getMessages()); } } return array('id' => $id, 'form' => $form, 'error' => "no error"); }
public function editAction() { $form = new LinktocontenuForm(); $this->translator = $this->getServiceLocator()->get('translator'); $form->get('submitbutton')->setAttribute('value', $this->translator->translate('Ajouter')); $this->linktocontenuDao = new LinktocontenuDao(); $this->sousrubriqueDao = new Sousrubriquedao(); $this->fichiersdao = new Fichiersdao(); $this->contenuDao = new ContenuDao(); $linktocontenu = new Linktocontenu(); $request = $this->getRequest(); if ($request->isPost()) { //trigger data controls $form->setInputFilter(new LinktocontenuInputFilter()); $form->setData($request->getPost()); //$form->setUseInputFilterDefaults(false); if ($form->isValid()) { $filterData = new Utils(); //id $linktocontenu->setId((int) $request->getPost('id')); //sousrubriquesList $section = $this->sousrubriqueDao->getSousrubrique($filterData->stripTags_replaceHtmlChar_trim((int) $request->getPost('sousrubriquesList'), true, false, true)); $linktocontenu->setSousrubrique($section); //contenusList $contenu = $this->contenuDao->getContenu($filterData->stripTags_replaceHtmlChar_trim((int) $request->getPost('contenusList'), true, false, true)); $linktocontenu->setContenu($contenu); //titre $linktocontenu->setTitre($filterData->stripTags_replaceHtmlChar_trim($request->getPost('titre'), true, false, true)); //soustitre $linktocontenu->setSousTitre($filterData->stripTags_replaceHtmlChar_trim($request->getPost('soustitre'), true, false, true)); //html $linktocontenu->setContenuHtml($request->getPost('html')); //imagepath $linktocontenu->setImage($filterData->stripTags_replaceHtmlChar_trim($request->getPost('imagepath'), true, false, true)); //imagepath2 $linktocontenu->setImage2($filterData->stripTags_replaceHtmlChar_trim($request->getPost('imagepath2'), true, false, true)); //rubriqueswhereislinkList $linktocontenu->setLinktopage($request->getPost('rubriqueswhereislinkList')); //type //$linktocontenu->setType(ContenuType::$linkItem); //si pas de rang prendre le rang du contenu à lier //position $position = $request->getPost('position'); if (!empty($position)) { $linktocontenu->setRang((int) $position); } else { $linktocontenu->setRang(-1); } //sousrubriqueswhereislinkList $section = $this->sousrubriqueDao->getSousrubrique($request->getPost('sousrubriqueswhereislinkList')); $linktocontenu->setLinktosection($section); $this->linktocontenuDao->saveLinktocontenu($linktocontenu); //flush cache $this->getServiceLocator()->get('CacheDataListener')->getCacheService()->flush(); return $this->redirect()->toRoute('Linktocontenu'); } else { return array('form' => $form, 'fichiers' => $allFichiers, 'error' => $form->getMessages()); } } $allFichiers = array(); $form = new LinktocontenuForm(); $id = (int) $this->params()->fromRoute('id', 0); //print_r($id); if (!$id) { return $this->redirect()->toRoute('Linktocontenu', array('action' => 'add')); } $linktocontenu = $this->linktocontenuDao->getLinktocontenu($id); $sectionsinselect1 = array(); $sections = $this->sousrubriqueDao->getSousrubriquesByRubrique($linktocontenu->getSousrubrique()->getRubrique()->getId(), 'array'); foreach ($sections as $value) { $sectionsinselect1[$value['id']] = $value['libelle']; } $contentsinselect1 = array(); $contents = $this->contenuDao->getContenusBySousrubrique($linktocontenu->getSousrubrique()->getId(), 'array'); foreach ($contents as $value) { $contentsinselect1[$value['contenu_id']] = $value['titre']; } $sectionsinselect2 = array(); $sections = $this->sousrubriqueDao->getSousrubriquesByRubrique($linktocontenu->getLinktosection()->getRubrique()->getId(), 'array'); foreach ($sections as $value) { $sectionsinselect2[$value['id']] = $value['libelle']; } $form->get('rubriquesList')->setAttribute('value', $linktocontenu->getSousrubrique()->getRubrique()->getId()); //fill select $form->get('sousrubriquesList')->setValueOptions($sectionsinselect1); $form->get('sousrubriquesList')->setAttribute('value', $linktocontenu->getSousrubrique()->getId()); //fill select $form->get('contenusList')->setValueOptions($contentsinselect1); $form->get('contenusList')->setAttribute('value', $linktocontenu->getContenu()->getId()); $form->get('id')->setAttribute('value', $linktocontenu->getId()); $form->get('titre')->setAttribute('value', $linktocontenu->getTitre()); $form->get('soustitre')->setAttribute('value', $linktocontenu->getSousTitre()); $form->get('position')->setAttribute('value', $linktocontenu->getRang()); $form->get('html')->setAttribute('value', $linktocontenu->getContenuHtml()); $form->get('imagepath')->setAttribute('value', $linktocontenu->getImage()); $form->get('imagepath2')->setAttribute('value', $linktocontenu->getImage2()); $form->get('rubriqueswhereislinkList')->setAttribute('value', $linktocontenu->getLinktosection()->getRubrique()->getId()); //fill select $form->get('sousrubriqueswhereislinkList')->setValueOptions($sectionsinselect2); $form->get('sousrubriqueswhereislinkList')->setAttribute('value', $linktocontenu->getLinktosection()->getId()); $this->translator = $this->getServiceLocator()->get('translator'); $form->get('submitbutton')->setAttribute('value', $this->translator->translate('Ajouter')); //get cache $cache = $this->getServiceLocator()->get('CacheDataListener'); $result = $cache->getCacheDataItem(CacheKeys::$CacheKeyFichiersAll); //if there's no cache for files if (!$result) { $allFichiers = $this->fichiersdao->getAllFichiers("object"); $cache->setCacheDataItem(CacheKeys::$CacheKeyFichiersAll, array('fichiers' => $allFichiers)); } else { $allFichiers = $result['fichiers']; } return array('form' => $form, 'fichiers' => $allFichiers, 'error' => "no error"); }