當前位置: 首頁>>代碼示例>>PHP>>正文


PHP question_bank::fractionoptionsfull方法代碼示例

本文整理匯總了PHP中question_bank::fractionoptionsfull方法的典型用法代碼示例。如果您正苦於以下問題:PHP question_bank::fractionoptionsfull方法的具體用法?PHP question_bank::fractionoptionsfull怎麽用?PHP question_bank::fractionoptionsfull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在question_bank的用法示例。


在下文中一共展示了question_bank::fractionoptionsfull方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ensure_fraction_options_initialised

    protected static function ensure_fraction_options_initialised() {
        if (!is_null(self::$fractionoptions)) {
            return;
        }

        // define basic array of grades. This list comprises all fractions of the form:
        // a. p/q for q <= 6, 0 <= p <= q
        // b. p/10 for 0 <= p <= 10
        // c. 1/q for 1 <= q <= 10
        // d. 1/20
        $rawfractions = array(
            0.9000000,
            0.8333333,
            0.8000000,
            0.7500000,
            0.7000000,
            0.6666667,
            0.6000000,
            0.5000000,
            0.4000000,
            0.3333333,
            0.3000000,
            0.2500000,
            0.2000000,
            0.1666667,
            0.1428571,
            0.1250000,
            0.1111111,
            0.1000000,
            0.0500000,
        );

        // Put the None option at the top.
        self::$fractionoptions = array(
            '0.0' => get_string('none'),
            '1.0' => '100%',
        );
        self::$fractionoptionsfull = array(
            '0.0' => get_string('none'),
            '1.0' => '100%',
        );

        // The the positive grades in descending order.
        foreach ($rawfractions as $fraction) {
            $percentage = (100 * $fraction) . '%';
            self::$fractionoptions["$fraction"] = $percentage;
            self::$fractionoptionsfull["$fraction"] = $percentage;
        }

        // The the negative grades in descending order.
        foreach (array_reverse($rawfractions) as $fraction) {
            self::$fractionoptionsfull['' . (-$fraction)] = (-100 * $fraction) . '%';
        }

        self::$fractionoptionsfull['-1.0'] = '-100%';
    }
開發者ID:Jtgadbois,項目名稱:Pedadida,代碼行數:56,代碼來源:bank.php


注:本文中的question_bank::fractionoptionsfull方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。