<?php
  include("./control/session.inc");

  $cname = 'tag_list'; 
  $title = 'リンクグループ一覧';
  $p = $_GET["p"];

function form()
{

//ページャー設定
  $delta = 5;    // 現在から前(後)に表示するＬＩＮＫ数
  $perPage = 5;  // 1ページのデータ表示件数
  $i=0;

//一覧表示HTML

$content1 = <<<EOD
<div id="main_r1">
<h2>タグのサンプル 一覧</h2>
EOD;

 print("$content1");

//ファイル一覧の取得

 $path='./content/html_tag/';

foreach(glob($path ."*.inc") as $file)
{
 $i++;
 $array1 = explode("/", $file);
 $list1 = ($array1[count($array1) -1] ); 
 $array2 = explode(".", $list1);

// $but1 = '<div class="but1"><div class="fi-link"> '.($array2[count($array2) -2] ).'</div></div>';
 $but1 = '<a href="./index.php?name=html_tag/'.($array2[count($array2) -2] ).'" target="_blank" class="but1"><div class="fi-link">'.($array2[count($array2) -2] ) .' 確認</div></a>';
 $but2 = '<a href="./AYANASU_control.php?cname=creating_tagr&oprt=1&name='.($array2[count($array2) -2] ).'" class="but1"><div class="fi-link"> htmlの確認</div></a>';
 $but3 = '<a href="./AYANASU_control.php?cname=creating_tagr&oprt=2&name='.($array2[count($array2) -2] ).'" class="but1"><div class="fi-page-edit"> 編集更新</div></a>';
 $but4 = '<a href="./content/file_operation/rename.php?name=html_tag/'.($array2[count($array2) -2] )."\" onClick=\"window.open"."('./content/file_operation/rename.php?name=html_tag/".($array2[count($array2) -2] )."','subwin','width=600,height=350,left=500,top=300,menubar=no,toolbar=no,location=no,scrollbars=no'); return false;\" class=\"but1\"><div class=\"fi-trash\"> 名前の変更</div></a>";
 $but5 = '<a href="./content/file_operation/delete.php?name=html_tag/'.($array2[count($array2) -2] )."\" onClick=\"window.open"."('./content/file_operation/delete.php?name=html_tag/".($array2[count($array2) -2] )."','subwin','width=600,height=350,left=500,top=300,menubar=no,toolbar=no,location=no,scrollbars=no'); return false;\" class=\"but1\"><div class=\"fi-trash\"> 削除確認画面</div></a>";
 $code = highlight_string('<?php include ("'.$file.'"); ?>',TRUE);

 $list = '<div id="border_box">'.$but1.PHP_EOL.$but2.PHP_EOL.$but3.PHP_EOL.$but4.PHP_EOL.$but5.PHP_EOL.'</div>'.PHP_EOL;

//ページング条件分岐

 $num = count(glob($path ."*.inc"));
  if( ($_GET['p'] =="" or $_GET['p'] =="0" or $_GET['p'] =="1") and $i <= $perPage){
 print $list;
 }if($_GET['p'] > "1" and $i >= ($perPage * $_GET['p']-($perPage-1)) and $i <= $perPage * $_GET['p']) {
 print $list;
 }

}

// ページャー設定
  $page_ceil = $num/$perPage;
  $totalPage = ceil($page_ceil);
  $url = "AYANASU_control.php?cname=content_list&p=";
  $page = ($_GET[p]) ? $_GET[p]: 1;
  include("./pager.inc");

  $content2 = "</div>";
  print $content2;

  }

?>
