Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

todolist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: todolist.php 8503 2001-11-19 09:37:02Z jhe $
5 //
6 // Definition of todo list.
7 //
8 // Created on: <04-Sep-2000 16:53:15 ce>
9 //
10 // This source file is part of Exponential Basic, publishing software.
11 //
12 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
29 // include_once( "classes/INIFile.php" );
30 // include_once( "classes/ezhttptool.php" );
31
32 $ini = eZINI::instance( 'site.ini' );
33 $Language = $ini->variable( "eZTodoMain", "Language" );
34 $DOC_ROOT = $ini->variable( "eZTodoMain", "DocumentRoot" );
35
36 $iniLanguage = new eZINI( "kernel/eztodo/user/intl/$Language/todolist.php.ini", false );
37
38 // include_once( "classes/eztemplate.php" );
39 // include_once( "classes/ezdatetime.php" );
40 // include_once( "classes/ezlocale.php" );
41
42 // include_once( "ezuser/classes/ezuser.php" );
43 // include_once( "ezuser/classes/ezusergroup.php" );
44 // include_once( "ezuser/classes/ezpermission.php" );
45
46 // include_once( "eztodo/classes/eztodo.php" );
47 // include_once( "eztodo/classes/ezcategory.php" );
48 // include_once( "eztodo/classes/ezpriority.php" );
49 // include_once( "eztodo/classes/ezstatus.php" );
50
51
52 if ( isset( $New ) )
53 {
54 eZHTTPTool::header( "Location: /todo/todoedit/new" );
55 exit();
56 }
57
58 $user =& eZUser::currentUser();
59
60 if ( $user == false )
61 {
62 eZHTTPTool::header( "Location: /error/403/" );
63 exit();
64 }
65
66 if ( isset( $Delete ) )
67 {
68 if ( count( $DeleteArrayID ) > 0 )
69 {
70 foreach ( $DeleteArrayID as $todoid )
71 {
72 $todo = new eZTodo( $todoid );
73 $due = $todo->due();
74 if ( $due )
75 deleteCache( "default", $Language, $due->year(), addZero( $due->month() ) , addZero( $due->day() ), $user->id() );
76 $todo->delete();
77 }
78 }
79 }
80
81 $t = new eZTemplate( "kernel/eztodo/user/" . $ini->variable( "eZTodoMain", "TemplateDir" ),
82 "kernel/eztodo/user/intl/", $Language, "todolist.php" );
83 $t->setAllStrings();
84 $t->set_file( "todo_list_page", "todolist.tpl" );
85
86 $CategoryID = eZHTTPTool::getVar( "CategoryTodoID" );
87 //$Show = eZHTTPTool::getVar( "Show" );
88 $ShowButton = eZHTTPTool::getVar( "ShowButton" );
89 $StatusID = eZHTTPTool::getVar( "StatusTodoID" );
90
91 if ( isset( $Show ) )
92 {
93 $GetByUserID = eZHTTPTool::getVar( "GetByUserID" );
94 $session->setVariable( "TodoUser", $GetByUserID );
95 }
96 else
97 {
98 $GetByUserID = $session->variable( "TodoUser" );
99 if ( !$GetByUserID )
100 {
101 $GetByUserID = $user->id();
102 $session->setVariable( "TodoUser", $GetByUserID );
103 }
104 }
105
106 $t->set_block( "todo_list_page", "todo_item_tpl", "todo_item" );
107 $t->set_block( "todo_list_page", "user_item_tpl", "user_item" );
108 $t->set_block( "todo_list_page", "no_found_tpl", "no_found" );
109 $t->set_block( "todo_list_page", "category_item_tpl", "category_item" );
110 $t->set_block( "todo_list_page", "status_item_tpl", "status_item" );
111
112 $t->set_block( "todo_item_tpl", "todo_is_public_tpl", "todo_is_public" );
113 $t->set_block( "todo_item_tpl", "todo_is_not_public_tpl", "todo_is_not_public" );
114
115
116 if ( isset( $ShowButton ) )
117 {
118 $session->setVariable( "TodoCategory", $CategoryID );
119 $session->setVariable( "TodoStatus", $StatusID );
120 }
121
122 $showCategory = $session->variable( "TodoCategory" );
123 $showTodo = $session->variable( "TodoStatus" );
124
125 $todo = new eZTodo();
126
127 // Check if the user want its own todos or the public todos. This needs the "view-others-todo permission".
128 $currentUserID = $user->id();
129 if ( eZPermission::checkPermission( $user, "eZTodo", "ViewOtherUsers" ) )
130 {
131 if ( $GetByUserID != "" )
132 {
133 if ( $GetByUserID == $currentUserID )
134 {
135 $todo_array = $todo->getByUserID( $currentUserID, $showTodo, $showCategory );
136 }
137 else
138 {
139 $todo_array = $todo->getByOthers( $GetByUserID, $showTodo, $showCategory );
140 }
141 }
142 else
143 {
144 $todo_array = $todo->getByUserID( $currentUserID, $showTodo, $showCategory );
145 }
146 }
147 else
148 {
149 $todo_array = $todo->getByUserID( $currentUserID, $showTodo, $showCategory );
150 }
151
152 $showID = $session->variable( "ShowTodoID" );
153
154 // User selector.
155 $userList = $user->getAll();
156
157 foreach ( $userList as $userItem )
158 {
159 if ( !isset( $GetByUserID ) )
160 {
161 $GetByUserID = $currentUserID;
162 }
163 $t->set_var( "user_id", $userItem->id() );
164 $t->set_var( "user_firstname", $userItem->firstName() );
165 $t->set_var( "user_lastname", $userItem->lastName() );
166
167 if ( $GetByUserID == $user->id() )
168 {
169 if ( $user->id() == $userItem->id() )
170 {
171 $t->set_var( "user_is_selected", "selected" );
172 }
173 else
174 {
175 $t->set_var( "user_is_selected", "" );
176 }
177 }
178 else
179 {
180 if ( $GetByUserID == $userItem->id() )
181 {
182 $t->set_var( "user_is_selected", "selected" );
183 }
184 else
185 {
186 $t->set_var( "user_is_selected", "" );
187 }
188 }
189 $t->parse( "user_item", "user_item_tpl", true );
190 }
191
192 // Todo list
193 if ( count( $todo_array ) == 0 )
194 {
195 $t->set_var( "todo_item", "" );
196 $t->parse( "no_found", "no_found_tpl" );
197 }
198
199 $locale = new eZLocale( $Language );
200
201 $i = 0;
202 foreach ( $todo_array as $todoItem )
203 {
204 if ( $i % 2 )
205 $t->set_var( "td_class", "bgdark" );
206 else
207 $t->set_var( "td_class", "bglight" );
208
209 $t->set_var( "todo_id", $todoItem->id() );
210 $t->set_var( "todo_name", $todoItem->name() );
211 $t->set_var( "todo_description", $todoItem->description() );
212 $cat = new eZCategory( $todoItem->categoryID() );
213 $t->set_var( "todo_category_id", $cat->name() );
214 $pri = new eZPriority( $todoItem->priorityID() );
215 $t->set_var( "todo_priority_id", $pri->name() );
216 $t->set_var( "todo_userid", $todoItem->userID() );
217 $stat = new eZStatus( $todoItem->statusID() );
218 $t->set_var( "todo_status", $stat->name() );
219
220 if ( $todoItem->isPublic() )
221 {
222 $t->set_var( "todo_is_not_public", "" );
223 $t->parse( "todo_is_public", "todo_is_public_tpl" );
224 }
225 else
226 {
227 $t->parse( "todo_is_not_public", "todo_is_not_public_tpl" );
228 $t->set_var( "todo_is_public", "" );
229 }
230
231 $t->set_var( "todo_date", $locale->format( $todoItem->date() ) );
232 $t->set_var( "no_found", "" );
233
234 $t->parse( "todo_item", "todo_item_tpl", true );
235 $i++;
236 }
237
238 $category = new eZCategory();
239 $categoryList =& $category->getAll();
240 $t->set_var( "category_selected", $showCategory ? "" : "selected" );
241
242 foreach ( $categoryList as $category )
243 {
244 $t->set_var( "category_name", $category->name() );
245 $t->set_var( "category_id", $category->id() );
246
247 if ( $category->id() == $showCategory )
248 {
249 $t->set_var( "is_selected", "selected" );
250 }
251 else
252 {
253 $t->set_var( "is_selected", "" );
254 }
255
256 $t->parse( "category_item", "category_item_tpl", true );
257 }
258
259 $status = new eZStatus();
260 $statusList =& $status->getAll();
261 $t->set_var( "all_selected", $showTodo ? "" : "selected" );
262
263 foreach ( $statusList as $status )
264 {
265 $t->set_var( "status_name", $status->name() );
266 $t->set_var( "status_id", $status->id() );
267
268 if ( $status->id() == $showTodo )
269 {
270 $t->set_var( "is_selected", "selected" );
271 }
272 else
273 {
274 $t->set_var( "is_selected", "" );
275 }
276
277 $t->parse( "status_item", "status_item_tpl", true );
278 }
279
280 $t->pparse( "output", "todo_list_page" );
281
282
283 // deletes the dayview cache file for a given day
284 function deleteCache( $SiteDesign, $language, $year, $month, $day, $userID )
285 {
286 @eZPBFile::unlink( "kernel/ezcalendar/user/cache/dayview.tpl-$SiteDesign-$language-$year-$month-$day-$userID.cache" );
287 @eZPBFile::unlink( "kernel/ezcalendar/user/cache/monthview.tpl-$SiteDesign-$language-$year-$month-$userID.cache" );
288 @eZPBFile::unlink( "kernel/ezcalendar/user/cache/dayview.tpl-$SiteDesign-$language-$year-$month-$day-$userID-private.cache" );
289 @eZPBFile::unlink( "kernel/ezcalendar/user/cache/monthview.tpl-$SiteDesign-$language-$year-$month-$userID-private.cache" );
290 }
291
292 //Adds a "0" in front of the value if it's below 10.
293 function addZero( $value )
294 {
295 settype( $value, "integer" );
296 $ret = $value;
297 if ( $ret < 10 )
298 {
299 $ret = "0" . $ret;
300 }
301 return $ret;
302 }
303
304 ?>
$session
$session
Definition: admin/articlelist.php:44
$day
else $day
Definition: appointmentedit.php:665
$year
else $year
Definition: appointmentedit.php:655
$userID
else $userID
Definition: appointmentedit.php:121
$month
else $month
Definition: appointmentedit.php:660
$pri
$pri
Definition: bugpreview.php:70
eZCategory
Definition: ezcategory.php:36
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZHTTPTool\getVar
static getVar( $name, $onlyCheckPost=false)
Definition: ezhttptool.php:55
eZINI
Reads and writes .ini style configuration files.
eZLocale
Definition: ezlocale.php:119
eZPBFile\unlink
static unlink( $filename)
Definition: ezpbfile.php:352
eZPermission\checkPermission
static checkPermission( $user, $moduleName, $permissionName)
Definition: ezpermission.php:430
eZPriority
Definition: ezpriority.php:35
eZStatus
Definition: ezstatus.php:36
eZTemplate
Definition: eztemplate.php:107
eZTodo
Definition: eztodo.php:39
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$SiteDesign
$SiteDesign
Definition: ezbulkmail/user/datasupplier.php:31
$cat
if(isset( $DeleteCategories)) $cat
Definition: ezforum/admin/categoryedit.php:49
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
exit
exit
Definition: folder.php:81
$language
$language
Definition: messageform.php:32
$DOC_ROOT
$DOC_ROOT
Definition: todolist.php:34
$iniLanguage
$iniLanguage
Definition: todolist.php:36
$currentUserID
$currentUserID
Definition: todolist.php:128
$CategoryID
$CategoryID
Definition: todolist.php:86
$StatusID
$StatusID
Definition: todolist.php:89
$showTodo
$showTodo
Definition: todolist.php:123
$userList
$userList
Definition: todolist.php:155
$t
if( $user==false) if(isset( $Delete)) $t
Definition: todolist.php:81
$i
$i
Definition: todolist.php:201
$Language
$Language
Definition: todolist.php:33
$ini
$ini
Definition: todolist.php:32
addZero
addZero( $value)
Definition: todolist.php:293
$user
if(isset( $New)) $user
Definition: todolist.php:58
$statusList
$statusList
Definition: todolist.php:260
$status
foreach( $categoryList as $category) $status
Definition: todolist.php:259
deleteCache
deleteCache( $SiteDesign, $language, $year, $month, $day, $userID)
Definition: todolist.php:284
$categoryList
$categoryList
Definition: todolist.php:239
$showID
$showID
Definition: todolist.php:152
$showCategory
if(isset( $ShowButton)) $showCategory
Definition: todolist.php:122
$todo
$todo
Definition: todolist.php:125
$ShowButton
$ShowButton
Definition: todolist.php:88
$category
foreach( $todo_array as $todoItem) $category
Definition: todolist.php:238
$locale
foreach( $userList as $userItem) if(count( $todo_array)==0) $locale
Definition: todolist.php:199
$todo_array
$todo_array
Definition: todomenulist.php:54
$due
for( $i=0; $i< count( $status_array); $i++) $due
Definition: todoview.php:158
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.