• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP print_progress函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中print_progress函数的典型用法代码示例。如果您正苦于以下问题:PHP print_progress函数的具体用法?PHP print_progress怎么用?PHP print_progress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了print_progress函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: unset

    return;
}
$file = '../include/config.inc.php';
unset($errors);
unset($progress);
if (file_exists($file)) {
    @chmod($file, 0666);
    if (!is_writeable($file)) {
        $errors[] = '<strong>' . $file . '</strong> is not writeable. Use <kbd>chmod a+rw ' . $file . '</kbd> to change permissions.';
    } else {
        $progress[] = '<strong>' . $file . '</strong> is writeable.';
    }
} else {
    $errors[] = '<strong>' . $file . '</strong> does not exist.';
}
print_progress($step);
echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form">';
if (isset($errors)) {
    if (isset($progress)) {
        print_feedback($progress);
    }
    print_errors($errors);
    echo '<input type="hidden" name="step" value="' . $step . '" />';
    unset($_POST['step']);
    unset($_POST['action']);
    unset($errors);
    print_hidden($step);
    echo '<p><strong>Note:</strong> To change permissions on Unix use <kbd>chmod a+rw</kbd> then the file name.</p>';
    echo '<p align="center"><input type="submit" class="button" value=" Try Again " name="retry" />';
} else {
    if (!copy('../../' . $_POST['step1']['old_path'] . '/include/config.inc.php', '../include/config.inc.php')) {
开发者ID:harriswong,项目名称:AContent,代码行数:31,代码来源:ustep5.php


示例2: print_progress

        $dcount++;
        print_progress($dcount, $dtotal);
        if ($discussion->course != $currcourse) {
            /// Discussions are ordered by course, so we only need to get any course's users once.
            $currcourse = $discussion->course;
            $users = get_course_users($currcourse, '', '', 'u.id,u.confirmed');
        }
        /// If this course has users, and posts more than a day old, mark them for each user.
        if ($users && ($posts = get_records_select('forum_posts', 'discussion = ' . $discussion->id . ' AND ' . $dateafter . ' < modified AND modified < ' . $onedayago, '', 'id,discussion,modified'))) {
            foreach ($users as $user) {
                /// If its a group discussion, make sure the user is in the group.
                if ($discussion->groupid) {
                    if (!isset($groups[$discussion->groupid][$user->id])) {
                        $groups[$discussion->groupid][$user->id] = ismember($discussion->groupid, $user->id);
                    }
                }
                if (!$discussion->groupid || !empty($groups[$discussion->groupid][$user->id])) {
                    foreach ($posts as $post) {
                        print_progress($dcount, $dtotal);
                        forum_tp_mark_post_read($user->id, $post, $discussion->forum);
                    }
                }
            }
        }
    }
    print_progress($dcount, $dtotal, 0);
}
delete_records('config', 'name', 'upgrade', 'value', 'forumread');
notify('Log upgrading was successful!', 'notifysuccess');
print_continue('index.php');
admin_externalpage_print_footer($adminroot);
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:upgradeforumread.php


示例3: moodle_install_roles

/**
 * Installs the roles system.
 * This function runs on a fresh install as well as on an upgrade from the old
 * hard-coded student/teacher/admin etc. roles to the new roles system.
 */
function moodle_install_roles()
{
    global $CFG, $db;
    /// Create a system wide context for assignemnt.
    $systemcontext = $context = get_context_instance(CONTEXT_SYSTEM);
    /// Create default/legacy roles and capabilities.
    /// (1 legacy capability per legacy role at system level).
    $adminrole = create_role(addslashes(get_string('administrator')), 'admin', addslashes(get_string('administratordescription')), 'moodle/legacy:admin');
    $coursecreatorrole = create_role(addslashes(get_string('coursecreators')), 'coursecreator', addslashes(get_string('coursecreatorsdescription')), 'moodle/legacy:coursecreator');
    $editteacherrole = create_role(addslashes(get_string('defaultcourseteacher')), 'editingteacher', addslashes(get_string('defaultcourseteacherdescription')), 'moodle/legacy:editingteacher');
    $noneditteacherrole = create_role(addslashes(get_string('noneditingteacher')), 'teacher', addslashes(get_string('noneditingteacherdescription')), 'moodle/legacy:teacher');
    $studentrole = create_role(addslashes(get_string('defaultcoursestudent')), 'student', addslashes(get_string('defaultcoursestudentdescription')), 'moodle/legacy:student');
    $guestrole = create_role(addslashes(get_string('guest')), 'guest', addslashes(get_string('guestdescription')), 'moodle/legacy:guest');
    $userrole = create_role(addslashes(get_string('authenticateduser')), 'user', addslashes(get_string('authenticateduserdescription')), 'moodle/legacy:user');
    /// Now is the correct moment to install capabilities - after creation of legacy roles, but before assigning of roles
    if (!assign_capability('moodle/site:doanything', CAP_ALLOW, $adminrole, $systemcontext->id)) {
        error('Could not assign moodle/site:doanything to the admin role');
    }
    if (!update_capabilities()) {
        error('Had trouble upgrading the core capabilities for the Roles System');
    }
    /// Look inside user_admin, user_creator, user_teachers, user_students and
    /// assign above new roles. If a user has both teacher and student role,
    /// only teacher role is assigned. The assignment should be system level.
    $dbtables = $db->MetaTables('TABLES');
    /// Set up the progress bar
    $usertables = array('user_admins', 'user_coursecreators', 'user_teachers', 'user_students');
    $totalcount = $progresscount = 0;
    foreach ($usertables as $usertable) {
        if (in_array($CFG->prefix . $usertable, $dbtables)) {
            $totalcount += count_records($usertable);
        }
    }
    print_progress(0, $totalcount, 5, 1, 'Processing role assignments');
    /// Upgrade the admins.
    /// Sort using id ASC, first one is primary admin.
    if (in_array($CFG->prefix . 'user_admins', $dbtables)) {
        if ($rs = get_recordset_sql('SELECT * from ' . $CFG->prefix . 'user_admins ORDER BY ID ASC')) {
            while ($admin = rs_fetch_next_record($rs)) {
                role_assign($adminrole, $admin->userid, 0, $systemcontext->id);
                $progresscount++;
                print_progress($progresscount, $totalcount, 5, 1, 'Processing role assignments');
            }
            rs_close($rs);
        }
    } else {
        // This is a fresh install.
    }
    /// Upgrade course creators.
    if (in_array($CFG->prefix . 'user_coursecreators', $dbtables)) {
        if ($rs = get_recordset('user_coursecreators')) {
            while ($coursecreator = rs_fetch_next_record($rs)) {
                role_assign($coursecreatorrole, $coursecreator->userid, 0, $systemcontext->id);
                $progresscount++;
                print_progress($progresscount, $totalcount, 5, 1, 'Processing role assignments');
            }
            rs_close($rs);
        }
    }
    /// Upgrade editting teachers and non-editting teachers.
    if (in_array($CFG->prefix . 'user_teachers', $dbtables)) {
        if ($rs = get_recordset('user_teachers')) {
            while ($teacher = rs_fetch_next_record($rs)) {
                // removed code here to ignore site level assignments
                // since the contexts are separated now
                // populate the user_lastaccess table
                $access = new object();
                $access->timeaccess = $teacher->timeaccess;
                $access->userid = $teacher->userid;
                $access->courseid = $teacher->course;
                insert_record('user_lastaccess', $access);
                // assign the default student role
                $coursecontext = get_context_instance(CONTEXT_COURSE, $teacher->course);
                // needs cache
                // hidden teacher
                if ($teacher->authority == 0) {
                    $hiddenteacher = 1;
                } else {
                    $hiddenteacher = 0;
                }
                if ($teacher->editall) {
                    // editting teacher
                    role_assign($editteacherrole, $teacher->userid, 0, $coursecontext->id, $teacher->timestart, $teacher->timeend, $hiddenteacher, $teacher->enrol, $teacher->timemodified);
                } else {
                    role_assign($noneditteacherrole, $teacher->userid, 0, $coursecontext->id, $teacher->timestart, $teacher->timeend, $hiddenteacher, $teacher->enrol, $teacher->timemodified);
                }
                $progresscount++;
                print_progress($progresscount, $totalcount, 5, 1, 'Processing role assignments');
            }
            rs_close($rs);
        }
    }
    /// Upgrade students.
    if (in_array($CFG->prefix . 'user_students', $dbtables)) {
        if ($rs = get_recordset('user_students')) {
//.........这里部分代码省略.........
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:101,代码来源:accesslib.php


示例4: build_context_rel

/**
 * rebuild context_rel table without deleting
 */
function build_context_rel()
{
    global $db;
    $savedb = $db->debug;
    // total number of records
    $total = count_records('context');
    // processed records
    $done = 0;
    print_progress($done, $total, 10, 0, 'Processing context relations');
    $db->debug = false;
    if ($contexts = get_records('context')) {
        foreach ($contexts as $context) {
            // no need to delete because it's all empty
            insert_context_rel($context, false, false);
            $db->debug = true;
            print_progress(++$done, $total, 10, 0, 'Processing context relations');
            $db->debug = false;
        }
    }
    $db->debug = $savedb;
}
开发者ID:veritech,项目名称:pare-project,代码行数:24,代码来源:accesslib.php



注:本文中的print_progress函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP print_project_access_levels_option_list函数代码示例发布时间:2022-05-15
下一篇:
PHP print_pre函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap