/** * ページに表示ヘッダを出力します。 */ protected function compose() { $itemHtml = parent::compose(); global $_GET; /* * ソート種別 */ $options = ""; foreach (self::$SORT_BY as $code => $name) { $options .= '<option value="' . $code . '" '; if ($this->sort_by && $code == $this->sort_by) { $options .= 'selected'; } $options .= '>' . $name . '</option>'; } $itemHtml = str_replace('${SORT_BY}', $options, $itemHtml); /* * ソート順 */ $options = ""; foreach (self::$SORT_ORDER as $code => $name) { $options .= '<option value="' . $code . '" '; if ($this->sort_order && $code == $this->sort_order || !$this->sort_order && $code == '') { $options .= 'selected'; } $options .= '>' . $name . '</option>'; } $itemHtml = str_replace('${SORT_ORDER}', $options, $itemHtml); // カテゴリ $categories = "<option value=''></option>"; $api = new VCPDBDriver(VCPDBDRIVER_CATEGORY_API_URL); $api->setParam("category_level", "1"); $api->setFlag("childless"); $response = $api->executeQuery(); if (gettype($response) == "object") { $itemElements = $response->xpath('/rss/channel/item'); foreach ($itemElements as $item) { $titleStr = null; $descStr = null; $title = $item->xpath('title'); if (count($title) > 0) { $titleStr = $title[0]; } $desc = $item->xpath('description'); if (count($desc) > 0) { $descStr = $desc[0]; } if ($titleStr == null || $descStr == null) { continue; } $categories .= '<option value="' . $titleStr . '" '; if ($this->category && $titleStr == $this->category) { $categories .= 'selected'; } $categories .= '>' . $descStr . '</option>'; } } $itemHtml = str_replace('${CATEGORIES}', $categories, $itemHtml); return $itemHtml; }