@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * Script defining generic functions against a search engine api. Just only if one day the search engine changes |
|
5 | - * @package chamilo.include.search |
|
6 | - */ |
|
4 | + * Script defining generic functions against a search engine api. Just only if one day the search engine changes |
|
5 | + * @package chamilo.include.search |
|
6 | + */ |
|
7 | 7 | /** |
8 | - * Code |
|
9 | - */ |
|
8 | + * Code |
|
9 | + */ |
|
10 | 10 | require 'xapian/XapianQuery.php'; |
11 | 11 | |
12 | 12 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param string $query_string The term string |
34 | 34 | */ |
35 | 35 | function chamilo_get_boolean_query($term) { |
36 | - return xapian_get_boolean_query($term); |
|
36 | + return xapian_get_boolean_query($term); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -44,22 +44,22 @@ discard block |
||
44 | 44 | $results_by_tool = array(); |
45 | 45 | if (count($results)>0) { |
46 | 46 | |
47 | - foreach ($results as $key => $row) { |
|
48 | - $results_by_tool[$row['toolid']][] = $row; |
|
49 | - } |
|
47 | + foreach ($results as $key => $row) { |
|
48 | + $results_by_tool[$row['toolid']][] = $row; |
|
49 | + } |
|
50 | 50 | |
51 | - $processed_results = array(); |
|
52 | - foreach ($results_by_tool as $toolid => $rows) { |
|
53 | - $tool_processor_class = $toolid .'_processor'; |
|
54 | - $tool_processor_path = api_get_path(LIBRARY_PATH) .'search/tool_processors/'. $tool_processor_class .'.class.php'; |
|
55 | - if (file_exists($tool_processor_path)) { |
|
56 | - require_once($tool_processor_path); |
|
57 | - $tool_processor = new $tool_processor_class($rows); |
|
58 | - $processed_results = array_merge($tool_processor->process(), $processed_results); |
|
59 | - } |
|
60 | - } |
|
51 | + $processed_results = array(); |
|
52 | + foreach ($results_by_tool as $toolid => $rows) { |
|
53 | + $tool_processor_class = $toolid .'_processor'; |
|
54 | + $tool_processor_path = api_get_path(LIBRARY_PATH) .'search/tool_processors/'. $tool_processor_class .'.class.php'; |
|
55 | + if (file_exists($tool_processor_path)) { |
|
56 | + require_once($tool_processor_path); |
|
57 | + $tool_processor = new $tool_processor_class($rows); |
|
58 | + $processed_results = array_merge($tool_processor->process(), $processed_results); |
|
59 | + } |
|
60 | + } |
|
61 | 61 | |
62 | - return array(count($processed_results), $processed_results); |
|
62 | + return array(count($processed_results), $processed_results); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
@@ -72,5 +72,5 @@ discard block |
||
72 | 72 | * @return XapianQuery query joined |
73 | 73 | */ |
74 | 74 | function chamilo_join_queries($query1, $query2=NULL, $op='or') { |
75 | - return xapian_join_queries($query1, $query2, $op); |
|
75 | + return xapian_join_queries($query1, $query2, $op); |
|
76 | 76 | } |
@@ -150,7 +150,7 @@ |
||
150 | 150 | $data = substr($png,$ipos,$chunk['size']); |
151 | 151 | $sections = explode("\0", $data); |
152 | 152 | if ($sections[0] == $key) { |
153 | - return $sections; |
|
153 | + return $sections; |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | // Extract the data and the CRC |
@@ -10,64 +10,64 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class HTML_QuickForm_receivers extends HTML_QuickForm_group |
12 | 12 | { |
13 | - /** |
|
14 | - * Array of all receivers |
|
15 | - */ |
|
16 | - var $receivers; |
|
17 | - /** |
|
18 | - * Array of selected receivers |
|
19 | - */ |
|
20 | - var $receivers_selected; |
|
21 | - /** |
|
22 | - * Constructor |
|
23 | - * @param string $elementName |
|
24 | - * @param string $elementLabel |
|
25 | - * @param array $attributes This should contain the keys 'receivers' and |
|
26 | - * 'receivers_selected' |
|
27 | - */ |
|
28 | - function HTML_QuickForm_receivers($elementName = null, $elementLabel = null, $attributes = null) |
|
29 | - { |
|
30 | - $this->receivers = $attributes['receivers']; |
|
31 | - $this->receivers_selected = $attributes['receivers_selected']; |
|
32 | - unset($attributes['receivers']); |
|
33 | - unset($attributes['receivers_selected']); |
|
34 | - $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes); |
|
35 | - $this->_persistantFreeze = true; |
|
36 | - $this->_appendName = true; |
|
37 | - $this->_type = 'receivers'; |
|
38 | - } |
|
39 | - /** |
|
40 | - * Create the form elements to build this element group |
|
41 | - */ |
|
42 | - function _createElements() |
|
43 | - { |
|
44 | - $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')')); |
|
45 | - $this->_elements[0]->setChecked(true); |
|
46 | - $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array ('onclick' => 'javascript:receivers_show(\'receivers_to\')')); |
|
47 | - $this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers); |
|
48 | - $this->_elements[2]->setSelected($this->receivers_selected); |
|
49 | - } |
|
50 | - /** |
|
51 | - * HTML representation |
|
52 | - */ |
|
53 | - function toHtml() |
|
54 | - { |
|
55 | - include_once ('HTML/QuickForm/Renderer/Default.php'); |
|
56 | - $this->_separator = '<br/>'; |
|
57 | - $renderer = & new HTML_QuickForm_Renderer_Default(); |
|
58 | - $renderer->setElementTemplate('{element}'); |
|
59 | - $select_boxes = $this->_elements[2]; |
|
60 | - $select_boxes->setElementTemplate('<div style="margin-left:20px;display:block;" id="receivers_'.$select_boxes->getName().'">'.$select_boxes->_elementTemplate.'</div>'); |
|
61 | - parent :: accept($renderer); |
|
62 | - $js = $this->getElementJS(); |
|
63 | - return $renderer->toHtml().$js; |
|
64 | - } |
|
65 | - /** |
|
66 | - * Get the necessary javascript |
|
67 | - */ |
|
68 | - function getElementJS() |
|
69 | - { |
|
70 | - $js = "<script type=\"text/javascript\"> |
|
13 | + /** |
|
14 | + * Array of all receivers |
|
15 | + */ |
|
16 | + var $receivers; |
|
17 | + /** |
|
18 | + * Array of selected receivers |
|
19 | + */ |
|
20 | + var $receivers_selected; |
|
21 | + /** |
|
22 | + * Constructor |
|
23 | + * @param string $elementName |
|
24 | + * @param string $elementLabel |
|
25 | + * @param array $attributes This should contain the keys 'receivers' and |
|
26 | + * 'receivers_selected' |
|
27 | + */ |
|
28 | + function HTML_QuickForm_receivers($elementName = null, $elementLabel = null, $attributes = null) |
|
29 | + { |
|
30 | + $this->receivers = $attributes['receivers']; |
|
31 | + $this->receivers_selected = $attributes['receivers_selected']; |
|
32 | + unset($attributes['receivers']); |
|
33 | + unset($attributes['receivers_selected']); |
|
34 | + $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes); |
|
35 | + $this->_persistantFreeze = true; |
|
36 | + $this->_appendName = true; |
|
37 | + $this->_type = 'receivers'; |
|
38 | + } |
|
39 | + /** |
|
40 | + * Create the form elements to build this element group |
|
41 | + */ |
|
42 | + function _createElements() |
|
43 | + { |
|
44 | + $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')')); |
|
45 | + $this->_elements[0]->setChecked(true); |
|
46 | + $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array ('onclick' => 'javascript:receivers_show(\'receivers_to\')')); |
|
47 | + $this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers); |
|
48 | + $this->_elements[2]->setSelected($this->receivers_selected); |
|
49 | + } |
|
50 | + /** |
|
51 | + * HTML representation |
|
52 | + */ |
|
53 | + function toHtml() |
|
54 | + { |
|
55 | + include_once ('HTML/QuickForm/Renderer/Default.php'); |
|
56 | + $this->_separator = '<br/>'; |
|
57 | + $renderer = & new HTML_QuickForm_Renderer_Default(); |
|
58 | + $renderer->setElementTemplate('{element}'); |
|
59 | + $select_boxes = $this->_elements[2]; |
|
60 | + $select_boxes->setElementTemplate('<div style="margin-left:20px;display:block;" id="receivers_'.$select_boxes->getName().'">'.$select_boxes->_elementTemplate.'</div>'); |
|
61 | + parent :: accept($renderer); |
|
62 | + $js = $this->getElementJS(); |
|
63 | + return $renderer->toHtml().$js; |
|
64 | + } |
|
65 | + /** |
|
66 | + * Get the necessary javascript |
|
67 | + */ |
|
68 | + function getElementJS() |
|
69 | + { |
|
70 | + $js = "<script type=\"text/javascript\"> |
|
71 | 71 | /* <![CDATA[ */ |
72 | 72 | receivers_hide('receivers_to'); |
73 | 73 | function receivers_show(item) { |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | } |
81 | 81 | /* ]]> */ |
82 | 82 | </script>\n"; |
83 | - return $js; |
|
84 | - } |
|
85 | - /** |
|
86 | - * accept renderer |
|
87 | - */ |
|
88 | - function accept(& $renderer, $required = false, $error = null) |
|
89 | - { |
|
90 | - $renderer->renderElement($this, $required, $error); |
|
91 | - } |
|
83 | + return $js; |
|
84 | + } |
|
85 | + /** |
|
86 | + * accept renderer |
|
87 | + */ |
|
88 | + function accept(& $renderer, $required = false, $error = null) |
|
89 | + { |
|
90 | + $renderer->renderElement($this, $required, $error); |
|
91 | + } |
|
92 | 92 | } |
93 | 93 | ?> |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | class DateRangePicker extends HTML_QuickForm_text |
8 | 8 | { |
9 | 9 | /** |
10 | - * Constructor |
|
11 | - */ |
|
10 | + * Constructor |
|
11 | + */ |
|
12 | 12 | public function __construct($elementName = null, $elementLabel = null, $attributes = null) |
13 | 13 | { |
14 | 14 | if (!isset($attributes['id'])) { |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
147 | - * @param array $dates result of parseDateRange() |
|
148 | - * |
|
149 | - * @return bool |
|
150 | - */ |
|
147 | + * @param array $dates result of parseDateRange() |
|
148 | + * |
|
149 | + * @return bool |
|
150 | + */ |
|
151 | 151 | public function validateDates($dates, $format = null) |
152 | 152 | { |
153 | 153 | if (empty($dates['start']) || empty($dates['end'])) { |
@@ -74,9 +74,9 @@ |
||
74 | 74 | $styleCss = $this->editor->getConfigAttribute('style'); |
75 | 75 | |
76 | 76 | if ($styleCss) { |
77 | - $style = true; |
|
77 | + $style = true; |
|
78 | 78 | } else { |
79 | - $style = false; |
|
79 | + $style = false; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | return $this->buildEditor($style); |
@@ -26,10 +26,10 @@ |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
29 | - * HTML code to display this datepicker |
|
29 | + * HTML code to display this datepicker |
|
30 | 30 | * |
31 | 31 | * @return string |
32 | - */ |
|
32 | + */ |
|
33 | 33 | public function toHtml() |
34 | 34 | { |
35 | 35 | if ($this->_flagFrozen) { |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * Url element |
|
5 | - * |
|
6 | - * Class Url |
|
7 | - */ |
|
4 | + * Url element |
|
5 | + * |
|
6 | + * Class Url |
|
7 | + */ |
|
8 | 8 | class Url extends HTML_QuickForm_text |
9 | 9 | { |
10 | 10 |
@@ -6,18 +6,18 @@ |
||
6 | 6 | */ |
7 | 7 | class SelectTheme extends HTML_QuickForm_select |
8 | 8 | { |
9 | - /** |
|
10 | - * Class constructor |
|
11 | - */ |
|
12 | - function SelectTheme($elementName=null, $elementLabel=null, $options=null, $attributes=null) { |
|
13 | - parent::__construct($elementName, $elementLabel, $options, $attributes); |
|
14 | - // Get all languages |
|
15 | - $themes = api_get_themes(); |
|
16 | - $this->_options = array(); |
|
17 | - $this->_values = array(); |
|
18 | - $this->addOption('--',''); // no theme select |
|
19 | - for ($i=0; $i< count($themes[0]);$i++) { |
|
20 | - $this->addOption($themes[1][$i],$themes[0][$i]); |
|
21 | - } |
|
22 | - } |
|
9 | + /** |
|
10 | + * Class constructor |
|
11 | + */ |
|
12 | + function SelectTheme($elementName=null, $elementLabel=null, $options=null, $attributes=null) { |
|
13 | + parent::__construct($elementName, $elementLabel, $options, $attributes); |
|
14 | + // Get all languages |
|
15 | + $themes = api_get_themes(); |
|
16 | + $this->_options = array(); |
|
17 | + $this->_values = array(); |
|
18 | + $this->addOption('--',''); // no theme select |
|
19 | + for ($i=0; $i< count($themes[0]);$i++) { |
|
20 | + $this->addOption($themes[1][$i],$themes[0][$i]); |
|
21 | + } |
|
22 | + } |
|
23 | 23 | } |
@@ -6,22 +6,22 @@ |
||
6 | 6 | */ |
7 | 7 | class SelectLanguage extends HTML_QuickForm_select |
8 | 8 | { |
9 | - /** |
|
10 | - * Class constructor |
|
11 | - */ |
|
12 | - function SelectLanguage($elementName=null, $elementLabel=null, $options=null, $attributes=null) |
|
13 | - { |
|
14 | - parent::__construct($elementName, $elementLabel, $options, $attributes); |
|
15 | - // Get all languages |
|
16 | - $languages = api_get_languages(); |
|
17 | - $this->_options = array(); |
|
18 | - $this->_values = array(); |
|
19 | - foreach ($languages['name'] as $index => $name) { |
|
20 | - if($languages['folder'][$index] == api_get_setting('platformLanguage')) { |
|
21 | - $this->addOption($name,$languages['folder'][$index],array('selected'=>'selected')); |
|
22 | - } else { |
|
23 | - $this->addOption($name,$languages['folder'][$index]); |
|
24 | - } |
|
25 | - } |
|
26 | - } |
|
9 | + /** |
|
10 | + * Class constructor |
|
11 | + */ |
|
12 | + function SelectLanguage($elementName=null, $elementLabel=null, $options=null, $attributes=null) |
|
13 | + { |
|
14 | + parent::__construct($elementName, $elementLabel, $options, $attributes); |
|
15 | + // Get all languages |
|
16 | + $languages = api_get_languages(); |
|
17 | + $this->_options = array(); |
|
18 | + $this->_values = array(); |
|
19 | + foreach ($languages['name'] as $index => $name) { |
|
20 | + if($languages['folder'][$index] == api_get_setting('platformLanguage')) { |
|
21 | + $this->addOption($name,$languages['folder'][$index],array('selected'=>'selected')); |
|
22 | + } else { |
|
23 | + $this->addOption($name,$languages['folder'][$index]); |
|
24 | + } |
|
25 | + } |
|
26 | + } |
|
27 | 27 | } |