本文整理汇总了PHP中feedback_get_current_completed函数的典型用法代码示例。如果您正苦于以下问题:PHP feedback_get_current_completed函数的具体用法?PHP feedback_get_current_completed怎么用?PHP feedback_get_current_completed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了feedback_get_current_completed函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array_values
$pagebreaks = array_values($pagebreaks);
$firstpagebreak = $pagebreaks[0];
} else {
$firstpagebreak = false;
}
$maxitemcount = count_records('feedback_item', 'feedback', $feedback->id);
//get the values of completeds before done. Anonymous user can not get these values.
if (!isset($SESSION->feedback->is_started) and !isset($savereturn) and $feedback->anonymous == FEEDBACK_ANONYMOUS_NO) {
if (!($feedbackcompletedtmp = feedback_get_current_completed($feedback->id, true, $courseid))) {
if ($feedbackcompleted = feedback_get_current_completed($feedback->id, false, $courseid)) {
//copy the values to feedback_valuetmp create a completedtmp
$feedbackcompletedtmp = feedback_set_tmp_values($feedbackcompleted);
}
}
} else {
$feedbackcompletedtmp = feedback_get_current_completed($feedback->id, true, $courseid);
}
/// Print the main part of the page
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
print_heading(format_text($feedback->name));
if (isset($savereturn) && $savereturn == 'saved') {
if ($feedback->page_after_submit) {
// print_simple_box_start('center', '75%');
print_box_start('generalbox boxaligncenter boxwidthwide');
echo format_text(stripslashes_safe($feedback->page_after_submit));
// print_simple_box_end();
print_box_end();
} else {
echo '<p align="center"><b><font color="green">' . get_string('entries_saved', 'feedback') . '</font></b></p>';
示例2: feedback_check_values
/**
* this function checks the correctness of values.
* the rules for this are implemented in the class of each item.
* it can be the required attribute or the value self e.g. numeric.
* the params first/lastitem are given to determine the visible range between pagebreaks.
*
* @global object
* @param int $firstitem the position of firstitem for checking
* @param int $lastitem the position of lastitem for checking
* @return boolean
*/
function feedback_check_values($firstitem, $lastitem)
{
global $DB, $CFG;
$feedbackid = optional_param('feedbackid', 0, PARAM_INT);
//get all items between the first- and lastitem
$select = "feedback = ?\n AND position >= ?\n AND position <= ?\n AND hasvalue = 1";
$params = array($feedbackid, $firstitem, $lastitem);
if (!($feedbackitems = $DB->get_records_select('feedback_item', $select, $params))) {
//if no values are given so no values can be wrong ;-)
return true;
}
foreach ($feedbackitems as $item) {
//get the instance of the item-class
$itemobj = feedback_get_item_class($item->typ);
//the name of the input field of the completeform is given in a special form:
//<item-typ>_<item-id> eg. numeric_234
//this is the key to get the value for the correct item
$formvalname = $item->typ . '_' . $item->id;
if ($itemobj->value_is_array()) {
//get the raw value here. It is cleaned after that by the object itself
$value = optional_param_array($formvalname, null, PARAM_RAW);
} else {
//get the raw value here. It is cleaned after that by the object itself
$value = optional_param($formvalname, null, PARAM_RAW);
}
$value = $itemobj->clean_input_value($value);
// If the item is not visible due to its dependency so it shouldn't be required.
// Many thanks to Pau Ferrer Ocaña.
if ($item->dependitem > 0 and $item->required == 1) {
$comparevalue = false;
if ($feedbackcompletedtmp = feedback_get_current_completed($item->feedback, true)) {
$comparevalue = feedback_compare_item_value($feedbackcompletedtmp->id, $item->dependitem, $item->dependvalue, true);
}
if (!$comparevalue) {
$item->required = 0;
// Override the required property.
}
}
//check if the value is set
if (is_null($value) and $item->required == 1) {
return false;
}
//now we let check the value by the item-class
if (!$itemobj->check_value($value, $item)) {
return false;
}
}
//if no wrong values so we can return true
return true;
}
示例3: get_records_select
} 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')) {
$pagebreaks = array_values($pagebreaks);
$firstpagebreak = $pagebreaks[0];
} else {
$firstpagebreak = false;
}
$maxitemcount = count_records('feedback_item', 'feedback', $feedback->id);
$feedbackcompletedtmp = feedback_get_current_completed($feedback->id, true, $courseid, $USER->sesskey);
/// Print the main part of the page
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
print_heading(format_text($feedback->name));
if (isset($savereturn) && $savereturn == 'saved') {
if ($feedback->page_after_submit) {
// print_simple_box_start('center', '75%');
print_box_start('generalbox boxaligncenter boxwidthwide');
echo format_text(stripslashes_safe($feedback->page_after_submit));
// print_simple_box_end();
print_box_end();
} else {
echo '<p align="center"><b><font color="green">' . get_string('entries_saved', 'feedback') . '</font></b></p>';
if (intval($feedback->publish_stats) == 1) {
示例4: f2f_feedback_trainer
public function f2f_feedback_trainer($fid){
global $DB,$CFG,$OUTPUT,$PAGE;
$evaltype = array(NULL => get_string('evoltype1', 'local_evaluations'),
'1' => get_string('evoltype2', 'local_evaluations'),
'2' => get_string('evoltype3', 'local_evaluations'),
'3' => get_string('evoltype4', 'local_evaluations'));
$feedbacks = $DB->get_records('local_evaluation',array('classid'=>$fid));
$data = array();
foreach ($feedbacks as $feedback) {
$line = array();
$params = array();
$linkcss = $feedback->publish_stats ? ' ' : 'class="dimmed" ';
$line[] = '<a ' . $linkcss . ' href="' . $CFG->wwwroot . '/local/evaluations/edit.php?id=' . $feedback->id . '&clid=' . $feedback->classid . '&do_show=edit">' . format_string($feedback->name) . '</a>';
$line[] = $evaltype[$feedback->evaluationtype];
$params = array('evaluation' => $feedback->id, 'hasvalue' => 1);
$itemscount = $DB->count_records('evaluation_item', $params);
$feedback_can_submit = true;
if ($feedback->multiple_submit == 0) {
if (evaluation_is_already_submitted($feedback->id, $feedback->classid)) {
$feedback_can_submit = false;
}
}
if ($feedback_can_submit) {
$total_count=$DB->get_record_sql("SELECT count(id) as total_count FROM {local_batch_users} lbu where lbu.f2fid=$fid group by lbu.f2fid");
if($total_count){
$total_count->total_count=$total_count->total_count;
}else{
$total_count->total_count=0;
}
switch($feedback->evaluationtype){
case 1:
$submited_count=$DB->get_record_sql("SELECT count(id) as submited_count FROM {local_batch_users} lbu where lbu.f2fid=$fid and lbu.prefeedback!=0 group by lbu.f2fid");
if($submited_count){
$line[] ="$submited_count->submited_count/$total_count->total_count";
}else{
$line[] ="0/$total_count->total_count";
}
break;
case 2:
$submited_count=$DB->get_record_sql("SELECT count(id) as submited_count FROM {local_batch_users} lbu where lbu.f2fid=$fid and lbu.postfeedback!=0 group by lbu.f2fid");
if($submited_count){
$line[] ="$submited_count->submited_count/$total_count->total_count";
}else{
$line[] ="0/$total_count->total_count";
}
break;
case 3:
$submited_count=$DB->get_record_sql("SELECT count(id) as submited_count FROM {local_batch_users} lbu where lbu.f2fid=$fid and lbu.trainerfeedback!=0 group by lbu.f2fid");
if($submited_count){
$line[] ="$submited_count->submited_count/$total_count->total_count";
}else{
$line[] ="0/$total_count->total_count";
}
break;
}
//$line[] ="0/1";
$checktime = time();
if (($feedback->timeopen > $checktime) OR ( $feedback->timeclose < $checktime AND $feedback->timeclose > 0)) {
$ected = '<font color="red">';
$ected .= get_string('feedback_is_not_open', 'local_evaluations');
$ected .= '</font>';
$line[] = $ected;
} else {
//if the user is not known so we cannot save the values temporarly
if (!isloggedin() or isguestuser()) {
$completefile = 'complete_guest.php';
$guestid = sesskey();
} else {
$completefile = 'complete.php';
$guestid = false;
}
$url_params = array('id' => $feedback->id, 'clid' => $feedback->classid, 'gopage' => 0);
if($feedback->evaluationtype == 3){
$t_employee = $DB->get_field_sql("SELECT lbu.userid,
(SELECT concat(us.firstname,' ',us.lastname) FROM {user} as us where us.id=lbu.userid) as employee_name
FROM {local_batch_users} lbu where lbu.f2fid=$feedback->classid order by lbu.userid asc limit 1");
$url_params['employee_id'] = $t_employee;
}
$completeurl = new moodle_url('/local/evaluations/' . $completefile, $url_params);
$feedbackcompletedtmp = feedback_get_current_completed($feedback->id, true, $feedback->classid, $guestid);
if($feedback->evaluationtype!=3){
$supervisers = $DB->get_fieldset_sql("select supervisorid from {local_batch_users} where f2fid=$feedback->classid and supervisorid!=''");
$superviser_count = COUNT($supervisers);
if($DB->record_exists_sql("select * from {evaluation_completed} where evaluation=$feedback->id HAVING COUNT(userid)=$superviser_count"))
$line[] = "Completed";
else
$line[] = "Pending";
}else if ($feedbackcompletedtmp) {
if ($startpage = feedback_get_page_to_continue($feedback->id, $feedback->classid, $guestid)) {
//.........这里部分代码省略.........