本文整理汇总了PHP中Result::set_evaluation_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Result::set_evaluation_id方法的具体用法?PHP Result::set_evaluation_id怎么用?PHP Result::set_evaluation_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Result
的用法示例。
在下文中一共展示了Result::set_evaluation_id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: EvalForm
exit;
}
$add_user_form = new EvalForm(EvalForm::TYPE_ADD_USERS_TO_EVAL, $evaluation[0], null, 'add_users_to_evaluation', null, api_get_self() . '?selecteval=' . Security::remove_XSS($_GET['selecteval']), Security::remove_XSS($_GET['firstletter']), $newstudents);
if (isset($_POST['submit_button'])) {
$users = is_array($_POST['add_users']) ? $_POST['add_users'] : array();
foreach ($users as $key => $value) {
$users[$key] = intval($value);
}
if (count($users) == 0) {
header('Location: ' . api_get_self() . '?erroroneuser=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
exit;
} else {
foreach ($users as $user_id) {
$result = new Result();
$result->set_user_id($user_id);
$result->set_evaluation_id($_GET['selecteval']);
$result->add();
}
}
header('Location: gradebook_view_result.php?adduser=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
exit;
} elseif ($_POST['firstLetterUser']) {
$firstletter = $_POST['firstLetterUser'];
if (!empty($firstletter)) {
header('Location: ' . api_get_self() . '?firstletter=' . Security::remove_XSS($firstletter) . '&selecteval=' . Security::remove_XSS($_GET['selecteval']));
exit;
}
}
$interbreadcrumb[] = array('url' => Security::remove_XSS($_SESSION['gradebook_dest']), 'name' => get_lang('Gradebook'));
$interbreadcrumb[] = array('url' => 'gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']), 'name' => get_lang('ViewResult'));
Display::display_header(get_lang('AddUserToEval'));
示例2: EvalForm
$resultadd->set_evaluation_id($_GET['selecteval']);
$evaluation = Evaluation::load($_GET['selecteval']);
$category = !empty($_GET['selectcat']) ? $_GET['selectcat'] : "";
$add_result_form = new EvalForm(EvalForm::TYPE_RESULT_ADD, $evaluation[0], $resultadd, 'add_result_form', null, api_get_self() . '?selectcat=' . Security::remove_XSS($category) . '&selecteval=' . Security::remove_XSS($_GET['selecteval']));
$table = $add_result_form->toHtml();
if ($add_result_form->validate()) {
$values = $add_result_form->exportValues();
$nr_users = $values['nr_users'];
if ($nr_users == '0') {
header('Location: gradebook_view_result.php?addresultnostudents=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
exit;
}
$scores = $values['score'];
foreach ($scores as $row) {
$res = new Result();
$res->set_evaluation_id($values['evaluation_id']);
$res->set_user_id(key($scores));
//if no scores are given, don't set the score
if (!empty($row) || $row == '0') {
$res->set_score($row);
}
$res->add();
next($scores);
}
header('Location: gradebook_view_result.php?addresult=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
exit;
}
$interbreadcrumb[] = array('url' => Security::remove_XSS($_SESSION['gradebook_dest']), 'name' => get_lang('Gradebook'));
Display::display_header(get_lang('AddResult'));
DisplayGradebook::display_header_result($evaluation[0], null, 0, 0);
echo $table;
示例3: load
/**
* Retrieve results and return them as an array of Result objects
* @param $id result id
* @param $user_id user id (student)
* @param $evaluation_id evaluation where this is a result for
*/
public static function load($id = null, $user_id = null, $evaluation_id = null)
{
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_grade_results = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$tbl_course_rel_course = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_session_rel_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
if (is_null($id) && is_null($user_id) && !is_null($evaluation_id)) {
$sql_verified_if_exist_evaluation = 'SELECT COUNT(*) AS count FROM ' . $tbl_grade_results . ' WHERE evaluation_id="' . Database::escape_string($evaluation_id) . '";';
$res_verified_if_exist_evaluation = Database::query($sql_verified_if_exist_evaluation);
$info_verified_if_exist_evaluation = Database::result($res_verified_if_exist_evaluation, 0, 0);
if ($info_verified_if_exist_evaluation != 0) {
$sql_course_rel_user = '';
if (api_get_session_id()) {
$sql_course_rel_user = 'SELECT course_code, id_user as user_id, status
FROM ' . $tbl_session_rel_course_user . '
WHERE status=0 AND c_id="' . api_get_course_int_id() . '" AND id_session=' . api_get_session_id();
} else {
$sql_course_rel_user = 'SELECT course_code, user_id, status
FROM ' . $tbl_course_rel_course . '
WHERE status ="' . STUDENT . '" AND c_id ="' . api_get_course_int_id() . '" ';
}
$res_course_rel_user = Database::query($sql_course_rel_user);
$list_user_course_list = array();
while ($row_course_rel_user = Database::fetch_array($res_course_rel_user, 'ASSOC')) {
$list_user_course_list[] = $row_course_rel_user;
}
$current_date = api_get_utc_datetime();
for ($i = 0; $i < count($list_user_course_list); $i++) {
$sql_verified = 'SELECT COUNT(*) AS count FROM ' . $tbl_grade_results . ' WHERE user_id="' . intval($list_user_course_list[$i]['user_id']) . '" AND evaluation_id="' . intval($evaluation_id) . '";';
$res_verified = Database::query($sql_verified);
$info_verified = Database::result($res_verified, 0, 0);
if ($info_verified == 0) {
$sql_insert = 'INSERT INTO ' . $tbl_grade_results . '(user_id,evaluation_id,created_at,score)
VALUES ("' . intval($list_user_course_list[$i]['user_id']) . '","' . intval($evaluation_id) . '","' . $current_date . '",0);';
$res_insert = Database::query($sql_insert);
}
}
$list_user_course_list = array();
}
}
$sql = "SELECT gr.id, gr.user_id, gr.evaluation_id, gr.created_at, gr.score \n FROM {$tbl_grade_results} gr\n LEFT JOIN {$tbl_user} u ON gr.user_id = u.user_id ";
$paramcount = 0;
if (!empty($id)) {
$sql .= ' WHERE gr.id = ' . Database::escape_string($id);
$paramcount++;
}
if (!empty($user_id)) {
if ($paramcount != 0) {
$sql .= ' AND';
} else {
$sql .= ' WHERE';
}
$sql .= ' user_id = ' . Database::escape_string($user_id);
$paramcount++;
}
if (!empty($evaluation_id)) {
if ($paramcount != 0) {
$sql .= ' AND';
} else {
$sql .= ' WHERE';
}
$sql .= ' evaluation_id = ' . Database::escape_string($evaluation_id);
$paramcount++;
}
$result = Database::query($sql);
$allres = array();
while ($data = Database::fetch_array($result)) {
$res = new Result();
$res->set_id($data['id']);
$res->set_user_id($data['user_id']);
$res->set_evaluation_id($data['evaluation_id']);
$res->set_date(api_get_local_time($data['created_at']));
$res->set_score($data['score']);
$allres[] = $res;
}
return $allres;
}
示例4: array
static function transaction_33($original_data, $web_service_details)
{
global $data_list;
$data = Migration::soap_call($web_service_details, 'notaDetalles', array('uididpersona' => $original_data['item_id'], 'uididprograma' => $original_data['orig_id'], 'intIdSede' => $original_data['branch_id']));
if ($data['error'] == false) {
$uidIdPrograma = $original_data['orig_id'];
$uidIdPersona = $original_data['item_id'];
$score = $data['name'];
$session_id = self::get_session_id_by_programa_id($uidIdPrograma, $data_list);
$user_id = self::get_user_id_by_persona_id($uidIdPersona, $data_list);
if (empty($user_id)) {
return array('message' => "User does not exists in DB: {$uidIdPersona}", 'status_id' => self::TRANSACTION_STATUS_FAILED);
}
if (empty($session_id)) {
return array('message' => "Session does not exists in DB: {$uidIdPrograma}", 'status_id' => self::TRANSACTION_STATUS_FAILED);
}
$course_list = SessionManager::get_course_list_by_session_id($session_id);
if (!empty($course_list)) {
$course_data = current($course_list);
if (isset($course_data['code'])) {
$gradebook = new Gradebook();
$gradebook = $gradebook->get_first(array('where' => array('course_code = ? AND session_id = ?' => array($course_data['code'], $session_id))));
error_log("Looking gradebook in course code: {$course_data['code']} - session_id: {$session_id}");
if (!empty($gradebook)) {
//Check if gradebook exists
$eval = new Evaluation();
$evals_found = $eval->load(null, null, null, $gradebook['id'], null, null);
//Try to create a gradebook evaluation
if (empty($evals_found)) {
error_log("Trying to create a new evaluation in course code: {$course_data['code']} - session_id: {$session_id}");
$params = array('session_id' => $session_id, 'gradebook_description' => 'Evaluación General', 'gradebook_evaluation_type_id' => 0);
self::create_gradebook_evaluation($params);
$evals_found = $eval->load(null, null, null, $gradebook['id'], null, null);
}
if (!empty($evals_found)) {
$evaluation = current($evals_found);
$eval_id = $evaluation->get_id();
error_log("Gradebook exists: {$gradebook['id']} eval_id: {$eval_id}");
//Eval found
$res = new Result();
$check_result = Result::load(null, $user_id, $eval_id);
if (!empty($check_result) && isset($check_result[0])) {
// Gradebook result found. Updating...
$res->set_evaluation_id($eval_id);
$res->set_user_id($user_id);
$res->set_score($score);
$res->set_id($check_result[0]->get_id());
$res->save();
$eval_result = Result::load(null, $user_id, $eval_id);
return array('entity' => 'gradebook_evaluation_result', 'before' => $check_result, 'after' => $eval_result, 'message' => "Gradebook result edited ", 'status_id' => self::TRANSACTION_STATUS_SUCCESSFUL);
} else {
// Gradebook result not found. Creating...
// @todo disable when moving to production
$res->set_evaluation_id($eval_id);
$res->set_user_id($user_id);
//if no scores are given, don't set the score
$res->set_score($score);
$res->add();
$eval_result = Result::load(null, $user_id, $eval_id);
//$message = "Gradebook result not modified because gradebook result does not exist for user_id: $user_id - eval_id: $eval_id - gradebook_id: {$gradebook['id']} - course: {$course_data['code']} - session_id: $session_id";
return array('entity' => 'gradebook_evaluation_result', 'before' => null, 'after' => $eval_result, 'message' => "Gradebook result added because it did not exist for update", 'status_id' => self::TRANSACTION_STATUS_SUCCESSFUL);
}
} else {
$message = "Evaluation not found in gradebook: {$gradebook['id']} : in course: {$course_data['code']} - session_id: {$session_id}";
}
} else {
$message = "Gradebook does not exists in course: {$course_data['code']} - session_id: {$session_id}";
}
} else {
$message = "Something is wrong with the course ";
}
} else {
$message = "NO course found for session id: {$session_id}";
}
return array('message' => $message, 'status_id' => self::TRANSACTION_STATUS_FAILED);
} else {
return $data;
}
}