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


PHP Display::tip方法代码示例

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


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

示例1: parseEvaluations

 /**
  * Parse evaluations
  *
  * @param int $user_id
  * @param array $sum_categories_weight_array
  * @param int $items_count
  * @param int $items_start
  * @param int $show_all
  * @param int $parentCategoryIdFilter filter by category id if set
  * @return array
  */
 public function parseEvaluations($user_id, $sum_categories_weight_array, $items_count, $items_start, $show_all, &$row, $parentCategoryIdFilter = null, $evaluationsAlreadyAdded = array())
 {
     // Generate actual data array
     $scoredisplay = ScoreDisplay::instance();
     $item_total = 0;
     $item_value_total = 0;
     $evaluationsAdded = array();
     for ($count = 0; $count < $items_count && $items_start + $count < count($this->evals_links); $count++) {
         $item = $this->evals_links[$count + $items_start];
         if (!empty($evaluationsAlreadyAdded)) {
             if (in_array($item->get_id(), $evaluationsAlreadyAdded)) {
                 continue;
             }
         }
         if (!empty($parentCategoryIdFilter)) {
             if ($item->get_category_id() != $parentCategoryIdFilter) {
                 continue;
             }
         }
         $evaluationsAdded[] = $item->get_id();
         $score = $item->calc_score($user_id);
         $real_score = $score;
         $divide = $score[1] == 0 ? 1 : $score[1];
         //sub cat weight
         $sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
         $item_value = $score[0] / $divide;
         //Fixing total when using one or multiple gradebooks
         if (empty($parentCategoryIdFilter)) {
             if ($this->category->get_parent_id() == 0) {
                 $item_value = $score[0] / $divide * $item->get_weight();
             } else {
                 $item_value = $item_value * $item->get_weight();
             }
         } else {
             $item_value = $score[0] / $divide * $item->get_weight();
         }
         $item_total += $item->get_weight();
         $complete_score = $scoredisplay->display_score($score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE);
         //if (true) {
         if (api_get_setting('gradebook_show_percentage_in_reports') == 'false') {
             $real_score = $scoredisplay->display_score($real_score, SCORE_SIMPLE);
             $temp_score = $scoredisplay->display_score(array($item_value, null), SCORE_DIV_SIMPLE_WITH_CUSTOM);
             $temp_score = Display::tip($real_score, $temp_score);
         } else {
             $temp_score = $scoredisplay->display_score($real_score, SCORE_DIV_PERCENT_WITH_CUSTOM);
             $temp_score = Display::tip($temp_score, $complete_score);
         }
         if (!isset($this->params['only_total_category']) || isset($this->params['only_total_category']) && $this->params['only_total_category'] == false) {
             if (!$show_all) {
                 if (in_array($item->get_type(), array(LINK_EXERCISE, LINK_DROPBOX, LINK_STUDENTPUBLICATION, LINK_LEARNPATH, LINK_FORUM_THREAD, LINK_ATTENDANCE, LINK_SURVEY, LINK_HOTPOTATOES))) {
                     if (!empty($score[0])) {
                         $row[] = $temp_score . ' ';
                     } else {
                         $row[] = '';
                     }
                 } else {
                     $row[] = $temp_score . ' ';
                 }
             } else {
                 $row[] = $temp_score;
             }
         }
         $item_value_total += $item_value;
     }
     return array('item_total' => $item_total, 'item_value_total' => $item_value_total, 'evaluations_added' => $evaluationsAdded);
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:77,代码来源:flatview_data_generator.class.php

示例2: get_table_data


//.........这里部分代码省略.........
             // Description.
             if ($this->exportToPdf == false) {
                 $row[] = $invisibility_span_open . $data[2] . $invisibility_span_close;
             }
             // Weight.
             $weight = $scoredisplay->display_score(array($data['3'], $this->currentcat->get_weight()), SCORE_SIMPLE, SCORE_BOTH, true);
             if ($this->teacherView) {
                 $row[] = $invisibility_span_open . Display::tag('p', $weight, array('class' => 'score')) . $invisibility_span_close;
             } else {
                 $row[] = $invisibility_span_open . $weight . $invisibility_span_close;
             }
             $category_weight = $item->get_weight();
             $mainCategoryWeight = $main_cat[0]->get_weight();
             if ($this->teacherView) {
                 $weight_total_links += $data[3];
             } else {
                 $cattotal = Category::load($_GET['selectcat']);
                 $scoretotal = $cattotal[0]->calc_score($this->userId);
                 $item_value = $scoredisplay->display_score($scoretotal, SCORE_SIMPLE);
             }
             // Edit (for admins).
             if ($this->teacherView) {
                 $cat = new Category();
                 $show_message = $cat->show_message_resource_delete($item->get_course_code());
                 if ($show_message === false) {
                     $row[] = $this->build_edit_column($item);
                 }
             } else {
                 $score = $item->calc_score($this->userId);
                 if (!empty($score[1])) {
                     $completeScore = $scoredisplay->display_score($score, SCORE_DIV_PERCENT);
                     $score = $score[0] / $score[1] * $item->get_weight();
                     $score = $scoredisplay->display_score(array($score, null), SCORE_SIMPLE);
                     $scoreToDisplay = Display::tip($score, $completeScore);
                 } else {
                     $scoreToDisplay = '-';
                     $categoryScore = null;
                 }
                 // Students get the results and certificates columns
                 //if (count($this->evals_links) > 0 && $status_user != 1) {
                 if (1) {
                     $value_data = isset($data[4]) ? $data[4] : null;
                     $best = isset($data['best']) ? $data['best'] : null;
                     $average = isset($data['average']) ? $data['average'] : null;
                     $ranking = isset($data['ranking']) ? $data['ranking'] : null;
                     $totalResult = [$totalResult[0] + $data['result_score_weight'][0], $totalResult[1] + $data['result_score_weight'][1]];
                     $totalBest = [$totalBest[0] + $data['best_score'][0], $totalBest[1] + $data['best_score'][1]];
                     $totalAverage = [$totalAverage[0] + $data['average_score'][0], $totalAverage[1] + $data['average_score'][1]];
                     // Student result
                     $row[] = $value_data;
                     $totalResultAverageValue = strip_tags($scoredisplay->display_score($totalResult, SCORE_AVERAGE));
                     $this->dataForGraph['my_result'][] = (double) str_replace('%', '', $totalResultAverageValue);
                     $totalAverageValue = strip_tags($scoredisplay->display_score($totalAverage, SCORE_AVERAGE));
                     $this->dataForGraph['average'][] = (double) str_replace('%', '', $totalAverageValue);
                     // Ranking
                     $row[] = $ranking;
                     // Best
                     $row[] = $best;
                     // Average
                     $row[] = $average;
                     if (get_class($item) == 'Category') {
                         if ($this->exportToPdf == false) {
                             $row[] = $this->build_edit_column($item);
                         }
                     }
                 } else {
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:67,代码来源:gradebooktable.class.php

示例3: get_table_data


//.........这里部分代码省略.........
         }
         $category_weight = $item->get_weight();
         if (api_is_allowed_to_edit(null, true)) {
             $weight_total_links += $data[3];
         } else {
             $cattotal = Category::load($_GET['selectcat']);
             $scoretotal = $cattotal[0]->calc_score(api_get_user_id());
             $item_value = $scoredisplay->display_score($scoretotal, SCORE_SIMPLE);
         }
         //Date
         //$row[] = $invisibility_span_open.$data[4].$invisibility_span_close;
         //Edit (for admins)
         if (api_is_allowed_to_edit(null, true)) {
             $cat = new Category();
             $show_message = $cat->show_message_resource_delete($item->get_course_code());
             if ($show_message === false) {
                 $row[] = $this->build_edit_column($item);
             }
         } else {
             //students get the results and certificates columns
             if (count($this->evals_links) > 0 && $status_user != 1) {
                 $value_data = isset($data[4]) ? $data[4] : null;
                 if (!is_null($value_data)) {
                     $row[] = Display::tag('h4', $value_data);
                 } else {
                     $row[] = $this->build_edit_column($item);
                 }
             } else {
                 $score = $item->calc_score(api_get_user_id());
                 if (!empty($score[1])) {
                     $complete_score = $scoredisplay->display_score($score, SCORE_DIV_PERCENT);
                     $score = $score[0] / $score[1] * $item->get_weight();
                     $score = $scoredisplay->display_score(array($score, null), SCORE_SIMPLE);
                     $row[] = Display::tip($score, $complete_score);
                 } else {
                     $row[] = '-';
                 }
                 if (!empty($this->cats)) {
                     $row[] = $this->build_edit_column($item);
                 }
             }
         }
         //Category added
         $sortable_data[] = $row;
         // Loading childrens
         if (get_class($item) == 'Category') {
             $stud_id = api_get_user_id();
             $course_code = api_get_course_id();
             $session_id = api_get_session_id();
             $parent_id = $item->get_id();
             $cats = Category::load($parent_id, null, null, null, null, null);
             if (isset($cats[0])) {
                 $allcat = $cats[0]->get_subcategories($stud_id, $course_code, $session_id);
                 $alleval = $cats[0]->get_evaluations($stud_id);
                 $alllink = $cats[0]->get_links($stud_id);
                 $sub_cat_info = new GradebookDataGenerator($allcat, $alleval, $alllink);
                 $data_array = $sub_cat_info->get_data($sorting, $from, $this->per_page);
                 $total_weight = 0;
                 //Links
                 foreach ($data_array as $data) {
                     $row = array();
                     $item = $data[0];
                     //if the item is invisible, wrap it in a span with class invisible
                     $invisibility_span_open = api_is_allowed_to_edit() && $item->is_visible() == '0' ? '<span class="invisible">' : '';
                     $invisibility_span_close = api_is_allowed_to_edit() && $item->is_visible() == '0' ? '</span>' : '';
                     $main_categories[$parent_id]['children'][$item->get_id()]['name'] = $item->get_name();
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:67,代码来源:gradebooktable.class.php

示例4: get_data


//.........这里部分代码省略.........
                     $row[] = $user[3];
                     //first name
                 }
             }
         }
         $item_value = 0;
         $item_value_total = 0;
         $item_total = 0;
         $convert_using_the_global_weight = true;
         $course_code = api_get_course_id();
         $session_id = api_get_session_id();
         $allcat = $this->category->get_subcategories(null, $course_code, $session_id, 'ORDER BY id');
         if ($parent_id == 0 && !empty($allcat)) {
             foreach ($allcat as $sub_cat) {
                 $score = $sub_cat->calc_score($user_id);
                 $real_score = $score;
                 $divide = $score[1] == 0 ? 1 : $score[1];
                 $sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()];
                 $item_value = $score[0] / $divide * $main_weight;
                 //Fixing total when using one or multiple gradebooks
                 $percentage = $sub_cat->get_weight() / $sub_cat_percentage * $sub_cat_percentage / $this->category->get_weight();
                 $item_value = $percentage * $item_value;
                 $item_total += $sub_cat->get_weight();
                 /*
                                     if ($convert_using_the_global_weight) {                                             
                                         $score[0] = $score[0]/$main_weight*$sub_cat->get_weight();                        
                                         $score[1] = $main_weight ;
                                     }                    
                 */
                 if (api_get_setting('gradebook_show_percentage_in_reports') == 'false') {
                     //if (true) {
                     $real_score = $scoredisplay->display_score($real_score, SCORE_SIMPLE);
                     $temp_score = $scoredisplay->display_score($score, SCORE_DIV_SIMPLE_WITH_CUSTOM);
                     $temp_score = Display::tip($real_score, $temp_score);
                 } else {
                     $real_score = $scoredisplay->display_score($real_score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE);
                     $temp_score = $scoredisplay->display_score($score, SCORE_DIV_SIMPLE_WITH_CUSTOM);
                     $temp_score = Display::tip($temp_score, $real_score);
                 }
                 if (!isset($this->params['only_total_category']) || isset($this->params['only_total_category']) && $this->params['only_total_category'] == false) {
                     if (!$show_all) {
                         $row[] = $temp_score . ' ';
                     } else {
                         $row[] = $temp_score;
                     }
                 }
                 $item_value_total += $item_value;
             }
             if ($convert_using_the_global_weight) {
                 //$item_total = $main_weight;
             }
         } else {
             for ($count = 0; $count < $items_count && $items_start + $count < count($this->evals_links); $count++) {
                 $item = $this->evals_links[$count + $items_start];
                 $score = $item->calc_score($user_id);
                 $real_score = $score;
                 $divide = $score[1] == 0 ? 1 : $score[1];
                 //sub cat weight
                 $sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
                 $item_value = $score[0] / $divide;
                 //Fixing total when using one or multiple gradebooks
                 if ($this->category->get_parent_id() == 0) {
                     $item_value = $score[0] / $divide * $item->get_weight();
                 } else {
                     $item_value = $item_value * $item->get_weight();
                 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:67,代码来源:flatview_data_generator.class.php


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