/**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     // ログインチェック
     $objSession = new SC_Session();
     SC_Utils::sfIsSuccess($objSession);
     $this->now_template = $this->lfGetNowTemplate();
     // uniqidをテンプレートへ埋め込み
     $this->uniqid = $objSession->getUniqId();
     switch ($this->lfGetMode()) {
         // ダウンロードボタン押下時の処理
         case 'download':
             break;
             // アップロードボタン押下時の処理
         // アップロードボタン押下時の処理
         case 'upload':
             // 画面遷移の正当性チェック
             if (!SC_Utils::sfIsValidTransition($objSession)) {
                 SC_Utils::sfDispError('');
             }
             // フォームパラメータ初期化
             $objForm = $this->lfInitUpload();
             // エラーチェック
             if ($arrErr = $this->lfValidateUpload($objForm)) {
                 $this->arrErr = $arrErr;
                 $this->arrForm = $objForm->getFormParamList();
                 break;
             }
             // アップロードファイル初期化
             $objUpFile = $this->lfInitUploadFile($objForm);
             // 一時ファイルへ保存
             $errMsg = $objUpFile->makeTempFile('template_file', false);
             // 書き込みエラーチェック
             if (isset($errMsg)) {
                 $this->arrErr['template_file'] = $errMsg;
                 $this->arrForm = $objForm->getFormParamList();
                 break;
             }
             $this->lfAddTemplates($objForm, $objUpFile);
             $this->tpl_onload = "alert('テンプレートファイルをアップロードしました。');";
             break;
             // 初回表示
         // 初回表示
         default:
             break;
     }
     // 画面の表示
     $objView = new SC_AdminView();
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     // 認証可否の判定
     $objSession = new SC_Session();
     SC_Utils::sfIsSuccess($objSession);
     // uniqidをテンプレートへ埋め込み
     $this->uniqid = $objSession->getUniqId();
     $objView = new SC_AdminView();
     switch ($this->lfGetMode()) {
         // 登録ボタン押下時
         case 'register':
             // 画面遷移の正当性チェック
             if (!SC_Utils::sfIsValidTransition($objSession)) {
                 sfDispError('');
             }
             // パラメータ検証
             $objForm = $this->lfInitRegister();
             if ($objForm->checkError()) {
                 SC_Utils_Ex::sfDispError('');
             }
             $template_code = $objForm->getValue('template_code');
             $this->tpl_select = $template_code;
             if ($template_code == "") {
                 $template_code = "default";
             }
             // DBへ使用するテンプレートを登録
             $this->lfRegisterTemplate($template_code);
             // XXX コンパイルファイルのクリア処理を行う
             $objView->_smarty->clear_compiled_tpl();
             // common.cssの内容を更新
             $this->lfChangeCommonCss($template_code);
             // テンプレートのコピー
             $this->lfCopyTemplate($template_code);
             // ブロック位置を更新
             $this->lfChangeBloc($template_code);
             // 完了メッセージ
             $this->tpl_onload = "alert('登録が完了しました。');";
             break;
             // 削除ボタン押下時
         // 削除ボタン押下時
         case 'delete':
             // 画面遷移の正当性チェック
             if (!SC_Utils::sfIsValidTransition($objSession)) {
                 SC_Utils::sfDispError('');
             }
             // パラメータ検証
             $objForm = $this->lfInitDelete();
             if ($objForm->checkError()) {
                 SC_Utils::sfDispError('');
             }
             //現在使用中のテンプレートとデフォルトのテンプレートは削除できないようにする
             $template_code = $objForm->getValue('template_code_temp');
             if ($template_code == TEMPLATE_NAME || $template_code == DEFAULT_TEMPLATE_NAME) {
                 $this->tpl_onload = "alert('選択中のテンプレートは削除出来ません');";
                 break;
             }
             $this->lfDeleteTemplate($template_code);
             break;
             // downloadボタン押下時
         // downloadボタン押下時
         case 'download':
             // 画面遷移の正当性チェック
             if (!SC_Utils::sfIsValidTransition($objSession)) {
                 SC_Utils::sfDispError('');
             }
             // パラメータ検証
             $objForm = $this->lfInitDownload();
             $template_code = $objForm->getValue('template_code_temp');
             // ユーザデータの下のファイルも保存する。
             $from_dir = USER_TEMPLATE_PATH . $template_code . "/";
             $to_dir = SMARTY_TEMPLATES_DIR . $template_code . "/_packages/";
             SC_Utils::sfMakeDir($to_dir);
             SC_Utils::sfCopyDir($from_dir, $to_dir);
             SC_Helper_FileManager::downloadArchiveFiles(SMARTY_TEMPLATES_DIR . $template_code);
             break;
             // プレビューボタン押下時
         // プレビューボタン押下時
         case 'preview':
             break;
         default:
             break;
     }
     // defaultパラメータのセット
     $this->templates = $this->lfGetAllTemplates();
     $this->now_template = TEMPLATE_NAME;
     // 画面の表示
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }