Exemple #1
0
function read_dir($dir, &$dir_array, $root, &$html_lines)
{
    global $link_array, $hot_array, $pop_array, $new_tools;
    global $menu_name;
    global $popular_access_dict;
    $dir_list = get_valid_dir($dir);
    if ($root == false && count($dir_list) != 0) {
        array_push($html_lines, "<ul>");
    }
    foreach ($dir_list as $dir2) {
        $path = $dir . "/" . $dir2;
        if (!checkShow($path)) {
            continue;
        }
        $dir_list2 = get_valid_dir($path);
        if (count($dir_list2) == 0) {
            $show_name = get_item_name($path);
            array_push($html_lines, "<li><a href='' name='{$path}'><span class='item'>" . $show_name . "</span></a>");
            $cnt = 0;
            $tip_str = "";
            if (array_key_exists($path, $popular_access_dict["hot"])) {
                $cnt = $popular_access_dict["hot"][$path];
                $tip_str = "点击次数:{$cnt}";
                $show_name = "{$show_name}({$cnt})";
                array_push($link_array[$menu_name], "<a class='btn btn-danger btn-xs' title='hot({$tip_str})' href='{$path}'>{$show_name}</a>");
                array_push($hot_array, "<a class='btn btn-danger btn-xs' title='hot({$tip_str})' href='{$path}'>{$show_name}</a> ");
            } elseif (array_key_exists($path, $popular_access_dict["good"])) {
                $cnt = $popular_access_dict["good"][$path];
                $tip_str = "点击次数:{$cnt}";
                $show_name = "{$show_name}({$cnt})";
                array_push($link_array[$menu_name], "<a class='btn btn-success btn-xs' title='popular({$tip_str})' href='{$path}'>{$show_name}</a>");
                array_push($pop_array, "<a class='btn btn-success btn-xs' title='popular({$tip_str})' href='{$path}'>{$show_name}</a> ");
            } else {
                if (array_key_exists($path, $popular_access_dict["all"])) {
                    $cnt = $popular_access_dict["all"][$path];
                }
                $tip_str = "点击次数:{$cnt}";
                $show_name = "{$show_name}({$cnt})";
                array_push($link_array[$menu_name], "<a class='btn btn-link btn-xs' href='{$path}' title='{$tip_str}'>{$show_name}</a>");
            }
            $filetime = @filectime($path . "/index.html");
            if (file_exists($path . "/index.php")) {
                $filetime = @filectime($path . "/index.php");
            }
            $mtime = date("F d Y H:i:s.", $filetime);
            $new_tools[$filetime] = "<a class='btn btn-info btn-xs' title='hot({$tip_str}, {$mtime})' href='{$path}'>{$show_name}</a> ";
        } else {
            array_push($html_lines, "<li><a href='' class='parent' name='{$path}'><span class='item'>" . get_item_name($path) . "</span></a>");
        }
        $dir_array[$dir2] = array();
        read_dir($path, $dir_array[$dir2], false, $html_lines);
        array_push($html_lines, "</li>");
    }
    if ($root == false && count($dir_list) != 0) {
        array_push($html_lines, "</ul>");
    }
}
        editShow($_POST['from_venue'], $_POST['to_venue'], $_POST['departure'], $idTrain, $_POST['seat'], $_POST['showid']);
        $_SESSION['edit-show'] = 'success';
        header("location:show-page.php?page=" . $_GET['page']);
    } else {
        $_SESSION['edit-show'] = 'failed';
        header("location:show-page.php?page=" . $_GET['page']);
    }
}
if (isset($_POST['delete'])) {
    removeShow($_POST['showid']);
    $_SESSION['delete-show'] = 'success';
    header("location:show-page.php?page=" . $_GET['page']);
}
if (isset($_POST['add'])) {
    $idTrain = getIdTrainByNameClass($_POST['train'], $_POST['class']);
    $show = checkShow($_POST['from_venue'], $_POST['to_venue'], $_POST['departure'], $idTrain, $_POST['seat']);
    if ($show == 0) {
        addShow($_POST['from_venue'], $_POST['to_venue'], $_POST['departure'], $idTrain, $_POST['seat']);
        $_SESSION['add-show'] = 'success';
        header("location:show-page.php?page=" . $_GET['page']);
    } else {
        $_SESSION['add-show'] = 'failed';
        header("location:show-page.php?page=" . $_GET['page']);
    }
}
?>

<script src="../js/jquery-2.1.1.min.js"></script>
<script src="../js/show-page.js"></script>
<script>
  var length = $('#class-edit > option').length;