TDL002.php
3.13 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
//*****************************************************************************
//*
//* プログラム名:ToDo
//* プログラムID:TDL002.php
//* 機能 :ToDo 一覧
//* 作成者 :
//*
//*****************************************************************************
header("Content-type: text/html; charset=EUC-JP");
include("include/session_start.inc");
include("include/SessionChk.inc");
include('./include/smarty.conf');
$strDBinc="include/dbcon.inc";
include($strDBinc);
$strSQL="";
$objRec="null";
//抽出条件
$strWhere = "";
//カテゴリ
if(trim($conCtg) != ""){
$strWhere .= "and category_id = ".$conCtg." ";
}
//重要度
if(trim($conImp) != ""){
$strWhere .= "and juyodo = ".$conImp." ";
}
//完了済み??
$strWhere .= "and end_flg = ".$dispMode." ";
//ソート条件
if($srtFlg == ""){
$strOrder = "seq desc";
}else if($srtFlg == 1){
$strOrder = "todo_name";
}else if($srtFlg == 2){
$strOrder = "mst_todo_category.category_name";
}else if($srtFlg == 3){
$strOrder = "end_date";
}else if($srtFlg == 4){
$strOrder = "juyodo desc";
}
//抽出!!
$strSQL = "select ";
$strSQL .= "seq, todo_name, sakusei_cd, category_id, juyodo, sinchoku, kikan_flg, end_date, mst_todo_category.category_name ";
$strSQL .= "from ";
$strSQL .= "todo_tbl ";
$strSQL .= "left join mst_todo_category ";
$strSQL .= "on mst_todo_category.syain_cd = '".$PHP_SYAIN_CD."' and mst_todo_category.category_syubetu = todo_tbl.category_id ";
$strSQL .= "where (sakusei_cd = '".$PHP_SYAIN_CD."' or kyoyu_menber like '%/".$PHP_SYAIN_CD."/%') ".$strWhere;
$strSQL .= "order by ".$strOrder;
//echo $strSQL."<hr>";
$objRec = pg_exec($strSQL);
if($objRec == false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
//ページMAX
$pageMax = floor((pg_numrows($objRec) - 1) / 10);
//ページ設定
if($pageNow == ""){
$pageNow = 0;
}
$intEndCnt=10 * ($pageNow+1);
if ($intEndCnt>pg_numrows($objRec)){
$intEndCnt=pg_numrows($objRec);
}
$i=0;
for($Cnt=$pageNow*10;$Cnt<$intEndCnt;$Cnt++){
$objftc = pg_fetch_object($objRec, $Cnt);
$strTodo[$i] = $objftc->todo_name;
if ($objftc->category_name == ""){
$strCtgName[$i] = "共有";
}else{
$strCtgName[$i] = $objftc->category_name;
}
$seq[$i] = $objftc->seq;
//〆
if(($objftc->kikan_flg) == 1){
$strTemp = $objftc->end_date;
$strEnd[$i] = substr($strTemp,0,4)."年".substr($strTemp,4,2)."月".substr($strTemp,6,2)."日".substr($strTemp,8,2)."時";
}else{
$strEnd[$i] = "----年--月--日--時";
}
//重要度
$strImp[$i] = "";
for($j=1;$j<=$objftc->juyodo;$j++){
$strImp[$i] .= "★";
}
//進捗率
$strProg[$i] = "";
for($j=0;$j<=10;$j++){
if(($j * 10) == $objftc->sinchoku ){
$strProg[$i] .= "<option value='".($j * 10)."' selected>".($j * 10)."</option>";
}else{
$strProg[$i] .= "<option value='".($j * 10)."'>".($j * 10)."</option>";
}
}
$i++;
}
if($i > 0){
$seq_list = implode("/", $seq);
}
$o_smarty->assign('strTodo',$strTodo);
$o_smarty->assign('strCtgName',$strCtgName);
$o_smarty->assign('strEnd',$strEnd);
$o_smarty->assign('strImp',$strImp);
$o_smarty->assign('seq',$seq);
$o_smarty->assign('strProg',$strProg);
$o_smarty->assign('pageMax',$pageMax);
$o_smarty->assign('seq_list',$seq_list);
$o_smarty->display('TDL002.tpl');
?>