1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
<!-- css --> <link rel="stylesheet" type="text/css" href="<?= path(__DIR__ . '/../css/bootstrap.min.css') ?>" /> <link rel="stylesheet" type="text/css" href="<?= path(__DIR__ . '/../css/bootstrapSwitch.css') ?>" /> <link rel="stylesheet" type="text/css" href="<?= path(__DIR__ . '/../css/bootstrap-datetimepicker.min.css') ?>" /> <link rel="stylesheet" type="text/css" href="<?= path(__DIR__ . '/../css/bootstrap-fileupload.min.css') ?>" /> <link rel="stylesheet" type="text/css" href="<?= path(__DIR__ . '/../css/select2.css') ?>" /> <link rel="stylesheet" type="text/css" href="<?= path(__DIR__ . '/../css/site.css') ?>" /> <link rel="stylesheet" type="text/css" href="<?= path(__DIR__ . '/../css/jquery.timepicker.css') ?>" /> <!-- meta --> <meta charset="utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-language" content="zh"/> <title>Pathways MIS</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <meta name="author" content="" /> <!-- Js --> <script type="text/javascript" src="<?= path(__DIR__ . '/../js/moment.min.js') ?>"></script> <script type="text/javascript" src="<?= path(__DIR__ . '/../js/angular-1.0.7.min.js') ?>"></script> <script type="text/javascript" src="<?= path(__DIR__ . '/../js/underscore-min.js') ?>"></script> <script type="text/javascript" src="<?= path(__DIR__ . '/../js/jquery-1.9.1.js') ?>"></script> <script type="text/javascript" src="<?= path(__DIR__ . '/../js/jquery-migrate-1.2.1.min.js') ?>"></script> <script type="text/javascript" src="<?= path(__DIR__ . '/../js/bootstrap.min.js') ?>"></script> <script type="text/javascript" src="<?= path(__DIR__ . '/../js/bootstrapSwitch.js') ?>"></script> <script type="text/javascript" src="<?= path(__DIR__ . '/../js/bootstrap-datetimepicker.js') ?>"></script> <script type="text/javascript" src="<?= path(__DIR__ . '/../js/bootstrap-fileupload.min.js') ?>"></script> <script type="text/javascript" src="<?= path(__DIR__ . '/../js/select2.js') ?>"></script> <script type="text/javascript" src="<?= path(__DIR__ . '/../js/bootbox.min.js') ?>"></script> <script type="text/javascript" src="<?= path(__DIR__ . '/../js/jquery.validate.min.js') ?>"></script> <script type="text/javascript" src="<?= path(__DIR__ . '/../js/jquery.validate.additional-methods.min.js') ?>"></script> <script type="text/javascript" src="<?= path(__DIR__ . '/../js/site.js') ?>"></script> <script type="text/javascript" src="<?= path(__DIR__ . '/../js/jquery.timepicker.js') ?>"></script>
<?php session_start(); ?> <?php
function getRelativePath($from, $to) { $from = explode('/', $from); $to = explode('/', $to); $relPath = $to;
foreach ($from as $depth => $dir) { // find first non-matching dir if ($dir === $to[$depth]) { // ignore this directory array_shift($relPath); } else { // get number of remaining dirs to $from $remaining = count($from) - $depth; if ($remaining > 1) { // add traversals up to first matching dir $padLength = (count($relPath) + $remaining - 1) * -1; $relPath = array_pad($relPath, $padLength, '..'); break; } else { $relPath[0] = './' . $relPath[0]; } } } return implode('/', $relPath); }
function path($filepath) { $from = $_SERVER['SCRIPT_FILENAME']; $to = realpath($filepath);
$from = str_replace('\\', '/', $from); $to = str_replace('\\', '/', $to);
$link = $from == $to ? '' : getRelativePath($from, $to); if (empty($link) && $from == $to) { $parts = explode('/', $from); $count = count($parts); $link = $parts[$count - 1]; }
return $link; } ?>
|