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


PHP admin_setting::get_setting_flag_value方法代碼示例

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


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

示例1: output_setting_flag

 /**
  * Output the checkbox for this setting flag. Should only be called if the flag is enabled.
  *
  * @param admin_setting $setting - The admin setting for this flag
  * @return string - The html for the checkbox.
  */
 public function output_setting_flag(admin_setting $setting)
 {
     $value = $setting->get_setting_flag_value($this);
     $output = ' <input type="checkbox" class="form-checkbox" ' . ' id="' . $setting->get_id() . '_' . $this->get_shortname() . '" ' . ' name="' . $setting->get_full_name() . '_' . $this->get_shortname() . '" ' . ' value="1" ' . ($value ? 'checked="checked"' : '') . ' />' . ' <label for="' . $setting->get_id() . '_' . $this->get_shortname() . '">' . $this->get_displayname() . ' </label> ';
     return $output;
 }
開發者ID:Alexbado,項目名稱:moodle2,代碼行數:12,代碼來源:adminlib.php

示例2: output_setting_flag

    /**
     * Output the checkbox for this setting flag. Should only be called if the flag is enabled.
     *
     * @param admin_setting $setting - The admin setting for this flag
     * @return string - The html for the checkbox.
     */
    public function output_setting_flag(admin_setting $setting) {
        global $OUTPUT;

        $value = $setting->get_setting_flag_value($this);

        $context = new stdClass();
        $context->id = $setting->get_id() . '_' . $this->get_shortname();
        $context->name = $setting->get_full_name() .  '_' . $this->get_shortname();
        $context->value = 1;
        $context->checked = $value ? true : false;
        $context->label = $this->get_displayname();

        return $OUTPUT->render_from_template('core_admin/setting_flag', $context);
    }
開發者ID:EsdrasCaleb,項目名稱:moodle,代碼行數:20,代碼來源:adminlib.php


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