Пример #1
0
/**
 * @return array
 */
function quiz_data_load()
{
    global $_REQUEST;
    $quiz_data = array();
    foreach ($_REQUEST as $key => $val) {
        if (preg_match("/^quiz_/", $key)) {
            $k = preg_replace("/^quiz_([.]*)/", "\$1", $key);
            $quiz_data[$k] = $val;
        }
    }
    if ($quiz_data["online"] == "online") {
        $quiz_data["online"] = "y";
    } else {
        if ($quiz_data["online"] == "offline") {
            $quiz_data["online"] = "n";
        }
    }
    //Convert 12-hour clock hours to 24-hour scale to compute time
    if (!empty($_REQUEST['publish_Meridian'])) {
        $_REQUEST['publish_Hour'] = date('H', strtotime($_REQUEST['publish_Hour'] . ':00 ' . $_REQUEST['publish_Meridian']));
    }
    if (!empty($_REQUEST['expire_Meridian'])) {
        $_REQUEST['expire_Hour'] = date('H', strtotime($_REQUEST['expire_Hour'] . ':00 ' . $_REQUEST['expire_Meridian']));
    }
    $quiz_data["datePub"] = TikiLib::make_time($quiz_data["publish_Hour"], $quiz_data["publish_Minute"], 0, $quiz_data["publish_Month"], $quiz_data["publish_Day"], $quiz_data["publish_Year"]);
    $quiz_data["dateExp"] = TikiLib::make_time($quiz_data["expire_Hour"], $quiz_data["expire_Minute"], 0, $quiz_data["expire_Month"], $quiz_data["expire_Day"], $quiz_data["expire_Year"]);
    $fields = array('nQuestion', 'shuffleAnswers', 'shuffleQuestions', 'multiSession', 'additionalQuestions', 'limitDisplay', 'timeLimited', 'canRepeat', 'additionalQuestions', 'forum');
    foreach ($fields as $field) {
        fetchYNOption($quiz_data, $quiz_data, $field);
    }
    return $quiz_data;
}
function quiz_data_load()
{
    global $_REQUEST;
    $quiz_data = array();
    foreach ($_REQUEST as $key => $val) {
        if (preg_match("/^quiz_/", $key)) {
            $k = preg_replace("/^quiz_([.]*)/", "\$1", $key);
            $quiz_data[$k] = $val;
        }
    }
    if ($quiz_data["online"] == "online") {
        $quiz_data["online"] = "y";
    } else {
        if ($quiz_data["online"] == "offline") {
            $quiz_data["online"] = "n";
        }
    }
    $quiz_data["datePub"] = TikiLib::make_time($quiz_data["publish_Hour"], $quiz_data["publish_Minute"], 0, $quiz_data["publish_Month"], $quiz_data["publish_Day"], $quiz_data["publish_Year"]);
    $quiz_data["dateExp"] = TikiLib::make_time($quiz_data["expire_Hour"], $quiz_data["expire_Minute"], 0, $quiz_data["expire_Month"], $quiz_data["expire_Day"], $quiz_data["expire_Year"]);
    $fields = array('nQuestion', 'shuffleAnswers', 'shuffleQuestions', 'multiSession', 'additionalQuestions', 'limitDisplay', 'timeLimited', 'canRepeat', 'additionalQuestions', 'forum');
    foreach ($fields as $field) {
        fetchYNOption($quiz_data, $quiz_data, $field);
        // echo '$quiz_data["'.$field.'"] = '.$quiz_data[$field]."<br>";
    }
    return $quiz_data;
}