2 /*******************************************************************************
3 * Copyright (C) 2007 Easter-eggs
4 * http://ldapsaisie.labs.libre-entreprise.org
6 * Author: See AUTHORS file in top-level directory.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 ******************************************************************************/
23 require_once 'core.php';
25 if(LSsession :: startLSsession()) {
27 if (isset($_POST['LSform_objecttype'])) {
28 $LSobject = $_POST['LSform_objecttype'];
30 else if (isset($_GET['LSobject'])) {
31 $LSobject = $_GET['LSobject'];
34 if (isset($LSobject)) {
36 if (LSsession ::loadLSobject($LSobject)) {
37 if ( LSsession :: canCreate($LSobject) ) {
38 if ( LSsession :: loadLSclass('LSimport')) {
39 $object = new $LSobject();
40 LStemplate :: assign('LSobject',$LSobject);
42 $ioFormats=$object->listValidIOformats();
43 if (is_array($ioFormats) && !empty($ioFormats)) {
44 LStemplate :: assign('ioFormats',$ioFormats);
45 if (LSimport::isSubmit()) {
46 $result=LSimport::importFromPostData();
48 if(is_array($result)) {
49 LStemplate :: assign('result',$result);
54 LStemplate :: assign('ioFormats',array());
55 LSerror :: addErrorCode('LSsession_16');
59 LStemplate :: assign('pagetitle',_('Import').' : '.$object->getLabel());
60 LSsession :: addCssFile('LSform.css');
61 LSsession :: addCssFile('LSimport.css');
62 LSsession :: setTemplate('import.tpl');
65 LSerror :: addErrorCode('LSsession_05','LSimport');
69 LSerror :: addErrorCode('LSsession_11');
73 LSerror :: addErrorCode('LSldapObject_01');
77 LSerror :: addErrorCode('LSsession_12');
82 LSsession :: setTemplate('login.tpl');
84 LSsession :: displayTemplate();