OSDN Git Service

汎用エラー出力作成
authorCake <cake_67@users.sourceforge.jp>
Fri, 17 Dec 2010 06:13:05 +0000 (15:13 +0900)
committerCake <cake_67@users.sourceforge.jp>
Fri, 17 Dec 2010 06:13:05 +0000 (15:13 +0900)
app/error.php
app/views/errors/error.ctp [new file with mode: 0644]
app/views/layouts/wrap.ctp [new file with mode: 0644]

index 3103376..68ebb1c 100644 (file)
  */
 class AppError extends ErrorHandler {
 
+       function error($params) {
+               $this->controller->layout = "wrap";
+
+               if (!isset($params['message'])) {
+                       $params['message'] = __('UNKNOWN ERROR', true);
+               }
+
+               $this->controller->set(array(
+                       'message' => $params['message'],
+                       'base' => $this->controller->base
+               ));
+
+               $this->_outputMessage('error');
+       }
+
        function errorPcView($params) {
                $this->controller->layout = "mobile_default";
 
diff --git a/app/views/errors/error.ctp b/app/views/errors/error.ctp
new file mode 100644 (file)
index 0000000..0c444c4
--- /dev/null
@@ -0,0 +1,4 @@
+<?php 
+echo $this->element('error', array(
+       'message' => $message,
+       ));
diff --git a/app/views/layouts/wrap.ctp b/app/views/layouts/wrap.ctp
new file mode 100644 (file)
index 0000000..6f10eb6
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+/*
+ * @filesource
+ * @copyright
+ * @link
+ * @package
+ * @since
+ * @version
+ * @license
+ */
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<?php echo $html->charset('utf-8'); ?>
+<meta http-equiv="X-UA-Compatible" content="IE=7">
+<title>
+<?php
+if (isset($site_configs['Site.siteName'])) {
+       echo $settings->value4key_name($site_configs, 'Site.siteName');
+} else {
+       echo "&nbsp;";
+}
+?>
+<?php echo $title_for_layout; ?>
+</title>
+<?php
+       //echo $html->meta('icon'); // スキン設定etcで管理画面変更対応予定
+       echo $html->css('cake.generic');
+       echo $html->css('base');
+       echo $html->css('box');
+       echo $html->css('layout');
+
+       // Javascript
+       // 独自ライブラリ
+       // readyイベント
+?>
+
+<style type="text/css">
+<!--
+<?php 
+echo $site_configs['Design.customCss']['value'];
+ ?>
+-->
+</style>
+
+<?php echo $scripts_for_layout; ?>
+
+</head>
+<body id="<?php echo $this->name; ?>_<?php echo $this->action; ?>">
+<div id="container">
+
+<?php echo $session->flash('auth'); ?>
+<?php echo $session->flash(); ?>
+<?php echo $content_for_layout; ?>
+
+<div id="footer">
+<?php 
+       echo $this->element('version', 
+               array(
+                       'version' => Configure::read('Version'),
+               )
+       );
+?>
+</div>
+
+</div>
+</body>
+</html>
\ No newline at end of file