7 * LICENSE: This source file is licensed under the terms of the GNU General Public License.
9 * @package Magic3 Framework
10 * @author 平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
11 * @copyright Copyright 2006-2008 Magic3 Project.
12 * @license http://www.gnu.org/copyleft/gpl.html GPL License
13 * @version SVN: $Id: ec_product_headerWidgetContainer.php 2266 2009-08-28 08:25:59Z fishbone $
14 * @link http://www.magic3.org
16 require_once($gEnvManager->getContainerPath() . '/baseWidgetContainer.php');
17 require_once($gEnvManager->getCurrentWidgetDbPath() . '/ec_product_headerDb.php');
19 class ec_product_headerWidgetContainer extends BaseWidgetContainer
21 private $db; // DB接続オブジェクト
22 const CONTENT_TYPE = 'ec_menu'; // コンテンツタイプ
23 const PARAM_CONTENT_ID = 'pcontent'; // コンテンツIDキー
28 function __construct()
31 parent::__construct();
34 $this->db = new ec_product_headerDb();
39 * _assign()でデータを埋め込むテンプレートファイルのファイル名を返す。
40 * 読み込むディレクトリは、「自ウィジェットディレクトリ/include/template」に固定。
42 * @param RequestManager $request HTTPリクエスト処理クラス
43 * @param object $param 任意使用パラメータ。そのまま_assign()に渡る
44 * @return string テンプレートファイル名。テンプレートライブラリを使用しない場合は空文字列「''」を返す。
46 function _setTemplate($request, &$param)
48 return 'index.tmpl.html';
53 * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
55 * @param RequestManager $request HTTPリクエスト処理クラス
56 * @param object $param 任意使用パラメータ。_setTemplate()と共有。
59 function _assign($request, &$param)
61 $this->lang = $this->gEnv->getCurrentLanguage();
64 $contentId = $request->trimValueOf(self::PARAM_CONTENT_ID);
65 if (empty($contentId)) $contentId = 0;
67 $ret = $this->db->getContentByContentId(self::CONTENT_TYPE, $contentId, $this->lang, $row);
69 $html = str_replace(M3_TAG_START . M3_TAG_MACRO_ROOT_URL . M3_TAG_END, $this->getUrl($this->gEnv->getRootUrl()), $row['cn_html']);// アプリケーションルートを変換
73 $this->tmpl->addVar("_widget", "content", $html);