apmuthu / LimeSurvey

The official LimeSurvey repository
http://www.limesurvey.org
0 stars 0 forks source link

LS 2.0.5.1 ERD #21

Open apmuthu opened 7 years ago

apmuthu commented 7 years ago

Part 1 of the LimeSurvey v2.0.5.1 Entity Relationship Diagram (ERD) ls_erd_1

apmuthu commented 1 year ago

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, the following changes need to be made. Introduced a new function at the beginning of the file 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 = '';
    foreach($alpha as $k => $v) {
        $c .= '<li><a class="surveytitle" href="' . $v . '">' . $k . '</a></li>';
    }
    return $c;  
}

and after the following foreach stanza, assign the following:

$list = order_links($list);

This works and is tested when statistics is not enabled.

publicSurveyList_mod.zip