Пример #1
0
 public static function getDOMForViewModeSelector()
 {
     $rt_numeric_view_mode = Labels::VIEW_MODE_NUMERIC_DEF;
     $rt_compact_view_mode = Labels::VIEW_MODE_COMPACT_DEF;
     if (array_key_exists(UrlParameters::ITEMS_COUNT, $_GET) && in_array(Utils::getFromGET(UrlParameters::ITEMS_COUNT), Labels::$VIEW_MODE_NUMERIC)) {
         $rt_numeric_view_mode = Utils::getFromGET(UrlParameters::ITEMS_COUNT);
     }
     if (array_key_exists(UrlParameters::VIEW_MODE, $_GET) && array_key_exists(Utils::getFromGET(UrlParameters::VIEW_MODE), Labels::$VIEW_MODE_COMPACT)) {
         $rt_compact_view_mode = Utils::getFromGET(UrlParameters::VIEW_MODE);
     }
     $mainTag = new Div();
     $mainTag->addStyleClass("view_mode");
     $numeric = new Div();
     $numeric->addStyleClass("numeric");
     $selectNumeric = new Ul();
     for ($numIndex = 0; $numIndex < count(Labels::$VIEW_MODE_NUMERIC); $numIndex++) {
         $value = Labels::$VIEW_MODE_NUMERIC[$numIndex];
         $option = new Li();
         $item = new Div();
         $item->addChild($value);
         $item->addStyleClass("numeric_item");
         $option->addChild($item);
         if ($value == $rt_numeric_view_mode) {
             $option->addStyleClass("selected");
         }
         $selectNumeric->addChild($option);
     }
     $line = new Div();
     $line->addStyleClass("view");
     $selectCompact = new Ul();
     foreach (Labels::$VIEW_MODE_COMPACT as $key => $value) {
         $option = new Li();
         /*$option->addChild($value);*/
         //$option->addAttribute("value", $key);
         $option->addChild(self::getDOMForViewMode($key));
         if ($key == $rt_compact_view_mode) {
             $option->addStyleClass("selected");
         }
         $selectCompact->addChild($option);
     }
     return $mainTag->addChildList([$line->addChild($selectCompact), $numeric->addChild($selectNumeric)]);
 }
Пример #2
0
 public static function createList($arr)
 {
     if (is_array($arr) && count($arr) > 0) {
         $mainTag = new Ul();
         for ($arrIndex = 0; $arrIndex < count($arr); $arrIndex++) {
             $li = new Li();
             $li->addChild($arr[$arrIndex]);
             $mainTag->addChild($li);
         }
         return $mainTag;
     }
     return "";
 }