options = $options; } function exec($Doc) { $DBObj = SiteMap::getObj('Announcement/Announcement.php'); $alias = ''; $action = 'list'; $params = array(); $parts = explode('/', $this->options['_restAlias']); if ($parts[0] == 'archives') { array_shift($parts); if ((count($parts) % 2) != 0) { $params['archives'] = sprintf('%04d', array_shift($parts)); } else { $params['archives'] = sprintf('%04d-%02d', array_shift($parts), array_shift($parts)); } if (!empty($parts)) { for ($i = 0; $i < count($parts); $i += 2) { $params[$parts[$i]] = $parts[$i + 1]; } } } else { if ((count($parts) % 2) != 0) { $alias = array_shift($parts); } if (!empty($parts)) { for ($i = 0; $i < count($parts); $i += 2) { $params[$parts[$i]] = $parts[$i + 1]; } } } if (!empty($alias)) { if (($id = $DBObj->getIdByAlias($alias))) { $DBObj->setPrimaryKey($id); $action = 'show'; } else { $p404 = SiteMap::getObj('NotFound/NotFoundView.php'); $p404->exec($Doc); return true;; } } $Show = SiteMap::getObj('Announcement/Show/Show.php', $Doc, $DBObj); if (!empty($params)) { foreach ($params as $k => $v) { switch ($k) { case 'page': $Show->pageNum = (int) $v; break; case 'archives': $action = 'archives'; $Show->archives = $v; break; } } } $Show->setAction($action); $Show->exec(); } }