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