1 <?php
4 class ldifexport extends plugin
5 {
6 /* Definitions */
7 var $plHeadline= "CSV 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 ldifexport ($config, $dn= NULL)
16 {
17 /* Include config object */
18 $this->config= $config;
20 $ui= get_userinfo();
21 $acl= get_permissions ($config->current['BASE'], $ui->subtreeACL);
22 $acl= get_module_permission($acl, "ldifexport", $config->current['BASE']);
23 $this->access= $acl;
24 }
26 function execute()
27 {
28 /* Call parent execute */
29 plugin::execute();
30 /* Set government mode */
31 $smarty= get_smarty();
33 $smarty->assign("type",FALSE);
35 /* Check permissions for export */
36 if ($this->access != '#all#'){
37 print_red(_("You've no permission to do LDAP exports."));
38 } else {
39 // fill in old vars in the Export form
40 if((isset($_POST['single']))&&(isset($_POST['sfrmgetsingle']))){
41 $smarty->assign("single",$_POST['single']);
42 $smarty->assign("type","single");
43 $dn = $_POST['single'];
44 }
45 if((isset($_POST['selfull']))&&(isset($_POST['sfrmgetfull']))){
46 $smarty->assign("depselectfull",$_POST['selfull']);
47 $smarty->assign("type","full");
48 $dn = $_POST['selfull'];
49 } else {
50 $smarty->assign("depselectfull", "");
51 }
52 if((isset($_POST['selivbb']))&&(isset($_POST['sfrmgetivbb']))){
53 $smarty->assign("depselectivbb",$_POST['selivbb']);
54 $smarty->assign("type","ivbb");
55 $dn = $_POST['selivbb'];
56 } else {
57 $smarty->assign("depselectivbb", "");
58 }
59 }
61 // Set values for optionlist in form
62 $smarty->assign("deplist", $this->config->idepartments);
64 // Get the LDAP link, to generate the Export
65 $ldap = $this->config->get_ldap_link();
67 if ($this->config->current['GOVERNMENTMODE'] == 'true'){
68 $smarty->assign ("govmode", "true");
69 } else {
70 $smarty->assign ("govmode", "false");
71 }
73 $smarty->assign("LDIFError",FALSE);
75 if(isset($dn))
76 {
77 if($ldap->dn_exists($dn) && $dn != ""){
78 ;
79 }
80 else {
81 $smarty->assign("LDIFError",TRUE);
82 print_red (_("Error while exporting the requested entries!"));
83 }
84 }
86 // Export a single LDAP entry
87 if(isset($_POST['sfrmgetsingle']))
88 {
89 $smarty->assign("para","?ivbb=2&dn=".base64_encode($_POST['single']));
90 }
91 elseif(isset($_POST['sfrmgetfull']))
92 {
93 $smarty->assign("para","?ivbb=3&dn=".base64_encode($_POST['selfull']));
94 }
95 elseif(isset($_POST['sfrmgetivbb']))
96 {
97 $smarty->assign("para","?ivbb=4&dn=".base64_encode($_POST['selivbb']));
98 }
101 /* Show main page */
102 return ($smarty->fetch (get_template_path('contentexport.tpl', TRUE)));
103 }
104 }
107 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
108 ?>