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


PHP Status::to_status方法代码示例

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


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

示例1: status_of_last_submission_to

 function status_of_last_submission_to($entity)
 {
     return Status::to_status($this->last_submission_to($entity));
 }
开发者ID:jlsa,项目名称:justitia,代码行数:4,代码来源:User.php

示例2: write_submission_summary

 function write_submission_summary($entities, $users)
 {
     // determine summary
     $num_passed = array();
     $num_failed = array();
     $num_missed_deadline = array();
     $num_none = array();
     foreach ($entities as $e => $entity) {
         $num_passed[$e] = $num_failed[$e] = $num_missed_deadline[$e] = $num_none[$e] = 0;
         foreach ($users as $userinfo) {
             $subms = $userinfo['subms'];
             $subm = isset($subms[$e]) ? $subms[$e] : false;
             if (Status::is_passed(Status::to_status($subm))) {
                 $num_passed[$e]++;
             } else {
                 if (Status::is_failed(Status::to_status($subm))) {
                     $num_failed[$e]++;
                 } else {
                     if (Status::is_missed_deadline(Status::to_status($subm))) {
                         $num_missed_deadline[$e]++;
                     } else {
                         $num_none[$e]++;
                     }
                 }
             }
         }
     }
     $sum = array();
     foreach ($entities as $e => $entity) {
         $sum[$e] = $num_passed[$e] + $num_failed[$e] + $num_missed_deadline[$e] + $num_none[$e];
     }
     echo '<tr class="first-child"><td class="summary">passed</td>';
     foreach ($entities as $e => $entity) {
         echo '<td>' . $num_passed[$e] . ' (' . number_format(100.0 * $num_passed[$e] / $sum[$e], 1) . '%)</td>';
     }
     echo "</tr>\n";
     echo '<tr><td class="summary">failed</td>';
     foreach ($entities as $e => $entity) {
         echo '<td>' . $num_failed[$e] . ' (' . number_format(100.0 * $num_failed[$e] / $sum[$e], 1) . '%)</td>';
     }
     echo "</tr>\n";
     echo '<tr><td class="summary">missed deadline</td>';
     foreach ($entities as $e => $entity) {
         echo '<td>' . $num_missed_deadline[$e] . ' (' . number_format(100.0 * $num_missed_deadline[$e] / $sum[$e], 1) . '%)</td>';
     }
     echo "</tr>\n";
     echo '<tr><td class="summary">not submitted</td>';
     foreach ($entities as $e => $entity) {
         echo '<td>' . $num_none[$e] . ' (' . number_format(100.0 * $num_none[$e] / $sum[$e], 1) . '%)</td>';
     }
     echo "</tr>\n";
 }
开发者ID:jlsa,项目名称:justitia,代码行数:52,代码来源:admin_results.php

示例3: to_css_class

 static function to_css_class($status)
 {
     $status = Status::to_status($status);
     switch (Status::base_status_group($status)) {
         case Status::NOT_DONE:
             return "skipped";
         case Status::PENDING:
             return $status == STATUS::MISSED_DEADLINE ? "misseddeadline" : "pending";
         case Status::JUDGING:
             return "judging";
         case Status::PASSED:
             return "passed";
         case Status::FAILED:
             return "failed";
         default:
             return "unknown-status";
     }
 }
开发者ID:jlsa,项目名称:justitia,代码行数:18,代码来源:Status.php

示例4: write_submitable_page

 function write_submitable_page()
 {
     $submissions = Authentication::current_user()->submissions_to($this->entity);
     $made_submission = isset($_REQUEST['made_submission']) ? $_REQUEST['made_submission'] : false;
     $this->write_block_begin('Problem description');
     $this->write_submitable_entity_info();
     $this->write_block_end();
     // submission form
     $last_submission = Authentication::current_user()->last_submission_to($this->entity);
     if ($this->entity->active()) {
         $passed = Status::to_status($last_submission) >= Status::PENDING && !isset($_FILES['file']);
         // no new submission
         $this->write_block_begin('Submit', 'collapsable block' . ($passed ? ' collapsed' : ''));
         $this->write_submit_form();
         $this->write_block_end();
     }
     echo "<h2>Submissions</h2>";
     $this->write_messages('submit-confirm');
     // submissions that were made
     if (empty($submissions)) {
         echo "<em>no submissions have been made for this assignment.</em>";
     } else {
         $i = count($submissions);
         foreach ($submissions as $subm) {
             // is this an interesting submission?
             $made_this_submission = $made_submission !== false && $subm->submissionid == $made_submission;
             $is_interesting = $this->entity->is_more_interesting_submission($subm, $last_submission) || $made_this_submission;
             if ($is_interesting) {
                 $last_submission = $subm;
             }
             // write
             $this->write_block_begin('Submission ' . $i, 'collapsable block submission ' . ($is_interesting ? '' : 'collapsed ') . ($made_this_submission ? 'appear ' : '') . Status::to_css_class($subm), '', "submission-{$subm->submissionid}");
             write_submission($subm, $this->entity);
             $this->write_block_end();
             $i--;
         }
     }
 }
开发者ID:jlsa,项目名称:justitia,代码行数:38,代码来源:index.php


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