Example #1
0
    /**
     * 
     * @param PCRequest $request
     */
    public function searchAction($request) {
        
        
        $param = $request->getParams();
        if (isset($param['host_name'])) {
            $host = $param['host_name'];
            $sites = PCMapperWebsite::searchSiteWithDomainLike($host, 0);
            $sitesStore = array();
            if ($sites !== FALSE) {
                foreach ($sites as $s) {
                    $resultS = array();
                    $resultS['siteCategory'] = PCMapperCategory::nameFromIdentifier($s->getCategory());
                    $resultS['site_id'] = $s->getIdentifier();
                    $resultS['siteHost'] = $s->getUrl();
                    $resultS['dateAdded'] = $s->getDate_added()->format("d-m-y");
                    $sitesStore[] = $resultS;
                }
            }

            $result = array();
            $result['sites'] = $sitesStore;
            $result['title'] = "WebSherpa - Search: " . $host;

            return PCRendererHTML::rendererForView("search", $result);
        }
        
        throw new PCExceptionController("Page not found", 404);
    }