From 2b2b5dcdd8fdd4fc867af3ceb28c6ebce896029c Mon Sep 17 00:00:00 2001 From: efalcy <efalcy@git-test.afi-sa.fr> Date: Wed, 2 Oct 2013 12:43:48 +0000 Subject: [PATCH] Categorie de groupes :affichage d'une popup pour la creation --- .../admin/controllers/UsergroupController.php | 28 ++++++++----------- library/Class/UserGroupCategorie.php | 5 ++++ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/application/modules/admin/controllers/UsergroupController.php b/application/modules/admin/controllers/UsergroupController.php index 62dd654d015..9b34bcdb6ca 100644 --- a/application/modules/admin/controllers/UsergroupController.php +++ b/application/modules/admin/controllers/UsergroupController.php @@ -18,7 +18,7 @@ * along with AFI-OPAC 2.0; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Admin_UsergroupController extends Zend_Controller_Action { +class Admin_UsergroupController extends ZendAfi_Controller_Action { public function indexAction() { $this->view->titre = "Gestion des groupes d'utilisateurs"; $bib= Class_Bib::getPortail(); @@ -37,7 +37,7 @@ class Admin_UsergroupController extends Zend_Controller_Action { 'containers' => Class_UserGroupCategorie::getLoader()->findAllBy(['order' => 'libelle']), 'add_link' => $this->view->tagAnchor($this->view->url(array_merge($add_link_options, ['id_bib' => $bib->getId()])), - $add_link_label)]; + $add_link_label,['data-popup'=>'true'])]; $this->view->categorieActions = $this->_getTreeViewContainerActions(); $this->view->usergroupActions = $this->_getTreeViewItemActions(); @@ -258,6 +258,7 @@ class Admin_UsergroupController extends Zend_Controller_Action { ), array( 'url' => $this->_getUrlForActionAndIdName('catadd'), + 'data-popup' => true, 'icon' => 'ico/add_cat.gif', 'label' => 'Ajouter une sous-catégorie' ), @@ -275,24 +276,17 @@ class Admin_UsergroupController extends Zend_Controller_Action { function cataddAction() { - $this->view->titre = "Ajouter une catégorie de groupes"; - - $categorie = new Class_UserGroupCategorie(); - $portail = Class_Bib::getPortail(); - $categorie->setIdBib($portail->getId()); - if ($parent_categorie = Class_UserGroupCategorie::find((int)$this->_getParam('id'))) - $categorie - ->setParentCategorie($parent_categorie); + $list_categories =[]; + foreach (Class_UserGroupCategorie::getLoader()->findAllBy(['order' => 'libelle']) as $cat) { + $list_categories[]=$cat->getLibelle(); + } - if ($this->_isCategorieSaved($categorie)) { - $this->_helper->notify($this->_('La catégorie "%s" a été ajoutée', $categorie->getLibelle())); - $this->_redirect(sprintf('admin/usergroup/index/id_cat/%d', $categorie->getId())); - return; - } + $titre_popup = "Ajouter une catégorie de groupes"; + + $this->renderPopupResult($this->view->_($titre_popup), + $this->view->addCategory($list_categories),[]); - $this->view->categorie = $categorie; - $this->view->combo_cat = $this->view->comboParentCategorie($categorie); } diff --git a/library/Class/UserGroupCategorie.php b/library/Class/UserGroupCategorie.php index 85b51df8435..771d339fd9b 100644 --- a/library/Class/UserGroupCategorie.php +++ b/library/Class/UserGroupCategorie.php @@ -36,6 +36,9 @@ class Class_UserGroupCategorie extends Storm_Model_Abstract { 'referenced_in' => 'parent_id']]; + public function getAllRootCategories() { + + } public static function getLoader() { return self::getLoaderFor(__CLASS__); } @@ -78,7 +81,9 @@ class Class_UserGroupCategorie extends Storm_Model_Abstract { } + public function getAllLibelles() { + } } \ No newline at end of file -- GitLab