Skip to content
Snippets Groups Projects

Stable

Merged Ghislain Loas requested to merge stable into hotline-master
Compare and
+ 727
441
Preferences
Compare changes
Files
@@ -16,14 +16,14 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Admin_AlbumController extends ZendAfi_Controller_Action {
use Trait_Translator;
protected $_baseUrlOptions = ['module' => 'admin',
'controller' => 'album'];
public function init() {
$this->view->titre = 'Collections';
@@ -64,7 +64,7 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
$response[] = ['label' => $renderStrategy->render($item)];
echo json_encode($response);
exit;
exit;
}
@@ -73,7 +73,7 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
$form = $this->_formImportEAD();
$this->view->form_import_ead = $form;
if (!$this->_request->isPost())
return;
@@ -83,13 +83,13 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
$this->_helper->notify(sprintf('%d albums importés', count($ead->getAlbums())));
$this->_redirect('admin/album');
return;
}
}
$this->_helper->notify('Le fichier reçu n\'est pas valide');
$this->_redirect('admin/album/importead');
}
protected function _formImportEAD() {
return $this->view
->newForm(['id' => 'import_ead', 'class' => 'form'])
@@ -126,7 +126,7 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
$categorie = Class_AlbumCategorie::newInstance()
->setParentCategorie($parent_categorie);
$titre = sprintf(((!$parent_categorie->hasParentCategorie())
$titre = sprintf(((!$parent_categorie->hasParentCategorie())
? 'Ajouter une catégorie à la collection "%s"'
: 'Ajouter une sous-catégorie à la catégorie "%s"'),
$parent_categorie->getLibelle());
@@ -177,7 +177,7 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
$this->_redirect('admin/album');
return;
}
$this->_renderAlbumForm($album, 'Modifier l\'album "' . $album->getTitre() . '"');
}
@@ -196,7 +196,7 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
}
$form = $this->_thumbnailsForm($album);
if ($form && $this->_request->isPost()
if ($form && $this->_request->isPost()
&& $form->isValid($this->_request->getPost())
&& ($album->updateAttributes($this->_request->getPost())
->save())) {
@@ -258,7 +258,7 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
$this->view->errors = $ressource->getErrors();
}
public function editressourceAction() {
if (null === ($ressource = Class_AlbumRessource::getLoader()
->find($this->_getParam('id')))) {
@@ -296,7 +296,7 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
protected function _setupRessourceFormAndSave($model) {
$form = $this->_ressourceForm($model);
$this->view->form = $form;
if (!$this->_request->isPost()
@@ -309,18 +309,18 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
$form->addModelErrors($model);
return false;
}
return $model->save()
&& $model->receiveFiles()
&& $model->getAlbum()->save()
&& $model->getAlbum()->index();
}
public function sortressourcesAction() {
$album = Class_Album::getLoader()->find((int)$this->_getParam('id'));
$album->sortRessourceByFileName()->save();
$this->_helper->notify('Médias réordonnés par nom de fichier');
$this->_helper->notify('Médias réordonnés par nom de fichier');
$this->_redirect('admin/album/edit_images/id/'.$album->getId());
}
@@ -424,7 +424,7 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
'required' => true,
'allowEmpty' => false]))
->addDisplayGroup(['libelle'], 'categorie',
['legend' => (($categorie->hasParentCategorie()) ?
['legend' => (($categorie->hasParentCategorie()) ?
'Catégorie'
: 'Collection')])
->populate($categorie->toArray());
@@ -467,7 +467,7 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
* @return Zend_Form
*/
protected function _albumForm($album) {
$form = ZendAfi_Form_Album::newWith($album);
$form = ZendAfi_Form_Album::newWithAlbum($album);
$form->addAttribs(['data-backurl' => $this->view->url(['action' => 'index',
'cat_id' => $album->getCatId()])]);
return $form;
@@ -513,7 +513,7 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
(new Storm_Cache())->clean();
$this->_helper->notify('Album sauvegardé');
$this->_redirect('admin/album/edit_album/id/' . $album->getId());
}
}
}
@@ -535,7 +535,7 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
*/
protected function _renderAlbumForm($album, $titre) {
$this->_validateAndSaveAlbum($album);
$this->view->titre = $titre;
$this->view->errors = $album->getErrors();
$this->view->album = $album;
@@ -548,7 +548,7 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
protected function _getTreeViewContainerActions() {
$actions = Class_AdminVar::isBibNumEnabled()
$actions = Class_AdminVar::isBibNumEnabled()
? [['url' => $this->_getUrlForAction('add_categorie_to'),
'icon' => 'ico/add_cat.gif',
'label' => 'Ajouter une sous-catégorie'],
@@ -559,7 +559,7 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
: [];
return array_merge($actions,
return array_merge($actions,
[['url' => $this->_getUrlForAction('edit_categorie'),
'icon' => 'ico/edit.gif',
'label' => 'Modifier la catégorie'],