49ceebadfcf99c8a7e989800fe6b3ad1e81f1516
[Pman.MTrack] / DataObjects / Mtrack_repos_branch.php
1 <?php
2 /**
3  * Table Definition for mtrack_repos
4  */
5 class_exists('DB_DataObject') ? '' : require_once 'DB/DataObject.php';
6
7 class Pman_MTrack_DataObjects_Mtrack_repos_branch extends DB_DataObject 
8 {
9     ###START_AUTOCODE
10     /* the code below is auto generated do not remove the above tag */
11
12     public $__table = 'mtrack_repos_branch';                    // table name
13     public $id;                              // int(11)  not_null primary_key auto_increment
14     public $name;                       // string(64)  not_null
15     public $repo_id;                         // string(16)  not_null
16      
17     function repo()
18     {
19         static $cache;
20         if (isset($cache[$this->repo_id])) {
21             return $cache[$this->repo_id];
22         }
23         $r = DB_DataObject::factory('mtrack_repos');
24         $r->get($this->repo_id);
25         $cache[$this->repo_id] = $r;
26         return $r;
27     }
28
29     function notifyENDOFDAYMAIL($rcpt, $last_sent_date, $notify, $force)
30     {
31         // fisrst use history to show a list of changes between the dates.
32         //die("building end of day mail");
33         // var_dump($notify->act_start );
34         $start = date('Y-m-d H:i:s', strtotime($notify->act_start . ' - 1 DAY'));
35         $end = date('Y-m-d H:i:s', strtotime($notify->act_start));
36         
37         $object = 'branch';
38         $branch = $this->name;
39     
40         
41         //$this->impl()->debug=1;
42         //print_r(array('since'=> '{'.$start.'}' , 'before' => '{'.$end .'}'));
43     
44          $res = $this->repo()->impl()->history('.', array('since'=> '{'.$start.'}' , 'before' => '{'.$end .'}'), $object, $branch);
45           
46          // find the last rev the day before...
47          
48          
49           
50          $obj = $this->repo()->historyToSummary($res, $notify->act_start);
51          if (!$obj) {
52             // echo "History returned nothing";
53              return true;
54          }
55          $obj->from_dt = $start;
56          $obj->to_dt = $end;
57          $obj->branch = $this->name;
58             //print_r($obj);exit; 
59           
60        
61         $ret =   $rcpt->buildMail('repo_daily_changes', $obj);
62         return $ret;
63                 
64     }
65      
66     
67 }
68