本文整理汇总了PHP中feedback_check_is_switchrole函数的典型用法代码示例。如果您正苦于以下问题:PHP feedback_check_is_switchrole函数的具体用法?PHP feedback_check_is_switchrole怎么用?PHP feedback_check_is_switchrole使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了feedback_check_is_switchrole函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: feedback_get_current_completed
}
}
}
//saving the items
if ($savevalues and !$preservevalues) {
//exists there any pagebreak, so there are values in the feedback_valuetmp
$userid = $USER->id;
//arb
if ($feedback->anonymous == FEEDBACK_ANONYMOUS_NO) {
$feedbackcompleted = feedback_get_current_completed($feedback->id, false, $courseid);
} else {
$feedbackcompleted = false;
}
$feedbackcompletedtmp = get_record('feedback_completedtmp', 'id', $completedid);
//fake saving for switchrole
$is_switchrole = feedback_check_is_switchrole();
if ($is_switchrole) {
$savereturn = 'saved';
feedback_delete_completedtmp($completedid);
} else {
if ($new_completed_id = feedback_save_tmp_values($feedbackcompletedtmp, $feedbackcompleted, $userid)) {
$savereturn = 'saved';
if ($feedback->anonymous == FEEDBACK_ANONYMOUS_NO) {
add_to_log($course->id, 'feedback', 'submit', 'view.php?id=' . $cm->id, $feedback->id, $cm->id, $userid);
feedback_send_email($cm, $feedback, $course, $userid);
} else {
feedback_send_email_anonym($cm, $feedback, $course, $userid);
}
//tracking the submit
$multiple_count = null;
$multiple_count->userid = $USER->id;
示例2: save_response
/**
* Saves the response
*
* The form data has already been stored in the temporary table in
* {@link save_response_tmp()}. This function copies the values
* from the temporary table to the completion table.
* It is also responsible for sending email notifications when applicable.
*/
public function save_response()
{
global $USER, $SESSION, $DB;
$feedbackcompleted = $this->find_last_completed();
$feedbackcompletedtmp = $this->get_current_completed_tmp();
if (feedback_check_is_switchrole()) {
// We do not actually save anything if the role is switched, just delete temporary values.
$this->delete_completedtmp();
return;
}
// Save values.
$completedid = feedback_save_tmp_values($feedbackcompletedtmp, $feedbackcompleted);
$this->completed = $DB->get_record('feedback_completed', array('id' => $completedid));
// Send email.
if ($this->feedback->anonymous == FEEDBACK_ANONYMOUS_NO) {
feedback_send_email($this->cm, $this->feedback, $this->cm->get_course(), $USER);
} else {
feedback_send_email_anonym($this->cm, $this->feedback, $this->cm->get_course());
}
unset($SESSION->feedback->is_started);
// Update completion state.
$completion = new completion_info($this->cm->get_course());
if (isloggedin() && !isguestuser() && $completion->is_enabled($this->cm) && $this->feedback->completionsubmit) {
$completion->update_state($this->cm, COMPLETION_COMPLETE);
}
}