image->width, 0), 'height' ); } parent::_prepareList($list); $list = $this->_groupByCategory($list); } protected function _groupByCategory($list) { $groups = array(); foreach ($list as $sponsor) { if (empty($groups[$sponsor['categoryId']])) { $groups[$sponsor['categoryId']] = array('categoryTitle' => $sponsor['category'], 'list' => array()); } $groups[$sponsor['categoryId']]['list'][] = $sponsor; } foreach($groups as &$group) { $group['list'] = $this->_groupByRow($group['list']); } $list = $groups; return $list; } protected function _groupByRow($list) { $rows = array(); $index = 0; foreach ($list as $row) { $rows[(int)floor(($index++)/3)]['list'][] = $row; } foreach($rows as &$row) { $row['maxHeight'] = max(Qs_Array::fetchCol($row['list'], 'imageHeight')); } return $rows; } public function getListSelect() { $select = parent::getListSelect(); $select->order('sc.sorter'); $select->order('Sponsor.name'); $select->order('id'); return $select; } }