public function getProtocol($rows, $nType = 0) { $arrThemes = array(); foreach ($rows as $row) { if (!array_key_exists($row['identity'], $arrThemes)) { $theme = new ThemesProtocol(); $theme->setVercode($this->_nVercode); $theme->setKernelCode($this->_nKernel); $theme->setProtocol($row, $this->_nChannel); if ($this->_nSort == COOLXIU_SEARCH_CHOICE) { $theme->setTag(COOLXIU_TAG_CHOICE); } $arrThemes[$row['identity']] = $theme; } $prev = new PrevProtocol(); if ((int) $row['prev_type'] == 1) { $arrThemes[$row['identity']]->setMainPrev($row); } $prev->setPrev($row); $arrThemes[$row['identity']]->pushPrevImg($prev, $row['prev_type']); } $arrProtocol = array(); foreach ($arrThemes as $key => $theme) { array_push($arrProtocol, $theme); } return $arrProtocol; }