示例#1
0
 public function executeList($getFirstgalleries = false)
 {
     $this->setLayout(false);
     $c = new Criteria();
     $c->addJoin(GalleryPeer::ID, RelationPeer::ID2, Criteria::LEFT_JOIN);
     $c->add(GalleryPeer::PUBLICATION_STATUS, UtilsHelper::STATUS_ACTIVE);
     $c->addAscendingOrderByColumn(RelationPeer::SORT_ORDER);
     $this->pager = UtilsHelper::pager("Gallery", $c, 10);
     $this->paging = $this->pager->paging(true);
 }
示例#2
0
 public function executeList()
 {
     $this->setLayout(false);
     $c = new Criteria();
     //		$c->addJoin(NewsPeer::ID, DocumentPeer::ID, Criteria::LEFT_JOIN );
     //		$c->addJoin(NewsPeer::ID, RelationPeer::ID1 );
     //		$c->addJoin(NewsI18nPeer::ID, RelationPeer::ID2 );
     $c->add(NewsPeer::PUBLICATION_STATUS, UtilsHelper::STATUS_ACTIVE);
     $c->addDescendingOrderByColumn(NewsPeer::START_DATE);
     $this->pager = UtilsHelper::pager("News", $c, 15);
     $this->paging = $this->pager->paging(true);
 }
示例#3
0
 public function executeSearch()
 {
     try {
         $this->setLayout(false);
         $request = $this->getRequest();
         $params = $request->getParameterHolder()->getAll();
         $searchOf = array();
         foreach ($params as $key => $param) {
             $parts = explode("-", $key);
             if ($parts[0] == "field" && !empty($param)) {
                 str_replace(array('+', '-', '&&', '||', '!', '(', ')', '{', '}', '[', ']', '^', '"', '~', '*', '?', ':', '\\', '.', '/'), array('\\+', '\\-', '\\&&', '\\||', '\\!', '\\(', '\\)', '\\{', '\\}', '\\[', '\\]', '\\^', '\\"', '\\~', '\\*', '\\?', '\\:', '\\\\', '\\.', '\\/'), $param);
                 $searchOf[$parts[1]] = trim($param);
             }
         }
         /////////////////////// QUERY BUILDING //////////////////////////
         $q = new Zend_Search_Lucene_Search_Query_Boolean();
         $queryTerms = explode(" ", strtolower($query));
         $i = 0;
         $query = "";
         foreach ($searchOf as $field => $term) {
             if ($i > 0) {
                 $query .= ' AND ';
             }
             $query .= $field . ':';
             if ($field == "NiceClasses" || $field == "ViennaClasses") {
                 $query .= '(';
                 $parts = explode(",", $term);
                 foreach ($parts as $el) {
                     for ($e = 1; $e < 21; $e++) {
                         $query .= $field . $e . ':"' . trim($el) . '" OR ';
                     }
                 }
                 $query = substr($query, 0, -4) . ")";
             } elseif ($field == "DesignatedContractingParty") {
                 $query .= '(';
                 $parts = explode(",", $term);
                 foreach ($parts as $el) {
                     for ($e = 1; $e < 21; $e++) {
                         $query .= $field . $e . ':"' . trim($el) . '" OR ';
                     }
                 }
                 $query = substr($query, 0, -4) . ")";
             } elseif ($field == "Label") {
                 if (strpos($term, "*") !== false || strpos($term, "?") !== false) {
                     $query .= trim($term);
                 } else {
                     $query .= trim($term) . '~0.7';
                 }
             } else {
                 if (strpos($term, "*") !== false || strpos($term, "?") !== false) {
                     $query .= trim($term);
                 } else {
                     $query .= trim($term);
                 }
             }
             $i++;
         }
         //echo "QUERY: ".$query;
         $q = Zend_Search_Lucene_Search_QueryParser::parse($query);
         //////////////////////// SEARCH EXECUTION ////////////////////
         $searchIndex = Zend_Search_Lucene::open(sfConfig::get('sf_root_dir') . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'search/');
         //Zend_Search_Lucene::setResultSetLimit(100);
         $searchResults = $searchIndex->find($q);
         //$this->count = count($searchResults);
         //$this->results = $searchResults;
         $this->pager = UtilsHelper::pager("Trademark", $searchResults, 100);
         $this->count = $this->pager->getNbResults();
         $this->paging = $this->pager->paging();
     } catch (Exception $e) {
         $this->error = $e->getMessage();
     }
 }
示例#4
0
 public function executeImportSessionReports()
 {
     $this->setLayout(false);
     if ($dids = $this->getRequestParameter("del")) {
         if ($this->getUser()->isAuthenticated()) {
             foreach ($dids as $did) {
                 $doc = Document::getDocumentInstance($did);
                 if ($doc) {
                     $doc->delete();
                 }
             }
         }
     }
     $this->is = Document::getDocumentInstance($this->getRequestParameter("is"));
     $matches = Document::getChildrenOf($this->getRequestParameter("is"), "SearchMatch");
     $this->pager = UtilsHelper::pager("SearchMatch", $matches, 10000);
     $this->count = $this->pager->getNbResults();
     $this->paging = $this->pager->paging();
 }