2008-02-08 18:39:24 +01:00
|
|
|
<?php
|
|
|
|
/*******************************************************************************
|
|
|
|
* Copyright (C) 2007 Easter-eggs
|
|
|
|
* http://ldapsaisie.labs.libre-entreprise.org
|
|
|
|
*
|
|
|
|
* Author: See AUTHORS file in top-level directory.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License version 2
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
require_once 'includes/functions.php';
|
|
|
|
require_once 'includes/class/class.LSsession.php';
|
|
|
|
|
|
|
|
$GLOBALS['LSsession'] = new LSsession();
|
|
|
|
|
|
|
|
if($LSsession -> startLSsession()) {
|
2008-02-26 18:40:05 +01:00
|
|
|
if (isset($_REQUEST['LSobject'])) {
|
|
|
|
$LSobject = $_REQUEST['LSobject'];
|
2008-06-18 14:27:35 +02:00
|
|
|
$dn = $_REQUEST['dn'];
|
2008-02-12 18:59:44 +01:00
|
|
|
|
|
|
|
if ( $LSobject == 'SELF' ) {
|
2008-06-18 14:27:35 +02:00
|
|
|
$LSobject = $GLOBALS['LSsession']-> LSuserObject -> getType();
|
|
|
|
$dn = $GLOBALS['LSsession']-> LSuserObject -> getValue('dn');
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
2008-06-18 14:27:35 +02:00
|
|
|
|
|
|
|
if ( $GLOBALS['LSsession'] -> loadLSobject($LSobject) ) {
|
|
|
|
// Affichage d'un objet
|
|
|
|
if ( $dn!='' ) {
|
|
|
|
if ($GLOBALS['LSsession'] -> canAccess($LSobject,$dn)) {
|
|
|
|
if ( $GLOBALS['LSsession'] -> canEdit($LSobject,$dn) ) {
|
2008-02-26 18:40:05 +01:00
|
|
|
$LSview_actions[] = array(
|
|
|
|
'label' => _('Modifier'),
|
2008-06-18 14:27:35 +02:00
|
|
|
'url' =>'modify.php?LSobject='.$LSobject.'&dn='.$dn,
|
2008-02-26 18:40:05 +01:00
|
|
|
'action' => 'modify'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-06-18 14:27:35 +02:00
|
|
|
if ($GLOBALS['LSsession'] -> canCreate($LSobject)) {
|
2008-02-26 18:40:05 +01:00
|
|
|
$LSview_actions[] = array(
|
|
|
|
'label' => _('Copier'),
|
2008-06-18 14:27:35 +02:00
|
|
|
'url' =>'create.php?LSobject='.$LSobject.'&load='.$dn,
|
2008-02-26 18:40:05 +01:00
|
|
|
'action' => 'copy'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-06-18 14:27:35 +02:00
|
|
|
if ($GLOBALS['LSsession'] -> canRemove($LSobject,$dn)) {
|
2008-02-26 18:40:05 +01:00
|
|
|
$LSview_actions[] = array(
|
|
|
|
'label' => _('Supprimer'),
|
2008-06-18 14:27:35 +02:00
|
|
|
'url' => 'remove.php?LSobject='.$LSobject.'&dn='.$dn,
|
2008-02-26 18:40:05 +01:00
|
|
|
'action' => 'delete'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2008-06-18 14:27:35 +02:00
|
|
|
if ($GLOBALS['LSsession']-> LSuserObject -> getValue('dn') != $dn) {
|
|
|
|
$object = new $LSobject();
|
|
|
|
$object -> loadData($dn);
|
2008-02-26 18:40:05 +01:00
|
|
|
$GLOBALS['Smarty'] -> assign('pagetitle',$object -> getDisplayValue());
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$object = &$GLOBALS['LSsession']-> LSuserObject;
|
|
|
|
$GLOBALS['Smarty'] -> assign('pagetitle',_('Mon compte'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$view = $object -> getView();
|
|
|
|
$view -> displayView();
|
|
|
|
|
|
|
|
// Relations
|
|
|
|
if (is_array($object -> config['relations'])) {
|
|
|
|
$LSrelations=array();
|
|
|
|
foreach($object -> config['relations'] as $relationName => $relationConf) {
|
|
|
|
if ($GLOBALS['LSsession'] -> relationCanAccess($object -> getValue('dn'),$relationName)) {
|
|
|
|
$return=array('label' => $relationConf['label']);
|
|
|
|
|
|
|
|
$id=rand();
|
|
|
|
$return['id']=$id;
|
|
|
|
$_SESSION['LSrelation'][$id] = array(
|
|
|
|
'relationName' => $relationName,
|
|
|
|
'objectType' => $object -> getType(),
|
|
|
|
'objectDn' => $object -> getDn(),
|
|
|
|
);
|
|
|
|
if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$relationName)) {
|
|
|
|
$return['actions'][] = array(
|
|
|
|
'label' => _('Modifier'),
|
|
|
|
'url' => 'select.php?LSobject='.$relationConf['LSobject'],
|
|
|
|
'action' => 'modify'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$GLOBALS['LSsession'] -> addJSscript('LSselect.js');
|
|
|
|
$GLOBALS['LSsession'] -> addJSscript('LSsmoothbox.js');
|
|
|
|
$GLOBALS['LSsession'] -> addCssFile('LSsmoothbox.css');
|
|
|
|
$GLOBALS['LSsession'] -> addJSscript('LSrelation.js');
|
2008-04-25 15:48:12 +02:00
|
|
|
if($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) {
|
|
|
|
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
|
|
|
|
$objRel = new $relationConf['LSobject']();
|
|
|
|
$list = $objRel -> $relationConf['list_function']($object);
|
|
|
|
if (is_array($list)) {
|
|
|
|
foreach($list as $o) {
|
|
|
|
$return['objectList'][] = $o -> getDisplayValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$return['objectList']=array();
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2008-04-25 15:48:12 +02:00
|
|
|
$GLOBALS['LSerror'] -> addErrorCode(1013,$relationName);
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
2008-04-25 15:48:12 +02:00
|
|
|
$LSrelations[]=$return;
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
|
|
|
else {
|
2008-04-25 15:48:12 +02:00
|
|
|
$GLOBALS['LSerror'] -> addErrorCode(1016,array('relation' => $relationName,'LSobject' => $relationConf['LSobject']));
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$GLOBALS['Smarty'] -> assign('LSrelations',$LSrelations);
|
|
|
|
}
|
|
|
|
|
|
|
|
$GLOBALS['Smarty'] -> assign('LSview_actions',$LSview_actions);
|
|
|
|
$GLOBALS['LSsession'] -> addJSscript('LSsmoothbox.js');
|
|
|
|
$GLOBALS['LSsession'] -> addCssFile('LSsmoothbox.css');
|
|
|
|
$GLOBALS['LSsession'] -> setTemplate('view.tpl');
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
2008-02-26 18:40:05 +01:00
|
|
|
else {
|
|
|
|
$GLOBALS['LSerror'] -> addErrorCode(1011);
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
2008-06-18 14:27:35 +02:00
|
|
|
// Affichage d'une liste d'un type d'objet
|
2008-02-26 18:40:05 +01:00
|
|
|
else {
|
|
|
|
$objectList=array();
|
2008-06-18 14:27:35 +02:00
|
|
|
$object = new $LSobject();
|
|
|
|
|
2008-02-26 18:40:05 +01:00
|
|
|
$GLOBALS['Smarty']->assign('pagetitle',$object -> getLabel());
|
|
|
|
$GLOBALS['Smarty']->assign('LSobject_list_objectname',$object -> getLabel());
|
2008-02-12 18:59:44 +01:00
|
|
|
|
2008-06-20 17:52:15 +02:00
|
|
|
$subDnLdapServer = $GLOBALS['LSsession'] -> getSortSubDnLdapServer();
|
|
|
|
|
2008-06-18 14:27:35 +02:00
|
|
|
if (isset($_SESSION['LSsession']['LSsearch'][$LSobject])) {
|
|
|
|
$filter = $_SESSION['LSsession']['LSsearch'][$LSobject]['filter'];
|
|
|
|
$params = $_SESSION['LSsession']['LSsearch'][$LSobject]['params'];
|
|
|
|
$pattern = $_SESSION['LSsession']['LSsearch'][$LSobject]['pattern'];
|
|
|
|
$recur = $_SESSION['LSsession']['LSsearch'][$LSobject]['recur'];
|
|
|
|
if ($recur) {
|
|
|
|
$topDn = $GLOBALS['LSsession'] -> topDn;
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
|
|
|
else {
|
2008-06-18 14:27:35 +02:00
|
|
|
$topDn = $object -> config['container_dn'].','.$GLOBALS['LSsession'] -> topDn;
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
2008-06-18 14:27:35 +02:00
|
|
|
$approx = $_SESSION['LSsession']['LSsearch'][$LSobject]['approx'];
|
2008-06-20 17:52:15 +02:00
|
|
|
$orderby = $_SESSION['LSsession']['LSsearch'][$LSobject]['orderby'];
|
|
|
|
$ordersense = $_SESSION['LSsession']['LSsearch'][$LSobject]['ordersense'];
|
|
|
|
$doSubDn = $_SESSION['LSsession']['LSsearch'][$LSobject]['doSubDn'];
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
|
|
|
else {
|
2008-06-18 14:27:35 +02:00
|
|
|
$filter = NULL;
|
|
|
|
$topDn = $object -> config['container_dn'].','.$GLOBALS['LSsession'] -> topDn;
|
|
|
|
$params = array('scope' => 'one');
|
|
|
|
$pattern = false;
|
|
|
|
$recur = false;
|
|
|
|
$approx = false;
|
2008-06-20 17:52:15 +02:00
|
|
|
$orderby = false;
|
|
|
|
$ordersense = 'ASC';
|
|
|
|
$doSubDn = (($subDnLdapServer)&&(!$GLOBALS['LSsession']->isSubDnLSobject($LSobject)));
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
2008-06-18 14:27:35 +02:00
|
|
|
|
|
|
|
if (isset($_REQUEST['LSview_search_submit'])) {
|
|
|
|
if (isset($_REQUEST['LSview_pattern']) && ($_REQUEST['LSview_pattern']!=$pattern)) {
|
|
|
|
$pattern = $_REQUEST['LSview_pattern'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$approx = (isset($_REQUEST['LSview_approx']));
|
|
|
|
|
|
|
|
if ($pattern && $pattern!='') {
|
|
|
|
$filter='(|';
|
|
|
|
if ($approx) {
|
|
|
|
foreach ($object -> attrs as $attr_name => $attr_val) {
|
|
|
|
$filter.='('.$attr_name.'~='.$pattern.')';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
foreach ($object -> attrs as $attr_name => $attr_val) {
|
|
|
|
$filter.='('.$attr_name.'=*'.$pattern.'*)';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$filter.=')';
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
|
|
|
else {
|
2008-06-18 14:27:35 +02:00
|
|
|
$filter = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_REQUEST['LSview_recur'])) {
|
|
|
|
$recur = true;
|
|
|
|
$params['scope'] = 'sub';
|
|
|
|
$topDn = $GLOBALS['LSsession'] -> topDn;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$recur = false;
|
|
|
|
$params['scope'] = 'one';
|
|
|
|
$topDn = $object -> config['container_dn'].','.$GLOBALS['LSsession'] -> topDn;
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
|
|
|
}
|
2008-06-18 14:27:35 +02:00
|
|
|
|
2008-06-20 17:52:15 +02:00
|
|
|
$sort=false;
|
|
|
|
if ((isset($_REQUEST['orderby']))) {
|
|
|
|
$possible_values= array('displayValue','subDn');
|
|
|
|
if (in_array($_REQUEST['orderby'],$possible_values)) {
|
|
|
|
$sort=true;
|
|
|
|
if ($orderby==$_REQUEST['orderby']) {
|
|
|
|
$ordersense = ($ordersense=='ASC')?'DESC':'ASC';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$ordersense = 'ASC';
|
|
|
|
}
|
|
|
|
$orderby=$_REQUEST['orderby'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$GLOBALS['Smarty']->assign('LSobject_list_subDn',$doSubDn);
|
|
|
|
|
2008-06-18 14:27:35 +02:00
|
|
|
// Sauvegarde en Session
|
|
|
|
$_SESSION['LSsession']['LSsearch'][$LSobject] = array(
|
|
|
|
'filter' => $filter,
|
|
|
|
'topDn' => $topDn,
|
|
|
|
'params' => $params,
|
|
|
|
'pattern' => $pattern,
|
|
|
|
'recur' => $recur,
|
2008-06-20 17:52:15 +02:00
|
|
|
'approx' => $approx,
|
|
|
|
'orderby' => $orderby,
|
|
|
|
'ordersense' => $ordersense,
|
|
|
|
'doSubDn' => $doSubDn
|
2008-06-18 14:27:35 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
$GLOBALS['Smarty']->assign('LSview_search_pattern',$pattern);
|
|
|
|
|
|
|
|
if ($recur) {
|
|
|
|
$GLOBALS['Smarty']->assign('LSview_search_recur',true);
|
|
|
|
}
|
|
|
|
if ($approx) {
|
|
|
|
$GLOBALS['Smarty']->assign('LSview_search_approx',true);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Hidden fields
|
|
|
|
$GLOBALS['Smarty']->assign('LSview_search_hidden_fields',array(
|
|
|
|
'LSobject' => $LSobject,
|
|
|
|
'LSview_search_submit' => 1
|
|
|
|
));
|
|
|
|
|
|
|
|
// Hash de la recherche déterminer à partir des paramètres de la recherche
|
|
|
|
$hash = mhash (MHASH_MD5,
|
|
|
|
print_r(
|
|
|
|
array(
|
|
|
|
'LSobject' => $LSobject,
|
|
|
|
'filter' => $filter,
|
|
|
|
'topDn' => $topDn,
|
|
|
|
'params' => $params
|
|
|
|
),
|
|
|
|
true
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
if (($GLOBALS['LSsession'] -> cacheSearch()) && isset($_SESSION['LSsession']['LSsearch'][$hash]) && (!isset($_REQUEST['refresh']))) {
|
|
|
|
// On affiche à partir du cache
|
|
|
|
$searchData=$_SESSION['LSsession']['LSsearch'][$hash];
|
|
|
|
debug('Recherche : From cache');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
debug('Recherche : Load');
|
|
|
|
if ($GLOBALS['LSsession'] -> canCreate($LSobject)) {
|
|
|
|
$LSview_actions[] = array (
|
|
|
|
'label' => _('Nouveau'),
|
|
|
|
'url' => 'create.php?LSobject='.$LSobject,
|
|
|
|
'action' => 'create'
|
2008-02-26 18:40:05 +01:00
|
|
|
);
|
2008-06-18 14:27:35 +02:00
|
|
|
$canCopy=true;
|
|
|
|
}
|
|
|
|
$LSview_actions[] = array (
|
|
|
|
'label' => _('Rafraîchir'),
|
|
|
|
'url' => 'view.php?LSobject='.$LSobject.'&refresh',
|
|
|
|
'action' => 'refresh'
|
|
|
|
);
|
|
|
|
|
|
|
|
$list=$object -> listObjects($filter,$topDn,$params);
|
|
|
|
$nbObjects=count($list);
|
|
|
|
$searchData['LSobject_list_nbresult']=$nbObjects;
|
|
|
|
|
|
|
|
$c=0;
|
|
|
|
|
|
|
|
foreach($list as $thisObject) {
|
|
|
|
if ($GLOBALS['LSsession'] -> canAccess($LSobject,$thisObject->getValue('dn'))) {
|
|
|
|
$subDn_name=false;
|
2008-06-20 17:52:15 +02:00
|
|
|
if ($doSubDn) {
|
2008-06-18 14:27:35 +02:00
|
|
|
reset($subDnLdapServer);
|
|
|
|
while (!$subDn_name && next($subDnLdapServer)) {
|
|
|
|
if (isCompatibleDNs(key($subDnLdapServer),$thisObject -> getValue('dn'))) {
|
|
|
|
$subDn_name=current($subDnLdapServer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$c++;
|
|
|
|
unset($actions);
|
|
|
|
|
2008-02-26 18:40:05 +01:00
|
|
|
$actions[] = array(
|
2008-06-18 14:27:35 +02:00
|
|
|
'label' => _('Voir'),
|
|
|
|
'url' =>'view.php?LSobject='.$LSobject.'&dn='.$thisObject -> getValue('dn'),
|
|
|
|
'action' => 'view'
|
2008-02-12 18:59:44 +01:00
|
|
|
);
|
2008-06-18 14:27:35 +02:00
|
|
|
|
|
|
|
if ($GLOBALS['LSsession'] -> canEdit($LSobject,$thisObject->getValue('dn'))) {
|
|
|
|
$actions[]=array(
|
|
|
|
'label' => _('Modifier'),
|
|
|
|
'url' => 'modify.php?LSobject='.$LSobject.'&dn='.$thisObject->getValue('dn'),
|
|
|
|
'action' => 'modify'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($canCopy) {
|
|
|
|
$actions[] = array(
|
|
|
|
'label' => _('Copier'),
|
|
|
|
'url' =>'create.php?LSobject='.$LSobject.'&load='.$thisObject -> getValue('dn'),
|
|
|
|
'action' => 'copy'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($GLOBALS['LSsession'] -> canRemove($thisObject -> getType(),$thisObject -> getValue('dn'))) {
|
|
|
|
$actions[] = array (
|
|
|
|
'label' => _('Supprimer'),
|
|
|
|
'url' => 'remove.php?LSobject='.$LSobject.'&dn='.$thisObject -> getValue('dn'),
|
|
|
|
'action' => 'delete'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$objectList[]=array(
|
|
|
|
'dn' => $thisObject->getValue('dn'),
|
|
|
|
'displayValue' => $thisObject->getDisplayValue(),
|
|
|
|
'actions' => $actions,
|
|
|
|
'subDn' => $subDn_name
|
2008-02-12 18:59:44 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
else {
|
2008-06-18 14:27:35 +02:00
|
|
|
debug($thisObject->getValue('dn'));
|
2008-02-12 18:59:44 +01:00
|
|
|
}
|
2008-06-18 14:27:35 +02:00
|
|
|
}
|
|
|
|
$searchData['objectList']=$objectList;
|
|
|
|
$searchData['LSview_actions'] = $LSview_actions;
|
|
|
|
if ($GLOBALS['LSsession'] -> cacheSearch()) {
|
|
|
|
$_SESSION['LSsession']['LSsearch'][$hash]=$searchData;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$GLOBALS['Smarty']->assign('LSobject_list_nbresult',$searchData['LSobject_list_nbresult']);
|
|
|
|
|
2008-06-20 17:52:15 +02:00
|
|
|
// Order by if $sort
|
|
|
|
if ($sort) {
|
|
|
|
function sortBy($a,$b) {
|
|
|
|
global $ordersense;
|
|
|
|
global $orderby;
|
|
|
|
|
|
|
|
if ($ordersense=='ASC') {
|
|
|
|
$sense = -1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$sense = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($a == $b) return 0;
|
|
|
|
$sort = array($a[$orderby],$b[$orderby]);
|
|
|
|
sort($sort);
|
|
|
|
if ($sort[0]==$a[$orderby])
|
|
|
|
return 1*$sense;
|
|
|
|
return -1*$sense;
|
|
|
|
}
|
|
|
|
if (!uasort($searchData['objectList'],'sortBy')) {
|
|
|
|
debug('Erreur durant le trie.');
|
|
|
|
}
|
|
|
|
$_SESSION['LSsession']['LSsearch'][$hash]=$searchData;
|
|
|
|
}
|
|
|
|
$GLOBALS['Smarty']->assign('LSobject_list_orderby',$orderby);
|
|
|
|
$GLOBALS['Smarty']->assign('LSobject_list_ordersense',$ordersense);
|
|
|
|
|
2008-06-18 14:27:35 +02:00
|
|
|
// Pagination
|
|
|
|
if ($searchData['LSobject_list_nbresult'] > NB_LSOBJECT_LIST) {
|
|
|
|
if (isset($_REQUEST['page'])) {
|
|
|
|
$searchData['objectList'] = array_slice($searchData['objectList'], ($_REQUEST['page']) * NB_LSOBJECT_LIST, NB_LSOBJECT_LIST);
|
|
|
|
$GLOBALS['Smarty']->assign('LSobject_list_currentpage',$_REQUEST['page']);
|
2008-02-26 18:40:05 +01:00
|
|
|
|
2008-02-12 18:59:44 +01:00
|
|
|
}
|
2008-02-26 18:40:05 +01:00
|
|
|
else {
|
2008-06-18 14:27:35 +02:00
|
|
|
$searchData['objectList'] = array_slice($searchData['objectList'], 0, NB_LSOBJECT_LIST);
|
|
|
|
$GLOBALS['Smarty']->assign('LSobject_list_currentpage',0);
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
2008-06-18 14:27:35 +02:00
|
|
|
$searchData['LSobject_list_nbpage']=ceil($searchData['LSobject_list_nbresult'] / NB_LSOBJECT_LIST);
|
|
|
|
$GLOBALS['Smarty']->assign('LSobject_list_nbpage',$searchData['LSobject_list_nbpage']);
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
2008-06-18 14:27:35 +02:00
|
|
|
|
2008-02-26 18:40:05 +01:00
|
|
|
$GLOBALS['LSsession'] -> addJSscript('LSview.js');
|
|
|
|
|
|
|
|
$GLOBALS['Smarty']->assign('LSview_search',array(
|
|
|
|
'action' => $_SERVER['PHP_SELF'],
|
|
|
|
'submit' => _('Rechercher'),
|
2008-06-18 14:27:35 +02:00
|
|
|
'LSobject' => $LSobject
|
2008-02-26 18:40:05 +01:00
|
|
|
));
|
|
|
|
|
2008-06-18 14:27:35 +02:00
|
|
|
$GLOBALS['Smarty']->assign('LSview_search_recur_label',_('Recherche récursive'));
|
|
|
|
$GLOBALS['Smarty']->assign('LSview_search_approx_label',_('Recherche approximative'));
|
|
|
|
|
|
|
|
$GLOBALS['Smarty']->assign('LSobject_list_without_result_label',_("Cette recherche n'a retourné aucun résultat."));
|
2008-02-26 18:40:05 +01:00
|
|
|
$GLOBALS['Smarty']->assign('_Actions',_('Actions'));
|
|
|
|
$GLOBALS['Smarty']->assign('_Modifier',_('Modifier'));
|
2008-06-18 14:27:35 +02:00
|
|
|
$GLOBALS['Smarty']->assign('LSobject_list',$searchData['objectList']);
|
|
|
|
$GLOBALS['Smarty']->assign('LSobject_list_objecttype',$LSobject);
|
|
|
|
$GLOBALS['Smarty'] -> assign('LSview_actions',$searchData['LSview_actions']);
|
2008-02-26 18:40:05 +01:00
|
|
|
$GLOBALS['LSsession'] -> setTemplate('viewList.tpl');
|
2008-02-12 18:59:44 +01:00
|
|
|
}
|
2008-02-26 18:40:05 +01:00
|
|
|
}
|
|
|
|
else {
|
2008-06-18 14:27:35 +02:00
|
|
|
$GLOBALS['LSerror'] -> addErrorCode(1004,$LSobject);
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
2008-02-12 18:59:44 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$GLOBALS['LSerror'] -> addErrorCode(1012);
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$GLOBALS['LSsession'] -> setTemplate('login.tpl');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Affichage des retours d'erreurs
|
|
|
|
$GLOBALS['LSsession'] -> displayTemplate();
|
|
|
|
?>
|