Skip to content
Snippets Groups Projects

CosmoZendify items deletion

Merged Alex Arnaud requested to merge dev#167408_delete_items_cosmozendification into master
Files
31
<?php
/**
* Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* 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
*/
class Cosmo_DeleteItemsController extends ZendAfi_Controller_Action {
public function indexAction() {
$this->view->titre = $this->_('Suppression des notices ou des exemplaires');
$this->view->libraries = Class_IntBib::query()->order('id_bib')->fetchAll();
}
public function allDashboardAction() {
$this->view->titre = $this->_('Supprimer toutes les notices et tous les exemplaires');
}
public function libraryDashboardAction() {
$id_bib = $this->_getParam('id');
$bib_name = Class_IntBib::find($id_bib)->getNomCourt();
$this->view->id_bib = $id_bib;
$this->view->titre = $this->_("Supprimer tous les exemplaires de $bib_name");
}
public function allAction() {
session_write_close();
$this->view->titre = $this->_('Suppression des notices et tout le reste en cours');
if ( null === $step = $this->_getParam('step')) {
$this->_helper->notify($this->_('Impossible de supprimer les notices et tout le reste'));
$this->_redirectClose($this->_getReferer());
return;
}
$cleaner =
((new Class_Cosmogramme_Cleaner($step, $this->_getParam('counter', 0)))
->delete());
$this->view->content = $this->view->Cosmo_Cleaner($cleaner);
if ( 'ajax' !== $this->_getParam('render', ''))
return;
$this->_helper->getHelper('HTMLAjaxResponse')
->htmlAjaxResponseWithScript($this->view->content);
}
public function libraryAction() {
session_write_close();
$id_bib = $this->_getParam('id');
$step = $this->_getParam('step');
$count_items = $this->_getParam('count_items');
$count_records = $this->_getParam('count_succinct_records');
$counter = $this->_getParam('counter');
$limit = $this->_getParam('limit') ?? 0;
if ( null === ($id_bib = $this->_getParam('id', null))) {
$this->_helper->notify($this->_('Identifiant de bibliothèque manquant.'));
return $this->_redirectToReferer();
}
$cleaner = ((new Class_Cosmogramme_ItemsCleaner($id_bib, $step, $count_items, $count_records, $counter, $limit))
->delete());
$this->view->content = $this->view->Cosmo_ItemsCleaner($cleaner);
if ( 'ajax' !== $this->_getParam('render', ''))
return;
$this->_helper->getHelper('HTMLAjaxResponse')
->htmlAjaxResponseWithScript($this->view->content);
}
}