Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 1.9.5
-
Fix Version/s: None
-
Component/s: Global search
-
Labels:None
-
Affected Branches:MOODLE_19_STABLE
Description
For example, get_string('modulenameplural', 'wiki') exists in lang/en_utf8/wiki.php as $string['modulenameplural'] = 'Wikis';
But, module name 'user' which means user-profile and blog does not have lang file.
---------------------(original sourse)-from here
(1) search/query.php
foreach($module_types as $mod) {
if ($mod == $adv->module) {
if ($mod != 'all'){
print "<option value='$mod' selected=\"selected\">".get_string('modulenameplural', $mod)."</option>\n";
}
else{
print "<option value='$mod' selected=\"selected\">".get_string('all', 'search')."</option>\n";
}
}
else {
if ($mod != 'all'){
print "<option value='$mod'>".get_string('modulenameplural', $mod)."</option>\n";
}
else{
print "<option value='$mod'>".get_string('all', 'search')."</option>\n";
}
}
}
-------
(2) search/stats.php
$table->data[] = array($documentsindatabasestr, $indexinfo->dbcount);
foreach($indexinfo->types as $key => $value) {
$table->data[] = array(get_string('documentsfor', 'search') . " '".get_string('modulenameplural', $key)."'", $value);
}
---------------------(original sourse)-to here
There are several solutions.
(1) add user.php in lang folder (for global search only...).
(2) make an exception the module names which does not exist in lang folder.
(3) make an exception the module names which does not exist in lang folder and change module name 'user' to 'user' and 'blog'.
My suggestion is that newly adding a function to get 'modulenameplural'.
for example, add to search/lib.php
function get_modulenameplural($modname)
{
if (($ret = get_string('modulenameplural', $modname)) != '[[modulenameplural]]') return $ret;
return get_string("modulenameplural_$modname", 'search');
}
and replace get_string('modulenameplural', $mod) to get_modulenameplural($mod) in search/query.php and search/stats.php.
And you need to add following strings in lang/search.php
$string['modulenameplural_user'] = 'Users';
-----------
On statistics view by search/stat.php,
User does not apear.
The cause of this problem is maybe based on this codes,
//individual document types
// $types = search_get_document_types();
$types = search_collect_searchables(true, false);
in search/indexlibphp, function __construct.
Why does not use search_get_document_types()?