TDLM01.php
5.12 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<?php
//*****************************************************************************
//*
//* プログラム名:ToDo
//* プログラムID:TDLMIN.php
//* 機能 :ToDo 一覧 TOP用
//* 作成者 :
//*
//*****************************************************************************
header("Content-type: text/html; charset=EUC-JP");
include("include/session_start.inc");
include("include/SessionChk.inc");
include("inc/TDLM01.inc");
include('./include/smarty.conf');
$strDBinc="include/dbcon.inc";
include($strDBinc);
$strSQL="";
$objRec="null";
//初期テーブル更新
$strSQL = "delete from kojin_data_tbl where seq = 4 and syain_cd = '".$PHP_SYAIN_CD."'";
$objRec = pg_exec($strSQL);
if($objRec == false){
echo("SQL実行に失敗しました(DELETE)");
exit;
}
$strSQL = "insert into kojin_data_tbl (seq, syain_cd, memo) values(4, '".$PHP_SYAIN_CD."', ".$srt_mode.")";
$objRec = pg_exec($strSQL);
if($objRec == false){
echo("SQL実行に失敗しました(INSERT)");
exit;
}
//ソート条件
if($srt_mode == 0){
$strW = "todo_name asc";
}else if($srt_mode == 1){
$strW = "juyodo desc";
}else if($srt_mode == 2){
$strW = "end_date asc";
}
//抽出!!
$strSQL = "select ";
$strSQL .= "seq, kyoyu_menber, alarm_date, todo_name, sakusei_cd, category_id, juyodo, sinchoku, kikan_flg, start_date, end_date, mst_todo_category.category_name, naiyo, 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."/%') and end_flg = 0 ";
$strSQL .= "order by ".$strW;
$objRec = pg_exec($strSQL);
if($objRec == false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
$hiddenComment = '<input type="hidden" name="comments" value="">'."\n";
$hiddenComment .= '<DIV CLASS="spanstyle" ID="iL0"></DIV>';
for($i=0;$i<pg_numrows($objRec);$i++){
$objftc = pg_fetch_object($objRec, $Cnt);
$strTodo[$i] = $objftc->todo_name;
//重要度
$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>";
}
}
//表示切替
if($srt_mode == 0){
$strData[$i] = $strImp[$i];
}else if($srt_mode == 1){
$strData[$i] = $strImp[$i];
}else if($srt_mode == 2){
$strData[$i] = $strEnd[$i];
}
//コメント生成
$File_comment[$i] = "";
//カテゴリ
if($objftc->category_id == 0){
$File_comment[$i] .= "カテゴリ:共有\r\n";
}else{
$File_comment[$i] .= "カテゴリ:".$objftc->category_name."\r\n";
}
//期間
if($objftc->kikan_flg == 1){
$strTemp1 = $objftc->start_date;
$strTemp1 = substr($strTemp1,0,4)."/".substr($strTemp1,4,2)."/".substr($strTemp1,6,2)." ".substr($strTemp1,8,2).":".substr($strTemp1,10,2);
$strTemp2 = $objftc->end_date;
$strTemp2 = substr($strTemp2,0,4)."/".substr($strTemp2,4,2)."/".substr($strTemp2,6,2)." ".substr($strTemp2,8,2).":".substr($strTemp2,10,2);
$File_comment[$i] .= "<hr>期間:".$strTemp1."〜".$strTemp2."\r\n";
}
//内容
if(trim($objftc->naiyo) == ""){
// $File_comment[$i] .= "内容:なし\r\n";
}else{
$File_comment[$i] .= "<hr>内容:\r\n".$objftc->naiyo."\r\n";
}
//アラーム
if(trim($objftc->alarm_date) != ""){
$File_comment[$i] .= "<hr>アラーム:".substr($objftc->alarm_date,0,4)."/".substr($objftc->alarm_date,4,2)."/".substr($objftc->alarm_date,6,2)." ".substr($objftc->alarm_date,8,2).":".substr($objftc->alarm_date,10,2)."\r\n";
}
//共有者
if($objftc->category_id == 0){
$strkyoyu = "";
$temp = trim($objftc->kyoyu_menber);
if($temp != "/"){
//作成者が含まれていない場合、たす!!
if(strpos($temp, "/".($objftc->sakusei_cd)."/") === false){
$temp = "/".($objftc->sakusei_cd).$temp;
}
$strwhere = str_replace("//", "", $temp);
$strwhere = substr($strwhere, 1, (strlen($strwhere) - 1));
$strwhere = str_replace("/", "' or syain_cd = '", $strwhere);
$strSQL2 = "select name_kj_sei, name_kj_mei from syain_tbl where syain_cd = '".$strwhere."' Order by disp_rank";
$objRec2 = pg_exec($strSQL2);
if($objRec2 == false){
echo("SQL実行に失敗しました(SELECT)");
exit;
}
for($j=0;$j<pg_numrows($objRec2);$j++){
$objftc2 = pg_fetch_object($objRec2, $j);
$strkyoyu .= ($objftc2->name_kj_sei).($objftc2->name_kj_mei)."\r\n";
}
}
$File_comment[$i] .= "<hr>共有者:\r\n".$strkyoyu;
}
$File_comment[$i] = str_replace ("\r\n","<br>",htmlspecialchars($File_comment[$i]));
$File_Count[$i]=$i+1;
$hiddenComment .= '<input type="hidden" name="comments" value="'.$File_comment[$i].'">'."\n";
$seq[$i] = $objftc->seq;
}
$o_smarty->assign('strTodo',$strTodo);
$o_smarty->assign('strImp',$strImp);
$o_smarty->assign('strProg',$strProg);
$o_smarty->assign('strEnd',$strEnd);
$o_smarty->assign('strData',$strData);
$o_smarty->assign('seq',$seq);
$o_smarty->assign('File_Count',$File_Count);
$o_smarty->assign('hiddenComment',$hiddenComment);
$o_smarty->display('TDLM01.tpl');
?>