1 | unit PlansPage;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, FileUtil, WebPage, HtmlClasses, HTTPServer, SqlDatabase,
|
---|
7 | ModuleUser;
|
---|
8 |
|
---|
9 | type
|
---|
10 |
|
---|
11 | { TPlansPage }
|
---|
12 |
|
---|
13 | TPlansPage = class(TWebPage)
|
---|
14 | procedure DataModuleProduce(HandlerData: THTTPHandlerData);
|
---|
15 | end;
|
---|
16 |
|
---|
17 | var
|
---|
18 | PlansPage: TPlansPage;
|
---|
19 |
|
---|
20 |
|
---|
21 | implementation
|
---|
22 |
|
---|
23 | {$R *.lfm}
|
---|
24 |
|
---|
25 | uses
|
---|
26 | Core, WebSession;
|
---|
27 |
|
---|
28 | { TPlansPage }
|
---|
29 |
|
---|
30 | procedure TPlansPage.DataModuleProduce(HandlerData: THTTPHandlerData);
|
---|
31 | var
|
---|
32 | DbRows: TDbRows;
|
---|
33 | I: Integer;
|
---|
34 | ModuleUser: TModuleUser;
|
---|
35 | begin
|
---|
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;
|
---|
72 | end;
|
---|
73 |
|
---|
74 | end.
|
---|
75 |
|
---|