1 <?php
4 class xlsexport extends plugin
5 {
6 /* Definitions */
7 var $plHeadline= "XLS import";
8 var $plDescription= "This does something";
9 var $access= "";
11 /* attribute list for save action */
12 var $attributes= array();
13 var $objectclasses= array();
15 function xlsexport ($config, $dn= NULL)
16 {
17 /* Include config object */
18 $this->config= $config;
20 /* set permissions */
21 $ui= get_userinfo();
22 $acl= get_permissions ($ui->dn, $ui->subtreeACL);
23 $this->acl= get_module_permission($acl, "ldapmanager", $ui->dn);
24 }
26 function execute()
27 {
28 /* Call parent execute */
29 plugin::execute();
31 /* Set government mode */
32 $smarty= get_smarty();
34 $smarty->assign("type",FALSE);
35 $smarty->assign("depselectivbb","");
37 /* Check permissions for export */
38 if (chkacl($this->acl,"xlsexport")!=""){
39 print_red(_("You've no permission to do LDAP exports."));
40 } else {
41 // fill in old vars in the Export form
42 if((isset($_POST['single']))&&(isset($_POST['sfrmgetsingle']))){
43 $smarty->assign("single",$_POST['single']);
44 $smarty->assign("type","single");
45 $a=$_POST['single'];
46 $b=$_POST['selfull'];
47 // $dn=$a.$b;
49 }
50 if((isset($_POST['selfull']))&&(isset($_POST['sfrmgetfull']))){
51 $smarty->assign("depselectfull",$_POST['selfull']);
52 $smarty->assign("type","full");
53 $dn = $_POST['selfull'];
54 } else {
55 $smarty->assign("depselectfull", "");
56 }
57 if((isset($_POST['selivbb']))&&(isset($_POST['sfrmgetivbb']))){
58 $smarty->assign("depselectivbb",$_POST['selivbb']);
59 $smarty->assign("type","ivbb");
60 $dn = $_POST['selivbb'];
61 } else {
62 $smarty->assign("depselectivbb", "");
63 }
64 }
66 // Set values for optionlist in form
67 $smarty->assign("deplist", $this->config->idepartments);
68 $smarty->assign("choicelist",array(get_people_ou()=>"users" ,"ou=groups,"=>"groups" ,"ou=computers,ou=systems,"=>"computers","ou=servers,ou=systems,"=>"servers","dc=addressbook,"=>"addressbook"));
70 // Get the LDAP link, to generate the Export
71 $ldap = $this->config->get_ldap_link();
74 if ($this->config->current['GOVERNMENTMODE'] == 'true'){
75 $smarty->assign ("govmode", "true");
76 } else {
77 $smarty->assign ("govmode", "false");
78 }
80 $smarty->assign("LDIFError",FALSE);
82 if(isset($dn))
83 {
84 if($ldap->dn_exists($dn) && $dn != ""){
85 ;
86 }
87 else {
88 $smarty->assign("LDIFError",TRUE);
89 print_red (_("Error while exporting the requested entries!"));
90 }
91 }
92 // print_r($_POST);
93 // Export a single LDAP entry
94 if(isset($_POST['sfrmgetsingle']))
95 {
96 $smarty->assign("para","?ivbb=2&d=".base64_encode($_POST['single'])."&n=".base64_encode($_POST['selfull']));
97 }
98 elseif(isset($_POST['sfrmgetfull']))
99 {
100 $smarty->assign("para","?ivbb=3&dn=".base64_encode($_POST['selfull']));
101 }
102 elseif(isset($_POST['sfrmgetivbb']))
103 {
104 $smarty->assign("para","?ivbb=4&dn=".base64_encode($_POST['selivbb']));
105 }
108 /* Show main page */
109 return ($smarty->fetch (get_template_path('contentexportxls.tpl', TRUE)));
110 }
111 }
114 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
115 ?>