/**
  * ページデータを取得する.
  *
  * @param integer $device_type_id 端末種別ID
  * @param integer $page_id ページID
  * @param SC_Helper_PageLayout $objLayout SC_Helper_PageLayout インスタンス
  * @return array ページデータの配列
  */
 function getTplMainpage($device_type_id, $page_id, &$objLayout)
 {
     $arrPageData = $objLayout->getPageProperties($device_type_id, $page_id);
     $objBlob = new SC_Helper_Blob_Ex();
     $containerName = $objBlob->getTemplateContainerName($device_type_id);
     $templatePath = $objLayout->getTemplatePath($device_type_id);
     $filename = $templatePath . $arrPageData[0]['filename'] . ".tpl";
     if ($objBlob->blobExists($containerName, $arrPageData[0]['filename'] . ".tpl")) {
         $arrPageData[0]['tpl_data'] = $objBlob->getBlobData($containerName, $arrPageData[0]['filename'] . ".tpl");
     }
     // ファイル名を画面表示用に加工しておく
     $arrPageData[0]['filename'] = preg_replace('|^' . preg_quote(USER_DIR) . '|', '', $arrPageData[0]['filename']);
     return $arrPageData[0];
 }
예제 #2
0
 function getFormFileList($temp_url, $save_url, $real_size = false)
 {
     $objBlob = new SC_Helper_Blob_Ex();
     $containerName = "saveimage";
     $arrRet = array();
     $cnt = 0;
     foreach ($this->keyname as $val) {
         if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") {
             // ファイルパスチェック(パスのスラッシュ/が連続しないようにする。)
             if (ereg("/\$", $temp_url)) {
                 $arrRet[$val]['filepath'] = $temp_url . $this->temp_file[$cnt];
             } else {
                 $arrRet[$val]['filepath'] = $temp_url . "/" . $this->temp_file[$cnt];
             }
             $arrRet[$val]['real_filepath'] = $this->temp_dir . $this->temp_file[$cnt];
         } elseif (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != "") {
             // ファイルパスチェック(パスのスラッシュ/が連続しないようにする。)
             if (ereg("/\$", $save_url)) {
                 $arrRet[$val]['filepath'] = $save_url . $this->save_file[$cnt];
             } else {
                 $arrRet[$val]['filepath'] = $save_url . "/" . $this->save_file[$cnt];
             }
             //$arrRet[$val]['real_filepath'] = $this->save_dir . $this->save_file[$cnt];
             $arrRet[$val]['real_filepath'] = IMAGE_SAVE_URLPATH . $this->save_file[$cnt];
         }
         if (isset($arrRet[$val]['filepath']) && !empty($arrRet[$val]['filepath'])) {
             if ($real_size) {
                 //                    if(is_file($arrRet[$val]['real_filepath'])) {
                 if ($objBlob->blobExists($containerName, $this->save_file[$cnt])) {
                     //is_file($arrRet[$val]['real_filepath'])) {
                     list($width, $height) = getimagesize($arrRet[$val]['real_filepath']);
                 }
                 // ファイル横幅
                 $arrRet[$val]['width'] = $width;
                 // ファイル縦幅
                 $arrRet[$val]['height'] = $height;
             } else {
                 // ファイル横幅
                 $arrRet[$val]['width'] = $this->width[$cnt];
                 // ファイル縦幅
                 $arrRet[$val]['height'] = $this->height[$cnt];
             }
             // 表示名
             $arrRet[$val]['disp_name'] = $this->disp_name[$cnt];
         }
         $cnt++;
     }
     return $arrRet;
 }
예제 #3
0
 /**
  * ページのレイアウト情報を取得し, 設定する.
  *
  * 現在の URL に応じたページのレイアウト情報を取得し, LC_Page インスタンスに
  * 設定する.
  *
  * @access public
  * @param LC_Page $objPage LC_Page インスタンス
  * @param boolean $preview プレビュー表示の場合 true
  * @param string $url ページのURL($_SERVER['PHP_SELF'] の情報)
  * @param integer $device_type_id 端末種別ID
  * @return void
  */
 function sfGetPageLayout(&$objPage, $preview = false, $url = "", $device_type_id = DEVICE_TYPE_PC)
 {
     // URLを元にページ情報を取得
     if ($preview === false) {
         $url = preg_replace('|^' . preg_quote(ROOT_URLPATH) . '|', '', $url);
         $arrPageData = $this->getPageProperties($device_type_id, null, 'url = ?', array($url));
     } else {
         $arrPageData = $this->getPageProperties($device_type_id, 0);
     }
     $objPage->tpl_mainpage = $this->getTemplatePath($device_type_id) . $arrPageData[0]['filename'] . ".tpl";
     $objPage->arrPageLayout =& $arrPageData[0];
     $objBlob = new SC_Helper_Blob_Ex();
     $containerName = $objBlob->getTemplateContainerName($device_type_id);
     /** pageのテンプレートがなければBlobから取得する */
     if (!is_file($objPage->tpl_mainpage)) {
         $objBlob->getBlob($containerName, $arrPageData[0]['filename'] . ".tpl", $objPage->tpl_mainpage);
     }
     // ページタイトルを設定
     if (SC_Utils_Ex::isBlank($objPage->tpl_title)) {
         $objPage->tpl_title = $objPage->arrPageLayout['page_name'];
     }
     // 該当ページのブロックを取得し, 配置する
     $masterData = new SC_DB_MasterData();
     $arrTarget = $masterData->getMasterData("mtb_target");
     $arrBlocs = $this->getBlocPositions($device_type_id, $objPage->arrPageLayout['page_id']);
     // php_path, tpl_path が存在するものを, 各ターゲットに配置
     foreach (array_keys($arrTarget) as $target_id) {
         foreach ($arrBlocs as $arrBloc) {
             if ($arrBloc['target_id'] != $target_id) {
                 continue;
             }
             /* Blobからすでにファイルを取得している場合*/
             if (is_file($arrBloc['tpl_path'])) {
                 $objPage->arrPageLayout[$arrTarget[$target_id]][] = $arrBloc;
             } else {
                 if ($objBlob->blobExists($containerName, $arrBloc['filename'] . ".tpl")) {
                     $localFilename = $arrBloc['tpl_path'];
                     $objBlob->getBlob($containerName, $arrBloc['filename'] . ".tpl", $localFilename);
                     $objPage->arrPageLayout[$arrTarget[$target_id]][] = $arrBloc;
                 } else {
                     $error = "ブロックが見つかりません\n" . "tpl_path: " . $arrBloc['tpl_path'] . "\n" . "php_path: " . $arrBloc['php_path'];
                     GC_Utils_Ex::gfPrintLog($error);
                 }
             }
         }
     }
     // カラム数を取得する
     $objPage->tpl_column_num = $this->getColumnNum($objPage->arrPageLayout);
 }
 /**
  * ブロックのテンプレートを取得する.
  *
  * @param integer $device_type_id 端末種別ID
  * @param integer $bloc_id ブロックID
  * @param SC_Helper_PageLayout $objLayout SC_Helper_PageLayout インスタンス
  * @return array ブロック情報の配列
  */
 function getBlocTemplate($device_type_id, $bloc_id, &$objLayout)
 {
     $arrBloc = $objLayout->getBlocs($device_type_id, 'bloc_id = ?', array($bloc_id));
     if (SC_Utils_Ex::isAbsoluteRealPath($arrBloc[0]['tpl_path'])) {
         $tpl_path = $arrBloc[0]['tpl_path'];
     } else {
         $tpl_path = SC_Helper_PageLayout_Ex::getTemplatePath($device_type_id) . BLOC_DIR . $arrBloc[0]['tpl_path'];
     }
     $objBlob = new SC_Helper_Blob_Ex();
     $containerName = $objBlob->getTemplateContainerName($device_type_id);
     if ($objBlob->blobExists($containerName, $arrBloc[0]['filename'] . ".tpl")) {
         $arrBloc[0]['bloc_html'] = $objBlob->getBlobData($containerName, BLOC_DIR . $arrBloc[0]['filename'] . ".tpl");
     }
     return $arrBloc[0];
 }