forked from tinydeal/SupplierManagement
/
problem_view_ls.php
96 lines (81 loc) · 2.61 KB
/
problem_view_ls.php
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/*
* @auther lion
* @date 2013-2-2
*/
require_once 'class/problem_service.class.php';
require_once 'class/problem.class.php';
require_once 'class/sub_pages.class.php';
require_once 'class/code_names.class.php';
if(isset($_GET["p"]))
$pageCurrent=$_GET["p"];
else
$pageCurrent=1;
//每页显示的条数
$page_size=10;
$problem_service=new ProblemService();
//总条目数
//每次显示的页数
$sub_pages=10;
$url="index.php?mod=problem&action=ls&p=";
if(isset($_GET["keywords"])){
$keywords=trim($_GET["keywords"]);
if(!empty($keywords)){
$array_problem=$problem_service->listAllByKeywords($pageCurrent,$page_size,$keywords);
$nums=$problem_service->getListRowsByKeywords($keywords);
$url="index.php?mod=problem&action=ls&keywords=$keywords&p=";
}else{
$array_problem=$problem_service->listAll($pageCurrent,$page_size);
$nums=$problem_service->getListRows();
}
}else{
$array_problem=$problem_service->listAll($pageCurrent,$page_size);
$nums=$problem_service->getListRows();
}
?>
<div class="search-form">
<form class="form-inline" action="./index.php" method="get">
<input type="hidden" class="search-query" name="mod" value="problem">
<input type="hidden" class="search-query" name="action" value="ls">
<input type="text" class="search-query" name="keywords" id="keywords">
<button type="submit" class="btn">搜索</button>
</form>
</div>
<div class="datatable">
<ul class="nav nav-tabs">
<li class="active">
<a href="#">合作问题记录管理</a>
</li>
<a type='button' class='btn btn-primary' href='./index.php?mod=problem&action=add_get' style="float: right;">新增问题记录</a>
</ul>
<table class="table table-bordered table-striped table-hover" id="table">
<thead>
<tr>
<th>问题类型</th>
<th>供应商名称</th>
<th>描述</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php
foreach ($array_problem as $problem){
echo "<tr>
<td><a href='./index.php?mod=problem&action=detail&did=$problem->id'>$problem->problem_name_category</td>
<td>$problem->supplier_name</td>
<td>$problem->description</td>
<td><a class='btn btn-primary' href='./index.php?mod=problem&action=edit_get&eid=".$problem->id."'>修改</a></td>
</tr>";
}
?>
</tbody>
</table>
<?php
$subPages=new SubPages($page_size,$nums,$pageCurrent,$sub_pages,$url);
?>
</div>
<script>
$(function () {
$('#keywords').val("<?php echo $keywords?>");
} );
</script>