コード例 #1
0
ファイル: Item.php プロジェクト: gingerP/shop
 public static function getCompactItemView($name, $images, $itemId, $pageNumber, $num, $key, $valueToSearch, $type, $trimName, $isHighLightElement)
 {
     $blackOut = new Div();
     $blackOut->addStyleClasses(["blackout", "catalog_item_button_container"]);
     $blackOut->addAttributes(["itemscope" => "", "itemtype" => "http://data-vocabulary.org/Product"]);
     $mainDiv = new Div();
     $blackOut->addChild($mainDiv);
     TagUtils::createShadow($mainDiv);
     $mainDiv->addStyleClasses(["simple_item_compact", $isHighLightElement ? Constants::HIGH_LIGHT_ELEMENT : ""]);
     $imagesContainer = new Div();
     $imagesContainer->addStyleClass("catalog_img_container");
     $mainDiv->addChild($imagesContainer);
     $index = 0;
     foreach ($images as $image) {
         if ($index == 1) {
             break;
         }
         $imgView = new Img();
         $imgView->addAttributes(array("src" => addslashes($image), "alt" => $name, TagLabels::ON_CLICK => "openSimpleImg(arguments[0])"));
         $imagesContainer->addChild($imgView);
         $index++;
     }
     if ($type == 'HARD') {
         $url = URLBuilder::getCatalogLinkForSingleItem($pageNumber, $num, $itemId, array(UrlParameters::KEY => $key, UrlParameters::SEARCH_VALUE => $valueToSearch));
         $mainDiv->addStyleClass("cursor_pointer");
         $link = TagUtils::createNote($trimName, "");
         $blackOut->addChild($link);
         $blackOut->addChild(self::getItemButton($url));
     } elseif ($type == 'SIMPLE') {
         $text = TagUtils::createNote($trimName, "");
         $blackOut->addChild($text);
     }
     return $blackOut;
 }
コード例 #2
0
ファイル: MainPage.php プロジェクト: gingerP/shop
 private function renderGalleryItemWithSingleItem($data)
 {
     $mainDiv = new Div();
     $mainDiv->addStyleClasses(["main_page_item", "blackout", "catalog_item_button_container"]);
     $container = new Div();
     $container->addStyleClass("main_page_item_sub");
     $urlToItem = URLBuilder::getItemLinkForComplexType("", $data[DB::TABLE_GOODS__KEY_ITEM], 1, 48);
     $itemImagePath = '';
     $itemName = $data[DB::TABLE_GOODS__NAME];
     $images = FileUtils::getFilesByPrefixByDescription(Constants::DEFAULT_ROOT_CATALOG_PATH . DIRECTORY_SEPARATOR . $data[DB::TABLE_GOODS__KEY_ITEM] . DIRECTORY_SEPARATOR, Constants::MEDIUM_IMAGE, 'jpg');
     if ($images[0] == '') {
         $itemImagePath = FileUtils::getCapImage(Labels::CAP_IMAGE_FOR_CLOTHING);
     } else {
         $itemImagePath = $images[0];
     }
     $singleItemView = new Div();
     $singleItemView->addStyleClasses(["main_page_item_sub_single"]);
     $imgView = new Img();
     $noteView = null;
     $imgView->addAttribute("src", $itemImagePath);
     if ($data[DB::TABLE_GOODS__GOD_TYPE] == "HARD") {
         $singleItemView->addStyleClass("cursor_pointer");
         $noteView = TagUtils::createNote($itemName, "");
     } else {
         $noteView = TagUtils::createNote($itemName, "");
     }
     $noteView->addStyleClasses(["f-15"]);
     $container->addChildList([$singleItemView, $noteView, Item::getItemButton($urlToItem)]);
     $singleItemView->addChild($imgView);
     return $mainDiv->addChild($container);
 }