本文整理汇总了PHP中ScoreDisplay类的典型用法代码示例。如果您正苦于以下问题:PHP ScoreDisplay类的具体用法?PHP ScoreDisplay怎么用?PHP ScoreDisplay使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ScoreDisplay类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_table_data
/**
* Function used by SortableTable to generate the data to display
*/
public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null)
{
$scoredisplay = ScoreDisplay::instance();
// determine sorting type
switch ($this->column) {
// Type
case 0:
$sorting = UserDataGenerator::UDG_SORT_TYPE;
break;
case 1:
$sorting = UserDataGenerator::UDG_SORT_NAME;
break;
case 2:
$sorting = UserDataGenerator::UDG_SORT_COURSE;
break;
case 3:
$sorting = UserDataGenerator::UDG_SORT_CATEGORY;
break;
case 4:
$sorting = UserDataGenerator::UDG_SORT_AVERAGE;
break;
case 5:
$sorting = UserDataGenerator::UDG_SORT_SCORE;
break;
case 6:
$sorting = UserDataGenerator::UDG_SORT_MASK;
break;
}
if ($this->direction == 'DESC') {
$sorting |= UserDataGenerator::UDG_SORT_DESC;
} else {
$sorting |= UserDataGenerator::UDG_SORT_ASC;
}
$data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
// generate the data to display
$sortable_data = array();
foreach ($data_array as $data) {
if ($data[2] != "") {
//filter by course removed
$row = array();
$row[] = $this->build_type_column($data[0]);
$row[] = $this->build_name_link($data[0]);
$row[] = $data[2];
$row[] = $data[3];
$row[] = $data[4];
$row[] = $data[5];
if ($scoredisplay->is_custom()) {
$row[] = $data[6];
}
$sortable_data[] = $row;
}
}
return $sortable_data;
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:57,代码来源:usertable.class.php
示例2: get_link
public function get_link()
{
$eval = $this->get_evaluation();
// course/platform admin can go to the view_results page
if (api_is_allowed_to_edit()) {
return 'gradebook_view_result.php?selecteval=' . $eval->get_id();
} elseif (ScoreDisplay::instance()->is_custom()) {
return 'gradebook_statistics.php?selecteval=' . $eval->get_id();
} else {
return null;
}
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:12,代码来源:evallink.class.php
示例3: compare_scores_by_custom_display
/**
* Compare the custom display of 2 scores, can be useful in sorting
*/
public static function compare_scores_by_custom_display($score1, $score2)
{
if (!isset($score1)) {
return isset($score2) ? 1 : 0;
} elseif (!isset($score2)) {
return -1;
} else {
$scoredisplay = ScoreDisplay::instance();
$custom1 = $scoredisplay->display_custom($score1);
$custom2 = $scoredisplay->display_custom($score2);
if ($custom1 == $custom2) {
return 0;
} else {
return $score1[0] / $score1[1] < $score2[0] / $score2[1] ? -1 : 1;
}
}
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:20,代码来源:scoredisplay.class.php
示例4: display_graph_by_resource
/**
* Display gradebook graphs
*/
public function display_graph_by_resource()
{
$headerName = $this->datagen->get_header_names();
$total_users = $this->datagen->get_total_users_count();
$displayscore = ScoreDisplay::instance();
$customdisplays = $displayscore->get_custom_score_display_settings();
if (empty($customdisplays)) {
echo get_lang('ToViewGraphScoreRuleMustBeEnabled');
return '';
}
$user_results = $this->datagen->get_data_to_graph2(false);
//if (empty($this->datagen->get_total_items_count()) || empty($total_users)) {
if (empty($user_results) || empty($total_users)) {
echo get_lang('NoResults');
return '';
}
// Removing first name
array_shift($headerName);
// Removing last name
array_shift($headerName);
$pre_result = $new_result = array();
foreach ($user_results as $result) {
for ($i = 0; $i < count($headerName); $i++) {
if (isset($result[$i + 1])) {
$pre_result[$i + 3][] = $result[$i + 1];
}
}
}
$i = 0;
$show_draw = false;
$resource_list = array();
$pre_result2 = array();
foreach ($pre_result as $key => $res_array) {
rsort($res_array);
$pre_result2[] = $res_array;
}
//@todo when a display custom does not exist the order of the color does not match
//filling all the answer that are not responded with 0
rsort($customdisplays);
if ($total_users > 0) {
foreach ($pre_result2 as $key => $res_array) {
$key_list = array();
foreach ($res_array as $user_result) {
$userResult = isset($user_result[1]) ? $user_result[1] : null;
if (!isset($resource_list[$key][$userResult])) {
$resource_list[$key][$userResult] = 0;
}
$resource_list[$key][$userResult] += 1;
$key_list[] = $userResult;
}
foreach ($customdisplays as $display) {
if (!in_array($display['display'], $key_list)) {
$resource_list[$key][$display['display']] = 0;
}
}
$i++;
}
}
//fixing $resource_list
$max = 0;
$new_list = array();
foreach ($resource_list as $key => $value) {
$new_value = array();
foreach ($customdisplays as $item) {
if ($value[$item['display']] > $max) {
$max = $value[$item['display']];
}
$new_value[$item['display']] = strip_tags($value[$item['display']]);
}
$new_list[] = $new_value;
}
$resource_list = $new_list;
$i = 1;
foreach ($resource_list as $key => $resource) {
// Reverse array, otherwise we get highest values first
$resource = array_reverse($resource, true);
$dataSet = new pData();
$dataSet->addPoints($resource, 'Serie');
$dataSet->addPoints(array_keys($resource), 'Labels');
$dataSet->setSerieDescription('Labels', strip_tags($headerName[$i - 1]));
$dataSet->setAbscissa('Labels');
$dataSet->setAbscissaName(get_lang('GradebookSkillsRanking'));
$dataSet->setAxisName(0, get_lang('Students'));
$palette = array('0' => array('R' => 186, 'G' => 206, 'B' => 151, 'Alpha' => 100), '1' => array('R' => 210, 'G' => 148, 'B' => 147, 'Alpha' => 100), '2' => array('R' => 148, 'G' => 170, 'B' => 208, 'Alpha' => 100), '3' => array('R' => 221, 'G' => 133, 'B' => 61, 'Alpha' => 100), '4' => array('R' => 65, 'G' => 153, 'B' => 176, 'Alpha' => 100), '5' => array('R' => 114, 'G' => 88, 'B' => 144, 'Alpha' => 100), '6' => array('R' => 138, 'G' => 166, 'B' => 78, 'Alpha' => 100), '7' => array('R' => 171, 'G' => 70, 'B' => 67, 'Alpha' => 100), '8' => array('R' => 69, 'G' => 115, 'B' => 168, 'Alpha' => 100));
// Cache definition
$cachePath = api_get_path(SYS_ARCHIVE_PATH);
$myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
$chartHash = $myCache->getHash($dataSet);
if ($myCache->isInCache($chartHash)) {
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
} else {
/* Create the pChart object */
$widthSize = 480;
$heightSize = 250;
$myPicture = new pImage($widthSize, $heightSize, $dataSet);
//.........这里部分代码省略.........
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:flatviewtable.class.php
示例5: register_user_certificate
static function register_user_certificate($category_id, $user_id)
{
// generating the total score for a course
$cats_course = Category::load($category_id, null, null, null, null, null, false);
$alleval_course = $cats_course[0]->get_evaluations($user_id, true);
$alllink_course = $cats_course[0]->get_links($user_id, true);
$evals_links = array_merge($alleval_course, $alllink_course);
$item_total = 0;
//@todo move these in a function
$sum_categories_weight_array = array();
if (isset($cats_course) && !empty($cats_course)) {
$categories = Category::load(null, null, null, $category_id);
if (!empty($categories)) {
foreach ($categories as $category) {
$sum_categories_weight_array[$category->get_id()] = $category->get_weight();
}
} else {
$sum_categories_weight_array[$category_id] = $cats_course[0]->get_weight();
}
}
$main_weight = $cats_course[0]->get_weight();
$item_total_value = 0;
$item_value = 0;
for ($count = 0; $count < count($evals_links); $count++) {
$item = $evals_links[$count];
$score = $item->calc_score($user_id);
$divide = $score[1] == 0 ? 1 : $score[1];
$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
$item_value = $score[0] / $divide * $item->get_weight() * $sub_cat_percentage / $main_weight;
$item_total_value += $item_value;
}
$item_total_value = (double) $item_total_value;
$cattotal = Category::load($category_id);
$scoretotal = $cattotal[0]->calc_score($user_id);
//Do not remove this the gradebook/lib/fe/gradebooktable.class.php file load this variable as a global
$scoredisplay = ScoreDisplay::instance();
$my_score_in_gradebook = $scoredisplay->display_score($scoretotal, SCORE_SIMPLE);
//Show certificate
$certificate_min_score = $cats_course[0]->get_certificate_min_score();
$scoretotal_display = $scoredisplay->display_score($scoretotal, SCORE_DIV_PERCENT);
//a student always sees only the teacher's repartition
if (isset($certificate_min_score) && $item_total_value >= $certificate_min_score) {
$my_certificate = get_certificate_by_user_id($cats_course[0]->get_id(), $user_id);
if (empty($my_certificate)) {
register_user_info_about_certificate($category_id, $user_id, $my_score_in_gradebook, api_get_utc_datetime());
$my_certificate = get_certificate_by_user_id($cats_course[0]->get_id(), $user_id);
}
if (!empty($my_certificate)) {
$certificate_obj = new Certificate($my_certificate['id']);
$url = Certificate::getCertificatePublicURL($my_certificate['id']);
$certificates = Display::url(Display::return_icon('certificate.png', get_lang('Certificates'), array(), 32), $url, array('target' => '_blank'));
$html = '<div class="actions" align="right">';
$html .= Display::url($url, $url, array('target' => '_blank'));
$html .= $certificates;
$html .= '</div>';
return $html;
}
} else {
return false;
}
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:61,代码来源:category.class.php
示例6: export_pdf_flatview
/**
* @param FlatViewTable $flatviewtable
* @param Category $cat
* @param $users
* @param $alleval
* @param $alllinks
* @param array $params
* @param null $mainCourseCategory
*/
public static function export_pdf_flatview($flatviewtable, $cat, $users, $alleval, $alllinks, $params = array(), $mainCourseCategory = null)
{
// Getting data
$printable_data = self::get_printable_data($cat[0], $users, $alleval, $alllinks, $params, $mainCourseCategory);
// HTML report creation first
$course_code = trim($cat[0]->get_course_code());
$displayscore = ScoreDisplay::instance();
$customdisplays = $displayscore->get_custom_score_display_settings();
$total = array();
if (is_array($customdisplays) && count($customdisplays)) {
foreach ($customdisplays as $custom) {
$total[$custom['display']] = 0;
}
$user_results = $flatviewtable->datagen->get_data_to_graph2(false);
foreach ($user_results as $user_result) {
$total[$user_result[count($user_result) - 1][1]]++;
}
}
$parent_id = $cat[0]->get_parent_id();
if (isset($cat[0]) && isset($parent_id)) {
if ($parent_id == 0) {
$grade_model_id = $cat[0]->get_grade_model_id();
} else {
$parent_cat = Category::load($parent_id);
$grade_model_id = $parent_cat[0]->get_grade_model_id();
}
}
$use_grade_model = true;
if (empty($grade_model_id) || $grade_model_id == -1) {
$use_grade_model = false;
}
if ($use_grade_model) {
if ($parent_id == 0) {
$title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed');
} else {
$title = api_strtoupper(get_lang('Average')) . '<br />' . $cat[0]->get_description() . ' - (' . $cat[0]->get_name() . ')';
}
} else {
if ($parent_id == 0) {
$title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed');
} else {
$title = api_strtoupper(get_lang('Average'));
}
}
$columns = count($printable_data[0]);
$has_data = is_array($printable_data[1]) && count($printable_data[1]) > 0;
$table = new HTML_Table(array('class' => 'data_table'));
$row = 0;
$column = 0;
$table->setHeaderContents($row, $column, get_lang('NumberAbbreviation'));
$column++;
foreach ($printable_data[0] as $printable_data_cell) {
if (!is_array($printable_data_cell)) {
$printable_data_cell = strip_tags($printable_data_cell);
}
$table->setHeaderContents($row, $column, $printable_data_cell);
$column++;
}
$row++;
if ($has_data) {
$counter = 1;
foreach ($printable_data[1] as &$printable_data_row) {
$column = 0;
$table->setCellContents($row, $column, $counter);
$table->updateCellAttributes($row, $column, 'align="center"');
$column++;
$counter++;
foreach ($printable_data_row as $key => &$printable_data_cell) {
$attributes = array();
$attributes['align'] = 'center';
$attributes['style'] = null;
if ($key === 'name') {
$attributes['align'] = 'left';
}
if ($key === 'total') {
$attributes['style'] = 'font-weight:bold';
}
$table->setCellContents($row, $column, $printable_data_cell);
$table->updateCellAttributes($row, $column, $attributes);
$column++;
}
$table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
$row++;
}
} else {
$column = 0;
$table->setCellContents($row, $column, get_lang('NoResults'));
$table->updateCellAttributes($row, $column, 'colspan="' . $columns . '" align="center" class="row_odd"');
}
$pdfParams = array('filename' => get_lang('FlatView') . '_' . api_get_utc_datetime(), 'pdf_title' => $title, 'course_code' => $course_code, 'add_signatures' => true);
$page_format = $params['orientation'] == 'landscape' ? 'A4-L' : 'A4';
//.........这里部分代码省略.........
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:101,代码来源:GradebookUtils.php
示例7: build_mask_column
/**
* @param $item
* @param $ignore_score_color
* @return string
*/
private function build_mask_column($item, $ignore_score_color)
{
$studscore = $this->scorecache[$item->get_item_type() . $item->get_id()];
$scoredisplay = ScoreDisplay::instance();
$displaytype = SCORE_DIV_PERCENT;
if ($ignore_score_color) {
$displaytype |= SCORE_IGNORE_SPLIT;
}
return $scoredisplay->display_score($studscore, $displaytype, SCORE_ONLY_CUSTOM);
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:15,代码来源:user_data_generator.class.php
示例8: build_result_column
/**
* @param int $userId
* @param GradebookItem $item
* @param $ignore_score_color
* @return null|string
*/
private function build_result_column($userId, $item, $ignore_score_color, $forceSimpleResult = false)
{
$scoredisplay = ScoreDisplay::instance();
$score = $item->calc_score($userId);
if (!empty($score)) {
switch ($item->get_item_type()) {
// category
case 'C':
if ($score != null) {
$displaytype = SCORE_PERCENT;
if ($ignore_score_color) {
$displaytype |= SCORE_IGNORE_SPLIT;
}
if ($forceSimpleResult) {
return array('display' => $scoredisplay->display_score($score, SCORE_DIV), 'score' => $score, 'score_weight' => $score);
}
return array('display' => $scoredisplay->display_score($score, SCORE_DIV), 'score' => $score, 'score_weight' => $score);
} else {
return array('display' => null, 'score' => $score, 'score_weight' => $score);
}
break;
// evaluation and link
// evaluation and link
case 'E':
case 'L':
//if ($parentId == 0) {
$scoreWeight = [$score[0] / $score[1] * $item->get_weight(), $item->get_weight()];
//}
return array('display' => $scoredisplay->display_score($score, SCORE_DIV), 'score' => $score, 'score_weight' => $scoreWeight);
}
}
return array('display' => null, 'score' => null, 'score_weight' => null);
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:39,代码来源:gradebook_data_generator.class.php
示例9: get_table_data
/**
* Function used by SortableTable to generate the data to display
*/
function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null)
{
$is_western_name_order = api_is_western_name_order();
$scoredisplay = ScoreDisplay::instance();
// determine sorting type
$col_adjust = $this->iscourse == '1' ? 1 : 0;
switch ($this->column) {
// first name or last name
case 0 + $col_adjust:
if ($is_western_name_order) {
$sorting = ResultsDataGenerator::RDG_SORT_FIRSTNAME;
} else {
$sorting = ResultsDataGenerator::RDG_SORT_LASTNAME;
}
break;
// first name or last name
// first name or last name
case 1 + $col_adjust:
if ($is_western_name_order) {
$sorting = ResultsDataGenerator::RDG_SORT_LASTNAME;
} else {
$sorting = ResultsDataGenerator::RDG_SORT_FIRSTNAME;
}
break;
//Score
//Score
case 2 + $col_adjust:
$sorting = ResultsDataGenerator::RDG_SORT_SCORE;
break;
case 3 + $col_adjust:
$sorting = ResultsDataGenerator::RDG_SORT_MASK;
break;
}
if ($this->direction == 'DESC') {
$sorting |= ResultsDataGenerator::RDG_SORT_DESC;
} else {
$sorting |= ResultsDataGenerator::RDG_SORT_ASC;
}
$data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
// generate the data to display
$sortable_data = array();
foreach ($data_array as $item) {
$row = array();
if ($this->iscourse == '1') {
$row[] = $item['result_id'];
}
if ($is_western_name_order) {
$row[] = $item['firstname'];
$row[] = $item['lastname'];
} else {
$row[] = $item['lastname'];
$row[] = $item['firstname'];
}
$row[] = Display::bar_progress($item['percentage_score'], false, $item['score']);
//$row[] = Display::bar_progress($item['percentage_score'], true);
if ($scoredisplay->is_custom()) {
$row[] = $item['display'];
}
if (!$this->forprint) {
$row[] = $this->build_edit_column($item);
}
$sortable_data[] = $row;
}
return $sortable_data;
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:68,代码来源:resulttable.class.php
示例10: register_user_certificate
/**
* @param int $category_id
* @param int $user_id
* @return bool|string
*/
public static function register_user_certificate($category_id, $user_id)
{
$courseId = api_get_course_int_id();
$courseCode = api_get_course_id();
$sessionId = api_get_session_id();
// Generating the total score for a course
$cats_course = Category::load($category_id, null, null, null, null, $sessionId, false);
/** @var Category $category */
$category = $cats_course[0];
//@todo move these in a function
$sum_categories_weight_array = array();
if (isset($cats_course) && !empty($cats_course)) {
$categories = Category::load(null, null, null, $category_id);
if (!empty($categories)) {
foreach ($categories as $subCategory) {
$sum_categories_weight_array[$subCategory->get_id()] = $subCategory->get_weight();
}
} else {
$sum_categories_weight_array[$category_id] = $cats_course[0]->get_weight();
}
}
$main_weight = $cats_course[0]->get_weight();
$cattotal = Category::load($category_id);
$scoretotal = $cattotal[0]->calc_score($user_id);
// Do not remove this the gradebook/lib/fe/gradebooktable.class.php
// file load this variable as a global
$scoredisplay = ScoreDisplay::instance();
$my_score_in_gradebook = $scoredisplay->display_score($scoretotal, SCORE_SIMPLE);
// A student always sees only the teacher's repartition
$scoretotal_display = $scoredisplay->display_score($scoretotal, SCORE_DIV_PERCENT);
if (!self::userFinishedCourse($user_id, $cats_course[0], 0, $courseCode, $sessionId, true)) {
return false;
}
$skillToolEnabled = api_get_setting('skill.allow_skills_tool') == 'true';
$userHasSkills = false;
if ($skillToolEnabled) {
if (!$category->getGenerateCertificates()) {
$skill = new Skill();
$skill->add_skill_to_user($user_id, $category_id, $courseId, $sessionId);
}
$objSkillRelUser = new SkillRelUser();
$userSkills = $objSkillRelUser->get_user_skills($user_id, $courseId, $sessionId);
$userHasSkills = !empty($userSkills);
if (!$category->getGenerateCertificates() && $userHasSkills) {
return ['badge_link' => Display::url(get_lang('DownloadBadges'), api_get_path(WEB_CODE_PATH) . "gradebook/get_badges.php?user={$user_id}", array('target' => '_blank', 'class' => 'btn btn-default'))];
}
}
$my_certificate = GradebookUtils::get_certificate_by_user_id($cats_course[0]->get_id(), $user_id);
if (empty($my_certificate)) {
GradebookUtils::register_user_info_about_certificate($category_id, $user_id, $my_score_in_gradebook, api_get_utc_datetime());
$my_certificate = GradebookUtils::get_certificate_by_user_id($cats_course[0]->get_id(), $user_id);
}
$html = array();
if (!empty($my_certificate)) {
$certificate_obj = new Certificate($my_certificate['id']);
$fileWasGenerated = $certificate_obj->html_file_is_generated();
if (!empty($fileWasGenerated)) {
$url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $my_certificate['id'];
$certificates = Display::url(Display::returnFontAwesomeIcon('download') . ' ' . get_lang('DownloadCertificate'), $url, array('target' => '_blank', 'class' => 'btn btn-sm btn-primary'));
$exportToPDF = Display::url(Display::return_icon('pdf.png', get_lang('ExportToPDF'), array(), ICON_SIZE_MEDIUM), "{$url}&action=export");
$hideExportLink = api_get_setting('hide_certificate_export_link');
$hideExportLinkStudent = api_get_setting('hide_certificate_export_link_students');
if ($hideExportLink === 'true' || api_is_student() && $hideExportLinkStudent === 'true') {
$exportToPDF = null;
}
$html = array('certificate_link' => $certificates, 'pdf_link' => $exportToPDF, 'pdf_url' => "{$url}&action=export");
if ($skillToolEnabled && $userHasSkills) {
$html['badge_link'] = Display::url(get_lang('DownloadBadges'), api_get_path(WEB_CODE_PATH) . "gradebook/get_badges.php?user={$user_id}", array('target' => '_blank', 'class' => 'btn btn-default'));
}
}
return $html;
}
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:78,代码来源:category.class.php
示例11: get_info_gradebook_certificate
/**
* Gets the info about a gradebook certificate for a user by course
* @param string The course code
* @param int The user id
* @return array if there is not information return false
*/
public static function get_info_gradebook_certificate($course_code, $user_id)
{
$tbl_grade_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
$tbl_grade_category = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$session_id = api_get_session_id();
if (empty($session_id)) {
$session_condition = ' AND (session_id = "" OR session_id = 0 OR session_id IS NULL )';
} else {
$session_condition = " AND session_id = {$session_id}";
}
$sql = 'SELECT * FROM ' . $tbl_grade_certificate . ' WHERE cat_id = (SELECT id FROM ' . $tbl_grade_category . '
WHERE
course_code = "' . Database::escape_string($course_code) . '" ' . $session_condition . ' LIMIT 1 ) AND
user_id=' . intval($user_id);
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
$row = Database::fetch_array($rs, 'ASSOC');
$score = $row['score_certificate'];
$category_id = $row['cat_id'];
$cat = Category::load($category_id);
$displayscore = ScoreDisplay::instance();
if (isset($cat) && $displayscore->is_custom()) {
$grade = $displayscore->display_score(array($score, $cat[0]->get_weight()), SCORE_DIV_PERCENT_WITH_CUSTOM);
} else {
$grade = $displayscore->display_score(array($score, $cat[0]->get_weight()));
}
$row['grade'] = $grade;
return $row;
}
return false;
}
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:37,代码来源:usermanager.lib.php
示例12: sort_by_mask
function sort_by_mask($item1, $item2)
{
$score1 = isset($item1['score']) ? array($item1['score'], $this->evaluation->get_max()) : null;
$score2 = isset($item2['score']) ? array($item2['score'], $this->evaluation->get_max()) : null;
return ScoreDisplay::compare_scores_by_custom_display($score1, $score2);
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:6,代码来源:results_data_generator.class.php
示例13: __construct
/**
* @param $form_name
* @param null $action
*/
public function __construct($form_name, $action = null)
{
parent::__construct($form_name, 'post', $action);
$displayscore = ScoreDisplay::instance();
$customdisplays = $displayscore->get_custom_score_display_settings();
$nr_items = count($customdisplays) != '0' ? count($customdisplays) : '1';
$this->setDefaults(array('scorecolpercent' => $displayscore->get_color_split_value()));
$this->addElement('hidden', 'maxvalue', '100');
$this->addElement('hidden', 'minvalue', '0');
$counter = 1;
//setting the default values
if (is_array($customdisplays)) {
foreach ($customdisplays as $customdisplay) {
$this->setDefaults(array('endscore[' . $counter . ']' => $customdisplay['score'], 'displaytext[' . $counter . ']' => $customdisplay['display']));
$counter++;
}
}
$scorecol = array();
//settings for the colored score
$this->addElement('header', get_lang('ScoreEdit'));
if ($displayscore->is_coloring_enabled()) {
$this->addElement('html', '<b>' . get_lang('ScoreColor') . '</b>');
$this->addElement('text', 'scorecolpercent', array(get_lang('Below'), get_lang('WillColorRed'), '%'), array('size' => 5, 'maxlength' => 5, 'input-size' => 2));
if (api_get_setting('gradebook.teachers_can_change_score_settings') != 'true') {
$this->freeze('scorecolpercent');
}
$this->addRule('scorecolpercent', get_lang('OnlyNumbers'), 'numeric');
$this->addRule(array('scorecolpercent', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
$this->addRule(array('scorecolpercent', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
}
//Settings for the scoring system
if ($displayscore->is_custom()) {
$this->addElement('html', '<br /><b>' . get_lang('ScoringSystem') . '</b>');
$this->addElement('static', null, null, get_lang('ScoreInfo'));
$this->setDefaults(array('beginscore' => '0'));
$this->addElement('text', 'beginscore', array(get_lang('Between'), null, '%'), array('size' => 5, 'maxlength' => 5, 'disabled' => 'disabled', 'input-size' => 2));
for ($counter = 1; $counter <= 20; $counter++) {
$renderer =& $this->defaultRenderer();
$elementTemplateTwoLabel = '<div id=' . $counter . ' style="display: ' . ($counter <= $nr_items ? 'inline' : 'none') . ';">
<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->
<label class="control-label">{label}</label>
<div class="form-group">
<label class="col-sm-2 control-label">
</label>
<div class="col-sm-1">
<!-- BEGIN error --><span class="form_error">{error}</span><br />
<!-- END error --> <b>' . get_lang('And') . '</b>
</div>
<div class="col-sm-2">
{element}
</div>
<div class="col-sm-1">
=
</div>
';
$elementTemplateTwoLabel2 = '
<div class="col-sm-2">
<!-- BEGIN error --><span class="form_error">{error}</span>
<!-- END error -->
{element}
</div>
<div class="col-sm-1">
<a href="javascript:plusItem(' . ($counter + 1) . ')">
<img style="display: ' . ($counter >= $nr_items ? 'inline' : 'none') . ';" id="plus-' . ($counter + 1) . '" src="' . Display::returnIconPath('add.png') . '" alt="' . get_lang('Add') . '" title="' . get_lang('Add') . '"></a>
<a href="javascript:minItem(' . $counter . ')">
<img style="display: ' . ($counter >= $nr_items && $counter != 1 ? 'inline' : 'none') . ';" id="min-' . $counter . '" src="' . Display::returnIconPath('delete.png') . '" alt="' . get_lang('Delete') . '" title="' . get_lang('Delete') . '"></a>
</div>
</div>
</div>';
$scorebetw = array();
$this->addElement('text', 'endscore[' . $counter . ']', null, array('size' => 5, 'maxlength' => 5, 'id' => 'txta-' . $counter, 'input-size' => 2));
$this->addElement('text', 'displaytext[' . $counter . ']', null, array('size' => 40, 'maxlength' => 40, 'id' => 'txtb-' . $counter));
$renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore[' . $counter . ']');
$renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext[' . $counter . ']');
$this->addRule('endscore[' . $counter . ']', get_lang('OnlyNumbers'), 'numeric');
$this->addRule(array('endscore[' . $counter . ']', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
$this->addRule(array('endscore[' . $counter . ']', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
}
}
if ($displayscore->is_custom()) {
$this->addButtonSave(get_lang('Ok'));
}
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:94,代码来源:scoredisplayform.class.php
示例14: get_data_to_graph2
public function get_data_to_graph2()
{
// do some checks on users/items counts, redefine if invalid values
$usertable = array();
foreach ($this->users as $user) {
$usertable[] = $user;
}
// sort users array
usort($usertable, array('FlatViewDataGenerator', 'sort_by_first_name'));
// generate actual data array
$scoredisplay = ScoreDisplay::instance();
$data = array();
$displaytype = SCORE_DIV;
$selected_users = $usertable;
foreach ($selected_users as $user) {
$row = array();
$row[] = $user[0];
// user id
$item_value = 0;
$item_total = 0;
for ($count = 0; $count < count($this->evals_links); $count++) {
$item = $this->evals_links[$count];
$score = $item->calc_score($user[0]);
$divide = $score[1] == 0 ? 1 : $score[1];
$item_value += $score[0] / $divide * $item->get_weight();
$item_total += $item->get_weight();
$score_denom = $score[1] == 0 ? 1 : $score[1];
$score_final = $score[0] / $score_denom * 100;
$row[] = array($score_final, trim($scoredisplay->display_score($score, SCORE_CUSTOM, null, true)));
}
$total_score = array($item_value, $item_total);
$score_final = $item_value / $item_total * 100;
$row[] = array($score_final, trim($scoredisplay->display_score($total_score, SCORE_CUSTOM, null, true)));
$data[] = $row;
}
return $data;
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:37,代码来源:flatview_data_generator.class.php
示例15: generate
/**
* Generates an HTML Certificate and fills the path_certificate field in the DB
**/
public function generate($params = array())
{
//The user directory should be set
if (empty($this->certification_user_path) && $this->force_certificate_generation == false) {
return false;
}
require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/be.inc.php';
require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/gradebook_functions.inc.php';
require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/scoredisplay.class.php';
$params['hide_print_button'] = isset($params['hide_print_button']) ? true : false;
$my_category = Category::load($this->certificate_data['cat_id']);
if (isset($my_category[0]) && $my_category[0]->is_certificate_available($this->user_id)) {
$user = api_get_user_info($this->user_id);
$scoredisplay = ScoreDisplay::instance();
$scorecourse = $my_category[0]->calc_score($this->user_id);
$scorecourse_display = isset($scorecourse) ? $scoredisplay->display_score($scorecourse, SCORE_AVERAGE) : get_lang('NoResultsAvailable');
// Prepare all necessary variables:
$organization_name = api_get_setting('Institution');
//$portal_name = api_get_setting('siteName');
$stud_fn = $user['firstname'];
$stud_ln = $user['lastname'];
//@todo this code is not needed
$certif_text = sprintf(get_lang('CertificateWCertifiesStudentXFinishedCourseYWithGradeZ'), $organization_name, $stud_fn . ' ' . $stud_ln, $my_category[0]->get_name(), $scorecourse_display);
$certif_text = str_replace("\\n", "\n", $certif_text);
//If the gradebook is related to skills we added the skills to the user
$skill = new Skill();
$skill->add_skill_to_user($this->user_id, $this->certificate_data['cat_id']);
if (is_dir($this->certification_user_path)) {
if (!empty($this->certificate_data)) {
$new_content_html = get_user_certificate_content($this->user_id, $my_category[0]->get_course_code(), false, $params['hide_print_button']);
if ($my_category[0]->get_id() == strval(intval($this->certificate_data['cat_id']))) {
$name = $this->certificate_data['path_certificate'];
$my_path_certificate = $this->certification_user_path . basename($name);
if (file_exists($my_path_certificate) && !empty($name) && !is_dir($my_path_certificate) && $this->force_certificate_generation == false) {
//Seems that the file was already generated
return true;
} else {
// Creating new name
$name = md5($this->user_id . $this->certificate_data['cat_id']) . '.html';
$my_path_certificate = $this->certification_user_path . $name;
$path_certificate = '/' . $name;
//Getting QR filename
$file_info = pathinfo($path_certificate);
$qr_code_filename = $this->certification_user_path . $file_info['filename'] . '_qr.png';
$my_new_content_html = str_replace('((certificate_barcode))', Display::img($this->certification_web_user_path . $file_info['filename'] . '_qr.png', 'QR'), $new_content_html['content']);
$my_new_content_html = mb_convert_encoding($my_new_content_html, 'UTF-8', api_get_system_encoding());
$result = @file_put_contents($my_path_certificate, $my_new_content_html);
if ($result) {
//Updating the path
self::update_user_info_about_certificate($this->certificate_data['cat_id'], $this->user_id, $path_certificate);
$this->certificate_data['path_certificate'] = $path_certificate;
if ($this->html_file_is_generated()) {
if (!empty($file_info)) {
$text = $this->parse_certificate_variables($new_content_html['variables']);
$this->generate_qr($text, $qr_code_filename);
}
}
}
return $result;
}
}
}
}
}
return false;
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:69,代码来源:certificate.lib.php
示例16: update_gradebook_score_display_custom_values
/**
* Updates the gradebook score custom values using the scoredisplay class of the
* gradebook module
*
* @param array List of gradebook score custom values
*
* @author Guillaume Viguier <[email protected]>
*/
function update_gradebook_score_display_custom_values($values)
{
require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/scoredisplay.class.php';
$scoredisplay = ScoreDisplay::instance();
$scores = $values['gradebook_score_display_custom_values_endscore'];
$displays = $values['gradebook_score_display_custom_values_displaytext'];
$nr_displays = count($displays);
$final = array();
for ($i = 1; $i < $nr_displays; $i++) {
if (!empty($scores[$i]) && !empty($displays[$i])) {
$final[$i]['score'] = $scores[$i];
$final[$i]['display'] = $displays[$i];
}
}
$scoredisplay->update_custom_score_display_settings($final);
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:24,代码来源:settings.lib.php
示例17: array
$interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
$category = Category::load($_GET['selectcat']);
$my_user_id = Security::remove_XSS($_GET['userid']);
$allevals = $category[0]->get_evaluations($my_user_id, true);
$alllinks = $category[0]->get_links($my_user_id, true);
if ($_GET['selectcat'] != null) {
$addparams = array('userid' => $m
|
请发表评论