00001 <?php
00002
00003 class aliroSelectors {
00004 private static $instance = __CLASS__;
00005
00006 public static function getInstance () {
00007 return is_object(self::$instance) ? self::$instance : (self::$instance = new self::$instance());
00008 }
00009
00013 public function menuParent ($thismenu) {
00014 $alirohtml = aliroHTML::getInstance();
00015 $mitems[] = $alirohtml->makeOption ('0', T_('Top'));
00016 $handler = aliroMenuHandler::getInstance();
00017 $menus = $handler->getByParentOrder($thismenu->menutype);
00018 foreach ($menus as $menu) {
00019 if ($menu->id == $thismenu->id) continue;
00020 $text = $menu->name;
00021 if ($menu->level) $text = '- '.$text;
00022 for ($i=0; $i<$menu->level; $i++) $text = ' '.$text;
00023 $mitems[] = $alirohtml->makeOption($menu->id, $text);
00024 }
00025 return $alirohtml->selectList($mitems, 'parent', 'class="inputbox" size="1"', 'value', 'text', $thismenu->parent);
00026 }
00027
00031 public function menuLinks ($lookup, $all=NULL, $none=NULL) {
00032 $alirohtml = aliroHTML::getInstance();
00033 if ( $all ) {
00034
00035 $mitems[] = $alirohtml->makeOption("0", T_('All'));
00036
00037 $mitems[] = $alirohtml->makeOption("-999", '----');
00038 }
00039 if ( $none ) {
00040
00041 $mitems[] = $alirohtml->makeOption("-999", T_('None'), (0 == count($lookup)));
00042
00043 $mitems[] = $alirohtml->makeOption( "-999", '----' );
00044 }
00045 $handler = aliroMenuHandler::getInstance();
00046 $types = $handler->getMenutypes();
00047 foreach ($types as $type) {
00048 $prefix = $type.' | ';
00049 $menus = $handler->getByParentOrder($type, 0);
00050 foreach ($menus as $menu) {
00051 $text = $menu->name;
00052 if ($menu->level) $text = '- '.$text;
00053 for ($i=0; $i<$menu->level; $i++) $text = ' '.$text;
00054 $mitems[] = $alirohtml->makeOption($menu->id, $prefix.$text);
00055 }
00056
00057 $mitems[] = $alirohtml->makeOption( "-999", '----' );
00058 }
00059 return $alirohtml->selectList( $mitems, 'selections[]', 'class="inputbox" size="26" multiple="multiple"', 'value', 'text', $lookup );
00060 }
00061
00062 }