/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk

« back to all changes in this revision

Viewing changes to classes/searchresults.php

  • Committer: Suren A. Chilingaryan
  • Date: 2009-01-30 23:56:42 UTC
  • Revision ID: csa@dside.dyndns.org-20090130235642-gw9n5v9y7w23dmmd
Further search improvements, support for custom properties (config)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
 function AcceptCurrent() {
25
25
    if ($this->current) {
26
 
        if (sizeof($this->results[$this->current]['results'])) {
 
26
        if ($this->results[$this->current]['results']) {
27
27
            $func = $this->engine->GetCmpFunction($this->current);
28
28
            if ($func) {
29
29
                usort($this->results[$this->current]['results'], $func);
30
30
            }
31
 
        } else {
 
31
        } else if (!$this->results[$this->current]['content']) {
32
32
            unset($this->results[$this->current]);
33
33
        }
34
34
        $this->current = false;
49
49
 function NewModule(SEARCHEngine $engine, $module, $title = false, $description = false) {
50
50
    $data = array(
51
51
        'module' => $module,
52
 
        'title' => ($title?$title:$engine->GetModuleTitle($module)),
53
 
        'description' => ($description?$description:$this->modules[$module]['description']),
54
 
        'results' => array()
 
52
        'title' => (($title!==false)?$title:$engine->GetModuleTitle($module)),
 
53
        'description' => (($description!==false)?$description:$engine->GetModuleDescription($module)),
55
54
    );
56
55
 
57
56
    $this->results[$module] = $data;
70
69
    if ($this->filter->FilterResult($info, $rating)) return false;
71
70
    if (($rating < 1)&&($rating < $this->threshold)) return false;
72
71
    
73
 
    $info['rating'] = $rating;
74
 
    if ($key === false) {
75
 
        $this->results[$this->current]['results'][] = $info;
 
72
    if (is_array($info)) {
 
73
        if (!$this->results[$this->current]['results']) {
 
74
            if ($this->results[$this->current]['content']) {
 
75
                throw new ADEIException(translate("The search results for current module are already containing html content, therefore result elements could not be added"));
 
76
            }
 
77
            $this->results[$this->current]['results'] = array();
 
78
        }
 
79
        
 
80
        $info['rating'] = $rating;
 
81
        if ($key === false) {
 
82
            $this->results[$this->current]['results'][] = $info;
 
83
        } else {
 
84
            $this->results[$this->current]['results'][$key] = $info;
 
85
        }
76
86
    } else {
77
 
        $this->results[$this->current]['results'][$key] = $info;
 
87
        if (!$this->results[$this->current]['content']) {
 
88
            if ($this->results[$this->current]['results']) {
 
89
                throw new ADEIException(translate("The search results for current module are already containing some elemnts, therefore html content could not be added"));
 
90
            }
 
91
            $this->results[$this->current]['content'] = "";
 
92
        }
 
93
        
 
94
        $this->results[$this->current]['content'] .= $info;
78
95
    }
79
96
    
80
97
    return true;