OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / widgets / m / content_search_box / include / container / m_content_search_boxWidgetContainer.php
1 <?php
2 /**
3  * index.php用コンテナクラス
4  *
5  * PHP versions 5
6  *
7  * LICENSE: This source file is licensed under the terms of the GNU General Public License.
8  *
9  * @package    Magic3 Framework
10  * @author     平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
11  * @copyright  Copyright 2006-2007 Magic3 Project.
12  * @license    http://www.gnu.org/copyleft/gpl.html  GPL License
13  * @version    SVN: $Id: m_content_search_boxWidgetContainer.php 4048 2011-03-27 05:11:31Z fishbone $
14  * @link       http://www.magic3.org
15  */
16 require_once($gEnvManager->getContainerPath()           . '/baseWidgetContainer.php');
17
18 class m_content_search_boxWidgetContainer extends BaseWidgetContainer
19 {
20         const TARGET_WIDGET = 'm/content';              // 呼び出しウィジェットID
21         
22         /**
23          * コンストラクタ
24          */
25         function __construct()
26         {
27                 // 親クラスを呼び出す
28                 parent::__construct();
29         }
30         /**
31          * テンプレートファイルを設定
32          *
33          * _assign()でデータを埋め込むテンプレートファイルのファイル名を返す。
34          * 読み込むディレクトリは、「自ウィジェットディレクトリ/include/template」に固定。
35          *
36          * @param RequestManager $request               HTTPリクエスト処理クラス
37          * @param object         $param                 任意使用パラメータ。そのまま_assign()に渡る
38          * @return string                                               テンプレートファイル名。テンプレートライブラリを使用しない場合は空文字列「''」を返す。
39          */
40         function _setTemplate($request, &$param)
41         {       
42                 return 'index.tmpl.html';
43         }
44         /**
45          * テンプレートにデータ埋め込む
46          *
47          * _setTemplate()で指定したテンプレートファイルにデータを埋め込む。
48          *
49          * @param RequestManager $request               HTTPリクエスト処理クラス
50          * @param object         $param                 任意使用パラメータ。_setTemplate()と共有。
51          * @param                                                               なし
52          */
53         function _assign($request, &$param)
54         {
55                 $act = $request->trimValueOf('act');
56                 if ($act == 'content_search'){                  // コンテンツ検索のとき
57                         // キーワード取得
58                         $keyword = $request->mobileTrimValueOf('keyword');
59                         
60                         // ブログメインに検索結果を表示させる
61                         $url = $this->gPage->createWidgetCmdUrl(self::TARGET_WIDGET, $this->gEnv->getCurrentWidgetId(), 'act=search&keyword=' . urlencode($keyword));
62                         $this->gPage->redirect($url, true/*遷移時のダイアログ表示を抑止*/);
63                 }
64                 // パラメータを埋め込む
65                 $this->tmpl->addVar("_widget", "url", $this->gEnv->createCurrentPageUrlForMobile());
66         }
67 }
68 ?>