示例#1
0
 public function execute($actionName)
 {
     // 作成モードであれば、Actionクラスと設定ファイルを作成
     if ($this->request->getParameter('__CREATE_ACTION') == 1) {
         $this->createActionTemplate($actionName);
     } else {
         $this->confirmPage($actionName);
     }
 }
示例#2
0
 /**
  * Converterを実行
  *
  * @param   array   $params Convertする条件が入った配列
  * @access  private
  * @since   3.0.0
  */
 private function _convert($params)
 {
     foreach ($params as $key => $value) {
         $key = preg_replace("/\\s+/", "", $key);
         $value = preg_replace("/\\s+/", "", $value);
         if ($key == "") {
             throw new Teeple_Exception("Converterの設定が不正です。キーがありません。");
         }
         //
         // $key は attribute.name のパターン
         //
         $keyArray = explode(".", $key);
         if (count($keyArray) != 2) {
             throw new Teeple_Exception("Converterのkeyの形式が不正です。");
         }
         $attribute = $keyArray[0];
         // 属性の名前
         $name = $keyArray[1];
         // Converterの名前
         //
         // $value にはConvert後の値を入れる変数名がセットできる
         //
         $newAttribute = $value;
         //
         // Converterを取得
         //
         $converter = $this->_list[$name];
         if (!is_object($converter)) {
             throw new Teeple_Exception("Converter {$className} の生成に失敗しました。");
         }
         //
         // attributeに * が指定されている場合は
         // リクエストパラメータ全てが変換対象となる
         //
         if ($attribute == '*') {
             $attribute = join(",", array_keys($this->request->getParameters()));
         }
         if (preg_match("/,/", $attribute)) {
             $attributes = array();
             foreach (explode(",", $attribute) as $param) {
                 if ($param) {
                     $attributes[$param] = $this->request->getParameter($param);
                 }
             }
         } else {
             $attributes = $this->request->getParameter($attribute);
         }
         //
         // Converterを適用
         //
         $result = $converter->convert($attributes);
         if ($newAttribute != "") {
             $this->request->setParameter($newAttribute, $result);
         } else {
             if (is_array($attributes)) {
                 foreach ($result as $key => $value) {
                     if ($key) {
                         $this->request->setParameter($key, $value);
                     }
                 }
             } else {
                 $this->request->setParameter($attribute, $result);
             }
         }
     }
 }