本文整理汇总了PHP中Evaluation::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Evaluation::load方法的具体用法?PHP Evaluation::load怎么用?PHP Evaluation::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Evaluation
的用法示例。
在下文中一共展示了Evaluation::load方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_block_anonymous_users
* @package chamilo.gradebook
*/
//$cidReset = true;
require_once '../inc/global.inc.php';
api_block_anonymous_users();
GradebookUtils::block_students();
$interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'] . '?', 'name' => get_lang('Gradebook'));
$interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'] . '?selectcat=' . Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('Details'));
$interbreadcrumb[] = array('url' => 'gradebook_showlog_eval.php?visiblelog=' . Security::remove_XSS($_GET['visiblelog']) . '&selectcat=' . Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('GradebookQualifyLog'));
$this_section = SECTION_COURSES;
Display::display_header('');
echo Display::page_header(get_lang('GradebookQualifyLog'));
$t_linkeval_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
$t_user = Database::get_main_table(TABLE_MAIN_USER);
$visible_log = Security::remove_XSS($_GET['visiblelog']);
$evaledit = Evaluation::load($visible_log);
$sql = "SELECT le.name,le.description,le.weight,le.visible,le.type,le.created_at,us.username FROM " . $t_linkeval_log . " le INNER JOIN " . $t_user . " us\n ON le.user_id_log=us.user_id where id_linkeval_log=" . $evaledit[0]->get_id() . " and type='evaluation';";
$result = Database::query($sql);
$list_info = array();
while ($row = Database::fetch_row($result)) {
$list_info[] = $row;
}
foreach ($list_info as $key => $info_log) {
$list_info[$key][5] = $info_log[5] ? api_convert_and_format_date($info_log[5]) : 'N/A';
$list_info[$key][3] = $info_log[3] == 1 ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
}
$parameters = array('visiblelog' => $visible_log, 'selectcat' => intval($_GET['selectcat']));
$table = new SortableTableFromArrayConfig($list_info, 1, 20, 'gradebookeval');
$table->set_additional_parameters($parameters);
$table->set_header(0, get_lang('GradebookNameLog'));
$table->set_header(1, get_lang('GradebookDescriptionLog'));
示例2: get_lang
$link[0]->save();
}
}
$confirmation_message = get_lang('ItemsVisible');
$filter_confirm_msg = false;
break;
case 'setinvisible':
foreach ($_POST['id'] as $indexstr) {
if (api_substr($indexstr, 0, 4) == 'CATE') {
$cats = Category::load(api_substr($indexstr, 4));
$cats[0]->set_visible(0);
$cats[0]->save();
$cats[0]->apply_visibility_to_children();
}
if (api_substr($indexstr, 0, 4) == 'EVAL') {
$eval = Evaluation::load(api_substr($indexstr, 4));
$eval[0]->set_visible(0);
$eval[0]->save();
}
if (api_substr($indexstr, 0, 4) == 'LINK') {
$link = LinkFactory::load(api_substr($indexstr, 4));
$link[0]->set_visible(0);
$link[0]->save();
}
}
$confirmation_message = get_lang('ItemsInVisible');
$filter_confirm_msg = false;
break;
}
}
}
示例3: add_evaluation_log
/**
* @param int $idevaluation
*/
public function add_evaluation_log($idevaluation)
{
if (!empty($idevaluation)) {
$tbl_grade_evaluations = Database::get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
$tbl_grade_linkeval_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
$eval = new Evaluation();
$dateobject = $eval->load($idevaluation, null, null, null, null);
$arreval = get_object_vars($dateobject[0]);
if (!empty($arreval['id'])) {
$sql = 'SELECT weight from ' . $tbl_grade_evaluations . '
WHERE id=' . $arreval['id'];
$rs = Database::query($sql);
$row_old_weight = Database::fetch_array($rs, 'ASSOC');
$current_date = api_get_utc_datetime();
$params = ['id_linkeval_log' => $arreval['id'], 'name' => $arreval['name'], 'description' => $arreval['description'], 'created_at' => $current_date, 'weight' => $row_old_weight['weight'], 'visible' => $arreval['visible'], 'type' => 'evaluation', 'user_id_log' => api_get_user_id()];
Database::insert($tbl_grade_linkeval_log, $params);
}
}
}
示例4: api_block_anonymous_users
/**
* Init
*/
//Disabling code when course code is null (gradebook as a tab) see issue #2705
exit;
$language_file = 'gradebook';
require_once '../inc/global.inc.php';
$this_section = SECTION_MYGRADEBOOK;
require_once 'lib/be.inc.php';
require_once 'lib/fe/displaygradebook.php';
require_once 'lib/gradebook_functions.inc.php';
require_once 'lib/fe/evalform.class.php';
require_once 'lib/scoredisplay.class.php';
api_block_anonymous_users();
block_students();
$evaluation = Evaluation::load($_GET['selecteval']);
$newstudents = $evaluation[0]->get_not_subscribed_students();
if (count($newstudents) == '0') {
header('Location: gradebook_view_result.php?nouser=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
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 {
示例5: api_block_anonymous_users
* @package chamilo.gradebook
*/
require_once '../inc/global.inc.php';
api_block_anonymous_users();
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(api_get_user_id(), api_get_course_info());
if (!$isDrhOfCourse) {
GradebookUtils::block_students();
}
$interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
//load the evaluation & category
$select_eval = Security::remove_XSS($_GET['selecteval']);
if (empty($select_eval)) {
api_not_allowed();
}
$displayscore = ScoreDisplay::instance();
$eval = Evaluation::load($select_eval);
$overwritescore = 0;
if ($eval[0]->get_category_id() < 0) {
// if category id is negative, then the evaluation's origin is a link
$link = LinkFactory::get_evaluation_link($eval[0]->get_id());
$currentcat = Category::load($link->get_category_id());
} else {
$currentcat = Category::load($eval[0]->get_category_id());
}
//load the result with the evaluation id
if (isset($_GET['delete_mark'])) {
$result = Result::load($_GET['delete_mark']);
if (!empty($result[0])) {
$result[0]->delete();
}
}
示例6: add_evaluation_log
public function add_evaluation_log($idevaluation)
{
if (!empty($idevaluation)) {
$tbl_grade_evaluations = Database::get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
$tbl_grade_linkeval_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
$eval = new Evaluation();
$dateobject = $eval->load($idevaluation, null, null, null, null);
$arreval = get_object_vars($dateobject[0]);
if (!empty($arreval['id'])) {
$sql_eval = 'SELECT weight from ' . $tbl_grade_evaluations . ' WHERE id=' . $arreval['id'];
$rs = Database::query($sql_eval);
$row_old_weight = Database::fetch_array($rs, 'ASSOC');
$current_date = api_get_utc_datetime();
$sql = "INSERT INTO " . $tbl_grade_linkeval_log . "(id_linkeval_log,name,description,created_at,weight,visible,type,user_id_log)\n\t\t\t\t\t VALUES('" . Database::escape_string($arreval['id']) . "','" . Database::escape_string($arreval['name']) . "','" . Database::escape_string($arreval['description']) . "','" . $current_date . "','" . Database::escape_string($row_old_weight['weight']) . "','" . Database::escape_string($arreval['visible']) . "','evaluation'," . api_get_user_id() . ")";
Database::query($sql);
}
}
}
示例7: get_evaluations
/**
* Get appropriate evaluations visible for the user
* @param int $stud_id student id (default: all students)
* @param boolean $recursive process subcategories (default: no recursion)
*/
public function get_evaluations($stud_id = null, $recursive = false, $course_code = '')
{
$evals = array();
if (empty($course_code)) {
$course_code = api_get_course_id();
}
// 1 student
if (isset($stud_id) && !empty($stud_id)) {
// special case: this is the root
if ($this->id == 0) {
$evals = Evaluation::get_evaluations_with_result_for_student(0, $stud_id);
} else {
$evals = Evaluation::load(null, null, $course_code, $this->id, api_is_allowed_to_edit() ? null : 1);
}
} else {
// all students
// course admin
if ((api_is_allowed_to_edit() || api_is_drh() || api_is_session_admin()) && !api_is_platform_admin()) {
// root
if ($this->id == 0) {
$evals = Evaluation::load(null, api_get_user_id(), null, $this->id, null);
} elseif (isset($this->course_code) && !empty($this->course_code)) {
// inside a course
$evals = Evaluation::load(null, null, $course_code, $this->id, null);
} else {
// course independent
$evals = Evaluation::load(null, api_get_user_id(), null, $this->id, null);
}
} elseif (api_is_platform_admin()) {
//platform admin
$evals = Evaluation::load(null, null, $course_code, $this->id, null);
}
}
if ($recursive) {
$subcats = $this->get_subcategories($stud_id, $course_code);
if (!empty($subcats)) {
foreach ($subcats as $subcat) {
$subevals = $subcat->get_evaluations($stud_id, true, $course_code);
//$this->debugprint($subevals);
$evals = array_merge($evals, $subevals);
}
}
}
return $evals;
}
示例8: get_evaluation
/**
* Lazy load function to get the linked evaluation
*/
protected function get_evaluation()
{
if (!isset($this->evaluation)) {
if (isset($this->ref_id)) {
$evalarray = Evaluation::load($this->get_ref_id());
$this->evaluation = $evalarray[0];
} else {
$eval = new Evaluation();
$eval->set_category_id(-1);
$eval->set_date(api_get_utc_datetime());
// these values will be changed
$eval->set_weight(0);
// when the link setter
$eval->set_visible(0);
// is called
$eval->set_id(-1);
// a 'real' id will be set when eval is added to db
$eval->set_user_id($this->get_user_id());
$eval->set_course_code($this->get_course_code());
$this->evaluation = $eval;
$this->set_ref_id($eval->get_id());
}
}
return $this->evaluation;
}
示例9: 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;
}
}
示例10: api_block_anonymous_users
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
require_once '../inc/global.inc.php';
api_block_anonymous_users();
GradebookUtils::block_students();
$evaledit = Evaluation::load($_GET['editeval']);
if ($evaledit[0]->is_locked() && !api_is_platform_admin()) {
api_not_allowed();
}
$form = new EvalForm(EvalForm::TYPE_EDIT, $evaledit[0], null, 'edit_eval_form', null, api_get_self() . '?editeval=' . Security::remove_XSS($_GET['editeval']));
if ($form->validate()) {
$values = $form->exportValues();
$eval = new Evaluation();
$eval->set_id($values['hid_id']);
$eval->set_name($values['name']);
$eval->set_description($values['description']);
$eval->set_user_id($values['hid_user_id']);
$eval->set_course_code($values['hid_course_code']);
$eval->set_category_id($values['hid_category_id']);
$parent_cat = Category::load($values['hid_category_id']);
$final_weight = $values['weight_mask'];
$eval->set_weight($final_weight);
$eval->set_max($values['max']);
if (empty($values['visible'])) {
$visible = 0;
} else {
示例11: add_evaluation_log
/**
* @param int $idevaluation
*/
public function add_evaluation_log($idevaluation)
{
if (!empty($idevaluation)) {
$em = Database::getManager();
$tbl_grade_linkeval_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
$eval = new Evaluation();
$dateobject = $eval->load($idevaluation, null, null, null, null);
$arreval = get_object_vars($dateobject[0]);
if (!empty($arreval['id'])) {
$row_old_weight = $em->find('ChamiloCoreBundle:GradebookEvaluation', $arreval['id']);
$current_date = api_get_utc_datetime();
$params = ['id_linkeval_log' => $arreval['id'], 'name' => $arreval['name'], 'description' => $arreval['description'], 'created_at' => $current_date, 'weight' => $row_old_weight->getWeight(), 'visible' => $arreval['visible'], 'type' => 'evaluation', 'user_id_log' => api_get_user_id()];
Database::insert($tbl_grade_linkeval_log, $params);
}
}
}