Open apmuthu opened 1 year ago
Screenshot that uses the last word of the survey of 3 characters for ordering and the rest for category.
The above suffers from a z-index inherited issue and hence a pure html collapsible menu with no added CSS and JS elements has been hammered out as below.
In application/views/surveys/publicSurveyList.php
in v2.0.5.1
in order to display the survey list in alphabetical order instead of the existing order in which it was created and collapsing the into a drill down category list, the following changes need to be made. Introduced a new function at the beginning of the file after the first foreach stanza and have it called as:
function order_links($list) {
// a new dom object
$dom = new domDocument;
libxml_use_internal_errors(true);
libxml_clear_errors();
// discard white space
$dom->preserveWhiteSpace = false;
$dom->loadHTML($list);
$a = $dom->getElementsByTagName('a');
$alpha = array();
foreach ($a as $b) {
$dc = utf8_decode($b->nodeValue);
$alpha[$dc] = $b->getAttribute('href');
}
ksort($alpha);
$c = '';
$old_cat = '';
$flag = true; // first pass
foreach($alpha as $k => $v) {
$cv = substr($k, 0, -4);
if ($old_cat <> $cv) {
if (!$flag) $c .= '</ul></details>';
$flag = false;
$c .= '<details><summary><span class="caret">'.$cv.'</span></summary>' . chr(10) . '<ul class="nested">';
$old_cat = $cv;
}
$c .= '<li><a class="surveytitle" href="' . $v . '">' . $k . '</a></li>';
}
$c .= '</ul></details>';
return $c;
}
$list = order_links($list);
The screenshot above remains the same.
In
application/views/surveys/publicSurveyList.php
inv2.0.5.1
in order to display the survey list in alphabetical order instead of the existing order in which it was created and collapsing the into a drill down category list, the following changes need to be made. Introduced some javascript and a new function at the beginning of the file as:and after the first foreach stanza in the file, execute it with:
Then introduce the CSS in the
templates/default/startpage.pstpl
in the head part and in other templates as well if needed:LimeSurvey_Category_Display_2.05.mod.zip