Ignore:
Timestamp:
2011/01/19 14:36:49 (13 years ago)
Author:
kotani
Message:

#748 モバイル/スマートフォンのデザイン管理機能

  • SEO管理をデバイス毎に登録できるように改修
Location:
branches/version-2_5-dev/data
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/Smarty/templates/admin/basis/seo.tpl

    r19954 r19967  
    2424<form name="form1" id="form1" method="post" action="?" onSubmit="return window.confirm('登録しても宜しいですか');"> 
    2525<input type="hidden" name="mode" value="confirm"> 
     26<input type="hidden" name="device_type_id" value="" /> 
    2627<input type="hidden" name="page_id" value="" /> 
    2728<div id="basis" class="contents-main"> 
    2829  <!--{if count($arrPageData) > 0 }--> 
    29     <!--{foreach name=page key=key item=item from=$arrPageData}--> 
    30     <input type="hidden" name="disp_flg<!--{$item.page_id}-->" value="<!--{$disp_flg[$item.page_id]}-->" /> 
     30    <!--{foreach name=device key=device_key item=arrDevicePageData from=$arrPageData}--> 
     31    <!--{if count($arrDevicePageData) > 0 }--> 
     32    <!--{foreach name=page key=key item=item from=$arrDevicePageData}--> 
    3133    <!-- <!--{$item.page_name}--> ここから --> 
    32     <h2><!--{$item.page_name}--> <!--{$item.url}--><a href="#" id="switch<!--{$item.page_id}-->" style="float:right " onClick="fnDispChange('disp<!--{$item.page_id}-->', 'switch<!--{$item.page_id}-->', 'disp_flg<!--{$item.page_id}-->');"><!--{if $disp_flg[$item.page_id] == ""}--> &gt;&gt; 非表示<!--{else}--> << 表示<!--{/if}--></a></h2> 
     34    <!--{if $smarty.foreach.page.first == true}--><h1><!--{$arrDeviceTypeName[$item.device_type_id]}--></h1><!--{/if}--> 
     35    <h2><!--{$item.page_name}--> <!--{$item.url}--></h2> 
    3336     
    34     <div id="disp<!--{$item.page_id}-->" style="display:<!--{$disp_flg[$item.page_id]}-->"> 
     37    <div id=" 
     38         _<!--{$item.device_type_id}-->_<!--{$item.page_id}-->"> 
    3539      <table> 
    3640        <tr> 
    3741          <th>メタタグ:Author</th> 
    3842          <td> 
    39           <span class="attention"><!--{$arrErr[$item.page_id].author}--></span> 
    40           <input type="text" name="meta[<!--{$item.page_id}-->][author]" value="<!--{$item.author|h}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" size="60" class="box60" style='<!--{if $arrErr[$item.page_id].author != ""}-->background-color: <!--{$smarty.const.ERR_COLOR}-->;<!--{/if}-->' /><span class="attention"> (上限<!--{$smarty.const.STEXT_LEN}-->文字)</span></td> 
     43          <span class="attention"><!--{$arrErr[$item.device_type_id][$item.page_id].author}--></span> 
     44          <input type="text" name="meta[<!--{$item.device_type_id}-->][<!--{$item.page_id}-->][author]" value="<!--{$item.author|h}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" size="60" class="box60" style='<!--{if $arrErr[$item.page_id].author != ""}-->background-color: <!--{$smarty.const.ERR_COLOR}-->;<!--{/if}-->' /><span class="attention"> (上限<!--{$smarty.const.STEXT_LEN}-->文字)</span></td> 
    4145        </tr> 
    4246        <tr> 
    4347          <th>メタタグ:Description</th> 
    4448          <td> 
    45           <span class="attention"><!--{$arrErr[$item.page_id].description}--></span> 
    46           <input type="text" name="meta[<!--{$item.page_id}-->][description]" value="<!--{$item.description|h}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" size="60" class="box60" style='<!--{if $arrErr[$item.page_id].description != ""}-->background-color: <!--{$smarty.const.ERR_COLOR}-->;<!--{/if}-->' /><span class="attention"> (上限<!--{$smarty.const.STEXT_LEN}-->文字)</span></td> 
     49          <span class="attention"><!--{$arrErr[$item.device_type_id][$item.page_id].description}--></span> 
     50          <input type="text" name="meta[<!--{$item.device_type_id}-->][<!--{$item.page_id}-->][description]" value="<!--{$item.description|h}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" size="60" class="box60" style='<!--{if $arrErr[$item.page_id].description != ""}-->background-color: <!--{$smarty.const.ERR_COLOR}-->;<!--{/if}-->' /><span class="attention"> (上限<!--{$smarty.const.STEXT_LEN}-->文字)</span></td> 
    4751        </tr> 
    4852        <tr> 
    4953          <th>メタタグ:Keywords</th> 
    5054          <td> 
    51           <span class="attention"><!--{$arrErr[$item.page_id].keyword}--></span> 
    52           <input type="text" name="meta[<!--{$item.page_id}-->][keyword]" value="<!--{$item.keyword|h}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" size="60" class="box60" style='<!--{if $arrErr[$item.page_id].keyword != ""}-->background-color: <!--{$smarty.const.ERR_COLOR}-->;<!--{/if}-->' /><span class="attention"> (上限<!--{$smarty.const.STEXT_LEN}-->文字)</span></td> 
     55          <span class="attention"><!--{$arrErr[$item.device_type_id][$item.page_id].keyword}--></span> 
     56          <input type="text" name="meta[<!--{$item.device_type_id}-->][<!--{$item.page_id}-->][keyword]" value="<!--{$item.keyword|h}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" size="60" class="box60" style='<!--{if $arrErr[$item.page_id].keyword != ""}-->background-color: <!--{$smarty.const.ERR_COLOR}-->;<!--{/if}-->' /><span class="attention"> (上限<!--{$smarty.const.STEXT_LEN}-->文字)</span></td> 
    5357        </tr> 
    5458      </table> 
     
    5660      <div class="btn-area"> 
    5761        <ul> 
    58           <li><a class="btn-action" href="javascript:;" onclick="document.form1.page_id.value = <!--{$item.page_id}-->; fnFormModeSubmit('form1', 'confirm', '', ''); return false;"><span class="btn-next">この内容で登録する</span></a></li> 
     62          <li><a class="btn-action" href="javascript:;" onclick="document.form1.device_type_id.value = <!--{$item.device_type_id}-->; document.form1.page_id.value = <!--{$item.page_id}-->; fnFormModeSubmit('form1', 'confirm', '', ''); return false;"><span class="btn-next">この内容で登録する</span></a></li> 
    5963        </ul> 
    6064      </div> 
     
    6266    </div> 
    6367    <!-- <!--{$item.page_name}--> ここまで --> 
     68    <!--{/foreach}--> 
     69    <!--{/if}--> 
    6470    <!--{/foreach}--> 
    6571  <!--{else}--> 
  • branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Seo.php

    r19805 r19967  
    5757        $this->arrPref = $masterData->getMasterData('mtb_pref'); 
    5858        $this->arrTAXRULE = $masterData->getMasterData("mtb_taxrule"); 
     59        $this->arrDeviceTypeName[DEVICE_TYPE_PC] = 'PCサイト'; 
     60        $this->arrDeviceTypeName[DEVICE_TYPE_MOBILE] = 'モバイルサイト'; 
     61        $this->arrDeviceTypeName[DEVICE_TYPE_SMARTPHONE] = 'スマートフォン'; 
    5962    } 
    6063 
     
    7679    function action() { 
    7780        $objSess = new SC_Session(); 
    78         $objQuery = new SC_Query(); 
    7981 
    8082        // 認証可否の判定 
     
    8284 
    8385        // データの取得 
    84         $objLayout = new SC_Helper_PageLayout_Ex(); 
    85         $this->arrPageData = $objLayout->lfgetPageData(" edit_flg = 2 "); 
    86  
    87         if (isset($_POST['page_id'])) { 
    88             $page_id = $_POST['page_id']; 
    89         } else { 
    90             $page_id = ""; 
    91         } 
     86        $this->arrPageData = $this->lfGetSeoPageData(); 
     87 
     88        $device_type_id = (isset($_POST['device_type_id'])) ? $_POST['device_type_id'] : ''; 
     89        $page_id = (isset($_POST['page_id'])) ? $_POST['page_id'] : ''; 
    9290 
    9391        if (!isset($_POST['mode'])) $_POST['mode'] = ""; 
     
    9593        if($_POST['mode'] == "confirm") { 
    9694            // エラーチェック 
    97             $this->arrErr[$page_id] = $this->lfErrorCheck($_POST['meta'][$page_id]); 
     95            $this->arrErr[$device_type_id][$page_id] = $this->lfErrorCheck($_POST['meta'][$device_type_id][$page_id]); 
    9896 
    9997            // エラーがなければデータを更新 
    100             if(count($this->arrErr[$page_id]) == 0) { 
     98            if(count($this->arrErr[$device_type_id][$page_id]) == 0) { 
    10199 
    102100                // 更新データの変換 
    103                 $arrMETA = $this->lfConvertParam($_POST['meta'][$page_id]); 
     101                $arrMETA = $this->lfConvertParam($_POST['meta'][$device_type_id][$page_id]); 
    104102 
    105103                // 更新データ配列生成 
    106                 $arrUpdData = array($arrMETA['author'], $arrMETA['description'], $arrMETA['keyword'], $page_id); 
     104                $arrUpdData = array($arrMETA['author'], $arrMETA['description'], $arrMETA['keyword'], $device_type_id, $page_id); 
    107105                // データ更新 
    108106                $this->lfUpdPageData($arrUpdData); 
    109107            }else{ 
    110108                // POSTのデータを再表示 
    111                 $arrPageData = $this->lfSetData($arrPageData, $_POST['meta']); 
     109                $arrPageData = $this->lfSetData($this->arrPageData, $_POST['meta']); 
    112110                $this->arrPageData = $arrPageData; 
    113111            } 
    114112        } 
    115113 
    116         $arrDisp_flg = array(); 
    117114        // エラーがなければデータの取得 
    118         if(count($this->arrErr[$page_id]) == 0) { 
     115        if(count($this->arrErr[$device_type_id][$page_id]) == 0) { 
    119116            // データの取得 
    120             $arrPageData = $objLayout->lfgetPageData(" edit_flg = 2 "); 
    121             $this->arrPageData = $arrPageData; 
    122         } 
    123  
    124         // 表示・非表示切り替え 
    125         foreach($arrPageData as $key => $val){ 
    126             $arrDisp_flg[$val['page_id']] = $_POST['disp_flg'.$val['page_id']]; 
    127         } 
    128  
    129         $this->disp_flg = $arrDisp_flg; 
     117            $this->arrPageData = $this->lfGetSeoPageData(); 
     118        } 
    130119    } 
    131120 
     
    157146        $sql .= "     keyword = ? "; 
    158147        $sql .= " WHERE "; 
    159         $sql .= "     page_id = ? "; 
     148        $sql .= "     device_type_id = ? "; 
     149        $sql .= "     AND page_id = ? "; 
    160150        $sql .= " "; 
    161151 
     
    191181    function lfSetData($arrPageData, $arrDispData){ 
    192182 
    193         foreach($arrPageData as $key => $val){ 
    194             $page_id = $val['page_id']; 
    195             $arrPageData[$key]['author'] = $arrDispData[$page_id]['author']; 
    196             $arrPageData[$key]['description'] = $arrDispData[$page_id]['description']; 
    197             $arrPageData[$key]['keyword'] = $arrDispData[$page_id]['keyword']; 
     183        foreach($arrPageData as $device_key => $arrVal){ 
     184            foreach($arrVal as $key => $val) { 
     185                $device_type_id = $val['device_type_id']; 
     186                $page_id = $val['page_id']; 
     187                $arrPageData[$device_key][$key]['author'] = $arrDispData[$device_type_id][$page_id]['author']; 
     188                $arrPageData[$device_key][$key]['description'] = $arrDispData[$device_type_id][$page_id]['description']; 
     189                $arrPageData[$device_key][$key]['keyword'] = $arrDispData[$device_type_id][$page_id]['keyword']; 
     190            } 
    198191        } 
    199192 
     
    227220        return $array; 
    228221    } 
     222 
     223    /** 
     224     * SEO管理で設定するページのデータを取得する 
     225     * 
     226     * @param void 
     227     * @return array $arrRet ページデータ($arrRet[デバイスタイプID]) 
     228     */ 
     229    function lfGetSeoPageData() { 
     230        $objLayout = new SC_Helper_PageLayout_Ex(); 
     231        $arrRet = array(); 
     232         
     233        $arrRet[DEVICE_TYPE_PC] = $objLayout->lfgetPageData('edit_flg = ? AND device_type_id = ?', array('2', DEVICE_TYPE_PC)); 
     234        $arrRet[DEVICE_TYPE_MOBILE] = $objLayout->lfgetPageData('edit_flg = ? AND device_type_id = ?', array('2', DEVICE_TYPE_MOBILE)); 
     235        $arrRet[DEVICE_TYPE_SMARTPHONE] = $objLayout->lfgetPageData('edit_flg = ? AND device_type_id = ?', array('2', DEVICE_TYPE_SMARTPHONE)); 
     236 
     237        return $arrRet; 
     238    } 
    229239} 
    230240?> 
Note: See TracChangeset for help on using the changeset viewer.