Changeset 20830
- Timestamp:
- 2011/04/12 22:58:10 (13 years ago)
- bzr:base-revision:
- svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_11-dev:20829
- bzr:committer:
- Kentaro Ohkouchi <ohkouchi@loop-az.jp>
- bzr:file-ids:
data/Smarty/templates/admin/design/index.tpl 15732@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2FSmarty%2Ftemplates%2Fdefault%2Fadmin%2Fdesign%2Findex.tpl
data/class/SC_FormParam.php 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2FSC_FormParam.php
data/class/helper/SC_Helper_PageLayout.php 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fhelper%2FSC_Helper_PageLayout.php
data/class/pages/admin/design/LC_Page_Admin_Design.php 15680@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2Fdesign%2FLC_Page_Admin_Design.php
data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php 15682@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2Fdesign%2FLC_Page_Admin_Design_MainEdit.php- bzr:mapping-version:
- v4
- bzr:merge:
ohkouchi@loop-az.jp-20110412135550-rrkz5279jtmkd6rz- bzr:repository-uuid:
- 1e3b908f-19a9-db11-a64c-001125224ba8
- bzr:revision-id:
- ohkouchi@loop-az.jp-20110412135757-jzouuuwavr7z993z
- bzr:revno:
- 3541
- bzr:revprop:branch-nick:
- branches/version-2_11-dev
- bzr:root:
- branches/version-2_11-dev
- bzr:text-revisions:
data/Smarty/templates/admin/design/index.tpl ohkouchi@loop-az.jp-20110412135550-rrkz5279jtmkd6rz
data/class/SC_FormParam.php ohkouchi@loop-az.jp-20110412135550-rrkz5279jtmkd6rz
data/class/helper/SC_Helper_PageLayout.php ohkouchi@loop-az.jp-20110412135550-rrkz5279jtmkd6rz
data/class/pages/admin/design/LC_Page_Admin_Design.php ohkouchi@loop-az.jp-20110412135550-rrkz5279jtmkd6rz
data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php ohkouchi@loop-az.jp-20110412135550-rrkz5279jtmkd6rz- bzr:timestamp:
- 2011-04-12 22:57:57.092000008 +0900
- bzr:user-agent:
- bzr2.2.1+bzr-svn1.0.4
- svn:original-date:
- 2011-04-12T13:57:57.092000Z
- Location:
- branches/version-2_11-dev/data
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_11-dev/data/Smarty/templates/admin/design/index.tpl
r20669 r20830 20 20 <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" /> 21 21 <input type="hidden" name="mode" value="" /> 22 <input type="hidden" name="page_id" value="<!--{$page_id }-->" />23 <input type="hidden" name="bloc_cnt" value="<!--{$bloc_cnt }-->" />22 <input type="hidden" name="page_id" value="<!--{$page_id|h}-->" /> 23 <input type="hidden" name="bloc_cnt" value="<!--{$bloc_cnt|h}-->" /> 24 24 <input type="hidden" name="device_type_id" value="<!--{$device_type_id|h}-->" /> 25 25 … … 35 35 <td colspan="3" id="<!--{$arrTarget[$smarty.const.TARGET_ID_HEAD]}-->" class="ui-sortable"> 36 36 <!--{assign var="firstflg" value=false}--> 37 <!--{foreach key=key item=item from=$ tpl_arrBlocname="bloc_loop"}-->37 <!--{foreach key=key item=item from=$arrBlocs name="bloc_loop"}--> 38 38 <!--{if $item.target_id == $arrTarget[$smarty.const.TARGET_ID_HEAD]}--> 39 39 <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> … … 43 43 <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 44 44 <!--{$item.name}--> 45 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{ $item.anywhere_selected}--> />全ページ)</label>45 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{if $item.anywhere == 1}-->checked="checked"<!--{/if}--> />全ページ)</label> 46 46 </div> 47 47 <!--{assign var="firstflg" value=true}--> … … 58 58 <td colspan="3" id="<!--{$arrTarget[$smarty.const.TARGET_ID_HEAD_TOP]}-->" class="ui-sortable"> 59 59 <!--{assign var="firstflg" value=false}--> 60 <!--{foreach key=key item=item from=$ tpl_arrBlocname="bloc_loop"}-->60 <!--{foreach key=key item=item from=$arrBlocs name="bloc_loop"}--> 61 61 <!--{if $item.target_id == $arrTarget[$smarty.const.TARGET_ID_HEAD_TOP]}--> 62 62 <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> … … 66 66 <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 67 67 <!--{$item.name}--> 68 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{ $item.anywhere_selected}--> />全ページ)</label>68 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{if $item.anywhere == 1}-->checked="checked"<!--{/if}--> />全ページ)</label> 69 69 </div> 70 70 <!--{assign var="firstflg" value=true}--> … … 79 79 <td colspan="2" id="<!--{$arrTarget[$smarty.const.TARGET_ID_HEADER_INTERNAL]}-->" class="ui-sortable"> 80 80 <!--{assign var="firstflg" value=false}--> 81 <!--{foreach key=key item=item from=$ tpl_arrBlocname="bloc_loop"}-->81 <!--{foreach key=key item=item from=$arrBlocs name="bloc_loop"}--> 82 82 <!--{if $item.target_id == $arrTarget[$smarty.const.TARGET_ID_HEADER_INTERNAL]}--> 83 83 <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> … … 87 87 <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 88 88 <!--{$item.name}--> 89 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{ $item.anywhere_selected}--> />全ページ)</label>89 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{if $item.anywhere == 1}-->checked="checked"<!--{/if}--> />全ページ)</label> 90 90 </div> 91 91 <!--{assign var="firstflg" value=true}--> … … 99 99 <td colspan="3" id="<!--{$arrTarget[$smarty.const.TARGET_ID_TOP]}-->" class="ui-sortable"> 100 100 <!--{assign var="firstflg" value=false}--> 101 <!--{foreach key=key item=item from=$ tpl_arrBlocname="bloc_loop"}-->101 <!--{foreach key=key item=item from=$arrBlocs name="bloc_loop"}--> 102 102 <!--{if $item.target_id == $arrTarget[$smarty.const.TARGET_ID_TOP]}--> 103 103 <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> … … 107 107 <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 108 108 <!--{$item.name}--> 109 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{ $item.anywhere_selected}--> />全ページ)</label>109 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{if $item.anywhere == 1}-->checked="checked"<!--{/if}--> />全ページ)</label> 110 110 </div> 111 111 <!--{assign var="firstflg" value=true}--> … … 121 121 <td colspan="3" id="<!--{$arrTarget[$smarty.const.TARGET_ID_MAIN_HEAD]}-->" class="ui-sortable"> 122 122 <!--{assign var="firstflg" value=false}--> 123 <!--{foreach key=key item=item from=$ tpl_arrBlocname="bloc_loop"}-->123 <!--{foreach key=key item=item from=$arrBlocs name="bloc_loop"}--> 124 124 <!--{if $item.target_id == $arrTarget[$smarty.const.TARGET_ID_MAIN_HEAD]}--> 125 125 <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> … … 129 129 <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 130 130 <!--{$item.name}--> 131 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{ $item.anywhere_selected}--> />全ページ)</label>131 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{if $item.anywhere == 1}-->checked="checked"<!--{/if}--> />全ページ)</label> 132 132 </div> 133 133 <!--{assign var="firstflg" value=true}--> … … 146 146 <td colspan="3" id="<!--{$arrTarget[$smarty.const.TARGET_ID_MAIN_FOOT]}-->" class="ui-sortable"> 147 147 <!--{assign var="firstflg" value=false}--> 148 <!--{foreach key=key item=item from=$ tpl_arrBlocname="bloc_loop"}-->148 <!--{foreach key=key item=item from=$arrBlocs name="bloc_loop"}--> 149 149 <!--{if $item.target_id == $arrTarget[$smarty.const.TARGET_ID_MAIN_FOOT]}--> 150 150 <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> … … 154 154 <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 155 155 <!--{$item.name}--> 156 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{ $item.anywhere_selected}--> />全ページ)</label>156 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{if $item.anywhere == 1}-->checked="checked"<!--{/if}--> />全ページ)</label> 157 157 </div> 158 158 <!--{assign var="firstflg" value=true}--> … … 166 166 <td rowspan="3" id="<!--{$arrTarget[$smarty.const.TARGET_ID_LEFT]}-->" class="ui-sortable"> 167 167 <!--{assign var="firstflg" value=false}--> 168 <!--{foreach key=key item=item from=$ tpl_arrBlocname="bloc_loop"}-->168 <!--{foreach key=key item=item from=$arrBlocs name="bloc_loop"}--> 169 169 <!--{if $item.target_id == $arrTarget[$smarty.const.TARGET_ID_LEFT]}--> 170 170 <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> … … 174 174 <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 175 175 <!--{$item.name}--> 176 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{ $item.anywhere_selected}--> />全ページ)</label>176 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{if $item.anywhere == 1}-->checked="checked"<!--{/if}--> />全ページ)</label> 177 177 </div> 178 178 <!--{assign var="firstflg" value=true}--> … … 184 184 <td id="<!--{$arrTarget[$smarty.const.TARGET_ID_MAIN_HEAD]}-->" class="ui-sortable"> 185 185 <!--{assign var="firstflg" value=false}--> 186 <!--{foreach key=key item=item from=$ tpl_arrBlocname="bloc_loop"}-->186 <!--{foreach key=key item=item from=$arrBlocs name="bloc_loop"}--> 187 187 <!--{if $item.target_id == $arrTarget[$smarty.const.TARGET_ID_MAIN_HEAD]}--> 188 188 <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> … … 192 192 <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 193 193 <!--{$item.name}--> 194 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{ $item.anywhere_selected}--> />全ページ)</label>194 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{if $item.anywhere == 1}-->checked="checked"<!--{/if}--> />全ページ)</label> 195 195 </div> 196 196 <!--{assign var="firstflg" value=true}--> … … 202 202 <td rowspan="3" id="<!--{$arrTarget[$smarty.const.TARGET_ID_RIGHT]}-->" class="ui-sortable"> 203 203 <!--{assign var="firstflg" value=false}--> 204 <!--{foreach key=key item=item from=$ tpl_arrBlocname="bloc_loop"}-->204 <!--{foreach key=key item=item from=$arrBlocs name="bloc_loop"}--> 205 205 <!--{if $item.target_id == $arrTarget[$smarty.const.TARGET_ID_RIGHT]}--> 206 206 <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> … … 210 210 <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 211 211 <!--{$item.name}--> 212 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{ $item.anywhere_selected}--> />全ページ)</label>212 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{if $item.anywhere == 1}-->checked="checked"<!--{/if}--> />全ページ)</label> 213 213 </div> 214 214 <!--{assign var="firstflg" value=true}--> … … 227 227 <td id="<!--{$arrTarget[$smarty.const.TARGET_ID_MAIN_FOOT]}-->" class="ui-sortable"> 228 228 <!--{assign var="firstflg" value=false}--> 229 <!--{foreach key=key item=item from=$ tpl_arrBlocname="bloc_loop"}-->229 <!--{foreach key=key item=item from=$arrBlocs name="bloc_loop"}--> 230 230 <!--{if $item.target_id == $arrTarget[$smarty.const.TARGET_ID_MAIN_FOOT]}--> 231 231 <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> … … 235 235 <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 236 236 <!--{$item.name}--> 237 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{ $item.anywhere_selected}--> />全ページ)</label>237 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{if $item.anywhere == 1}-->checked="checked"<!--{/if}--> />全ページ)</label> 238 238 </div> 239 239 <!--{assign var="firstflg" value=true}--> … … 248 248 <td colspan="3" id="<!--{$arrTarget[$smarty.const.TARGET_ID_BOTTOM]}-->" class="ui-sortable"> 249 249 <!--{assign var="firstflg" value=false}--> 250 <!--{foreach key=key item=item from=$ tpl_arrBlocname="bloc_loop"}-->250 <!--{foreach key=key item=item from=$arrBlocs name="bloc_loop"}--> 251 251 <!--{if $item.target_id == $arrTarget[$smarty.const.TARGET_ID_BOTTOM]}--> 252 252 <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> … … 256 256 <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 257 257 <!--{$item.name}--> 258 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{ $item.anywhere_selected}--> />全ページ)</label>258 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{if $item.anywhere == 1}-->checked="checked"<!--{/if}--> />全ページ)</label> 259 259 </div> 260 260 <!--{assign var="firstflg" value=true}--> … … 271 271 <td colspan="3" id="<!--{$arrTarget[$smarty.const.TARGET_ID_FOOTER_BOTTOM]}-->" class="ui-sortable"> 272 272 <!--{assign var="firstflg" value=false}--> 273 <!--{foreach key=key item=item from=$ tpl_arrBlocname="bloc_loop"}-->273 <!--{foreach key=key item=item from=$arrBlocs name="bloc_loop"}--> 274 274 <!--{if $item.target_id == $arrTarget[$smarty.const.TARGET_ID_FOOTER_BOTTOM]}--> 275 275 <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> … … 279 279 <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 280 280 <!--{$item.name}--> 281 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{ $item.anywhere_selected}--> />全ページ)</label>281 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{if $item.anywhere == 1}-->checked="checked"<!--{/if}--> />全ページ)</label> 282 282 </div> 283 283 <!--{assign var="firstflg" value=true}--> … … 300 300 <td id="<!--{$arrTarget[$smarty.const.TARGET_ID_UNUSED]}-->" class="ui-sortable" style="width: 145px;"> 301 301 <!--{assign var="firstflg" value=false}--> 302 <!--{foreach key=key item=item from=$ tpl_arrBlocname="bloc_loop"}-->302 <!--{foreach key=key item=item from=$arrBlocs name="bloc_loop"}--> 303 303 <!--{if $item.target_id == $arrTarget[$smarty.const.TARGET_ID_UNUSED]}--> 304 304 <div class="sort<!--{if !$firstflg}--> first<!--{/if}-->"> … … 308 308 <input type="hidden" class="top" name="top_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="<!--{$item.bloc_row}-->" /> 309 309 <!--{$item.name}--> 310 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{ $item.anywhere_selected}-->/>全ページ)</label>310 <label class="anywherecheck">(<input type="checkbox" class="anywhere" name="anywhere_<!--{$smarty.foreach.bloc_loop.iteration}-->" value="1" <!--{if $item.anywhere == 1}-->checked="checked"<!--{/if}--> />全ページ)</label> 311 311 </div> 312 312 <!--{assign var="firstflg" value=true}--> … … 322 322 <ul> 323 323 <!--{if $device_type_id == $smarty.const.DEVICE_TYPE_PC}--> 324 <li><a class="btn-action" href="javascript:;" name='preview' onclick="doPreview();" <!--{if $page_id == "0" or $exists_page == "0"}--> DISABLED<!--{/if}-->><span class="btn-prev">プレビュー</span></a></li>324 <li><a class="btn-action" href="javascript:;" name='preview' onclick="doPreview();"><span class="btn-prev">プレビュー</span></a></li> 325 325 <!--{/if}--> 326 326 <li><a class="btn-action" href="javascript:;" name='subm' onclick="fnTargetSelf(); fnFormModeSubmit('form1','confirm','',''); return false;"><span class="btn-next">登録する</span></a></li> -
branches/version-2_11-dev/data/class/SC_FormParam.php
r20764 r20830 415 415 $cnt++; 416 416 } 417 if( is_null($ret)){417 if(SC_Utils_Ex::isBlank($ret)){ 418 418 $ret = $default; 419 419 } -
branches/version-2_11-dev/data/class/helper/SC_Helper_PageLayout.php
r20764 r20830 35 35 36 36 /** 37 * ページのレイアウト情報をセットする. 38 * 39 * LC_Page オブジェクトにページのレイアウト情報をセットする. 40 * 41 * @param LC_Page $objPage ページ情報のインスタンス 37 * ページのレイアウト情報を取得し, 設定する. 38 * 39 * 現在の URL に応じたページのレイアウト情報を取得し, LC_Page インスタンスに 40 * 設定する. 41 * 42 * @access public 43 * @param LC_Page $objPage LC_Page インスタンス 42 44 * @param boolean $preview プレビュー表示の場合 true 43 45 * @param string $url ページのURL($_SERVER['PHP_SELF'] の情報) … … 46 48 */ 47 49 function sfGetPageLayout(&$objPage, $preview = false, $url = "", $device_type_id = DEVICE_TYPE_PC) { 48 $debug_message = ""; 49 $arrPageLayout = array(); 50 51 // 現在のURLの取得 50 51 // URLを元にページ情報を取得 52 52 if ($preview === false) { 53 53 $url = preg_replace('|^' . preg_quote(ROOT_URLPATH) . '|', '', $url); 54 55 // URLを元にページデザインを取得 56 $arrPageData = $this->lfGetPageData("device_type_id = ? AND url = ? AND page_id <> 0" , array($device_type_id, $url)); 57 } else { 58 // TODO 59 $arrPageData = $this->lfGetPageData("device_type_id = ? AND page_id = 0", array($device_type_id)); 60 $objPage->tpl_mainpage = $this->getTemplatePath($device_type_id) 61 . "preview/" . $arrPageData[0]['filename'] . ".tpl"; 62 } 63 64 $arrPageLayout = $arrPageData[0]; 65 66 $objPage->tpl_mainpage = $this->getTemplatePath($device_type_id) . $arrPageLayout['filename'] . ".tpl"; 54 $arrPageData = $this->getPageProperties($device_type_id, null, 'url = ?', array($url)); 55 } 56 // プレビューの場合は, プレビュー用のデータを取得 57 else { 58 $arrPageData = $this->getPageProperties($device_type_id, 0); 59 } 60 $objPage->tpl_mainpage = $this->getTemplatePath($device_type_id) . $arrPageData[0]['filename'] . ".tpl"; 61 $objPage->arrPageLayout =& $arrPageData[0]; 67 62 68 63 // ページタイトルを設定 69 if (!isset($objPage->tpl_title)) { 70 $objPage->tpl_title = $arrPageLayout['page_name']; 71 } 72 73 // 全ナビデータを取得する 74 $arrNavi = $this->lfGetNaviData($arrPageLayout['page_id'], $device_type_id); 64 if (SC_Utils_Ex::isBlank($objPage->tpl_title)) { 65 $objPage->tpl_title = $objPage->arrPageLayout['page_name']; 66 } 67 68 // 該当ページのブロックを取得し, 配置する 75 69 $masterData = new SC_DB_MasterData(); 76 70 $arrTarget = $masterData->getMasterData("mtb_target"); 77 78 foreach (array_keys($arrTarget) as $key) { 79 if (TARGET_ID_UNUSED != $key) { 80 $arrPageLayout[$arrTarget[$key]] 81 = $this->lfGetNavi($arrNavi, $key, $device_type_id); 71 $arrBlocs = $this->getBlocPositions($device_type_id, $objPage->arrPageLayout['page_id']); 72 // php_path, tpl_path が存在するものを, 各ターゲットに配置 73 foreach (array_keys($arrTarget) as $target_id) { 74 foreach ($arrBlocs as $arrBloc) { 75 if ($arrBloc['target_id'] != $target_id) { 76 continue; 77 } 78 if (is_file($arrBloc['php_path']) 79 || is_file($arrBloc['tpl_path'])) { 80 $objPage->arrPageLayout[$arrTarget[$target_id]][] = $arrBloc; 81 } else { 82 $error = "ブロックが見つかりません\n" 83 . "tpl_path: " . $arrBloc['tpl_path'] . "\n" 84 . "php_path: " . $arrBloc['php_path']; 85 GC_Utils_Ex::gfPrintLog($error); 86 } 82 87 } 83 88 } 84 $objPage->arrPageLayout = $arrPageLayout;85 86 89 // カラム数を取得する 87 $objPage->tpl_column_num = $this->lfGetColumnNum($arrPageLayout); 88 } 89 90 /** 91 * ページ情報を取得する. 92 * 93 * @param string $where クエリのWHERE句 94 * @param array $arrVal WHERE句の条件値 95 * @return array ページ情報を格納した配列 96 */ 97 function lfGetPageData($where = 'page_id <> 0', $arrVal = array()) { 98 $objQuery =& SC_Query_Ex::getSingletonInstance(); 90 $objPage->tpl_column_num = $this->getColumnNum($objPage->arrPageLayout); 91 } 92 93 /** 94 * ページの属性を取得する. 95 * 96 * この関数は, dtb_pagelayout の情報を検索する. 97 * $device_type_id は必須. デフォルト値は DEVICE_TYPE_PC. 98 * $page_id が null の場合は, $page_id が 0 以外のものを検索する. 99 * 100 * @access public 101 * @param integer $device_type_id 端末種別ID 102 * @param integer $page_id ページID; null の場合は, 0 以外を検索する. 103 * @param string $where 追加の検索条件 104 * @param array $arrParams 追加の検索パラメータ 105 * @return array ページ属性の配列 106 */ 107 function getPageProperties($device_type_id = DEVICE_TYPE_PC, $page_id = null, $where = '', $arrParams = array()) { 108 $objQuery =& SC_Query_Ex::getSingletonInstance(); 109 $where = 'device_type_id = ? ' . (SC_Utils_Ex::isBlank($where) ? $where : 'AND ' . $where); 110 if ($page_id === null) { 111 $where = 'page_id <> ? AND ' . $where; 112 $page_id = 0; 113 } else { 114 $where = 'page_id = ? AND ' . $where; 115 } 99 116 $objQuery->setOrder('page_id'); 100 return $objQuery->select("*", "dtb_pagelayout", $where, $arrVal); 101 } 102 103 /** 104 * ナビ情報を取得する. 105 * 117 $arrParams = array_merge(array($page_id, $device_type_id), $arrParams); 118 return $objQuery->select('*', 'dtb_pagelayout', $where, $arrParams); 119 } 120 121 /** 122 * ブロック情報を取得する. 123 * 124 * @access public 125 * @param integer $device_type_id 端末種別ID 126 * @param string $where 追加の検索条件 127 * @param array $arrParams 追加の検索パラメータ 128 * @param boolean $has_realpath php_path, tpl_path の絶対パスを含める場合 true 129 * @return array ブロック情報の配列 130 */ 131 function getBlocs($device_type_id = DEVICE_TYPE_PC, $where = '', $arrParams = array(), $has_realpath = true) { 132 $objQuery =& SC_Query_Ex::getSingletonInstance(); 133 $where = 'device_type_id = ? ' . (SC_Utils_Ex::isBlank($where) ? $where : 'AND ' . $where); 134 $arrParams = array_merge(array($device_type_id), $arrParams); 135 $objQuery->setOrder('bloc_id'); 136 $arrBlocs = $objQuery->select('*', 'dtb_bloc', $where, $arrParams); 137 if ($has_realpath) { 138 $this->setBlocPathTo($device_type_id, $arrBlocs); 139 } 140 return $arrBlocs; 141 } 142 143 /** 144 * ブロック配置情報を取得する. 145 * 146 * @access public 147 * @param integer $device_type_id 端末種別ID 106 148 * @param integer $page_id ページID 107 * @param integer $device_type_id 端末種別ID108 * @return array ナビ情報の配列109 */ 110 function lfGetNaviData($page_id, $device_type_id = DEVICE_TYPE_PC) {149 * @param boolean $has_realpath php_path, tpl_path の絶対パスを含める場合 true 150 * @return array 配置情報を含めたブロックの配列 151 */ 152 function getBlocPositions($device_type_id, $page_id, $has_realpath = true) { 111 153 $objQuery =& SC_Query_Ex::getSingletonInstance(); 112 154 $table = <<< __EOF__ … … 118 160 $where = "bloc.device_type_id = ? AND (anywhere = 1 OR pos.page_id = ?)"; 119 161 $objQuery->setOrder('target_id, bloc_row'); 120 return $objQuery->select("*", $table, $where, 121 array($device_type_id, $page_id)); 122 } 123 124 /** 125 * 各部分のナビ情報を取得する. 126 * 127 * @param array $arrNavi ナビ情報の配列 128 * @param integer $target_id ターゲットID 129 * @param integer $device_type_id 端末種別ID 130 * @return array ブロック情報の配列 131 */ 132 function lfGetNavi($arrNavi, $target_id, $device_type_id = DEVICE_TYPE_PC) { 133 $arrRet = array(); 134 if (is_array($arrNavi)) { 135 foreach ($arrNavi as $key => $val) { 136 // 指定された箇所と同じデータだけを取得する 137 if ($target_id == $val['target_id'] ) { 138 if ($val['php_path'] != '') { 139 $arrNavi[$key]['php_path'] = HTML_REALDIR . $val['php_path']; 140 } else { 141 $arrNavi[$key]['tpl_path'] = $this->getTemplatePath($device_type_id) . BLOC_DIR . $val['tpl_path']; 142 } 143 // phpから呼び出されるか、tplファイルが存在する場合 144 if ($val['php_path'] != '' || is_file($arrNavi[$key]['tpl_path'])) { 145 $arrRet[] = $arrNavi[$key]; 146 } else { 147 GC_Utils_Ex::gfPrintLog("ブロック読み込みエラー:" . $arrNavi[$key]['tpl_path']); 148 } 149 } 150 } 151 } 152 return $arrRet; 153 } 154 155 /** 156 * カラム数を取得する. 157 * 158 * @param array $arrPageLayout レイアウト情報の配列 159 * @return integer $col_num カラム数 160 */ 161 function lfGetColumnNum($arrPageLayout) { 162 // メインは確定 163 $col_num = 1; 164 // LEFT NAVI 165 if (count($arrPageLayout['LeftNavi']) > 0) $col_num++; 166 // RIGHT NAVI 167 if (count($arrPageLayout['RightNavi']) > 0) $col_num++; 168 169 return $col_num; 162 $arrBlocs = $objQuery->select("*", $table, $where, 163 array($device_type_id, $page_id)); 164 if ($has_realpath) { 165 $this->setBlocPathTo($device_type_id, $arrBlocs); 166 } 167 return $arrBlocs; 170 168 } 171 169 … … 173 171 * ページ情報を削除する. 174 172 * 173 * XXX ファイルを確実に削除したかどうかのチェック 174 * 175 * @access public 175 176 * @param integer $page_id ページID 176 177 * @param integer $device_type_id 端末種別ID … … 183 184 // page_id が空でない場合にはdeleteを実行 184 185 if ($page_id != '') { 185 186 $arrPageData = $this->lfGetPageData("page_id = ? AND device_type_id = ?" , array($page_id, $device_type_id)); 186 $arrPageData = $this->getPageProperties($device_type_id, $page_id); 187 187 // SQL実行 188 188 $ret = $objQuery->delete("dtb_pagelayout", "page_id = ? AND device_type_id = ?", array($page_id, $device_type_id)); … … 198 198 * 199 199 * dtb_pagelayout の削除後に呼び出すこと。 200 * 201 * @access private 200 202 * @param string $filename 201 203 * @param integer $device_type_id 端末種別ID … … 224 226 225 227 /** 226 * データがベースデータかどうか. 227 * 228 * 編集可能ページかどうか. 229 * 230 * @access public 231 * @param integer $device_type_id 端末種別ID 228 232 * @param integer $page_id ページID 229 * @param integer $device_type_id 端末種別ID 230 * @return boolean ベースデータの場合 true 231 */ 232 function lfCheckBaseData($page_id, $device_type_id) { 233 $result = false; 234 233 * @return 編集可能ページの場合 true 234 */ 235 function isEditablePage($device_type_id, $page_id) { 235 236 if ($page_id == 0) { 236 return $result; 237 } 238 239 $arrChkData = $this->lfgetPageData("page_id = ? AND device_type_id = ?", 240 array($page_id, $device_type_id)); 241 242 if ($arrChkData[0]['edit_flg'] == 2) { 243 $result = true; 244 } 245 246 return $result; 237 return false; 238 } 239 $arrPages = $this->getPageProperties($device_type_id, $page_id); 240 if ($arrPages[0]['edit_flg'] != 2) { 241 return true; 242 } 243 return false; 247 244 } 248 245 249 246 /** 250 247 * テンプレートのパスを取得する. 248 * 249 * @access public 250 * @param integer $device_type_id 端末種別ID 251 * @param boolean $isUser USER_REALDIR 以下のパスを返す場合 true 252 * @return string テンプレートのパス 251 253 */ 252 254 function getTemplatePath($device_type_id = DEVICE_TYPE_PC, $isUser = false) { … … 281 283 * を取得する. 282 284 * 285 * @access public 283 286 * @param integer $device_type_id 端末種別ID 284 287 * @param boolean $hasPackage パッケージのパスも含める場合 true … … 305 308 return $userDir; 306 309 } 310 311 // }}} 312 // {{{ private functions 313 314 /** 315 * ブロックの php_path, tpl_path を設定する. 316 * 317 * @access private 318 * @param integer $device_type_id 端末種別ID 319 * @param array $arrBlocs 設定するブロックの配列 320 * @return void 321 */ 322 function setBlocPathTo($device_type_id = DEVICE_TYPE_PC, &$arrBlocs) { 323 foreach (array_keys($arrBlocs) as $key) { 324 $arrBloc =& $arrBlocs[$key]; 325 $arrBloc['php_path'] = SC_Utils_Ex::isBlank($arrBloc['php_path']) ? '' : HTML_REALDIR . $arrBloc['php_path']; 326 $bloc_dir = $this->getTemplatePath($device_type_id) . BLOC_DIR; 327 $arrBloc['tpl_path'] = SC_Utils_Ex::isBlank($arrBloc['tpl_path']) ? '' : $bloc_dir . $arrBloc['tpl_path']; 328 } 329 } 330 331 /** 332 * カラム数を取得する. 333 * 334 * @access private 335 * @param array $arrPageLayout レイアウト情報の配列 336 * @return integer $col_num カラム数 337 */ 338 function getColumnNum($arrPageLayout) { 339 // メインは確定 340 $col_num = 1; 341 // LEFT NAVI 342 if (count($arrPageLayout['LeftNavi']) > 0) $col_num++; 343 // RIGHT NAVI 344 if (count($arrPageLayout['RightNavi']) > 0) $col_num++; 345 346 return $col_num; 347 } 307 348 } 308 349 ?> -
branches/version-2_11-dev/data/class/pages/admin/design/LC_Page_Admin_Design.php
r20764 r20830 28 28 * デザイン管理 のページクラス. 29 29 * 30 * ターゲットID 0:未使用 1:レフトナビ 2:ライトナビ 3:イン画面上部 4:メイン画面下部 5:画面上部 6:画面下部 7:ヘッダより上 8:フッタより下 9:HEADタグ内 10:ヘッダ内部31 30 * @package Page 32 31 * @author LOCKON CO.,LTD. … … 68 67 * Page のアクション. 69 68 * 70 * TODO パラメータの数値チェック71 *72 69 * @return void 73 70 */ 74 71 function action() { 75 72 $objLayout = new SC_Helper_PageLayout_Ex(); 76 77 // ページIDを取得 78 if (isset($_REQUEST['page_id']) && is_numeric($_REQUEST['page_id'])) { 79 $page_id = $_REQUEST['page_id']; 80 } else { 81 $page_id = 1; // FIXME $_REQUEST['page_id'] を受け取れない不具合時に不正処理が行なわれる原因となった 82 } 83 // 端末種別IDを取得 84 if (isset($_REQUEST['device_type_id']) 85 && is_numeric($_REQUEST['device_type_id'])) { 86 $device_type_id = $_REQUEST['device_type_id']; 87 } else { 88 $device_type_id = DEVICE_TYPE_PC; 89 } 90 91 //サブタイトルの追加 92 $this->tpl_subtitle .= ' - ' . $this->arrDeviceType[$device_type_id]; 93 94 // 編集可能ページを取得 95 $this->arrEditPage = $objLayout->lfGetPageData("page_id <> 0 AND device_type_id = ?", array($device_type_id)); 96 97 // レイアウト情報を取得 98 $arrBlocPos = $objLayout->lfGetNaviData($page_id, $device_type_id); 99 100 // データの存在チェックを行う 101 $arrPageData = $objLayout->lfGetPageData("page_id = ? AND device_type_id = ?", array($page_id, $device_type_id)); 102 103 if (count($arrPageData) <= 0) { 104 $this->exists_page = 0; 105 }else{ 106 $this->exists_page = 1; 107 } 108 109 // メッセージ表示 110 if (isset($_GET['msg']) && $_GET['msg'] == 'on') { 111 $this->complate_msg="alert('登録が完了しました。');"; 112 } 113 114 // ブロックを取得 115 $objQuery = SC_Query_Ex::getSingletonInstance(); 116 $arrBloc = $objQuery->select("*", "dtb_bloc", "device_type_id = ?", array($device_type_id)); 73 $objFormParam = new SC_FormParam_Ex(); 74 $this->lfInitParam($objFormParam, intval($_REQUEST['bloc_cnt'])); 75 $objFormParam->setParam($_REQUEST); 76 77 $this->device_type_id = $objFormParam->getValue('device_type_id', DEVICE_TYPE_PC); 78 $this->page_id = $objFormParam->getValue('page_id', 1); 117 79 118 80 switch ($this->getMode()) { 119 81 // 新規ブロック作成 120 82 case 'new_bloc': 121 SC_Response_Ex::sendRedirect('bloc.php', array("device_type_id" => $ device_type_id));83 SC_Response_Ex::sendRedirect('bloc.php', array("device_type_id" => $this->device_type_id)); 122 84 exit; 123 85 break; … … 125 87 // 新規ページ作成 126 88 case 'new_page': 127 SC_Response_Ex::sendRedirect('main_edit.php', array("device_type_id" => $ device_type_id));89 SC_Response_Ex::sendRedirect('main_edit.php', array("device_type_id" => $this->device_type_id)); 128 90 exit; 129 91 break; 130 92 93 // プレビュー 94 case 'preview': 95 $this->placingBlocs($objFormParam, true); 96 $filename = $this->savePreviewData($this->page_id, $objLayout); 97 $_SESSION['preview'] = 'ON'; 98 SC_Response_Ex::sendRedirectFromUrlPath('preview/' . DIR_INDEX_PATH, array('filename' => $filename)); 99 exit; 100 101 // 編集実行 131 102 case 'confirm': 132 case 'preview': 133 //TODO 要リファクタリング(MODE if利用) 134 $page_id = $_POST['page_id']; 135 if ($this->getMode() == 'preview') { 136 $page_id = '0'; 137 } 138 139 // 更新用にデータを整える 140 $arrUpdBlocData = array(); 141 142 // delete実行 143 $arrRet = $objQuery->delete("dtb_blocposition", 144 "page_id = ? AND device_type_id = ?", 145 array($page_id, $device_type_id)); 146 147 $arrTargetFlip = array_flip($this->arrTarget); 148 149 // POSTのデータを使いやすいように修正 150 for ($upd_cnt = 1; $upd_cnt <= $_POST['bloc_cnt']; $upd_cnt++) { 151 if (!isset($_POST['id_'.$upd_cnt])) { 152 break; 153 } 154 155 // ブロック名称 156 $arrUpdBlocData[$upd_cnt]['name'] = $_POST['name_'.$upd_cnt]; 157 // ブロックID 158 $arrUpdBlocData[$upd_cnt]['id'] = $_POST['id_'.$upd_cnt]; 159 // ターゲットID 160 $arrUpdBlocData[$upd_cnt]['target_id'] = $arrTargetFlip[$_POST['target_id_'.$upd_cnt]]; 161 // TOP座標 162 $arrUpdBlocData[$upd_cnt]['top'] = $_POST['top_'.$upd_cnt]; 163 // 全ページ適用か 164 $arrUpdBlocData[$upd_cnt]['anywhere'] = $_POST['anywhere_'.$upd_cnt]; 165 // 更新URL 166 $arrUpdBlocData[$upd_cnt]['update_url'] = $_SERVER['HTTP_REFERER']; 167 } 168 169 // ブロックの順序を取得し、更新を行う 170 foreach ($arrUpdBlocData as $key => $val) { 171 if ($arrUpdBlocData[$key]['target_id'] == TARGET_ID_UNUSED) { 172 continue; 173 } 174 175 // ブロックの順序を取得 176 $arrUpdBlocData[$key]['bloc_row'] = $this->lfGetRowID($arrUpdBlocData, $val); 177 178 // insertデータ生成 179 $arrInsData = array('device_type_id' => $device_type_id, 180 'page_id' => $page_id, 181 'target_id' => $arrUpdBlocData[$key]['target_id'], 182 'bloc_id' => $arrUpdBlocData[$key]['id'], 183 'bloc_row' => $arrUpdBlocData[$key]['bloc_row'], 184 'anywhere' => $arrUpdBlocData[$key]['anywhere'] ? 1 : 0); 185 $count = $objQuery->getOne("SELECT COUNT(*) FROM dtb_blocposition WHERE anywhere = 1 AND bloc_id = ? AND device_type_id = ?", 186 array($arrUpdBlocData[$key]['id'], $device_type_id)); 187 188 if ($arrUpdBlocData[$key]['anywhere'] == 1) { 189 $count = $objQuery->getOne("SELECT COUNT(*) FROM dtb_blocposition WHERE anywhere = 1 AND bloc_id = ? AND device_type_id = ?", 190 array($arrUpdBlocData[$key]['id'], $device_type_id)); 191 if ($count != 0) { 192 continue; 193 } 194 } else { 195 if ($count > 0) { 196 $objQuery->query("DELETE FROM dtb_blocposition WHERE anywhere = 1 AND bloc_id = ? AND device_type_id = ?", 197 array($arrUpdBlocData[$key]['id'], $device_type_id)); 198 } 199 } 200 // SQL実行 201 $arrRet = $objQuery->insert("dtb_blocposition", $arrInsData); 202 } 203 204 // プレビュー処理 TODO 要リファクタリング(MODE if利用) 205 if ($this->getMode() == 'preview') { 206 $this->lfSetPreData($arrPageData, $objLayout); 207 208 $_SESSION['preview'] = 'ON'; 209 210 SC_Response_Ex::sendRedirectFromUrlPath('preview/' . DIR_INDEX_PATH, array('filename' => $arrPageData[0]['filename'])); 211 exit; 212 213 } else { 214 $arrQueryString = array("device_type_id" => $device_type_id, "page_id" => $page_id, 'msg' => 'on'); 215 SC_Response_Ex::reload($arrQueryString, true); 216 exit; 217 } 103 $this->placingBlocs($objFormParam); 104 $arrQueryString = array("device_type_id" => $this->device_type_id, "page_id" => $this->page_id, 'msg' => 'on'); 105 SC_Response_Ex::reload($arrQueryString, true); 106 exit; 107 218 108 break; 219 109 … … 221 111 case 'delete': 222 112 //ベースデータでなければファイルを削除 223 if ( !$objLayout->lfCheckBaseData($page_id, $device_type_id)) {224 $objLayout->lfDelPageData($ page_id, $device_type_id);225 SC_Response_Ex::reload(array('device_type_id' => $ device_type_id), true);113 if ($objLayout->isEditablePage($this->device_type_id, $this->page_id)) { 114 $objLayout->lfDelPageData($this->page_id, $this->device_type_id); 115 SC_Response_Ex::reload(array('device_type_id' => $this->device_type_id), true); 226 116 exit; 227 117 } … … 229 119 230 120 default: 231 } 232 233 // ブロック情報を画面配置用に編集 234 $tpl_arrBloc = array(); 235 $cnt = 0; 236 // 使用されているブロックデータを生成 237 foreach($arrBlocPos as $key => $val){ 238 if ($val['page_id'] == $page_id) { 239 $tpl_arrBloc = $this->lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt); 240 $cnt++; 241 } 242 } 243 // 未使用のブロックデータを追加 244 foreach($arrBloc as $key => $val){ 245 if (!$this->lfChkBloc($val, $tpl_arrBloc)) { 246 $val['target_id'] = TARGET_ID_UNUSED; // 未使用に追加する 247 $tpl_arrBloc = $this->lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt); 248 $cnt++; 249 } 250 } 251 252 $this->tpl_arrBloc = $tpl_arrBloc; 253 $this->bloc_cnt = count($tpl_arrBloc); 254 $this->page_id = $page_id; 255 $this->device_type_id = $device_type_id; 256 257 // ページ名称を取得 258 $arrPageData = $objLayout->lfGetPageData('page_id = ? AND device_type_id = ?', array($page_id, $device_type_id)); 259 $this->arrPageData = $arrPageData[0]; 260 261 global $GLOBAL_ERR; 262 $errCnt = 0; 263 if ($GLOBAL_ERR != "") { 264 $arrGlobalErr = explode("\n",$GLOBAL_ERR); 265 $errCnt = count($arrGlobalErr) - 8; 266 if ($errCnt < 0 ) { 267 $errCnt = 0; 268 } 269 } 270 $this->errCnt = $errCnt; 121 // 完了メッセージ表示 122 if (isset($_GET['msg']) && $_GET['msg'] == 'on') { 123 $this->tpl_onload="alert('登録が完了しました。');"; 124 } 125 } 126 127 $this->arrBlocs = $this->getLayout($this->device_type_id, $this->page_id, $objLayout); 128 $this->bloc_cnt = count($this->arrBlocs); 129 // 編集中のページ 130 $this->arrPageData = $objLayout->getPageProperties($this->device_type_id, $this->page_id); 131 // 編集可能ページ一覧 132 $this->arrEditPage = $objLayout->getPageProperties($this->device_type_id, null); 133 //サブタイトルを取得 134 $this->tpl_subtitle .= ' - ' . $this->arrDeviceType[$this->device_type_id]; 271 135 } 272 136 … … 281 145 282 146 /** 283 * ブロック情報の配列を生成する. 284 * 285 * @param array $arrBloc Bloc情報 286 * @param array $tpl_arrBloc データをセットする配列 287 * @param array $val DBから取得したブロック情報 147 * フォームパラメータの初期化を行う. 148 * 149 * @param SC_FormParam $objFormParam SC_FormParam インスタンス. 150 * @param integer $bloc_cnt ブロック数 151 * @return void 152 */ 153 function lfInitParam(&$objFormParam, $bloc_cnt = 0) { 154 $objFormParam->addParam("ページID", "page_id", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); 155 $objFormParam->addParam("端末種別ID", "device_type_id", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); 156 $objFormParam->addParam("ブロック数", "bloc_cnt", INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); 157 158 for ($i = 1; $i <= $bloc_cnt; $i++) { 159 $objFormParam->addParam("ブロック名", "name_" . $i, STEXT_LEN, 'a', array("MAX_LENGTH_CHECK", "GRAPH_CHECK")); 160 $objFormParam->addParam("ブロックID", "id_" . $i, INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); 161 $objFormParam->addParam("ターゲットID", "target_id_" . $i, STEXT_LEN, 'a', array("MAX_LENGTH_CHECK", "ALNUM_CHECK")); 162 $objFormParam->addParam("TOP座標", "top_" . $i, INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); 163 $objFormParam->addParam("全ページ", "anywhere_" . $i, INT_LEN, 'n', array("MAX_LENGTH_CHECK", "NUM_CHECK")); 164 } 165 } 166 167 /** 168 * ブロックのレイアウト情報を取得する. 169 * 170 * @param integer $device_type_id 端末種別ID 171 * @param integer $page_id ページID 172 * @param SC_Helper_PageLayout $objLayout SC_Helper_PageLayout インスタンス 173 * @return array レイアウト情報の配列 174 */ 175 function getLayout($device_type_id, $page_id, &$objLayout) { 176 $arrResults = array(); 177 $i = 0; 178 179 // レイアウト済みのブロックデータを追加 180 $arrBlocPos = $objLayout->getBlocPositions($device_type_id, $page_id); 181 foreach($arrBlocPos as $arrBloc){ 182 $this->copyBloc($arrResults, $arrBloc, $i); 183 $i++; 184 } 185 186 // 未使用のブロックデータを追加 187 $arrBloc = $objLayout->getBlocs($device_type_id); 188 foreach($arrBloc as $arrBloc){ 189 if (!$this->existsBloc($arrBloc, $arrResults)) { 190 $arrBloc['target_id'] = TARGET_ID_UNUSED; 191 $this->copyBloc($arrResults, $arrBloc, $i); 192 $i++; 193 } 194 } 195 return $arrResults; 196 } 197 198 /** 199 * ブロック情報の配列をコピーする. 200 * 201 * @param array $arrDest コピー先ブロック情報 202 * @param array $arrFrom コピー元ブロック情報 288 203 * @param integer $cnt 配列番号 289 * @return array データをセットした配列 290 */ 291 function lfSetBlocData($arrBloc, $val, $tpl_arrBloc, $cnt) { 292 293 $tpl_arrBloc[$cnt]['target_id'] = $this->arrTarget[$val['target_id']]; 294 $tpl_arrBloc[$cnt]['bloc_id'] = $val['bloc_id']; 295 $tpl_arrBloc[$cnt]['bloc_row'] = 296 isset($val['bloc_row']) ? $val['bloc_row'] : ""; 297 $tpl_arrBloc[$cnt]['anywhere'] = $val['anywhere']; 298 if($val['anywhere'] == 1){ 299 $tpl_arrBloc[$cnt]['anywhere_selected'] = 'checked="checked"'; 300 } 301 foreach($arrBloc as $bloc_key => $bloc_val){ 302 if ($bloc_val['bloc_id'] == $val['bloc_id']) { 303 $bloc_name = $bloc_val['bloc_name']; 304 break; 305 } 306 } 307 $tpl_arrBloc[$cnt]['name'] = $bloc_name; 308 309 return $tpl_arrBloc; 310 } 311 312 /** 313 * ブロックIDが配列に追加されているかのチェックを行う. 314 * 315 * @param array $arrBloc Bloc情報 316 * @param array $arrChkData チェックを行うデータ配列 204 * @return void 205 */ 206 function copyBloc(&$arrDest, $arrFrom, $cnt) { 207 $arrDest[$cnt]['target_id'] = $this->arrTarget[$arrFrom['target_id']]; 208 $arrDest[$cnt]['bloc_id'] = $arrFrom['bloc_id']; 209 $arrDest[$cnt]['bloc_row'] = $arrFrom['bloc_row']; 210 $arrDest[$cnt]['anywhere'] = $arrFrom['anywhere']; 211 $arrDest[$cnt]['name'] = $arrFrom['bloc_name']; 212 } 213 214 /** 215 * ブロックIDがコピー先の配列に追加されているかのチェックを行う. 216 * 217 * @param array $arrBloc ブロックの配列 218 * @param array $arrToBlocs チェックを行うデータ配列 317 219 * @return bool 存在する場合 true 318 220 */ 319 function lfChkBloc($arrBloc, $arrChkData) { 320 foreach($arrChkData as $key => $val){ 321 if ($val['bloc_id'] === $arrBloc['bloc_id'] ) { 322 // 配列に存在すればTrueを返す 221 function existsBloc($arrBloc, $arrToBlocs) { 222 foreach($arrToBlocs as $arrToBloc){ 223 if ($arrBloc['bloc_id'] === $arrToBloc['bloc_id'] ) { 323 224 return true; 324 225 } 325 226 } 326 327 // 配列に存在しなければFlaseを返す328 227 return false; 329 228 } 330 229 331 230 /** 332 * ブロックIDが何番目に配置されているかを調べる.333 *334 * @param array $arrUpdData 更新情報335 * @param array $arrObj チェックを行うデータ配列336 * @return integer 順番337 */338 function lfGetRowID($arrUpdData, $arrObj){339 $no = 0; // カウント用(同じデータが必ず1件あるので、初期値は0)340 341 // 対象データが何番目に配置されているのかを取得する。342 foreach ($arrUpdData as $key => $val) {343 if ($val['target_id'] === $arrObj['target_id'] and $val['top'] <= $arrObj['top']){344 $no++;345 }346 }347 // 番号を返す348 return $no;349 }350 351 /**352 231 * プレビューするデータを DB に保存する. 353 232 * 354 * FIXME 355 * 356 * @param array $arrPageData ページ情報の配列 357 * @return void 358 */ 359 function lfSetPreData($arrPageData, &$objLayout){ 360 $objQuery = new SC_Query_Ex(); // DB操作オブジェクト 361 $sql = ""; // データ更新SQL生成用 362 $ret = ""; // データ更新結果格納用 363 $arrUpdData = array(); // 更新データ生成用 364 $filename = $arrPageData[0]['filename']; 365 366 $arrPreData = $objLayout->lfgetPageData(" page_id = ? " , array("0")); 367 368 // XXX tplファイルの削除 369 $del_tpl = USER_REALDIR . "templates/" . $filename . '.tpl'; 370 371 if (file_exists($del_tpl)){ 372 unlink($del_tpl); 373 } 374 375 // filename が空の場合にはMYページと判断 376 if($filename == ""){ 377 $tplfile = TEMPLATE_REALDIR . "mypage/index"; 378 $filename = 'mypage'; 379 } else { 380 $tplfile = TEMPLATE_REALDIR . $filename; 381 } 382 383 // プレビュー用tplファイルのコピー 384 $copyTo = USER_REALDIR . "templates/preview/" . TEMPLATE_NAME . "/" . $filename . ".tpl"; 385 386 if (!is_dir(dirname($copyTo))) { 387 mkdir(dirname($copyTo)); 388 } 389 390 copy($tplfile . ".tpl", $copyTo); 391 392 // 更新データの取得 393 $sql = "select page_id,page_name, header_chk, footer_chk from dtb_pagelayout where page_id = ? OR page_id = ANY (SELECT page_id FROM dtb_blocposition WHERE anywhere = 1)" ; 394 395 $ret = $objQuery->getAll($sql, array($arrPageData[0]['page_id'])); 396 397 // dbデータのコピー 398 $sql = " update dtb_pagelayout set "; 399 $sql .= " page_name = ?"; 400 $sql .= " ,header_chk = ?"; 401 $sql .= " ,footer_chk = ?"; 402 $sql .= " ,url = ?"; 403 $sql .= " ,filename = ?"; 404 // $sql .= " ,anywhere = ?"; 405 $sql .= " where page_id = 0"; 406 var_dump($ret); 407 echo("####<br/>\n\n".__LINE__ ." in file:".__FILE__."<br/>\n\n ####"); 408 409 $arrUpdData = array($ret[0]['page_id'] 410 ,$ret[0]['page_id'] 411 ,$ret[0]['page_id'] 412 ,USER_DIR . "templates/" . TEMPLATE_NAME . "/" 413 ,$filename 414 // ,$ret[0]['anywhere'] 415 416 ); 417 418 $objQuery->query($sql,$arrUpdData); 233 * @param integer $page_id プレビューを行うページID 234 * @param SC_Helper_PageLayout $objLayout SC_Helper_PageLayout インスタンス 235 * @return string プレビューを行う tpl_mainpage ファイル名 236 */ 237 function savePreviewData($page_id, &$objLayout){ 238 $arrPageData = $objLayout->getPageProperties(DEVICE_TYPE_PC, $page_id); 239 $objQuery =& SC_Query_Ex::getSingletonInstance(); 240 $arrPageData[0]['page_id'] = 0; 241 $objQuery->update('dtb_pagelayout', $arrPageData[0], 'page_id = 0 AND device_type_id = ?', array(DEVICE_TYPE_PC)); 242 return $arrPageData[0]['filename']; 243 } 244 245 /** 246 * ブロックを配置する. 247 * 248 * @param SC_FormParam $objFormParam SC_FormParam インスタンス 249 * @param boolean $is_preview プレビュー時の場合 true 250 * @return void 251 */ 252 function placingBlocs(&$objFormParam, $is_preview = false) { 253 $page_id = $is_preview ? 0 : $objFormParam->getValue('page_id'); 254 $device_type_id = $objFormParam->getValue('device_type_id'); 255 $bloc_cnt = $objFormParam->getValue('bloc_cnt'); 256 $objQuery =& SC_Query_Ex::getSingletonInstance(); 257 $objQuery->begin(); 258 $objQuery->delete("dtb_blocposition", "page_id = ? AND device_type_id = ?", 259 array($page_id, $device_type_id)); 260 $arrTargetFlip = array_flip($this->arrTarget); 261 var_dump($objFormParam->getHashArray()); 262 var_dump($_POST); 263 for ($i = 1; $i <= $bloc_cnt; $i++) { 264 // bloc_id が取得できない場合は INSERT しない 265 $id = $objFormParam->getValue('id_' . $i); 266 if (SC_Utils_Ex::isBlank($id)) { 267 continue; 268 } 269 // 未使用は INSERT しない 270 $arrParams['target_id'] = $arrTargetFlip[$objFormParam->getValue('target_id_' . $i)]; 271 if ($arrParams['target_id'] == TARGET_ID_UNUSED) { 272 continue; 273 } 274 275 // 他のページに anywhere が存在する場合は INSERT しない 276 $arrParams['anywhere'] = intval($objFormParam->getValue('anywhere_' . $i)); 277 if ($arrParams['anywhere'] == 1) { 278 $count = $objQuery->count('dtb_blocposition', 'anywhere = 1 AND bloc_id = ? AND device_type_id = ?', 279 array($id, $device_type_id)); 280 if ($count > 0) { 281 continue; 282 } 283 } 284 285 $arrParams['device_type_id'] = $device_type_id; 286 $arrParams['page_id'] = $page_id; 287 $arrParams['bloc_id'] = $id; 288 $arrParams['bloc_row'] = $objFormParam->getValue('top_' . $i); 289 290 $objQuery->insert("dtb_blocposition", $arrParams); 291 } 292 $objQuery->commit(); 419 293 } 420 294 } -
branches/version-2_11-dev/data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php
r20813 r20830 92 92 93 93 // ページ一覧を取得 94 $this->arrPageList = $this->objLayout->lfGetPageData("page_id <> 0 AND device_type_id = ?", 95 array($device_type_id)); 94 $this->arrPageList = $this->objLayout->getPageProperties($device_type_id, null); 96 95 97 96 // メッセージ表示 … … 107 106 switch ($this->getMode()) { 108 107 case 'delete': 109 if ( !$this->objLayout->lfCheckBaseData($page_id, $device_type_id)) {108 if ($this->objLayout->isEditablePage($device_type_id, $page_id)) { 110 109 $this->lfDeletePageData($page_id, $device_type_id); 111 110 exit; … … 138 137 */ 139 138 function lfGetPageData($page_id, $device_type_id, $objView){ 140 $arrPageData = $this->objLayout->lfGetPageData("page_id = ? AND device_type_id = ?", 141 array($page_id, $device_type_id)); 139 $arrPageData = $this->objLayout->getPageProperties($device_type_id, $page_id); 142 140 143 141 if (strlen($arrPageData[0]['filename']) == 0) { … … 183 181 $page_id = $arrTmp['page_id']; 184 182 185 $arrTmp = $this->objLayout-> lfGetPageData('page_id = ? AND device_type_id = ?', array($page_id, $device_type_id));183 $arrTmp = $this->objLayout->getPageProperties($device_type_id, $page_id); 186 184 $arrData = $arrTmp[0]; 187 185 188 186 // ベースデータでなければファイルを削除し、PHPファイルを作成する 189 if ( !$this->objLayout->lfCheckBaseData($arrData['page_id'], $device_type_id)) {187 if ($this->objLayout->isEditablePage($device_type_id, $arrData['page_id'])) { 190 188 // PHPファイル作成 191 189 $this->lfCreatePHPFile($_POST['url'], $device_type_id); … … 231 229 // データが存在しているかチェックを行う 232 230 if ($page_id !== ''){ 233 $arrChk = $this->objLayout->lfGetPageData("page_id = ? AND device_type_id = ?", 234 array($page_id, $device_type_id)); 231 $arrChk = $this->objLayout->getPageProperties($device_type_id, $page_id); 235 232 } 236 233 … … 273 270 274 271 // ベースデータの場合には変更しない。 275 if ( !$this->objLayout->lfCheckBaseData($page_id, $device_type_id)) {272 if ($this->objLayout->isEditablePage($device_type_id, $page_id)) { 276 273 $arrUpdData['page_name'] = $page_name; 277 274 $arrUpdData['url'] = $filename . '.php'; … … 295 292 /** 296 293 * 入力項目のエラーチェックを行う. 294 * 295 * XXX $device_type_id が dtb_pagelayout の検索条件に入ってない 297 296 * 298 297 * @param array $arrData 入力データ … … 334 333 } 335 334 336 $arrChk = $this->objLayout->lfgetPageData($sqlWhere , $params); 335 $objQuery =& SC_Query_Ex::getSingletonInstance(); 336 $arrChk = $objQuery->select('*', 'dtb_pagelayout', $sqlWhere, $params); 337 337 338 338 if (count($arrChk) >= 1) {
Note: See TracChangeset
for help on using the changeset viewer.