source: trunk/Modules/ZdechovNET/PlansPage.pas

Last change on this file was 151, checked in by chronos, 9 months ago
File size: 1.8 KB
Line 
1unit PlansPage;
2
3interface
4
5uses
6 Classes, SysUtils, FileUtil, WebPage, HtmlClasses, HTTPServer, SqlDatabase,
7 ModuleUser;
8
9type
10
11 { TPlansPage }
12
13 TPlansPage = class(TWebPage)
14 procedure DataModuleProduce(HandlerData: THTTPHandlerData);
15 end;
16
17var
18 PlansPage: TPlansPage;
19
20
21implementation
22
23{$R *.lfm}
24
25uses
26 Core, WebSession;
27
28{ TPlansPage }
29
30procedure TPlansPage.DataModuleProduce(HandlerData: THTTPHandlerData);
31var
32 DbRows: TDbRows;
33 I: Integer;
34 ModuleUser: TModuleUser;
35begin
36 with TWebSession(HandlerData) do begin
37 ModuleUser := TModuleUser(ModuleManager.FindModuleByName('User'));
38 if Request.Path.Count > 1 then begin
39 PageNotFound;
40 Exit;
41 end;
42
43 ModuleUser.LoadUserInfo;
44 with HtmlDocument.Body, SubItems.AddString do begin
45 Text := '<table>';
46 try
47 DbRows := TDbRows.Create;
48 Text := '<br/><strong>Plánované úkoly:</strong><br />' +
49 '<div><ul>';
50 Database.Query(DbRows, 'SELECT * FROM `Plans` WHERE (`TimeFinished` IS NULL) AND (`Public`=1) ORDER BY `TimeCreate`');
51 for I := 0 to DbRows.Count - 1 do begin
52 Text := Text + '<li>' + DbRows[I].Items['Description'] + '</li>';
53 end;
54 Text := Text + '</ul></div><br/>';
55
56 Text := Text + '<br/><strong>Hotové úkoly:</strong><br />' +
57 '<div><ul>';
58 Database.Query(DbRows, 'SELECT * FROM `Plans` WHERE (`TimeFinished` IS NOT NULL) AND (`Public`=1) ORDER BY `TimeCreate`');
59 for I := 0 to DbRows.Count - 1 do begin
60 Text := Text + '<li>' + DbRows[I].Items['Description'] + '<br/>' +
61 '<i style="padding-left: 30px;">' + DbRows[I].Items['Conclusion'] + '</i></li>';
62 end;
63 Text := Text + '</ul></div><br/>';
64
65 finally
66 DbRows.Free;
67 end;
68 Text := Text + '</table>';
69 end;
70 GeneratePage(Self);
71 end;
72end;
73
74end.
75
Note: See TracBrowser for help on using the repository browser.