Skip to content
Snippets Groups Projects
Commit 09fdd302 authored by Laurent's avatar Laurent Committed by Patrick Barroca
Browse files

Update 72866

parent 4368274b
Branches
Tags
3 merge requests!3297WIP: Master,!3025Dev#72866 65 poker contractuel bdp64 resa multi sigb,!3010Dev#72866 65 poker contractuel bdp64 resa multi sigb
Pipeline #6406 passed with stage
in 36 minutes and 1 second
'72866' =>
['Label' => $this->_('65% [POKER] [Contractuel] BDP64 - Résa multi SIGB'),
'Desc' => '',
['Label' => $this->_('Gestion des demandes d\'inscription'),
'Desc' => $this->_('Vous pouvez modérer, accepter ou rejeter les demandes d\'inscriptions au portail'),
'Image' => '',
'Video' => '',
'Category' => '',
'Video' => 'https://youtu.be/TdqLz98r2kA',
'Category' => $this->_('Administration'),
'Right' => function($feature_description, $user) {return true;},
'Wiki' => '',
'Test' => '',
'Wiki' => 'http://wiki.bokeh-library-portal.org/index.php?title=G%C3%A9rer_les_demandes_d%27inscription',
'Test' => '/admin/registration',
'Date' => '2019-02-06'],
\ No newline at end of file
......@@ -45,30 +45,31 @@ class Admin_RegistrationController extends ZendAfi_Controller_Action {
public function archiveAction() {
$this->_redirectToIndex();
if ((!$id = $this->_getParam('id', null))
|| (!$registration = Class_UsersNonValid::find($id))) {
return $this->_helper->notify($this->_('Aucune demande d\'inscription archivée'));
$this->_helper->notify($this->_('Aucune demande d\'inscription archivée'));
return $this->_redirectToIndex();
}
$registration->delete();
$this->_helper->notify($this->_('Demande d\'inscription de "%s" archivée', $registration->getLogin()));
$this->_redirectToIndex();
}
public function validateAction() {
$this->_redirectToIndex();
if ((!$id = $this->_getParam('id', null))
|| (!$registration = Class_UsersNonValid::find($id)))
return $this->_helper->notify($this->_('Aucune demande d\'inscription validée'));
|| (!$registration = Class_UsersNonValid::find($id))) {
$this->_helper->notify($this->_('Aucune demande d\'inscription validée'));
return $this->_redirectToIndex();
}
$message = $registration->activate()
? $this->_('Inscription de "%s" validée', $registration->getLogin())
: $this->_('Impossible de valider la demande d\'inscription de "%s"', $registration->getLogin());
$this->_helper->notify($message);
$this->_redirectToIndex();
}
......
......@@ -4,56 +4,10 @@ if (empty($this->registrations)) {
return;
}
$has_one_expired = false;
$description = (new Class_TableDescription('registration'))
->addColumn($this->_('Identifiant'), 'login')
->addColumn($this->_('Email'), 'mail')
->addColumn($this->_('Bibliothèque'), 'bib_libelle')
->addColumn($this->_('Date'), 'date')
->addColumn($this->_('Expirée'), function($model) use(&$has_one_expired)
{
$has_one_expired = $has_one_expired || $model->isExpired();
return $model->isExpired() ? $this->_('Oui') : $this->_('Non');
})
->addRowAction(
function($model)
{
return $this->renderModelActions($model,
[['url' => ['action' => 'reject',
'id' => $model->getId()],
'icon' => 'delete',
'label' => $this->_('Rejeter la demande d\'inscription de "%s"', $model->getLogin()),
'anchorOptions' => ['onclick' => sprintf('return confirm(\'%s\')',
$this->_('Etes-vous sûr de vouloir rejeter cette inscription ?')) ]],
['url' => ['action' => 'validate',
'id' => $model->getId()],
'icon' => 'add_user',
'condition' => function($model) {return !$model->hasUser();},
'label' => $this->_('Valider la demande d\'inscription de "%s"', $model->getLogin())],
['url' => ['controller' => 'users',
'action' => 'edit',
'id' => $model->getBibUserId()],
'icon' => 'user',
'condition' => 'hasUser',
'label' => $this->_('Visualiser les informations du compte "%s"', $model->getLogin())],
['url' => ['action' => 'archive',
'id' => $model->getId()],
'icon' => 'validate',
'condition' => 'hasUser',
'label' => $this->_('Archiver la demande d\'inscription de "%s"', $model->getLogin())],
]);
});
$description = new Class_TableDescription_Registrations('registration');
echo $this->renderTable($description, $this->registrations);
if ($has_one_expired)
if ($description->hasOneExpired())
echo $this->button(
(new Class_Entity())->setText($this->_('Supprimer les demandes expirées'))
->setUrl($this->url(['action' => 'delete-expired']))
......
......@@ -21,9 +21,6 @@
class Class_TableDescription_CosmoWaitingFiles extends Class_TableDescription {
use Trait_Translator;
protected $_view;
public function setView($view) {
......
......@@ -21,8 +21,6 @@
class Class_TableDescription_PNBItems extends Class_TableDescription {
use Trait_Translator;
public function init() {
$this
->addColumn($this->_('Titre'), 'title')
......
<?php
/**
* Copyright (c) 2012-2019, 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 Class_TableDescription_Registrations extends Class_TableDescription {
protected $_has_one_expired = false;
public function init() {
$this->addColumn($this->_('Identifiant'), 'login')
->addColumn($this->_('Email'), 'mail')
->addColumn($this->_('Bibliothèque'), 'bib_libelle')
->addColumn($this->_('Date'), 'date')
->addColumn($this->_('Expirée'), function($model)
{
$this->_has_one_expired = $this->_has_one_expired || $model->isExpired();
return $model->isExpired() ? $this->_('Oui') : $this->_('Non');
})
->addRowAction(['url' => ['action' => 'reject',
'id' => '%s'],
'icon' => 'delete',
'label' => function($model)
{
return $this->_('Rejeter la demande d\'inscription de "%s"',
$model->getLogin());
},
'anchorOptions' => ['onclick' => sprintf('return confirm(\'%s\')',
$this->_('Etes-vous sûr de vouloir rejeter cette inscription ?'))]])
->addRowAction(['url' => ['action' => 'validate',
'id' => '%s'],
'icon' => 'add_user',
'condition' => function($model) { return !$model->hasUser(); },
'label' => function($model)
{
return $this->_('Valider la demande d\'inscription de "%s"',
$model->getLogin());
}])
->addRowAction(['url' => ['controller' => 'users',
'action' => 'edit',
'id' => '%s'],
'id' => function($model) { return $model->getBibUserId(); },
'icon' => 'user',
'condition' => 'hasUser',
'label' => function($model)
{
return $this->_('Visualiser les informations du compte "%s"',
$model->getLogin());
}])
->addRowAction(['url' => ['action' => 'archive',
'id' => '%s'],
'icon' => 'validate',
'condition' => 'hasUser',
'label' => function($model)
{
return $this->_('Archiver la demande d\'inscription de "%s"',
$model->getLogin());
}])
;
}
public function hasOneExpired() {
return $this->_has_one_expired;
}
}
......@@ -106,16 +106,25 @@ class Class_UsersNonValid extends Storm_Model_Abstract {
public function activate() {
$user = new Class_Users();
if (!$user
->setLogin($this->getLogin())
->setMail($this->getMail())
->setPassword($this->getPassword())
->setIdSite($this->getIdSite())
->setIdabon($this->getIdabon())
->setNom($this->getLastname())
->setPrenom($this->getFirstname())
->save())
$user = (new Class_Users())
->setLogin($this->getLogin())
->setMail($this->getMail())
->setPassword($this->getPassword())
;
if ($this->hasIdSite())
$user->setIdSite($this->getIdSite());
if ($this->hasIdabon())
$user->setIdabon($this->getIdabon());
if ($this->hasLastname())
$user->setNom($this->getLastname());
if ($this->hasFirstname())
$user->setPrenom($this->getFirstname());
if (!$user->save())
return false;
$this
......
......@@ -117,6 +117,7 @@ class ZendAfi_View_Helper_Admin_HelpLinkBokehWiki {
'codification-browser' => ['index' => 'Explorateur_de_codifications'],
'batch' => ['index' => 'Batchs,_tâches_planifiées'],
'feature' => ['index' => 'Nouvelles_fonctionnalités'],
'registration' => ['index' => 'Gérer_les_demandes_d\'inscription'],
];
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment