Title1

Title2

Title3

13-4 選單的樣板

 



    {* nav_m.php begin*}

    {* 選單管理 表單 *}
    {if $WEB.file_name == "nav_m.php" and $op == "op_form"}
      <div class="container" style="margin-top:20px;">
        <div class="panel panel-primary">
          <div class="panel-heading">
            <h3 class="panel-title">{$DBV.form_title}</h3>
          </div>
          <div class="panel-body">

            <form action="nav_m.php" method="post">

              <div class="row">
                <div class="col-md-6">
                  <div class="form-group">
                    <label>標題</label>
                    <input type="text" class="form-control" id="title " name="title" value="{$DBV.title}" placeholder="標題">
                  </div>
                </div>
                <div class="col-md-2">
                  <div class="form-group">
                    <label style="display:block;">外連狀態</label>

                    <input type='radio' name='target' id='target_1' value='1' {if $DBV.target==1}checked{/if} >
                    <label for='target_1'>是</label>&nbsp;&nbsp;

                    <input type='radio' name='target' id='target_0' value='0' {if $DBV.target==0}checked{/if}>
                    <label for='target_0'>否</label>

                  </div>
                </div>
                <div class="col-md-2">
                  <div class="form-group">
                    <label style="display:block;">啟用狀態</label>

                    <input type='radio' name='enable' id='enable_1' value='1' {if $DBV.enable==1}checked{/if} >
                    <label for='enable_1'>是</label>&nbsp;&nbsp;

                    <input type='radio' name='enable' id='enable_0' value='0' {if $DBV.enable==0}checked{/if}>
                    <label for='enable_0'>否</label>

                  </div>
                </div>
                <div class="col-md-2">
                  <div class="form-group">
                    <label>排序</label>
                    <input type="text" class="form-control" id="sort"  name="sort"  value="{$DBV.sort}" placeholder="排序">
                  </div>
                </div>
              </div>


              <div class="form-group">
                <label>網址</label>
                <input type="text" class="form-control" id="url"  name="url"  value="{$DBV.url}" placeholder="網址">
              </div>

              <!--用來控制程式流程-->
              <input type="hidden" name="op" value="{$DBV.op}">
              <input type="hidden" name="sn" value="{$DBV.sn}">
              <button type="submit" class="btn btn-default">送出</button>
            </form>

          </div>
        </div>
      </div>

    {/if}


    {* 選單管理 顯示單筆 *}
    {if $WEB.file_name == "nav_m.php" and $op == "op_show"}

      <div class="container" style="margin-top:20px;">
        <div style="margin:10px 0;">
          <button onclick="window.location.href='{$smarty.session.CurrentUrl}'" type="button" class="btn btn-warning">返回</button>

          <button onclick="window.location.href='?op=op_form&sn={$DBV.sn}'" type="button" class="btn btn-success">編輯</button>
        </div>


        <div class="panel panel-primary">
          <div class="panel-heading">
            <h3 class="panel-title">顯示單筆</h3>
          </div>
          <div class="panel-body">

              <div class="row">
                <div class="col-md-6">
                  <div class="form-group">
                    <label>標題</label>
                    <div class="form-control">{$DBV.title}</div>
                  </div>
                </div>
                <div class="col-md-2">
                  <div class="form-group">
                    <label style="display:block;">外連狀態</label>
                    <div class="form-control">{$DBV.target}</div>
                  </div>
                </div>
                <div class="col-md-2">
                  <div class="form-group">
                    <label style="display:block;">啟用狀態</label>
                    <div class="form-control">{$DBV.enable}</div>
                  </div>
                </div>
                <div class="col-md-2">
                  <div class="form-group">
                    <label>排序</label>
                    <div class="form-control">{$DBV.sort}</div>
                  </div>
                </div>
              </div>

              <div class="form-group">
                <label>網址</label>
                <div class="form-control">{$DBV.url}</div>
              </div>

          </div>
        </div>
      </div>
    {/if}

    {* 選單管理 列表 *}
    {if $WEB.file_name == "nav_m.php" and $op == "op_list"}
      {literal}
        <link rel="stylesheet" href="../class/sweet-alert/sweet-alert.css" type="text/css" />
        <script src="../class/sweet-alert/sweet-alert.js" type="text/javascript"></script>
        <script type="text/javascript">
          function op_delete_js(sn){
            swal({
              title: '確定要刪除此資料?',
              text: '相關資料通通都將會被移除!',
              type: 'warning',
              showCancelButton: 1,
              confirmButtonColor: '#DD6B55',
              confirmButtonText: '確定刪除!',
              closeOnConfirm: false ,
              allowOutsideClick: true
            },
            function(){
              location.href='nav_m.php?op=op_delete&sn=' + sn;
            });
          }
        </script>
      {/literal}
      <div class="container" style="margin-top:20px;">
        <h2 class="text-center">選單管理</h2>
        <table class="table table-bordered table-hover list-table">
          <thead>
            <tr class="active">
              <th class="text-center col-md-3">標題</th>
              <th class="text-center col-md-4">網址</th>
              <th class="text-center col-md-1">排序</th>
              <th class="text-center col-md-1">外連</th>
              <th class="text-center col-md-1">啟用</th>
              <th class="text-center col-md-2">
                <button onclick="window.location.href='?op=op_form'" type="button" class="btn btn-primary btn-xs">新增</button>
              </th>
            </tr>
          </thead>
          <tbody>
            {foreach from=$DBV item=row}
              <tr>
                <td>{$row.title}</td>
                <td>{$row.url}</td>
                <td class="text-center">{$row.sort}</td>
                <td class="text-center">{$row.target}</td>
                <td class="text-center">{$row.enable}</td>
                <td class="text-center">
                  <button onclick="window.location.href='?op=op_show&sn={$row.sn}'" type="button" class="btn btn-warning btn-xs">瀏覽</button>
                  <button onclick="window.location.href='?op=op_form&sn={$row.sn}'" type="button" class="btn btn-success btn-xs">編輯</button>
                  <button onclick="javascript:op_delete_js({$row.sn});" type="button" class="btn btn-danger btn-xs">刪除</button>
                </td>
              </tr>
            {/foreach}
          </tbody>
        </table>
      </div>

    {/if}

    {* nav_m.php end *}