0) { $_req_param = array_map('trimAll', $_req_param); extract($_req_param, EXTR_SKIP); } header('Content-type: text/html; charset="utf-8"'); function trimAll($defore) { if (is_array($defore)) { return $defore; } $after = trim($defore); $after = preg_replace('/^[  ]*(.*?)[  ]*$/u', '$1', $after); return $after; } function charset_endode($value) { if (is_array($value)) { $value = array_map('charset_endode', $value); return $value; } return mb_convert_encoding($value,'UTF-8','UTF-8,SJIS-win,eucJP-win'); } /** * Smarty拡張クラス。 * 各ロジッククラスはこのクラスのインスタンスを生成し、 * Smartyのアサイン処理を行います。 */ class TenjoBase { /** データベースオブジェクト */ //private $_db = null; /** エラーメッセージ格納用配列 */ private $errarray = array(); /** * エラーメッセージ配列にエラーメッセージを登録する。 */ public function entryErrMsg($title, $message) { array_push($this->errarray, array("title" => $title, "message" => $message)); } /** * エラーメッセージを表示する。 * @param 呼出し元 */ public function showErrMsg($src_name = null) { if(count($this->errarray) <= 0) { return; } if ($src_name == null) { $this->assign("errors", $this->errarray); $this->display("error.tpl"); } else { $this->assign("head_errors", $this->errarray); $this->display($src_name . ".tpl"); } exit(); } /** * 日付フォーマット */ // 年月日 public function formatDate($date, $format = 'Y年m月d日') { $arrDate = explode('-', $date); // 空白以降を無視。時分秒のデータほしければここは別処理 $pos = strpos($arrDate[2], ' '); $arrDate[2] = $pos !== false ? substr($arrDate[2], 0, $pos) : $arrDate[2]; // 正規表現文字列をエスケープ $format = preg_quote($format); $pattern = array('/Y/', '/m/', '/d/'); $formatting = preg_replace($pattern, $arrDate, $format); return $formatting; } // 年月日時分秒 public function formatDateTime($date, $dFormat = 'Y年m月d日', $tFormat = 'H時i分s秒') { $d = explode('-', $date); $t = explode(':', $date); // 空白をもとに日付、時間を区切る $dPos = strpos($d[2], ' '); $tPos = strpos($t[0], ' '); // $d[2] = $dPos !== false ? substr($d[2], 0, $dPos) : $d[2]; $t[0] = $tPos !== false ? substr($t[0], $tPos+1, 2) : $t[0]; // 正規表現文字列をエスケープ $dFormat = preg_quote($dFormat); $tFormat = preg_quote($tFormat); // $dPattern = array('/Y/', '/m/', '/d/'); $dFormatting = preg_replace($dPattern, $d, $dFormat); // $tPattern = array('/H/', '/i/', '/s/'); $tFormatting = preg_replace($tPattern, $t, $tFormat); // $formatting = $dFormatting." ".$tFormatting; return $formatting; } // SELECT 年セット public function setSelectYear($year) { $optionYear = ""; for($i=$year-5; $i<$year+5; $i++){ $optionYear .= "