File modules/util/Tree.class.php
Last commit: Sat Dec 7 23:03:22 2024 +0100 Jan Dankert UI: New Administration-Entry in Navigation-Menu.
1 <?php 2 3 namespace util; 4 5 use cms\action\RequestParams; 6 use cms\base\Language as L; 7 use cms\model\Alias; 8 use cms\model\BaseObject; 9 use cms\model\Element; 10 use cms\model\Folder; 11 use cms\model\Group; 12 use cms\model\Link; 13 use cms\model\Page; 14 use cms\model\PageContent; 15 use cms\model\Permission; 16 use cms\model\Project; 17 use cms\model\Tag; 18 use cms\model\Template; 19 use cms\model\User; 20 use cms\model\Value; 21 use language\Messages; 22 use util\exception\SecurityException; 23 24 25 /** 26 * Navigation tree. 27 * 28 * @author Jan Dankert 29 */ 30 class Tree 31 { 32 public $treeElements = array(); 33 34 private $userIsAdmin = false; 35 36 /** 37 * Konstruktor. 38 */ 39 public function __construct() 40 { 41 // Feststellen, ob der angemeldete Benutzer ein Administrator ist 42 $user = Request::getUser(); 43 $this->userIsAdmin = is_object($user) && $user->isAdmin; 44 } 45 46 public function root() 47 { 48 $this->overview(); 49 } 50 51 52 public function overview() 53 { 54 $treeElement = new TreeElement(); 55 $treeElement->id = 0; 56 $treeElement->text = L::lang('PROJECTS'); 57 $treeElement->description = L::lang('PROJECTS'); 58 $treeElement->action = 'projectlist'; 59 $treeElement->icon = 'projectlist'; 60 $treeElement->type = 'projects'; 61 62 $this->addTreeElement($treeElement); 63 64 if ($this->userIsAdmin) { 65 66 $treeElement = new TreeElement(); 67 $treeElement->text = L::lang('USER_AND_GROUPS'); 68 $treeElement->description = L::lang('USER_AND_GROUPS'); 69 $treeElement->icon = 'userlist'; 70 $treeElement->type = 'userandgroups'; 71 $treeElement->action = 'usergroup'; 72 73 $this->addTreeElement($treeElement); 74 } 75 76 77 if ($this->userIsAdmin) { 78 $treeElement = new TreeElement(); 79 $treeElement->text = L::lang('PREFERENCES'); 80 $treeElement->description = L::lang('PREFERENCES'); 81 $treeElement->icon = 'configuration'; 82 //$treeElement->type = 'configuration'; 83 $treeElement->action = 'configuration'; 84 85 $this->addTreeElement($treeElement); 86 } 87 88 } 89 90 91 92 public function userandgroups() 93 { 94 if (!$this->userIsAdmin) 95 throw new SecurityException(); 96 97 $treeElement = new TreeElement(); 98 $treeElement->text = L::lang('USER'); 99 $treeElement->description = L::lang('USER'); 100 $treeElement->action = 'userlist'; 101 $treeElement->icon = 'userlist'; 102 $treeElement->type = 'users'; 103 104 $this->addTreeElement($treeElement); 105 106 $treeElement = new TreeElement(); 107 $treeElement->text = L::lang('GROUPS'); 108 $treeElement->description = L::lang('GROUPS'); 109 $treeElement->action = 'grouplist'; 110 $treeElement->icon = 'grouplist'; 111 $treeElement->type = 'groups'; 112 113 $this->addTreeElement($treeElement); 114 } 115 116 117 public function projects() 118 { 119 $startElement = new TreeElement(); 120 121 $startElement->internalId = 0; 122 $startElement->id = 0; 123 $startElement->text = L::lang('START'); 124 $startElement->icon = 'index'; 125 $startElement->action = 'index'; 126 $startElement->type = ''; 127 $startElement->description = ''; 128 $this->addTreeElement($startElement); 129 130 131 // Schleife ueber alle Projekte 132 foreach (Project::getAllProjects() as $id => $name) { 133 134 $project = new Project($id); 135 $rootFolder = new Folder($project->getRootObjectId()); 136 $rootFolder->load(); 137 138 // Berechtigt für das Projekt? 139 if ($rootFolder->hasRight(Permission::ACL_READ)) { 140 $treeElement = new TreeElement(); 141 142 $treeElement->internalId = $id; 143 $treeElement->id = $id; 144 $treeElement->text = $name; 145 $treeElement->icon = 'project'; 146 $treeElement->action = 'project'; 147 $treeElement->type = 'project'; 148 $treeElement->description = ''; 149 150 $this->addTreeElement($treeElement); 151 } 152 } 153 } 154 155 156 public function project($projectid) 157 { 158 $project = new Project($projectid); 159 160 // Hoechster Ordner der Projektstruktur 161 $folder = new Folder($project->getRootObjectId()); 162 $folder->load(); 163 164 $defaultLanguageId = $project->getDefaultLanguageId(); 165 $defaultModelId = $project->getDefaultModelId(); 166 167 // Ermitteln, ob der Benutzer Projektadministrator ist 168 // Projektadministratoren haben das Recht, im Root-Ordner die Eigenschaften zu aendern. 169 $userIsProjectAdmin = $folder->hasRight(Permission::ACL_PROP); 170 171 if ($folder->hasRight(Permission::ACL_READ)) { 172 $treeElement = new TreeElement(); 173 $treeElement->id = $folder->objectid; 174 // $treeElement->text = $folder->name; 175 $treeElement->text = L::lang('FOLDER_ROOT'); 176 $treeElement->description = L::lang('FOLDER_ROOT_DESC'); 177 $treeElement->extraId[RequestParams::PARAM_LANGUAGE_ID] = $defaultLanguageId; 178 $treeElement->extraId[RequestParams::PARAM_MODEL_ID] = $defaultModelId; 179 $treeElement->icon = 'folder'; 180 $treeElement->action = 'folder'; 181 // $treeElement->url = Html::url( 'folder','',$folder->objectid,array(RequestParams::PARAM_TARGET=>'content') ); 182 $treeElement->type = 'folder'; 183 $treeElement->internalId = $folder->objectid; 184 $this->addTreeElement($treeElement); 185 } 186 187 188 189 // Tags 190 $treeElement = new TreeElement(); 191 $treeElement->description = ''; 192 $treeElement->id = $projectid; 193 $treeElement->extraId[RequestParams::PARAM_PROJECT_ID] = $projectid; 194 $treeElement->internalId = $projectid; 195 $treeElement->action = 'taglist'; 196 $treeElement->text = L::lang('TAGLIST'); 197 $treeElement->icon = 'taglist'; 198 $treeElement->description = L::lang('TAGLIST_DESC'); 199 $treeElement->type = 'taglist'; 200 $this->addTreeElement($treeElement); 201 202 203 204 205 // Templates 206 if ($userIsProjectAdmin) { 207 $treeElement = new TreeElement(); 208 $treeElement->id = $projectid; 209 $treeElement->extraId[RequestParams::PARAM_PROJECT_ID] = $projectid; 210 $treeElement->extraId[RequestParams::PARAM_MODEL_ID] = $defaultModelId; 211 $treeElement->extraId[RequestParams::PARAM_LANGUAGE_ID] = $defaultLanguageId; 212 $treeElement->internalId = $projectid; 213 $treeElement->text = L::lang('TEMPLATES'); 214 // $treeElement->url = Html::url('template','listing',0,array(RequestParams::PARAM_TARGETSUBACTION=>'listing',RequestParams::PARAM_TARGET=>'content')); 215 $treeElement->description = L::lang('TEMPLATES_DESC'); 216 $treeElement->icon = 'templatelist'; 217 $treeElement->action = 'templatelist'; 218 $treeElement->type = 'templates'; 219 $this->addTreeElement($treeElement); 220 } 221 222 223 // Sprachen 224 if ($userIsProjectAdmin) { 225 $treeElement = new TreeElement(); 226 $treeElement->description = ''; 227 $treeElement->id = $projectid; 228 $treeElement->extraId[RequestParams::PARAM_PROJECT_ID] = $projectid; 229 $treeElement->internalId = $projectid; 230 $treeElement->action = 'languagelist'; 231 $treeElement->text = L::lang('LANGUAGES'); 232 // $treeElement->url = Html::url('language','listing',0,array(RequestParams::PARAM_TARGETSUBACTION=>'listing',RequestParams::PARAM_TARGET=>'content')); 233 $treeElement->icon = 'languagelist'; 234 $treeElement->description = L::lang('LANGUAGES_DESC'); 235 236 // Nur fuer Projekt-Administratoren aufklappbar 237 if ($userIsProjectAdmin) 238 $treeElement->type = 'languages'; 239 240 $this->addTreeElement($treeElement); 241 } 242 243 244 245 if ($userIsProjectAdmin) { 246 247 // Projektmodelle 248 $treeElement = new TreeElement(); 249 $treeElement->description = ''; 250 251 // Nur fuer Projekt-Administratoren aufklappbar 252 if ($userIsProjectAdmin) 253 $treeElement->type = 'models'; 254 255 $treeElement->id = $projectid; 256 $treeElement->internalId = $projectid; 257 $treeElement->extraId[RequestParams::PARAM_PROJECT_ID] = $projectid; 258 $treeElement->description = L::lang('MODELS_DESC'); 259 $treeElement->text = L::lang('MODELS'); 260 // $treeElement->url = Html::url('model','listing',0,array(RequestParams::PARAM_TARGETSUBACTION=>'listing',RequestParams::PARAM_TARGET=>'content')); 261 $treeElement->action = 'modellist'; 262 $treeElement->icon = 'modellist'; 263 $this->addTreeElement($treeElement); 264 } 265 266 } 267 268 269 public function taglist( $projectid ) 270 { 271 $project = new Project( $projectid ); 272 273 foreach ( $project->getTags() as $id=>$name ) { 274 $treeElement = new TreeElement(); 275 $treeElement->id = $id; 276 $treeElement->internalId = $id; 277 $treeElement->text = $name; 278 $treeElement->action = 'tag'; 279 $treeElement->icon = 'tag'; 280 $treeElement->type = 'tag'; 281 282 $treeElement->description = ''; 283 284 $this->addTreeElement($treeElement); 285 } 286 } 287 288 289 /** 290 * Tag. 291 * 292 * @param $tagid 293 */ 294 public function tag($tagid ) 295 { 296 $tag = new Tag( $tagid ); 297 298 foreach ($tag->getObjects() as $o ) { 299 300 // Wenn keine Leseberechtigung 301 if (!$o->hasRight(Permission::ACL_READ)) 302 continue; 303 304 $defaultName = $o->getDefaultName(); 305 306 $treeElement = new TreeElement(); 307 $treeElement->id = $o->objectid; 308 $treeElement->internalId = $o->objectid; 309 $treeElement->text = $defaultName->name; 310 $treeElement->description = L::lang('' . $o->getType()) . ' ' . $o->objectid; 311 312 if ( $defaultName->description ) 313 $treeElement->description .= ': ' . $defaultName->description; 314 else 315 $treeElement->description .= ' - ' . L::lang('NO_DESCRIPTION_AVAILABLE'); 316 317 $treeElement->action = $o->getType(); 318 $treeElement->icon = $o->getType(); 319 320 if ( in_array($o->getType(),['folder','link','page','alias'])) // openable? 321 $treeElement->type = $o->getType(); 322 323 $this->addTreeElement($treeElement); 324 } 325 } 326 327 328 329 public function users() 330 { 331 if (!$this->userIsAdmin) 332 throw new SecurityException(); 333 334 335 foreach (User::getAllUsers() as $user) { 336 $treeElement = new TreeElement(); 337 $treeElement->id = $user->userid; 338 $treeElement->internalId = $user->userid; 339 $treeElement->text = $user->name; 340 $treeElement->action = 'user'; 341 //$treeElement->type = 'user'; 342 $treeElement->icon = 'user'; 343 344 $desc = $user->fullname; 345 346 if ($user->isAdmin) 347 $desc .= ' (' . L::lang('USER_ADMIN') . ') '; 348 if ($user->desc == "") 349 $desc .= ' - ' . L::lang('NO_DESCRIPTION_AVAILABLE'); 350 else 351 $desc .= ' - ' . $user->desc; 352 353 $treeElement->description = $desc; 354 355 $this->addTreeElement($treeElement); 356 } 357 } 358 359 360 public function groups() 361 { 362 if (!$this->userIsAdmin) 363 throw new SecurityException(); 364 365 366 foreach (Group::getRootGroups() as $id => $name) { 367 $treeElement = new TreeElement(); 368 369 $g = new Group($id); 370 $g->load(); 371 372 $treeElement->id = $id; 373 $treeElement->internalId = $id; 374 $treeElement->text = $g->name; 375 $treeElement->icon = 'group'; 376 $treeElement->description = L::lang('GROUP') . ' ' . $g->name . ': ' . implode(', ', $g->getUsers()); 377 $treeElement->type = 'userofgroup'; 378 $treeElement->action = 'group'; 379 380 $this->addTreeElement($treeElement); 381 } 382 } 383 384 385 public function userofgroup($id) 386 { 387 if (!$this->userIsAdmin) 388 throw new SecurityException(); 389 390 391 $g = new Group($id); 392 393 394 foreach ($g->getChildrenIds() as $id) { 395 $treeElement = new TreeElement(); 396 397 $subGroup = new Group($id); 398 $subGroup->load(); 399 $treeElement->id = $id; 400 $treeElement->internalId = $id; 401 $treeElement->text = $subGroup->name; 402 $treeElement->icon = 'group'; 403 $treeElement->description = L::lang('GROUP') . ' ' . $subGroup->name . ': ' . implode(', ', $subGroup->getUsers()); 404 $treeElement->type = 'userofgroup'; 405 $treeElement->action = 'group'; 406 407 $this->addTreeElement($treeElement); 408 } 409 410 411 412 foreach ($g->getUsers() as $id => $name) { 413 $treeElement = new TreeElement(); 414 415 $u = new User($id); 416 $u->load(); 417 $treeElement->id = $u->userid; 418 $treeElement->internalId = $u->userid; 419 $treeElement->text = $u->name; 420 $treeElement->icon = 'user'; 421 $treeElement->action = 'user'; 422 $treeElement->description = $u->fullname; 423 424 $this->addTreeElement($treeElement); 425 } 426 427 428 } 429 430 431 public function page($id) 432 { 433 $page = new Page($id); 434 435 $page->load(); 436 437 $template = new Template($page->templateid); 438 439 foreach ($template->getElementIds() as $elementid) { 440 $element = new Element($elementid); 441 $element->load(); 442 443 if ($element->isWritable()) { 444 $treeElement = new TreeElement(); 445 $treeElement->id = $id . '_' . $elementid; 446 $treeElement->internalId = $id . '_' . $elementid; 447 $treeElement->text = $element->label; 448 $treeElement->action = 'pageelement'; 449 450 if ( in_array($element->typeid,[Element::ELEMENT_TYPE_LINK,Element::ELEMENT_TYPE_INSERT])) 451 $treeElement->type = 'pageelement'; 452 453 $treeElement->icon = 'el_' . $element->getTypeName(); 454 $treeElement->extraId = array('elementid' => $elementid); 455 456 457 $treeElement->description = L::lang('EL_' . $element->getTypeName()); 458 if ($element->desc != '') 459 $treeElement->description .= ' - ' . Text::maxLength($element->desc, 25); 460 else 461 $treeElement->description .= ' - ' . L::lang('NO_DESCRIPTION_AVAILABLE'); 462 463 $this->addTreeElement($treeElement); 464 } 465 } 466 } 467 468 469 /** 470 * Gets the linked object (if there is one). 471 * 472 * @param $id 473 * @return void 474 * @throws exception\ObjectNotFoundException 475 */ 476 public function pageelement($id) 477 { 478 $ids = explode('_', $id); 479 if (count($ids) > 1) { 480 list($pageid, $elementid) = $ids; 481 482 $page = new Page($pageid); 483 484 $page->load(); 485 486 $element = new Element($elementid); 487 $element->load(); 488 489 $pageContent = new PageContent(); 490 $pageContent->pageId = $page->pageid; 491 $pageContent->elementId = $elementid; 492 $project = $page->getProject(); 493 $pageContent->languageid = $project->getDefaultLanguageId(); 494 $pageContent->load(); 495 496 $value = new Value(); 497 $value->contentid = $pageContent->contentId; 498 $value->load(); 499 500 if (BaseObject::available($value->linkToObjectId)) { 501 $o = new BaseObject($value->linkToObjectId); 502 $o->load(); 503 if ( $o->hasRight( Permission::ACL_READ ) ) { 504 505 $treeElement = new TreeElement(); 506 $treeElement->type = $o->getType(); 507 $treeElement->action = $o->getType(); 508 $treeElement->icon = $o->getType(); 509 $treeElement->id = $o->objectid; 510 $treeElement->internalId = $o->objectid; 511 $treeElement->extraId = array(); 512 $treeElement->text = $o->getName(); 513 $treeElement->description = L::lang('' . $o->getType()) . ' ' . $o->objectid; 514 515 $this->addTreeElement($treeElement); 516 } 517 } 518 } 519 } 520 521 522 public function value($id) 523 { 524 if ($id != 0) { 525 $value = new Value(); 526 $value->loadWithId($id); 527 528 $objectid = intval($value->linkToObjectId); 529 if ($objectid != 0) { 530 $object = new BaseObject($objectid); 531 $object->load(); 532 533 $treeElement = new TreeElement(); 534 $treeElement->id = $id; 535 $treeElement->internalId = $id; 536 $treeElement->text = $object->getDefaultName()->name; 537 if (in_array($object->getType(), array('page', 'folder'))) { 538 $treeElement->type = $object->getType(); 539 $treeElement->internalId = $object->objectid; 540 } 541 $treeElement->action = $object->getType(); 542 $treeElement->icon = $object->getType(); 543 $treeElement->extraId = array(RequestParams::PARAM_LANGUAGE_ID => $object->getProject()->getDefaultLanguageId()); 544 545 $defaultName = $object->getDefaultName(); 546 547 if ($defaultName->description ) 548 $treeElement->description .= ' - ' . $defaultName->description; 549 else 550 $treeElement->description .= ' - ' . L::lang('NO_DESCRIPTION_AVAILABLE'); 551 552 $this->addTreeElement($treeElement); 553 } 554 } 555 } 556 557 558 public function link($id) 559 { 560 $link = new Link($id); 561 $link->load(); 562 563 $o = new BaseObject($link->linkedObjectId); 564 $o->load(); 565 566 if ( $o->hasRight( Permission::ACL_READ ) ) { 567 // Object is readable 568 569 $treeElement = new TreeElement(); 570 $treeElement->id = $o->objectid; 571 $treeElement->internalId = $o->objectid; 572 $treeElement->text = $o->getName(); 573 $treeElement->description = L::lang('' . $o->getType()) . ' ' . $id; 574 575 $defaultName = $o->getDefaultName(); 576 577 if ($defaultName->description ) 578 $treeElement->description .= ': ' . $defaultName->description; 579 else 580 $treeElement->description .= ' - ' . L::lang('NO_DESCRIPTION_AVAILABLE'); 581 582 $treeElement->action = $o->getType(); 583 $treeElement->icon = $o->getType(); 584 $treeElement->extraId = array(RequestParams::PARAM_LANGUAGE_ID => $_REQUEST[RequestParams::PARAM_LANGUAGE_ID], RequestParams::PARAM_MODEL_ID => $_REQUEST[RequestParams::PARAM_MODEL_ID]); 585 586 // Besonderheiten fuer bestimmte Objekttypen 587 588 if ($o->isPage) { 589 // Nur wenn die Seite beschreibbar ist, werden die 590 // Elemente im Baum angezeigt 591 if ($o->hasRight(Permission::ACL_WRITE)) 592 $treeElement->type = 'pageelements'; 593 } 594 $this->addTreeElement($treeElement); 595 } 596 597 } 598 599 600 public function alias($id) 601 { 602 $alias = new Alias($id); 603 $alias->load(); 604 605 $o = new BaseObject($alias->linkedObjectId); 606 $o->load(); 607 608 $treeElement = new TreeElement(); 609 $treeElement->id = $o->objectid; 610 $treeElement->internalId = $o->objectid; 611 $treeElement->text = $o->getName(); 612 $treeElement->description = L::lang('' . $o->getType()) . ' ' . $id; 613 614 $treeElement->action = $o->getType(); 615 $treeElement->icon = $o->getType(); 616 617 // Besonderheiten fuer bestimmte Objekttypen 618 if ($o->isPage) { 619 // Nur wenn die Seite beschreibbar ist, werden die 620 // Elemente im Baum angezeigt 621 if ($o->hasRight(Permission::ACL_WRITE)) 622 $treeElement->type = 'page'; 623 } 624 625 $this->addTreeElement($treeElement); 626 } 627 628 629 public function url($id) 630 { 631 // URLs have no sub-nodes. 632 // do nothing. 633 } 634 635 636 /** 637 * Laedt Elemente zu einem Ordner 638 */ 639 public function folder($id) 640 { 641 $f = new Folder($id); 642 $f->load(); 643 644 /** @var BaseObject $o */ 645 foreach ($f->getObjects() as $o) { 646 // Wenn keine Leseberechtigung 647 if (!$o->hasRight(Permission::ACL_READ)) 648 continue; 649 650 $treeElement = new TreeElement(); 651 $treeElement->id = $o->objectid; 652 $treeElement->internalId = $o->objectid; 653 $treeElement->text = $o->getDefaultName()->name; 654 $treeElement->description = L::lang('' . $o->getType()) . ' ' . $o->objectid; 655 656 $defaultName = $o->getDefaultName(); 657 658 if ( $defaultName->description ) 659 $treeElement->description .= ': ' . $defaultName->description; 660 else 661 $treeElement->description .= ' - ' . L::lang('NO_DESCRIPTION_AVAILABLE'); 662 663 $treeElement->action = $o->getType(); 664 $treeElement->icon = $o->getType(); 665 666 if ( in_array($o->getType(),['folder','link','page','alias'])) // openable? 667 $treeElement->type = $o->getType(); 668 669 $this->addTreeElement($treeElement); 670 } 671 } 672 673 674 public function templates($projectid) 675 { 676 $project = new Project($projectid); 677 678 foreach ($project->getTemplates() as $id => $name) { 679 $treeElement = new TreeElement(); 680 681 $t = new Template($id); 682 $t->load(); 683 $treeElement->text = $t->name; 684 $treeElement->id = $id; 685 $treeElement->icon = 'template'; 686 $treeElement->action = 'template'; 687 $treeElement->internalId = $id; 688 $treeElement->extraId = array(); 689 $treeElement->type = 'template'; 690 $treeElement->description = $t->name . ' (' . L::lang(Messages::TEMPLATE) . ' ' . $id . ')'; 691 $this->addTreeElement($treeElement); 692 } 693 } 694 695 696 public function template($id) 697 { 698 699 $t = new Template($id); 700 $t->load(); 701 702 // Anzeigen der Template-Elemente 703 // 704 foreach ($t->getElementIds() as $elementid) { 705 $e = new Element($elementid); 706 $e->load(); 707 708 // "Code"-Element nur fuer Administratoren 709 if ($e->type == 'code' && !$this->userIsAdmin) 710 continue; 711 712 $treeElement = new TreeElement(); 713 $treeElement->id = $elementid; 714 $treeElement->internalId = $elementid; 715 $treeElement->extraId = array(); 716 $treeElement->text = $e->label; 717 $treeElement->icon = 'el_' . $e->type; 718 $treeElement->action = 'element'; 719 720 if ($e->desc == '') 721 $desc = L::lang('NO_DESCRIPTION_AVAILABLE'); 722 else 723 $desc = $e->desc; 724 $treeElement->description = $e->name . ' (' . L::lang('EL_' . $e->type) . '): ' . Text::maxLength($desc, 40); 725 $this->addTreeElement($treeElement); 726 } 727 } 728 729 730 /** 731 * Sprachen 732 */ 733 public function languages($projectid) 734 { 735 // Sprachvarianten 736 // 737 $project = new Project($projectid); 738 739 foreach ($project->getLanguages() as $languageid => $name) { 740 $treeElement = new TreeElement(); 741 $treeElement->id = $languageid; 742 $treeElement->internalId = $languageid; 743 $treeElement->text = $name; 744 $treeElement->icon = 'language'; 745 $treeElement->action = 'language'; 746 $treeElement->description = ''; 747 $this->addTreeElement($treeElement); 748 } 749 } 750 751 752 // Projektvarianten 753 // 754 public function models($projectid) 755 { 756 757 $project = new Project($projectid); 758 759 foreach ($project->getModels() as $id => $name) { 760 $treeElement = new TreeElement(); 761 $treeElement->id = $id; 762 $treeElement->internalId = $id; 763 $treeElement->text = $name; 764 $treeElement->action = 'model'; 765 $treeElement->icon = 'model'; 766 $treeElement->description = ''; 767 $this->addTreeElement($treeElement); 768 } 769 } 770 771 772 public function settings() { 773 774 if ($this->userIsAdmin) { 775 $treeElement = new TreeElement(); 776 $treeElement->text = L::lang('PREFERENCES'); 777 $treeElement->description = L::lang('PREFERENCES'); 778 $treeElement->icon = 'configuration'; 779 //$treeElement->type = 'configuration'; 780 $treeElement->action = 'configuration'; 781 782 $this->addTreeElement($treeElement); 783 } 784 } 785 786 /** 787 * Hinzufuegen eines Baum-Elementes 788 * @param TreeElement Hinzuzufuegendes Baumelement 789 */ 790 private function addTreeElement($treeElement) 791 { 792 $this->treeElements[] = $treeElement; 793 } 794 }
Downloadmodules/util/Tree.class.php
History Sat, 7 Dec 2024 23:03:22 +0100 Jan Dankert UI: New Administration-Entry in Navigation-Menu. Sat, 7 Dec 2024 00:32:55 +0100 Jan Dankert UI: Split the navigation into the 3 parts: Projects, users and settings. Thu, 16 Feb 2023 01:04:38 +0100 Jan Dankert New: Tags for base objects. Mon, 13 Jun 2022 22:13:03 +0200 Jan Dankert Fix: Show icon for pageelement values Mon, 25 Apr 2022 23:12:32 +0200 Jan Dankert Fix: Only show objects which are readable. Fri, 15 Apr 2022 14:51:22 +0200 dankert Refactoring: User,Config and Database info is now stored in the Request, because so there is no session required for clients which are using Basic Authorization. Sun, 5 Dec 2021 20:33:24 +0100 dankert Cleanup: Removed unusable properties from class 'Value' and 'BaseObject'. Sun, 5 Dec 2021 15:33:29 +0100 dankert Cleanup: Removed unusable properties from class 'Value'. Thu, 4 Mar 2021 01:15:06 +0100 Jan Dankert Fix: Calculate correct parent groups of group. Mon, 4 Jan 2021 23:14:09 +0100 Jan Dankert New: Groups may contain subgroups. Users within a group inherit the permissions of all parent groups. Mon, 4 Jan 2021 19:03:18 +0100 Jan Dankert Refactoring: ACL class is renamed to Permission, because most RBAC/DMAC concepts are calling it a permission. Sun, 15 Nov 2020 22:27:21 +0100 Jan Dankert Fix: Navigaton nodes which are not able to open should NOT have an icon to open the node. Sun, 15 Nov 2020 00:26:57 +0100 Jan Dankert New: Aliases are now openable in the navigation tree. Mon, 9 Nov 2020 22:28:28 +0100 Jan Dankert Change: Group icon for group list. Tue, 29 Sep 2020 22:17:11 +0200 Jan Dankert Refactoring: Do not use global constants. Sun, 27 Sep 2020 04:09:05 +0200 Jan Dankert Refactoring: The tree functions should use normal templates as the other actions. Beware of the JS hell. Sat, 26 Sep 2020 04:03:53 +0200 Jan Dankert Refactoring: read language keys with a class. Wed, 23 Sep 2020 01:04:05 +0200 Jan Dankert Cleanup of deprecated methods and deprecated class attributes. Mon, 21 Sep 2020 23:44:23 +0200 Jan Dankert Fixing editing of values. Fri, 18 Sep 2020 23:04:13 +0200 Jan Dankert Refactoring: Renaming module "cms/publish" to "cms/generator" Mon, 17 Aug 2020 22:52:37 +0200 Jan Dankert Cleanup: Killing the old odd 'GLOBAL_' message prefixes. Mon, 13 Apr 2020 22:33:04 +0200 Jan Dankert New: An action for navigating to the user and group administration. Sat, 22 Feb 2020 23:58:02 +0100 Jan Dankert Refactoring: Namespacing for module 'util'. Wed, 13 Nov 2019 00:15:07 +0100 Jan Dankert Fix: Use element labels in the tree. Thu, 29 Aug 2019 23:58:41 +0200 Jan Dankert Refactoring: Auth-Module in der Konfiguration als Liste. Sat, 24 Aug 2019 01:30:30 +0200 Jan Dankert Nach der Abmeldung alle View neu laden. Thu, 6 Jun 2019 21:42:30 +0200 Jan Dankert Fix: Anzeige/Öffnen von Aliases in der Navigation. Thu, 30 May 2019 00:10:13 +0200 Jan Dankert New: Aliases integriert, jedoch noch nicht sprachspezifisch (folgt noch). Tue, 28 May 2019 22:03:17 +0200 Jan Dankert Refactoring: Acl-Konstanten als Klassenkonstanten. Sat, 18 May 2019 21:37:53 +0200 Jan Dankert Refactoring: Text::maxLength statt Text::maxLaenge Tue, 30 Apr 2019 22:49:48 +0200 Jan Dankert Aktuelles Objekt im Navigationsbaum markieren. Mon, 14 Jan 2019 21:28:55 +0100 Jan Dankert Fixes für Nicht-Administratoren. Sat, 22 Dec 2018 23:20:44 +0100 Jan Dankert Fix: Keine Fehlermeldung, wenn URLs in der Navigation aufgeklappt werden. Sat, 8 Dec 2018 01:16:11 +0100 Jan Dankert Aufklappen von Seitenelementen funktioniert jetzt endlich wieder. Man, ey. Sat, 8 Dec 2018 00:50:08 +0100 Jan Dankert Fix: Baumobjekte korrigiert. Sun, 2 Dec 2018 02:12:44 +0100 Jan Dankert Fix: Den Publisher korrekt setzen. Sat, 3 Nov 2018 00:39:32 +0100 Jan Dankert Input-Felder können jetzt ein Label enthalten, das ganze Template-Markup wird dadurch deutlich einfacher. Formularfelder per Flexbox layouten, das geht viel einfacher. Tue, 25 Sep 2018 21:27:24 +0200 Jan Dankert Beim Aufklappen von Seiten im Navigationsbaum lassen sich die Inhalte nun auch öffnen. Mon, 24 Sep 2018 22:51:08 +0200 Jan Dankert Liste von Varianten und Sprachen im Navigationsbaum korrigiert. Hier wird die InternalId benötigt. Ggf. kann das mit der Id zusammengelegt werden. Sun, 23 Sep 2018 22:26:00 +0200 Jan Dankert Die IndexAction soll beim Start des UI auch die Action und Id ermitteln. Damit die Id gesetzt werden kann, muss die Id über den Dispatcher in die Action gebracht werden. Dazu muss erst der Request gesetzt werden, bevor die weitere Verarbeitung geschieht, daher geschieht die fachliche Initialisierung der Actions jetzt (wieder) über eine init()-Methode, die vom Dispatcher aufgerufen wird. Wed, 19 Sep 2018 23:56:56 +0200 Jan Dankert Der Navigationsbaum soll initial durch den 1. HTTP-Request schon bereit gestellt werden. Per Javascript erfolgt nur noch das Auf- und Zublättern. Sat, 21 Jul 2018 01:11:17 +0200 Jan Dankert Projekte nur anzeigen, wenn dafür berechtigt. Sat, 21 Jul 2018 01:03:47 +0200 Jan Dankert Huuups, da hatte ich etwas viel gelöscht. Die Einstellungen sind jetzt wieder da. Und nur für Administratoren sichtbar. Sat, 21 Jul 2018 00:58:31 +0200 Jan Dankert Es gibt nur noch 1 Baum, daher die Klasse umbenannt.