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


PHP portfolio_filesize_info函數代碼示例

本文整理匯總了PHP中portfolio_filesize_info函數的典型用法代碼示例。如果您正苦於以下問題:PHP portfolio_filesize_info函數的具體用法?PHP portfolio_filesize_info怎麽用?PHP portfolio_filesize_info使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: require_once

    //== Portfolio settings ==
    require_once($CFG->libdir. '/portfoliolib.php');
    $catname = get_string('portfolios', 'portfolio');
    $manage = get_string('manageportfolios', 'portfolio');
    $url = "$CFG->wwwroot/$CFG->admin/portfolio.php";

    $ADMIN->add('modules', new admin_category('portfoliosettings', $catname, empty($CFG->enableportfolios)));

    // Add manage page (with table)
    $temp = new admin_page_manageportfolios();
    $ADMIN->add('portfoliosettings', $temp);

    // Add common settings page
    $temp = new admin_settingpage('manageportfolioscommon', get_string('commonportfoliosettings', 'portfolio'));
    $temp->add(new admin_setting_heading('manageportfolioscommon', '', get_string('commonsettingsdesc', 'portfolio')));
    $fileinfo = portfolio_filesize_info(); // make sure this is defined in one place since its used inside portfolio too to detect insane settings
    $fileoptions = $fileinfo['options'];
    $temp->add(new admin_setting_configselect(
        'portfolio_moderate_filesize_threshold',
        get_string('moderatefilesizethreshold', 'portfolio'),
        get_string('moderatefilesizethresholddesc', 'portfolio'),
        $fileinfo['moderate'], $fileoptions));
    $temp->add(new admin_setting_configselect(
        'portfolio_high_filesize_threshold',
        get_string('highfilesizethreshold', 'portfolio'),
        get_string('highfilesizethresholddesc', 'portfolio'),
        $fileinfo['high'], $fileoptions));

    $temp->add(new admin_setting_configtext(
        'portfolio_moderate_db_threshold',
        get_string('moderatedbsizethreshold', 'portfolio'),
開發者ID:nottmoo,項目名稱:moodle,代碼行數:31,代碼來源:plugins.php

示例2: get_string

         if ($ADMIN->fulltree) {
             include "{$CFG->dirroot}/{$filterpath}/filtersettings.php";
         }
         $ADMIN->add('filtersettings', $settings);
     }
 }
 $catname = get_string('portfolios', 'portfolio');
 $manage = get_string('manageportfolios', 'portfolio');
 $url = "{$CFG->wwwroot}/{$CFG->admin}/portfolio.php";
 $ADMIN->add('modules', new admin_category('portfoliosettings', $catname, empty($CFG->enableportfolios)));
 // jump through hoops to do what we want
 $temp = new admin_settingpage('manageportfolios', get_string('manageportfolios', 'portfolio'));
 $temp->add(new admin_setting_heading('manageportfolios', get_string('activeportfolios', 'portfolio'), ''));
 $temp->add(new admin_setting_manageportfolio());
 $temp->add(new admin_setting_heading('manageportfolioscommon', get_string('commonsettings', 'admin'), get_string('commonsettingsdesc', 'portfolio')));
 $fileinfo = portfolio_filesize_info();
 // make sure this is defined in one place since its used inside portfolio too to detect insane settings
 $fileoptions = $fileinfo['options'];
 $temp->add(new admin_setting_configselect('portfolio_moderate_filesize_threshold', get_string('moderatefilesizethreshold', 'portfolio'), get_string('moderatefilesizethresholddesc', 'portfolio'), $fileinfo['moderate'], $fileoptions));
 $temp->add(new admin_setting_configselect('portfolio_high_filesize_threshold', get_string('highfilesizethreshold', 'portfolio'), get_string('highfilesizethresholddesc', 'portfolio'), $fileinfo['high'], $fileoptions));
 $temp->add(new admin_setting_configtext('portfolio_moderate_db_threshold', get_string('moderatedbsizethreshold', 'portfolio'), get_string('moderatedbsizethresholddesc', 'portfolio'), 20, PARAM_INTEGER, 3));
 $temp->add(new admin_setting_configtext('portfolio_high_db_threshold', get_string('highdbsizethreshold', 'portfolio'), get_string('highdbsizethresholddesc', 'portfolio'), 50, PARAM_INTEGER, 3));
 $ADMIN->add('portfoliosettings', $temp);
 $ADMIN->add('portfoliosettings', new admin_externalpage('portfolionew', get_string('addnewportfolio', 'portfolio'), $url, 'moodle/site:config', true), '', $url);
 $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliodelete', get_string('deleteportfolio', 'portfolio'), $url, 'moodle/site:config', true), '', $url);
 $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliocontroller', get_string('manageportfolios', 'portfolio'), $url, 'moodle/site:config', true), '', $url);
 foreach (portfolio_instances(false, false) as $portfolio) {
     require_once $CFG->dirroot . '/portfolio/type/' . $portfolio->get('plugin') . '/lib.php';
     $classname = 'portfolio_plugin_' . $portfolio->get('plugin');
     $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliosettings' . $portfolio->get('id'), $portfolio->get('name'), $url . '?edit=' . $portfolio->get('id'), 'moodle/site:config', !$portfolio->get('visible')), $portfolio->get('name'), $url . ' ?edit=' . $portfolio->get('id'));
 }
開發者ID:nicolasconnault,項目名稱:moodle2.0,代碼行數:31,代碼來源:plugins.php

示例3: portfolio_expected_time_file

/**
* try and determine expected_time for purely file based exports
* or exports that might include large file attachments.
*
 * @global object
* @param mixed $totest - either an array of stored_file objects or a single stored_file object
* @return constant PORTFOLIO_TIME_XXX
*/
function portfolio_expected_time_file($totest)
{
    global $CFG;
    if ($totest instanceof stored_file) {
        $totest = array($totest);
    }
    $size = 0;
    foreach ($totest as $file) {
        if (!$file instanceof stored_file) {
            debugging('something weird passed to portfolio_expected_time_file - not stored_file object');
            debugging(print_r($file, true));
            continue;
        }
        $size += $file->get_filesize();
    }
    $fileinfo = portfolio_filesize_info();
    $moderate = $high = 0;
    // avoid warnings
    foreach (array('moderate', 'high') as $setting) {
        $settingname = 'portfolio_' . $setting . '_filesize_threshold';
        if (empty($CFG->{$settingname}) || !array_key_exists($CFG->{$settingname}, $fileinfo['options'])) {
            debugging("weird or unset admin value for {$settingname}, using default instead");
            ${$setting} = $fileinfo[$setting];
        } else {
            ${$setting} = $CFG->{$settingname};
        }
    }
    if ($size < $moderate) {
        return PORTFOLIO_TIME_LOW;
    } else {
        if ($size < $high) {
            return PORTFOLIO_TIME_MODERATE;
        }
    }
    return PORTFOLIO_TIME_HIGH;
}
開發者ID:sebastiansanio,項目名稱:tallerdeprogramacion2fiuba,代碼行數:44,代碼來源:portfoliolib.php


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