protected function saveRoute($row) { $module = $this->modules[$this->data[$row]['Module']]; //no path - no route if (!$module['path']) { return; } $titles = explode("\n", $this->data[$row]['Name']); $route = new Cms_Model_Route(); $route->set_application_id(1); if (isset($this->data[$row]['page_id'])) { $route->set_page_id($this->data[$row]['page_id']); } $route->set_path($module['path']); if (isset($module['params'])) { $route->set_params($module['params']); } foreach ($this->languages as $langIndex => $lang) { $title = $this->getLangText($titles, $langIndex); $currRow = $row; if (!isset($module['route_uri'])) { $uriParts = array(); while (isset($this->data[$currRow])) { $currTitles = explode("\n", $this->data[$currRow]['Name']); $uriParts[] = $this->seoFilter->filter($currTitles[$langIndex]); if (!isset($this->data[$currRow]['parent'])) { break; } $currRow = $this->data[$currRow]['parent']; } //print_r($uriParts); $uriParts = array_reverse($uriParts); $uri = implode('/', $uriParts); } else { $uri = $module['route_uri']; } //check if route exists $existingRoutes = Cms_Model_RouteMapper::getInstance()->fetchAll(array('uri' => $uri, 'lang' => $lang)); if (count($existingRoutes) > 0) { continue; } $route->set_name($title)->set_lang($lang)->set_uri($uri); $route->set_id(null); //print_r($route); Cms_Model_RouteMapper::getInstance()->save($route); } $this->data[$row]['route_id'] = $route->get_id(); }