Changeset 5749 for trunk/prototype/services/ImapServiceAdapter.php
- Timestamp:
- 03/19/12 14:36:58 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/services/ImapServiceAdapter.php
r5745 r5749 19 19 public function find( $URI, $justthese = false, $criteria = false ) 20 20 { 21 //require_once dirname(__FILE__) . '/../api/controller.php'; 21 22 $context = $justthese['context']; 22 23 $URI = $URI['concept']; … … 93 94 94 95 foreach( $result as $i => $val ) 95 $result[$i] = unserialize( $val ); 96 96 $result[$i] = unserialize( $val ); 97 97 } 98 98 else … … 110 110 } 111 111 //return var_export($result); 112 112 113 113 $response = array( "page" => $page, "total" => $total_pages, "records" => $count ); 114 114 115 115 116 for ($i=0; $i<count($result); $i++) 116 117 { 117 $flags_enum = array(' Recent', 'Unseen', 'Answered', 'Draft', 'Deleted', 'Flagged');118 $flags_enum = array('Unseen'=> 1, 'Answered'=> 1, 'Forwarded'=> 1, 'Flagged'=> 1, 'Recent'=> 1, 'Draft'=> 1 ); 118 119 119 120 foreach ($flags_enum as $key => $flag) 120 121 { 121 if ( !isset($result[$i][$flag]) || !trim($result[$i][$flag]) || trim($result[$i][$flag]) == '') 122 unset($flags_enum[$key]); 122 if ( !isset($result[$i][$key]) || !trim($result[$i][$key]) || trim($result[$i][$key]) == '') 123 $flags_enum[$key] = 0; 124 //unset($flags_enum[$key]); 123 125 124 126 unset($result[$i][$flag]); 125 } 126 127 } 127 128 if (array_key_exists($i, $result)) 128 129 { … … 131 132 $response["rows"][$i]['flags'] = implode(',', $flags_enum); 132 133 $response["rows"][$i]['size'] = $response["rows"][$i]['Size']; 134 $response["rows"][$i]['folder'] = $folder_name; 135 $filter = array('AND', array('=', 'folderName', $folder_name), array('=','messageNumber', $result[$i]['msg_number'])); 136 $followupflagged = Controller::find( 137 array('concept' => 'followupflagged'), 138 false, 139 array('filter' => $filter, 'criteria' => array('deepness' => '2')) 140 ); 141 142 143 if(isset($followupflagged[0]['followupflagId'])) 144 { 145 $followupflag = Controller::read( array( 'concept' => 'followupflag', 'id' => $followupflagged[0]['followupflagId'] )); 146 $followupflagged[0]['followupflag'] = $followupflag; 147 $response["rows"][$i]['followupflagged'] = $followupflagged[0]; 148 149 } 150 151 $labeleds = Controller::find( 152 array('concept' => 'labeled'), 153 false, 154 array('filter' => $filter, 'criteria' => array('deepness' => '2')) 155 ); 156 foreach ($labeleds as $e){ 157 $labels = Controller::read( array( 'concept' => 'label', 'id' => $e['labelId'])); 158 $response["rows"][$i]['labels'][$e['labelId']] = $labels; 159 } 133 160 //$response["rows"][$i]['udate'] = ( $result[$i]['udate'] + $this->functions->CalculateDateOffset() * 1000 ); 134 161 unset($response["rows"][$i]['Size']); 135 162 } 136 } 137 163 } 138 164 return $this->to_utf8($response); 139 165 }
Note: See TracChangeset
for help on using the changeset viewer.