当前位置: 首页>>代码示例>>PHP>>正文


PHP Display::bar_progress方法代码示例

本文整理汇总了PHP中Display::bar_progress方法的典型用法代码示例。如果您正苦于以下问题:PHP Display::bar_progress方法的具体用法?PHP Display::bar_progress怎么用?PHP Display::bar_progress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Display的用法示例。


在下文中一共展示了Display::bar_progress方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: print_stats

 /**
  * Show statistics
  * @param string $title The title
  * @param array $stats
  * @param bool $show_total
  * @param bool $is_file_size
  */
 static function print_stats($title, $stats, $show_total = true, $is_file_size = false)
 {
     $total = 0;
     $data = Statistics::rescale($stats);
     echo '<table class="data_table" cellspacing="0" cellpadding="3">
             <tr><th colspan="' . ($show_total ? '4' : '3') . '">' . $title . '</th></tr>';
     $i = 0;
     foreach ($stats as $subtitle => $number) {
         $total += $number;
     }
     foreach ($stats as $subtitle => $number) {
         if (!$is_file_size) {
             $number_label = number_format($number, 0, ',', '.');
         } else {
             $number_label = Statistics::make_size_string($number);
         }
         $percentage = $total > 0 ? number_format(100 * $number / $total, 1, ',', '.') : '0';
         echo '<tr class="row_' . ($i % 2 == 0 ? 'odd' : 'even') . '">
                 <td width="150">' . $subtitle . '</td>
                 <td width="550">' . Display::bar_progress($percentage, false) . '</td>
                 <td align="right">' . $number_label . '</td>';
         if ($show_total) {
             echo '<td align="right"> ' . $percentage . '%</td>';
         }
         echo '</tr>';
         $i++;
     }
     if ($show_total) {
         if (!$is_file_size) {
             $total_label = number_format($total, 0, ',', '.');
         } else {
             $total_label = Statistics::make_size_string($total);
         }
         echo '<tr><th  colspan="4" align="right">' . get_lang('Total') . ': ' . $total_label . '</td></tr>';
     }
     echo '</table>';
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:44,代码来源:statistics.lib.php

示例2: 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

示例3: cut

                    $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count . ' / ' . $count_students);
                    break;
                default:
                    if ($answer_id == 1) {
                        $data[$id]['name'] = cut($question_obj->question, 100);
                    } else {
                        $data[$id]['name'] = '-';
                    }
                    $data[$id]['answer'] = $answer_info;
                    $data[$id]['correct'] = $correct_answer;
                    $count = get_number_students_answer_count($real_answer_id, $question_id, $exercise_id, $courseCode, $sessionId);
                    $percentange = 0;
                    if (!empty($count_students)) {
                        $percentange = $count / $count_students * 100;
                    }
                    $data[$id]['attempts'] = Display::bar_progress($percentange, false, $count . ' / ' . $count_students);
            }
            $id++;
        }
    }
}
// Format A table
$table = new HTML_Table(array('class' => 'data_table'));
$row = 0;
$column = 0;
foreach ($headers as $header) {
    $table->setHeaderContents($row, $column, $header);
    $column++;
}
$row++;
foreach ($data as $row_table) {
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:stats.php

示例4: array_keys

            $nr_items[$display]++;
            $resultcount++;
        }
    }
    $keys = array_keys($nr_items);
    // find the region with the most scores, this is 100% of the bar
    $highest_ratio = 0;
    foreach ($keys as $key) {
        if ($nr_items[$key] > $highest_ratio) {
            $highest_ratio = $nr_items[$key];
        }
    }
    // Generate table
    $stattable = '<table class="data_table" cellspacing="0" cellpadding="3">';
    $stattable .= '<tr><th>' . get_lang('ScoringSystem') . '</th>';
    $stattable .= '<th>' . get_lang('Percentage') . '</th>';
    $stattable .= '<th>' . get_lang('CountUsers') . '</th>';
    //$stattable .= '<th>' . get_lang('Statistics') . '</th></tr>';
    $counter = 0;
    foreach ($keys as $key) {
        $bar = $highest_ratio > 0 ? $nr_items[$key] / $highest_ratio * 100 : 0;
        $stattable .= '<tr class="row_' . ($counter % 2 == 0 ? 'odd' : 'even') . '">';
        $stattable .= '<td width="150">' . $key . '</td>';
        $stattable .= '<td width="550">' . Display::bar_progress($bar) . '</td>';
        $stattable .= '<td align="right">' . $nr_items[$key] . '</td>';
        $counter++;
    }
    $stattable .= '</tr></table>';
    echo $stattable;
}
Display::display_footer();
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:gradebook_statistics.php

示例5: display_score

 /**
  * Display a score according to the current settings
  * @param array $score data structure, as returned by the calc_score functions
  * @param int $type one of the following constants:
  * SCORE_DIV, SCORE_PERCENT, SCORE_DIV_PERCENT, SCORE_AVERAGE
  * (ignored for student's view if custom score display is enabled)
  * @param int $what one of the following constants:
  * SCORE_BOTH, SCORE_ONLY_DEFAULT, SCORE_ONLY_CUSTOM (default: SCORE_BOTH)
  * (only taken into account if custom score display is enabled and for course/platform admin)
  *
  * @return string
  */
 public function display_score($score, $type = SCORE_DIV_PERCENT, $what = SCORE_BOTH, $no_color = false)
 {
     $my_score = $score == 0 ? 1 : $score;
     if ($type == SCORE_BAR) {
         $percentage = $my_score[0] / $my_score[1] * 100;
         return Display::bar_progress($percentage);
     }
     if ($type == SCORE_SIMPLE) {
         $simple_score = $this->format_score($my_score[0]);
         return $simple_score;
     }
     if ($this->custom_enabled && isset($this->custom_display_conv)) {
         $display = $this->display_default($my_score, $type);
     } else {
         // if no custom display set, use default display
         $display = $this->display_default($my_score, $type);
     }
     if ($this->coloring_enabled && $no_color == false) {
         $my_score_denom = isset($score[1]) && !empty($score[1]) ? $score[1] : 1;
         $scoreCleaned = isset($score[0]) ? $score[0] : 0;
         if ($scoreCleaned / $my_score_denom < $this->color_split_value / 100) {
             $display = Display::tag('font', $display, array('color' => 'red'));
         }
     }
     return $display;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:38,代码来源:scoredisplay.class.php


注:本文中的Display::bar_progress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。