final move of files
[web.mtrack] / MTrackWeb / Events.php
1 <?php # vim:ts=2:sw=2:et:
2 /* For licensing and copyright terms, see the file named LICENSE */
3  
4 // is this working ???
5 // partly - event.toHTML is borked... - we should use templating for this..
6 require_once 'MTrackWeb.php';
7
8 class MTrackWeb_Events extends MTrackWeb
9 {
10     var $id; // 0 = new
11     var $issue = false;
12     var $preview;
13     var $error;
14     var $editable;
15     var $tid = 0;
16     
17     function get($pi=0)
18     {
19         $this->id = $pi ?  $pi: $_GET['id'];
20         $this->id  = $this->id  == 'new' ? 0 : $this->id;
21         
22         $this->tid = is_numeric($this->id) ? $this->id : 0;
23         
24     
25   
26         if ($this->id) {
27             $this->issue = (strlen($this->id) == 32)  ? 
28                 MTrackIssue::loadById($this->id) : 
29                 MTrackIssue::loadByNSIdent($this->id);
30         }
31         
32         
33         if (!$this->issue) {
34             $this->jdata(array(
35                 'total' => 0,
36                 'html' => ''
37             ));
38         }
39         MTrackACL::requireAllRights("ticket:" . $this->issue->tid, 'read');
40  // may die.. fixme
41         
42         
43          
44         $start = isseT($_REQUEST['start']) ? (int) $_REQUEST['start'] : 0;
45         $limit = isseT($_REQUEST['limit']) ? (int) $_REQUEST['limit'] : 10;
46         
47         // output from this areay..
48         $changes = array();
49         $cids = array();
50         $change_audit = array();
51         $effort_audit = array();
52      
53         //shortcuts.
54         $tid = $this->issue->tid;
55         require_once 'MTrack/DataObjects/Event.php';
56         
57         $changes = MTrack_DataObject_Event::fetchRange($this->issue, $start, $limit);
58          
59         ksort($changes);
60         foreach($changes as $c) {
61             echo $c->toHtml();
62         }
63         exit;
64         //$this->renderEvents();
65     }
66       
67 }