654f4de1854b08188d2ff1cd74ff2c50d3e8b061
1 <?php
2 class appgroup extends plugin
3 {
4 /* CLI vars */
5 var $cli_summary= "Manage application groups";
6 var $cli_description= "Some longer text\nfor help";
7 var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
9 /* Appgroup attributes */
10 var $gosaMemberApplication= array();
12 /* Helpers */
13 var $departments = ""; // All departments within $this->curbase;
14 var $apps = array(); // All available applications
15 var $used_apps = array(); // Specifies which applications are currently assigned
17 var $option_name = array();
18 var $option_value = array();
19 var $appoption = array();
21 var $table = "";
22 var $curbase = "";
23 var $curCatDir ;
24 var $curCatDepth =0; //
26 /* attribute list for save action */
27 var $attributes= array();
28 var $objectclasses= array("gosaApplicationGroup");
30 function appgroup ($config, $dn= NULL)
31 {
32 plugin::plugin ($config, $dn);
34 /* Load member applications */
35 if (isset ($this->attrs["gosaMemberApplication"][0])){
36 for ($i= 0; $i<$this->attrs["gosaMemberApplication"]["count"]; $i++){
37 $this->gosaMemberApplication[]=
38 $this->attrs["gosaMemberApplication"][$i];
39 }
40 }
42 /* Load application options */
43 if (isset($this->attrs['gosaApplicationParameter'])){
44 for ($i= 0; $i<$this->attrs['gosaApplicationParameter']['count']; $i++){
45 $option= preg_replace('/^[^:]+:/', '',
46 $this->attrs['gosaApplicationParameter'][$i]);
47 $name= preg_replace('/:.*$/', '',
48 $this->attrs['gosaApplicationParameter'][$i]);
49 $this->appoption[$name]= $option;
50 }
51 }
53 /* Parse MemberApplication*/
54 $tmp = array();
55 $tmp2 = array();
56 $prios = array();
57 $cats = array();
59 foreach($this->gosaMemberApplication as $memberApp){
60 if(preg_match("/\|/i",$memberApp)){
62 $tmp = split("\|",$memberApp);
64 if(!empty($tmp[0])){
65 $tmp2[$tmp[1]][$tmp[2]] = array("App"=>$tmp[0]);
66 }
67 if(!empty($tmp[1])){
68 $n = split("/",$tmp[1]);
69 $c = count($n);
70 $cats [$tmp[1]] = $n[$c-1];
71 }
72 $prios[$tmp[1]][$tmp[2]] = $tmp[2];
73 }else{
74 $tmp2[]['App'] = $memberApp;
75 }
76 }
78 $this->Categories = $cats;
80 $this->gosaMemberApplication = $tmp2;
81 $cats[""]="";
82 foreach($cats as $cat ){
83 if((isset($prios[$cat]))&&(count($prios[$cat]))){
84 $max = max($prios[$cat]);
85 $min = 1;//min($prios[$cat]);
86 $last = false;
87 for($i = $min ; $i < $max ; $i++){
88 if(!isset($prios[$cat][$i])){
89 if($last == false){
90 $this->gosaMemberApplication[$cat][$i]['App'] = "__SEPARATOR__".$i;
92 $last = true;
93 }
94 }else{
95 $last = false;
96 }
97 }
98 }
99 }
101 $tmp = array();
102 foreach($this->gosaMemberApplication as $key => $entries){
103 ksort ($entries);
104 foreach($entries as $entry){
105 $tmp[$key][]= $entry;
106 }
107 }
108 $this->gosaMemberApplication = $tmp;
109 $this->curbase = $this->config->current['BASE'];
110 }
112 function catDown($id){
113 /* Get all cats depinding on current dir */
114 $cats = $this->GetSubdirs($this->curCatDir);
115 $ret = array();
116 if((in_array($id,array_flip($cats)))&&(count($cats)>1)){
117 if(count($cats) == 2){
118 $ret = array_reverse($cats);
119 }else{
120 $cnt = 0;
121 $hit = 0;
122 foreach($cats as $cat=>$name){
123 if($cat == $id){
124 $hit = $cnt;
125 }
126 $cnt ++;
127 }
128 if($hit == 0){
129 $first = array_slice($cats,0,0);
130 $middle = array_slice($cats,0,2);
131 $last = array_slice($cats,$hit+2,$cnt);
132 }else{
133 $first = array_slice($cats,0,$hit);
134 $middle = array_slice($cats,$hit,2);
135 $last = array_slice($cats,$hit+2,$cnt);
136 }
137 foreach($first as $cat => $name){
138 $ret[$cat]=$name;
139 }
140 foreach(array_reverse($middle) as $cat => $name){
141 $ret[$cat]=$name;
142 }
143 foreach($last as $cat => $name){
144 $ret[$cat]=$name;
145 }
146 }
147 foreach($cats as $cat => $name){
148 unset($this->Categories[$cat]);
149 }
150 foreach($ret as $cat => $name){
151 $this->Categories[$cat]=$name;
152 }
153 }
154 }
156 function catUp($id)
157 {
158 /* Get all cats depinding on current dir */
159 $cats = $this->GetSubdirs($this->curCatDir);
161 $ret = array();
163 if((in_array($id,array_flip($cats)))&&(count($cats)>1)){
164 if(count($cats) == 2){
165 $ret = array_reverse($cats);
166 }else{
167 $cnt = 0;
168 $hit = 0;
169 foreach($cats as $cat => $name){
170 $cnt ++;
171 if($cat == $id){
172 $hit = $cnt;
173 }
174 }
176 if($hit>1){
177 if($hit == 2){
178 $first = array_slice($cats,0,$hit-2);
179 $middle = array_slice($cats,$hit-2,$hit);
180 $last = array_slice($cats,$hit,$cnt);
181 }else{
182 $first = array_slice($cats,0,$hit-2);
183 $middle = array_slice($cats,$hit-2,2);
184 $last = array_slice($cats,$hit,$cnt);
185 }
186 foreach($first as $cat => $name){
187 $ret[$cat]=$name;
188 }
189 foreach(array_reverse($middle) as $cat => $name){
190 $ret[$cat]=$name;
191 }
192 foreach($last as $cat => $name){
193 $ret[$cat]=$name;
194 }
195 }
196 }
198 foreach($cats as $cat => $name){
199 unset($this->Categories[$cat]);
200 }
201 foreach($ret as $cat => $name){
202 $this->Categories[$cat]=$name;
203 }
204 }
207 }
209 function getOneUp($appl)
210 {
211 $cat = $this->curCatDir;
212 if(!isset($this->gosaMemberApplication[$cat][($appl-1)])) return;
213 $f = 1;
214 if($appl == 1 ){
215 $f = 0;
216 }
217 $first = array_slice($this->gosaMemberApplication[$cat],0,($appl-1));
218 $middle = array_slice($this->gosaMemberApplication[$cat],$appl-1,(($appl+1)-$f));
219 $last = array_slice($this->gosaMemberApplication[$cat],($appl+1));
220 $tmp = array();
221 foreach($first as $entry){
222 $tmp[] = $entry;
223 }
224 foreach(array_reverse($middle) as $entry){
225 $tmp[] = $entry;
226 }
227 foreach($last as $entry){
228 $tmp[] = $entry;
229 }
230 $this->gosaMemberApplication[$cat] =$tmp;
231 }
233 function getOneDown($appl){
234 $cat = $this->curCatDir;
235 if(!isset($this->gosaMemberApplication[$cat][($appl+1)])) return;
236 $f = 0;
237 if($appl == 0 ){
238 $f = 1;
239 }
240 $first = array_slice($this->gosaMemberApplication[$cat],0,($appl));
241 $middle = array_slice($this->gosaMemberApplication[$cat],$appl,(($appl+1+$f)));
242 $last = array_slice($this->gosaMemberApplication[$cat],($appl+2));
244 $tmp = array();
245 foreach($first as $entry){
246 $tmp[] = $entry;
247 }
248 foreach(array_reverse($middle) as $entry){
249 $tmp[] = $entry;
250 }
251 foreach($last as $entry){
252 $tmp[] = $entry;
253 }
254 $this->gosaMemberApplication[$cat] =$tmp;
255 }
257 function AddSeperator($id)
258 {
259 $found = false;
260 $cat = "";
261 $tmp = array();
262 foreach($this->gosaMemberApplication[$this->curCatDir] as $appID => $app){
263 $tmp[] = $app;
264 if(($app['App'] == $id)&&(!$found)){
265 $cnt = count($this->gosaMemberApplication[$this->curCatDir]);
266 $tmp[] = array("App" => "__SEPARATOR__".($cnt+1));
267 $found = true;
268 }
269 }
270 if($found){
271 $this->gosaMemberApplication[$this->curCatDir]=$tmp;
272 }
273 }
275 function execute()
276 {
277 /* Call parent execute */
278 plugin::execute();
280 if((isset($_GET['act']))&&($_GET['act']=="depopen")){
281 $dep = base64_decode($_GET['depid']);
282 if(isset($this->config->idepartments[$dep])){
283 $this->curbase = $dep;
284 }
285 }
287 if((isset($_GET['act']))&&($_GET['act']=="open")){
288 $this->curCatDir = $_GET['id'];
289 }
291 /* Do we need to flip is_account state? */
292 if (isset($_POST['modify_state'])){
293 $this->is_account= !$this->is_account;
294 }
296 /* Do we represent a valid group? */
297 if (!$this->is_account && $this->parent == NULL){
298 $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\"> <b>".
299 _("This 'dn' is no appgroup.")."</b>";
300 return ($display);
301 }
303 /* Show tab dialog headers */
304 $display= "";
305 if ($this->parent != NULL){
306 if ($this->is_account){
307 $display= $this->show_header(_("Remove applications"),
308 _("This group has application features enabled. You can disable them by clicking below."));
309 } else {
310 $display.= $this->show_header(_("Create applications"),
311 _("This group has application features disabled. You can enable them by clicking below."));
312 return ($display);
313 }
314 }
317 /* Add Categorie */
320 if((isset($_POST['AddCat']))&&(isset($_POST['CatName']))&&(!empty($_POST['CatName']))){
322 if(preg_match("/[^0-9a-z,\.-;:_#\+\- ]/i",$_POST['CatName'])){
323 print_red(_("Invalid character in category name."));
324 }elseif(!in_array($_POST['CatName'],$this->Categories)){
325 if(empty($this->curCatDir)){
326 $this->Categories[$_POST['CatName']]=$_POST['CatName'];
327 }else{
328 $this->Categories[$this->curCatDir."/".$_POST['CatName']]=$_POST['CatName'];
329 }
330 }else{
331 print_red(_("The specified category already exists."));
332 }
333 }
336 $this->reload();
337 foreach($_POST as $name => $value){
338 if(preg_match("/AddSep_/",$name)){
339 $this->AddSeperator($value);
340 }
343 if(preg_match("/DelApp_/",$name)){
344 $app = $value;
346 foreach($this->gosaMemberApplication as $key => $cat){
347 foreach($cat as $key2 => $app){
348 if($app['App'] == $value){
349 unset($this->gosaMemberApplication[$key][$key2]);
350 if(isset($this->used_apps[$value])){
351 unset($this->used_apps[$value]);
352 }
353 }
354 }
355 }
356 }
357 if(preg_match("/DelCat_/",$name)){
358 $app = $value;
359 foreach($this->Categories as $key => $cat){
360 if($cat == $value){
361 unset($this->Categories[$key]);
362 }
363 }
364 }
365 if(preg_match("/EdiApp_/",$name)){
366 $appname = $value;
367 /* We've got the appname, get parameters from ldap */
368 $ldap= $this->config->get_ldap_link();
369 $ldap->cd($this->config->current['BASE']);
370 $ldap->search("(&(objectClass=gosaApplication)(cn=$appname))");
371 if ($ldap->count() != 1){
372 print_red (_("The selected application name is not uniq. Please check your LDAP."));
373 } else {
374 $attrs= $ldap->fetch();
375 if(isset($attrs['gosaApplicationParameter'])){
376 $this->dialog= TRUE;
378 /* Fill name and value arrays */
379 for ($i= 0; $i<$attrs['gosaApplicationParameter']['count']; $i++){
380 $option= preg_replace('/^[^:]+:/', '',
381 $attrs['gosaApplicationParameter'][$i]);
382 $name= preg_replace('/:.*$/', '',
383 $attrs['gosaApplicationParameter'][$i]);
384 $this->option_name[$i]= $name;
386 /* Fill with values from application, default should be
387 loaded by the external scripts */
388 if (isset($this->appoption[$name])){
389 $this->option_value[$i]= $this->appoption[$name];
390 }
391 }
393 /* Create edit field */
394 $table= "<table summary=\"\">";
395 for ($i= 0; $i < count($this->option_name); $i++){
396 if (isset($this->option_value[$i])){
397 $value= $this->option_value[$i];
398 } else {
399 $value= "";
400 }
401 $table.="<tr><td>".$this->option_name[$i]."</td><td>".
402 "<input name=\"value$i\" size=60 maxlength=250 ".
403 "value=\"".$value."\"><br></td></tr>";
404 }
405 $table.= "</table>";
406 $this->table= $table;
407 } else {
408 print_red (_("The selected application has no options."));
409 }
410 }
411 }
412 }
413 $this->reload();
415 /* Add group with post */
416 if((isset($_GET['act']))&&($_GET['act']=="add")){
417 $this->used_apps[$_GET['id']]= $_GET['id'];
418 asort($this->used_apps);
419 $this->addApp($_GET['id']);
420 }
422 /* Add multiple */
423 if(isset($_POST['AddApps'])){
424 foreach($_POST as $name => $value){
425 if(preg_match("/AddApp_/",$name)){
426 $app = preg_replace("/AddApp_/","",$name);
427 $this->addApp($app);
428 }
429 }
430 }
433 /* Cancel edit options? */
434 if (isset($_POST['edit_options_cancel'])){
435 $this->dialog= FALSE;
436 }
438 /* Finish edit options? */
439 if (isset($_POST['edit_options_finish'])){
440 $this->dialog= FALSE;
442 /* Save informations passed by the user */
443 $this->option_value= array();
444 for ($i= 0; $i<count($this->option_name); $i++){
445 $this->appoption[$this->option_name[$i]]= $_POST["value$i"];
446 $this->is_modified= TRUE;
447 }
448 }
450 /* Prepare templating stuff */
451 $smarty= get_smarty();
452 $smarty->assign("used_apps", $this->used_apps);
453 $apps= array();
454 foreach ($this->apps as $key => $value){
455 if (!array_key_exists($key, $this->used_apps)){
456 $apps["$key"]= "$value";
457 }
458 }
460 $div = new DivSelectBox("appgroup");
462 $div->SetHeight(300);
464 /* NEW LIST MANAGMENT
465 * We also need to search for the departments
466 * So we are able to navigate like in konquerer
467 */
469 $ldap = $this->config->get_ldap_link();
470 $ldap->cd($this->curbase) ;
471 $ldap->ls("(objectClass=gosaDepartment)");
472 $departments= array();
473 $tmp = array();
474 while ($value = $ldap->fetch()){
475 $tmp[strtolower($value['dn']).$value['dn']]=$value;
476 }
477 ksort($tmp);
478 foreach($tmp as $value){
479 if($value["description"][0]!=".."){
480 $departments[$value['dn']]=convert_department_dn($value['dn'])." - [".$value["description"][0]."]";
481 }else{
482 $departments[$value['dn']]=convert_department_dn($value['dn']);
483 }
484 }
486 /* END NEW LIST MANAGMENT
487 */
489 $linkopen = "<a href='?plug=".$_GET['plug']."&act=depopen&depid=%s'>%s</a>";
490 $linkadd = "<a href='?plug=".$_GET['plug']."&act=add&id=%s'>%s</a>";
492 $base_back = preg_replace("/^[^,]+,/","",$this->curbase);
493 if((strlen($base_back)>= strlen($this->config->current['BASE']))&&($this->curbase!=$this->config->current['BASE'])){
494 $div->AddEntry(array(
495 array("string"=>sprintf($linkopen,base64_encode($base_back),".. ["._("back")."]"),
496 "attach"=>"style='border:0px;'")
497 ));
498 }
499 foreach($departments as $key => $app){
500 $div->AddEntry(array(
501 array("string"=>"<img src='images/folder.png' alt='"._("department")."'> ".sprintf($linkopen,base64_encode($key),$app),
502 "attach"=>"style='border:0px;'")
503 ));
504 }
506 foreach($apps as $key => $app){
507 $div->AddEntry(array(
508 array("string"=>sprintf("<input type='checkbox' value='1' name='AddApp_%s'>",$key).
509 "<img src='images/select_application.png' alt='"._("application")."'> ".sprintf($linkadd,$key,$app),
510 "attach"=>"style='border:0px;'")
511 ));
512 }
514 if((isset($_GET['act']))&&(($_GET['act'] == "cat_up")||($_GET['act']=="cat_down"))){
515 if($_GET['act']=="cat_up"){
516 $this->catUp($_GET['id']);
517 }
518 if($_GET['act']=="cat_down"){
519 $this->catDown($_GET['id']);
520 }
521 }
523 if((isset($_GET['act']))&&(($_GET['act'] == "one_up")||($_GET['act']=="one_down"))){
524 if(isset($_GET['id'])){
525 $id = $_GET['id'];
526 $act = $_GET['act'];
527 $found = -1;
528 if(isset($this->gosaMemberApplication[$this->curCatDir])){
529 foreach($this->gosaMemberApplication[$this->curCatDir] as $key => $member){
530 if($id == $member['App']){
531 $found = $key;
532 }
533 }
534 }
536 if($found != -1){
537 if($act == "one_up"){
538 $this->getOneUp($found);
539 }elseif($act == "one_down") {
540 $this->getOneDown($found);
541 }
542 }
543 }
544 }
546 $div2 = new DivSelectBox("appgroup");
547 $div2->SetHeight(300);
549 $linkopen = "<img src='images/folder.png'> <a href='?plug=".$_GET['plug']."&act=open&id=%s'>%s</a>";
550 $catremove = " <input type='image' src='images/edittrash.png' name='DelCat_%s' value='%s'>";
551 $app = "<img src='images/select_application.png'> %s";
553 $catupdown = "<a href='?plug=".$_GET['plug']."&act=cat_up&id=%s'>
554 <img src='images/sort_up.png' border=0></a> <a href='?plug=".$_GET['plug']."&act=cat_down&id=%s'>
555 <img src='images/sort_down.png' border=0></a>";
557 if(empty($this->curCatDir)){
558 $cnt =0;
559 }else{
560 $cnt = count(split("/",$this->curCatDir));
561 $tmp = split("/",$this->curCatDir);
562 $bbk = "";
563 for($i = 0 ; $i < ($cnt -1 ) ; $i++){
564 $bbk .= $tmp[$i];
565 }
566 $div2 ->AddEntry(array(array("string"=>sprintf($linkopen,$bbk,"..")),array("string"=>" ","attach"=>"style='border-right:0px;'")));
567 }
569 $this->GetSubdirs($this->curCatDir);
571 foreach($this->GetSubdirs($this->curCatDir) as $path => $name){
572 $div2 ->AddEntry(array(
573 array("string"=>sprintf($linkopen,$path,$name)),
574 array("string"=>preg_replace("/%s/",$path,$catupdown.$catremove).
575 "<img src='images/empty.png' width='19px'>",
576 "attach"=>"align='right' style='width:80px;border-right:0px;'")));
577 }
579 /* Append entries */
581 $separator ="<hr height=1 size=1></hr>";
583 $sep = "<input type='image' src='images/back.png' value='%s' name='AddSep_%s'>";
585 $upudown ="<a href='?plug=".$_GET['plug']."&act=one_up&id=%s'> <img src='images/sort_up.png' border=0></a>".
586 " <a href='?plug=".$_GET['plug']."&act=one_down&id=%s'> <img src='images/sort_down.png' border=0></a>".
587 " <input type='image' src='images/edittrash.png' name='DelApp_%s' value='%s'>";
588 $edit= " <input type='image' src='images/edit.png' name='EdiApp_%s' value='%s'>";
590 if(isset($this->gosaMemberApplication[$this->curCatDir])){
591 foreach($this->gosaMemberApplication[$this->curCatDir] as $cat => $entry){
592 if(preg_match("/__SEPARATOR__/",$entry['App'])){
593 $div2 ->AddEntry(array(array("string"=>$separator),
594 array("string"=>preg_replace("/\%s/",$entry['App'],$upudown."<img src='images/empty.png' width='19px'>"),"attach"=>"align='right' style='border-right:0px;'")));
595 }else{
596 $div2 ->AddEntry(array(array("string"=>sprintf($app,$entry['App'])),
597 array("string"=>preg_replace("/\%s/",$entry['App'],$sep.$upudown.$edit),"attach"=>"align='right' style='border-right:0px;'")));
598 }
599 }
600 }
602 $smarty->assign("UsedApps", $div2->DrawList());
603 $smarty->assign("List", $div->DrawList());
604 $smarty->assign("apps", $apps);
606 /* Show main page */
607 if ($this->dialog){
608 $smarty->assign("table", $this->table);
609 $display.= $smarty->fetch (get_template_path('application_options.tpl', TRUE));
610 } else {
611 $display.= $smarty->fetch (get_template_path('application.tpl', TRUE));
612 }
613 return ($display);
614 }
617 function remove_from_parent()
618 {
619 plugin::remove_from_parent();
621 $this->attrs["gosaMemberApplication"]= array();
623 $ldap= $this->config->get_ldap_link();
624 $ldap->cd($this->dn);
625 $ldap->modify($this->attrs);
626 show_ldap_error($ldap->get_error());
628 /* Optionally execute a command after we're done */
629 $this->handle_post_events("remove");
630 }
633 /* Save to LDAP */
634 function save()
635 {
636 plugin::save();
638 /* Copy members */
639 $this->Categories[""]="";
640 $this->attrs["gosaMemberApplication"]= array();
641 $cats = array();
642 foreach($this->Categories as $name => $cats){
643 $cats[$name] =0;
644 if(isset($this->gosaMemberApplication[$name])){
645 foreach($this->gosaMemberApplication[$name] as $entry){
646 if(!preg_match("/__SEPARATOR__/",$entry['App'])){
647 $this->attrs["gosaMemberApplication"][]= $entry['App']."|".$name."|".$cats[$name];
648 }
649 $cats[$name] = $cats[$name] + 1;
650 }
651 }
652 if(($cats[$name]==0)&&(!empty($name))){
653 $this->attrs["gosaMemberApplication"][]= "|".$name."|".$cats[$name];
654 }
655 }
657 /* Are there application parameters to be saved */
658 $this->attrs['gosaApplicationParameter']= array();
659 foreach($this->appoption as $name => $value){
660 if ($value != ""){
661 $this->attrs['gosaApplicationParameter'][]= "$name:$value";
662 }
663 }
665 /* Write back to LDAP */
666 $ldap= $this->config->get_ldap_link();
667 $ldap->cd($this->dn);
668 $ldap->modify($this->attrs);
669 show_ldap_error($ldap->get_error());
671 /* Optionally execute a command after we're done */
672 if ($this->initially_was_account == $this->is_account){
673 if ($this->is_modified){
674 $this->handle_post_events("mofify");
675 }
676 } else {
677 $this->handle_post_events("add");
678 }
680 }
682 function check()
683 {
684 $message= array();
685 return ($message);
686 }
689 function reload()
690 {
691 /* Generate applist */
692 $this->apps= array();
693 $ldap= $this->config->get_ldap_link();
694 $ldap->cd ("ou=apps,".$this->curbase);
696 $ldap->ls ("(objectClass=gosaApplication)","ou=apps,".$this->curbase);
697 while ($attrs= $ldap->fetch()){
698 if (isset($attrs["description"][0])){
699 $this->apps[$attrs["cn"][0]]=
700 $attrs["cn"][0]." (".
701 $attrs["description"][0].")";
702 } else {
703 $this->apps[$attrs["cn"][0]]=
704 $attrs["cn"][0];
705 }
706 }
707 natcasesort ($this->apps);
708 reset ($this->apps);
710 if(is_array($this->gosaMemberApplication))
711 foreach ($this->gosaMemberApplication as $cat){
712 if(is_array($cat))
713 foreach($cat as $entry){
714 $this->used_apps[$entry['App']]= $entry['App'];
715 }
716 }
717 }
720 function addApp($cn)
721 {
722 if((isset($this->gosaMemberApplication[$this->curCatDir]))&&(is_array($this->gosaMemberApplication[$this->curCatDir]))){
723 foreach($this->gosaMemberApplication[$this->curCatDir] as $entry){
724 if($entry['App'] == $cn) return;
725 }
726 }
727 $this->gosaMemberApplication[$this->curCatDir][]= array("App"=>$cn);
728 $this->used_apps[$cn]=$cn;
729 $this->is_modified= TRUE;
730 }
733 function removeApp($cn)
734 {
735 $temp= array();
736 foreach ($this->gosaMemberApplication as $value){
737 if ($value != $cn){
738 $temp[]= $value;
739 }
740 }
741 $this->gosaMemberApplication= $temp;
742 $this->is_modified= TRUE;
743 }
745 function GetSubdirs($dir)
746 {
747 $ret = array();
748 $tmp1 = split("/",$this->curCatDir);
750 foreach($this->Categories as $path=>$cat){
751 $tmp2 = split("/",$path);
753 if((empty($this->curCatDir))&&(!preg_match("/\//",$path))){
754 $abort = false;
755 }elseif(((count($tmp1))+1) == (count($tmp2))){
756 $abort = false;
757 for($i = 0 ; $i < count($tmp1) ; $i++){
758 if($tmp1[$i] != $tmp2[$i]){
759 $abort = true;
760 }
761 }
762 }else{
763 $abort= true;
764 }
765 if(!$abort){
766 $ret[$path]=$cat;
767 }
768 }
769 return($ret);
770 }
772 }
774 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
775 ?>