function lfDeleteCampaign($campaign_id, &$objQuery)
 {
     $objFileManager = new SC_Helper_FileManager_Ex();
     // ディレクトリ名を取得名
     $directory_name = $objQuery->get("dtb_campaign", "directory_name", "campaign_id = ?", array($campaign_id));
     // ファイルを削除
     $objFileManager->sfDeleteDir(CAMPAIGN_TEMPLATE_PATH . $directory_name);
     $objFileManager->sfDeleteDir(CAMPAIGN_PATH . $directory_name);
     $sqlval['del_flg'] = 1;
     $sqlval['update_date'] = "now()";
     // delete
     $objQuery->update("dtb_campaign", $sqlval, "campaign_id = ?", array($campaign_id));
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     // フォーム操作クラス
     $objFormParam = new SC_FormParam_Ex();
     // パラメーター情報の初期化
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($this->createSetParam($_POST));
     $objFormParam->convParam();
     // ファイル管理クラス
     $objUpFile = new SC_UploadFile_Ex($objFormParam->getValue('now_dir'), $objFormParam->getValue('now_dir'));
     // ファイル情報の初期化
     $this->lfInitFile($objUpFile);
     // ファイル操作クラス
     $objFileManager = new SC_Helper_FileManager_Ex();
     switch ($this->getMode()) {
         // フォルダ移動
         case 'move':
             $objFormParam = new SC_FormParam_Ex();
             $this->lfInitParamModeMove($objFormParam);
             $objFormParam->setParam($this->createSetParam($_POST));
             $objFormParam->convParam();
             $this->arrErr = $objFormParam->checkError();
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 $now_dir = $this->lfCheckSelectDir($objFormParam, $objFormParam->getValue('tree_select_file'));
                 $objFormParam->setValue('now_dir', $now_dir);
             }
             break;
             // ファイル表示
         // ファイル表示
         case 'view':
             $objFormParam = new SC_FormParam_Ex();
             $this->lfInitParamModeView($objFormParam);
             $objFormParam->setParam($this->createSetParam($_POST));
             $objFormParam->convParam();
             $this->arrErr = $objFormParam->checkError();
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 if ($this->tryView($objFormParam)) {
                     $file_url = htmlspecialchars(ereg_replace($objFormParam->getValue('top_dir'), "", $objFormParam->getValue('select_file')));
                     $tpl_onload = "win02('./file_view.php?file=" . $file_url . "', 'user_data', '600', '400');";
                     $this->setTplOnLoad($tpl_onload);
                 }
             }
             break;
             // ファイルダウンロード
         // ファイルダウンロード
         case 'download':
             $objFormParam = new SC_FormParam_Ex();
             $this->lfInitParamModeView($objFormParam);
             $objFormParam->setParam($this->createSetParam($_POST));
             $objFormParam->convParam();
             $this->arrErr = $objFormParam->checkError();
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 if (is_dir($objFormParam->getValue('select_file'))) {
                     $disp_error = "※ ディレクトリをダウンロードすることは出来ません。<br/>";
                     $this->setDispError('select_file', $disp_error);
                 } else {
                     // ファイルダウンロード
                     $objFileManager->sfDownloadFile($objFormParam->getValue('select_file'));
                     exit;
                 }
             }
             break;
             // ファイル削除
         // ファイル削除
         case 'delete':
             $objFormParam = new SC_FormParam_Ex();
             $this->lfInitParamModeView($objFormParam);
             $objFormParam->setParam($this->createSetParam($_POST));
             $objFormParam->convParam();
             $this->arrErr = $objFormParam->checkError();
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 $objFileManager->sfDeleteDir($objFormParam->getValue('select_file'));
             }
             break;
             // ファイル作成
         // ファイル作成
         case 'create':
             $objFormParam = new SC_FormParam_Ex();
             $this->lfInitParamModeCreate($objFormParam);
             $objFormParam->setParam($this->createSetParam($_POST));
             $objFormParam->convParam();
             $this->arrErr = $objFormParam->checkError();
             if (SC_Utils_Ex::isBlank($this->arrErr)) {
                 if (!$this->tryCreateDir($objFileManager, $objFormParam)) {
                     $disp_error = "※ " . htmlspecialchars($objFormParam->getValue('create_file'), ENT_QUOTES) . "の作成に失敗しました。<br/>";
                     $this->setDispError('create_file', $disp_error);
                 } else {
                     $tpl_onload = "alert('フォルダを作成しました。');";
                     $this->setTplOnLoad($tpl_onload);
                 }
             }
             break;
             // ファイルアップロード
         // ファイルアップロード
         case 'upload':
             // 画像保存処理
             $ret = $objUpFile->makeTempFile('upload_file', false);
             if (SC_Utils_Ex::isBlank($ret)) {
                 $tpl_onload = "alert('ファイルをアップロードしました。');";
                 $this->setTplOnLoad($tpl_onload);
             } else {
                 $this->setDispError('upload_file', $ret);
             }
             break;
             // 初期表示
         // 初期表示
         default:
             break;
     }
     // 値をテンプレートに渡す
     $this->arrParam = $objFormParam->getHashArray();
     // 現在の階層がルートディレクトリかどうかテンプレートに渡す
     $this->setIsTopDir($objFormParam);
     // 現在の階層より一つ上の階層をテンプレートに渡す
     $this->setParentDir($objFormParam);
     // 現在いる階層(表示用)をテンプレートに渡す
     $this->setDispPath($objFormParam);
     // 現在のディレクトリ配下のファイル一覧を取得
     $this->arrFileList = $objFileManager->sfGetFileList($objFormParam->getValue('now_dir'));
     // 現在の階層のディレクトリをテンプレートに渡す
     $this->setDispParam('tpl_now_file', $objFormParam->getValue('now_dir'));
     // ディレクトリツリー表示
     $this->setDispTree($objFileManager, $objFormParam);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     //---- 認証可否の判定
     $objSess = new SC_Session();
     SC_Utils_Ex::sfIsSuccess($objSess);
     // ルートディレクトリ
     $top_dir = USER_PATH;
     $objView = new SC_AdminView();
     $objQuery = new SC_Query();
     $objFileManager = new SC_Helper_FileManager_Ex();
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     // 現在の階層を取得
     if ($_POST['mode'] != "") {
         $now_dir = $_POST['now_file'];
     } else {
         // 初期表示はルートディレクトリ(user_data/)を表示
         $now_dir = $top_dir;
     }
     // ファイル管理クラス
     $objUpFile = new SC_UploadFile($now_dir, $now_dir);
     // ファイル情報の初期化
     $this->lfInitFile($objUpFile);
     switch ($_POST['mode']) {
         // ファイル表示
         case 'view':
             // エラーチェック
             $arrErr = $this->lfErrorCheck();
             if (!is_array($arrErr)) {
                 // 選択されたファイルがディレクトリなら移動
                 if (is_dir($_POST['select_file'])) {
                     ///$now_dir = $_POST['select_file'];
                     // ツリー遷移用のjavascriptを埋め込む
                     $arrErr['select_file'] = "※ ディレクトリを表示することは出来ません。<br/>";
                 } else {
                     // javascriptで別窓表示(テンプレート側に渡す)
                     // FIXME XSS対策すること
                     $file_url = ereg_replace(USER_PATH, "", $_POST['select_file']);
                     $this->tpl_onload = "win02('./file_view.php?file=" . $file_url . "', 'user_data', '600', '400');";
                 }
             }
             break;
             // ファイルダウンロード
         // ファイルダウンロード
         case 'download':
             // エラーチェック
             $arrErr = $this->lfErrorCheck();
             if (!is_array($arrErr)) {
                 if (is_dir($_POST['select_file'])) {
                     // ディレクトリの場合はjavascriptエラー
                     $arrErr['select_file'] = "※ ディレクトリをダウンロードすることは出来ません。<br/>";
                 } else {
                     // ファイルダウンロード
                     $objFileManager->sfDownloadFile($_POST['select_file']);
                     exit;
                 }
             }
             break;
             // ファイル削除
         // ファイル削除
         case 'delete':
             // エラーチェック
             $arrErr = $this->lfErrorCheck();
             if (!is_array($arrErr)) {
                 $objFileManager->sfDeleteDir($_POST['select_file']);
             }
             break;
             // ファイル作成
         // ファイル作成
         case 'create':
             // エラーチェック
             $arrErr = $this->lfCreateErrorCheck();
             if (!is_array($arrErr)) {
                 $create_dir = ereg_replace("/\$", "", $now_dir);
                 // ファイル作成
                 if (!$objFileManager->sfCreateFile($create_dir . "/" . $_POST['create_file'], 0755)) {
                     // 作成エラー
                     $arrErr['create_file'] = "※ " . $_POST['create_file'] . "の作成に失敗しました。<br/>";
                 } else {
                     $this->tpl_onload .= "alert('フォルダを作成しました。');";
                 }
             }
             break;
             // ファイルアップロード
         // ファイルアップロード
         case 'upload':
             // 画像保存処理
             $ret = $objUpFile->makeTempFile('upload_file', false);
             if ($ret != "") {
                 $arrErr['upload_file'] = $ret;
             } else {
                 $this->tpl_onload .= "alert('ファイルをアップロードしました。');";
             }
             break;
             // フォルダ移動
         // フォルダ移動
         case 'move':
             $now_dir = $this->lfCheckSelectDir($_POST['tree_select_file']);
             break;
             // 初期表示
         // 初期表示
         default:
             break;
     }
     // トップディレクトリか調査
     $is_top_dir = false;
     // 末尾の/をとる
     $top_dir_check = ereg_replace("/\$", "", $top_dir);
     $now_dir_check = ereg_replace("/\$", "", $now_dir);
     if ($top_dir_check == $now_dir_check) {
         $is_top_dir = true;
     }
     // 現在の階層より一つ上の階層を取得
     $parent_dir = $this->lfGetParentDir($now_dir);
     // 現在のディレクトリ配下のファイル一覧を取得
     $this->arrFileList = $objFileManager->sfGetFileList($now_dir);
     $this->tpl_is_top_dir = $is_top_dir;
     $this->tpl_parent_dir = $parent_dir;
     $this->tpl_now_dir = $now_dir;
     $this->tpl_now_file = basename($now_dir);
     $this->arrErr = isset($arrErr) ? $arrErr : "";
     $this->arrParam = $_POST;
     // ツリーを表示する divタグid, ツリー配列変数名, 現在ディレクトリ, 選択ツリーhidden名, ツリー状態hidden名, mode hidden名
     $treeView = "fnTreeView('tree', arrTree, '{$now_dir}', 'tree_select_file', 'tree_status', 'move');";
     if (!empty($this->tpl_onload)) {
         $this->tpl_onload .= $treeView;
     } else {
         $this->tpl_onload = $treeView;
     }
     // ツリー配列作成用 javascript
     if (!isset($_POST['tree_status'])) {
         $_POST['tree_status'] = "";
     }
     $arrTree = $objFileManager->sfGetFileTree($top_dir, $_POST['tree_status']);
     $this->tpl_javascript .= "arrTree = new Array();\n";
     foreach ($arrTree as $arrVal) {
         $this->tpl_javascript .= "arrTree[" . $arrVal['count'] . "] = new Array(" . $arrVal['count'] . ", '" . $arrVal['type'] . "', '" . $arrVal['path'] . "', " . $arrVal['rank'] . ",";
         if ($arrVal['open']) {
             $this->tpl_javascript .= "true);\n";
         } else {
             $this->tpl_javascript .= "false);\n";
         }
     }
     // 画面の表示
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }