Пример #1
0
function partition_surveys($surveys, $responses, $accessibility, &$current, &$historical)
{
    foreach ($surveys as $sid => $survey) {
        // if the survey is available
        if (isset($accessibility[$sid]['available']) && true === (bool) $accessibility[$sid]['available']) {
            // get a link to the survey, its status, and the last access date
            $name = sprintf('<a href="%s">%s</a>', survey_fetch_url_by_survey_name($survey['name']), $survey['title']);
            $status = fetch_status($sid, $responses);
            $date = fetch_latest_submission_date($sid, $responses);
            $avail = fetch_availability($survey, $availability);
            // but, if the survey is not open, get rid of the link
            if (STATUS_OPEN !== $availability) {
                $name = $survey['title'];
            }
            $current[] = array($name, $status, $date, $avail);
            // otherwise the survey is historical
        } else {
            $name = $survey['title'];
            $status = fetch_status($sid, $responses);
            $date = fetch_latest_submission_date($sid, $responses);
            $avail = _('Closed');
            $historical[] = array($name, $status, $date, $avail);
        }
    }
}
Пример #2
0
function partition_surveys($surveys, $responses, $availability, &$current, &$historical)
{
    foreach ($surveys as $sid => $survey) {
        // if the survey is available
        if (isset($availability[$sid]['available']) && true === (bool) $availability[$sid]['available']) {
            $name = sprintf('<a href="%s">%s</a>', survey_fetch_url_by_survey_name($survey['name']), $survey['title']);
            $status = fetch_status($sid, $responses);
            $date = fetch_latest_submission_date($sid, $responses);
            $current[] = array($name, $status, $date);
            // otherwise the survey is historical
        } else {
            $name = $survey['title'];
            $status = fetch_status($sid, $responses);
            $date = fetch_latest_submission_date($sid, $responses);
            $historical[] = array($name, $status, $date);
        }
    }
}