function editAction() { $this->view->title = "Modification d'une image"; //if ($this->view->aclIsAllowed('gallery','manage',true)){ $this->view->assign('isXmlHttpRequest', $this->_isXmlHttpRequest); $this->view->assign('success', false); $pageID = $this->_getParam('pageID'); $blockID = $this->_getParam('blockID'); $imageID = $this->_getParam('imageID'); $baseDir = $this->view->baseUrl(); $imageSelect = new ImagesIndex(); $select = $imageSelect->select()->setIntegrityCheck(false)->from('ImagesIndex')->join('Galleries_Images', 'GI_ImageID = II_ImageID')->where('II_ImageID = ?', $imageID); $imageData = $imageSelect->fetchRow($select); if (!$imageData) { if ($this->_request->isPost()) { $this->view->assign('success', true); } $this->view->assign('deleted', true); $this->view->assign('imageID', $imageID); } else { $imageObject = new ImageObject(); $imageData = $imageObject->populate($imageID, Zend_Registry::get("currentEditLanguage")); $this->view->assign('deleted', false); $galleryImageSelect = new GalleriesImages(); $select = $galleryImageSelect->select()->where('GI_ImageID = ?', $imageID); $galleryImageData = $galleryImageSelect->fetchRow($select); $imageData['GI_Online'] = $galleryImageData['GI_Online']; $imageData['GI_Position'] = $galleryImageData['GI_Position']; $cancelUrl = "/gallery/index/list/blockID/{$blockID}/pageID/{$pageID}"; $form = new FormImage(array('baseDir' => $baseDir, 'cancelUrl' => "", 'galleryID' => '', 'imageID' => $imageID)); if ($this->_request->isPost()) { $formData = $this->_request->getPost(); if ($form->isValid($formData)) { $formData['ImageSrc'] = $imageData['ImageSrc']; $imageObject = new ImageObject(); $imageObject->save($imageID, $formData, Zend_Registry::get("currentEditLanguage")); $galleryImageData['GI_Online'] = $form->getValue('GI_Online'); $galleryImageData['GI_Position'] = $form->getValue('GI_Position'); $galleryImageData->save(); $gallerySelect = new Galleries(); $select = $gallerySelect->select()->where('G_ID = ?', $galleryImageData['GI_GalleryID']); $galleryData = $gallerySelect->fetchRow($select); if ($blockID > 0) { $blockParameters = Cible_FunctionsBlocks::getBlockParameters($blockID); $categoryID = $blockParameters[0]['P_Value']; $indexData['pageID'] = $categoryID; $indexData['moduleID'] = $this->_moduleID; $indexData['contentID'] = $galleryImageData['GI_GalleryID']; $indexData['languageID'] = Zend_Registry::get("currentEditLanguage"); $indexData['title'] = $formData['II_Title']; $indexData['text'] = ''; $indexData['link'] = 'image'; $indexData['contents'] = $formData['II_Title'] . " " . $formData['II_Description']; if ($formData['GI_Online'] == 1 && $galleryData['G_Online'] == 1) { $indexData['action'] = 'update'; } else { $indexData['action'] = 'delete'; } Cible_FunctionsIndexation::indexation($indexData); } if (!$this->_isXmlHttpRequest) { $this->_redirect("/gallery/index/list/blockID/{$blockID}/pageID/{$pageID}"); } else { $buttonAction = $formData['buttonAction']; $this->view->assign('buttonAction', $buttonAction); $this->view->assign('success', true); $this->view->assign('imageID', $imageID); $this->view->assign('imageTitle', $form->getValue('II_Title')); $this->view->assign('imageDescription', $form->getValue('II_Description')); } } else { $this->view->form = $form; } } else { $form->populate($imageData); $this->view->form = $form; } } //} }