当前位置: 首页>>代码示例>>PHP>>正文


PHP feedback_get_all_break_positions函数代码示例

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


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

示例1: feedback_get_page_to_continue

/**
 * this returns the position where the user can continue the completing.
 *
 * @global object
 * @global object
 * @global object
 * @param int $feedbackid
 * @param int $courseid
 * @param string $guestid this id will be saved temporary and is unique
 * @return int the position to continue
 */
function feedback_get_page_to_continue($feedbackid, $courseid = false, $guestid = false) {
    global $CFG, $USER, $DB;

    //is there any break?

    if (!$allbreaks = feedback_get_all_break_positions($feedbackid)) {
        return false;
    }

    $params = array();
    if ($courseid) {
        $courseselect = "AND fv.course_id = :courseid";
        $params['courseid'] = $courseid;
    } else {
        $courseselect = '';
    }

    if ($guestid) {
        $userselect = "AND fc.guestid = :guestid";
        $usergroup = "GROUP BY fc.guestid";
        $params['guestid'] = $guestid;
    } else {
        $userselect = "AND fc.userid = :userid";
        $usergroup = "GROUP BY fc.userid";
        $params['userid'] = $USER->id;
    }

    $sql =  "SELECT MAX(fi.position)
               FROM {feedback_completedtmp} fc, {feedback_valuetmp} fv, {feedback_item} fi
              WHERE fc.id = fv.completed
                    $userselect
                    AND fc.feedback = :feedbackid
                    $courseselect
                    AND fi.id = fv.item
         $usergroup";
    $params['feedbackid'] = $feedbackid;

    $lastpos = $DB->get_field_sql($sql, $params);

    //the index of found pagebreak is the searched pagenumber
    foreach ($allbreaks as $pagenr => $br) {
        if ($lastpos < $br) {
            return $pagenr;
        }
    }
    return count($allbreaks);
}
开发者ID:numbas,项目名称:moodle,代码行数:58,代码来源:lib.php

示例2: feedback_get_page_to_continue

/** 
 *  this returns the position where the user can continue the completing.
 *  @param int $feedbackid
 *  @param int $courseid
 *  @param string $guestid this id will be saved temporary and is unique
 *  @return int the position to continue
 */
function feedback_get_page_to_continue($feedbackid, $courseid = false, $guestid)
{
    global $CFG, $USER;
    //is there any break?
    if (!($allbreaks = feedback_get_all_break_positions($feedbackid))) {
        return false;
    }
    if ($courseid) {
        $courseselect = "fv.course_id = " . $courseid;
    } else {
        $courseselect = "1";
    }
    if ($guestid) {
        $userselect = "AND fc.guestid = '" . $guestid . "'";
        $usergroup = "GROUP BY fc.guestid";
    } else {
        $userselect = "AND fc.userid = " . $USER->id;
        $usergroup = "GROUP BY fc.userid";
    }
    $sql = "SELECT MAX(fi.position)\n                FROM " . $CFG->prefix . "feedback_completedtmp AS fc, " . $CFG->prefix . "feedback_valuetmp AS fv, " . $CFG->prefix . "feedback_item AS fi\n                WHERE fc.id = fv.completed\n                    " . $userselect . "\n                    AND fc.feedback = " . $feedbackid . "\n                    AND " . $courseselect . "\n                    AND fi.id = fv.item\n                " . $usergroup;
    $lastpos = get_field_sql($sql);
    //the index of found pagebreak is the searched pagenumber
    foreach ($allbreaks as $pagenr => $br) {
        if ($lastpos < $br) {
            return $pagenr;
        }
    }
    return count($allbreaks);
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:36,代码来源:lib.php

示例3: feedback_send_email_anonym

                 feedback_send_email_anonym($cm, $feedback, $course, $userid);
             }
             //tracking the submit
             $multiple_count = null;
             $multiple_count->userid = $USER->id;
             $multiple_count->feedback = $feedback->id;
             $multiple_count->completed = $new_completed_id;
             $multiple_count->count = 1;
             insert_record('feedback_tracking', $multiple_count);
             unset($SESSION->feedback->is_started);
         } else {
             $savereturn = 'failed';
         }
     }
 }
 if ($allbreaks = feedback_get_all_break_positions($feedback->id)) {
     if ($gopage <= 0) {
         $startposition = 0;
     } else {
         $startposition = $allbreaks[$gopage - 1];
     }
     $ispagebreak = true;
 } else {
     $startposition = 0;
     $newpage = 0;
     $ispagebreak = false;
 }
 //get the feedbackitems after the last shown pagebreak
 $feedbackitems = get_records_select('feedback_item', 'feedback = ' . $feedback->id . ' AND position > ' . $startposition, 'position');
 //get the first pagebreak
 if ($pagebreaks = get_records_select('feedback_item', "feedback = " . $feedback->id . " AND typ = 'pagebreak'", 'position')) {
开发者ID:kai707,项目名称:ITSA-backup,代码行数:31,代码来源:complete.php

示例4: feedback_get_page_to_continue

/**
 * this returns the position where the user can continue the completing.
 *
 * @deprecated since Moodle 3.1
 * @global object
 * @global object
 * @global object
 * @param int $feedbackid
 * @param int $courseid
 * @param string $guestid this id will be saved temporary and is unique
 * @return int the position to continue
 */
function feedback_get_page_to_continue($feedbackid, $courseid = false, $guestid = false)
{
    global $CFG, $USER, $DB;
    debugging('Function feedback_get_page_to_continue() is deprecated and since it is ' . 'no longer used in mod_feedback', DEBUG_DEVELOPER);
    //is there any break?
    if (!($allbreaks = feedback_get_all_break_positions($feedbackid))) {
        return false;
    }
    $params = array();
    if ($courseid) {
        $courseselect = "AND fv.course_id = :courseid";
        $params['courseid'] = $courseid;
    } else {
        $courseselect = '';
    }
    if ($guestid) {
        $userselect = "AND fc.guestid = :guestid";
        $usergroup = "GROUP BY fc.guestid";
        $params['guestid'] = $guestid;
    } else {
        $userselect = "AND fc.userid = :userid";
        $usergroup = "GROUP BY fc.userid";
        $params['userid'] = $USER->id;
    }
    $sql = "SELECT MAX(fi.position)\n               FROM {feedback_completedtmp} fc, {feedback_valuetmp} fv, {feedback_item} fi\n              WHERE fc.id = fv.completed\n                    {$userselect}\n                    AND fc.feedback = :feedbackid\n                    {$courseselect}\n                    AND fi.id = fv.item\n         {$usergroup}";
    $params['feedbackid'] = $feedbackid;
    $lastpos = $DB->get_field_sql($sql, $params);
    //the index of found pagebreak is the searched pagenumber
    foreach ($allbreaks as $pagenr => $br) {
        if ($lastpos < $br) {
            return $pagenr;
        }
    }
    return count($allbreaks);
}
开发者ID:evltuma,项目名称:moodle,代码行数:47,代码来源:lib.php


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