Changeset 6136 for trunk/prototype/modules
- Timestamp:
- 05/08/12 15:12:01 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/modules/calendar/interceptors/DBMapping.php
r6114 r6136 38 38 } 39 39 40 public function encodeCreateAlarm(&$uri, &$params, &$criteria, $original) { 41 42 if (!isset($params['schedulable']) || !isset($params['rangeStart']) || !isset($params['rangeEnd'])) { 43 $participant = Controller::read(array('concept' => 'participant', 'id' => $params['participant']), array('schedulable')); 44 $schedulable = Controller::read(array('concept' => 'schedulable', 'id' => $participant['schedulable']), array('startTime', 'endTime')); 45 46 $params['schedulable'] = $participant['schedulable']; 47 $params['rangeStart'] = strtotime('- ' . $params['time'] . ' ' . self::codeAlarmUnit($params['unit']), (int) ($schedulable['startTime'] / 1000)) . '000'; 48 $params['rangeEnd'] = $schedulable['endTime']; 49 } 50 51 $params['type'] = self::codeAlarmType($params['type']); 40 public function encodeCreateAlarm( &$uri , &$params , &$criteria , $original ){ 41 42 if(!isset($params['schedulable']) || !isset($params['rangeStart']) || !isset($params['rangeEnd']) ) 43 { 44 $participant = Controller::read( array( 'concept' => 'participant' , 'id' => $params['participant'] ) , array('schedulable') ); 45 46 $params['schedulable'] = $participant['schedulable']; 47 48 $params['type'] = self::codeAlarmType($params['type']); 49 50 $params['offset'] = $params['time'] * 1000; 51 52 switch( strtolower($params['unit']) ) 53 { 54 case 'd': $params['offset'] *= 24; 55 case 'h': $params['offset'] *= 60; 56 case 'm': $params['offset'] *= 60; 57 } 58 } 52 59 } 53 60 … … 658 665 659 666 $params = array(); 660 661 $al = Controller::service('PostgreSQL')->execSql( "SELECT co.id as id, co.cal_uid as uid, co.type_id as type, co.dtstart as startTime, co.summary as summary, co.description as description, co.dtend as endTime, co.location as location, co.allday as allDay, co.transp as transparent, co.class_id as class, ".662 "co.range_start as rangeStart, co.range_end as rangeEnd, co.last_update as lastUpdate, co.dtstamp as dtstamp, co.sequence as sequence, co.tzid as timezone, CASE WHEN rep.object_id = co.id THEN occ.occurrence - al.alarm_offset ELSE co.dtstart - al.alarm_offset END as sendTime".663 664 665 666 667 "ELSE co.range_start - al.alarm_offset >= '$target' AND co.range_start - al.alarm_offset <= '".( $target + 86400000)."' END");667 668 $al = Controller::service('PostgreSQL')->execSql( "SELECT distinct co.id as \"id\", co.cal_uid as \"uid\", co.type_id as \"type\", co.dtstart as \"startTime\", co.summary as \"summary\", co.description as \"description\", co.dtend as \"endTime\", co.location as \"location\", co.allday as \"allDay\", co.transp as transparent, co.class_id as class, ". 669 "co.range_start as \"rangeStart\", co.range_end as \"rangeEnd\", co.last_update as \"lastUpdate\", co.dtstamp as \"dtstamp\", co.sequence as \"sequence\", co.tzid as \"timezone\", CASE WHEN rep.object_id = co.id THEN occ.occurrence - al.alarm_offset ELSE co.dtstart - al.alarm_offset END as \"sendTime\" ". 670 "FROM calendar_alarm as al, calendar_object as co, calendar_repeat as rep, calendar_repeat_occurrence as occ, calendar_participant as part WHERE ". 671 "al.action_id = '".ALARM_ALERT."' AND al.sent = '0' AND al.participant_id = part.id AND part.object_id = co.id AND ". 672 "CASE WHEN rep.object_id = co.id ". 673 "THEN rep.id = occ.repeat_id AND occ.occurrence - al.alarm_offset >= '$target' AND occ.occurrence - al.alarm_offset <= '".( $target + 86400000)."' ". 674 "ELSE co.range_start - al.alarm_offset >= '$target' AND co.range_start - al.alarm_offset <= '".( $target + 86400000)."' END";); 668 675 669 676 if(is_array($al)) 670 677 foreach( $al as $v ) 671 678 { 672 $params['sendTime'] = $ al['sendTime'];673 674 unset( $ al['sendTime'] );675 676 $params['schedulable'] = $ al;679 $params['sendTime'] = $v['sendTime']; 680 681 unset( $v['sendTime'] ); 682 683 $params['schedulable'] = $v; 677 684 } 678 685 else
Note: See TracChangeset
for help on using the changeset viewer.