response = new SC_Response_Ex(); if ($hasPrevURL) { $this->setPrevURL(); } } function setPrevURL() { // TODO SC_SiteSession で実装した方が良さげ $objCartSess = new SC_CartSession_Ex(); $objCartSess->setPrevURL($_SERVER['REQUEST_URI']); } /** * LC_Page のパラメーターを, テンプレートに設定し, 出力の準備を行う. * * @param LC_Page $page LC_Page インスタンス * @param $is_admin boolean 管理画面を扱う場合 true */ function prepare($page, $is_admin = false) { if (!$this->deviceSeted || !is_null($this->view)) { $device = ($is_admin) ? DEVICE_TYPE_ADMIN : $this->detectDevice(); $this->setDevice($device); } $this->assignobj($page); $this->view->setPage($page); $this->response->setResposeBody($this->view->getResponse($page->getTemplate())); } /** * リロードを行う. * * SC_Response::reload() のラッパーです. */ function reload($queryString = array(), $removeQueryString = false) { $this->response->reload($queryString, $removeQueryString); } function noAction() { return; } /** * ヘッダを追加する. */ function addHeader($name, $value) { $this->response->addHeader($name, $value); } /** * デバイス毎の出力方法を自動で変更する、ファサード * Enter description here ... */ function setDevice($device = DEVICE_TYPE_PC) { switch ($device) { case DEVICE_TYPE_MOBILE: if (USE_MOBILE === false) { exit; } $this->response->setContentType('text/html'); $this->setView(new SC_MobileView_Ex()); break; case DEVICE_TYPE_SMARTPHONE: $this->setView(new SC_SmartphoneView_Ex()); break; case DEVICE_TYPE_PC: $this->setView(new SC_SiteView_Ex()); break; case DEVICE_TYPE_ADMIN: $this->setView(new SC_AdminView_Ex()); } $this->deviceSeted = true; } /** * SC_View インスタンスを設定する. */ function setView($view) { $this->view = $view; } /** * 機種を判別する。 * * SC_Display::MOBILE = ガラケー = 1 * SC_Display::SMARTPHONE = スマホ = 2 * SC_Display::PC = PC = 10 * * @static * @return integer 端末種別ID */ function detectDevice() { $nu = new Net_UserAgent_Mobile(); $su = new SC_SmartphoneUserAgent_Ex(); $retDevice = 0; if ($nu->isMobile()) { return DEVICE_TYPE_MOBILE; } elseif ($su->isSmartphone()) { return DEVICE_TYPE_SMARTPHONE; } else { return DEVICE_TYPE_PC; } } function assign($val1,$val2) { $this->view->assign($val1, $val2); } function assignobj($obj) { $this->view->assignobj($obj); } function assignarray($array) { $this->view->assignarray($array); } }