Exemplo n.º 1
0
 /**
  * Help render mr_report_abstract SQL
  *
  * @param mr_report_abstract $report mr_report_abstract instance
  * @return string
  */
 public function help_render_mr_report_sql(mr_report_abstract $report)
 {
     global $CFG, $USER;
     $output = '';
     $executedsql = $report->get_executedsql();
     $usernames = array('mrsupport', 'mrdev');
     if (!empty($CFG->reportviewsql) and is_array($CFG->reportviewsql)) {
         $usernames = array_merge($usernames, $CFG->reportviewsql);
     }
     if (in_array($USER->username, $usernames) and !empty($executedsql)) {
         $sql = '';
         foreach ($executedsql as $values) {
             list($rawsql, $params) = $values;
             $rawsql = trim($rawsql);
             $sql .= s($rawsql) . "\n\n";
             if (!is_null($params)) {
                 $sql .= s(var_export($params, true)) . "\n\n\n";
             }
         }
         $output = print_collapsible_region($this->output->box('<pre>' . trim($sql) . '</pre>', ''), 'generalbox mr_report_sql', 'mr_report_sql_id', get_string('reportsql', 'local_mr'), 'mr_report_sql_toggle', false, true);
     }
     return $output;
 }
Exemplo n.º 2
0
 /**
  * Renders the overall feedback for the author of the submission
  *
  * @param workshop_assessment $assessment
  * @return string HTML
  */
 protected function overall_feedback(workshop_assessment $assessment)
 {
     $content = $assessment->get_overall_feedback_content();
     if ($content === false) {
         return '';
     }
     $o = '';
     if (!is_null($content)) {
         $o .= $this->output->container($content, 'content');
     }
     $attachments = $assessment->get_overall_feedback_attachments();
     if (!empty($attachments)) {
         $o .= $this->output->container_start('attachments');
         $images = '';
         $files = '';
         foreach ($attachments as $attachment) {
             $icon = $this->output->pix_icon(file_file_icon($attachment), get_mimetype_description($attachment), 'moodle', array('class' => 'icon'));
             $link = html_writer::link($attachment->fileurl, $icon . ' ' . substr($attachment->filepath . $attachment->filename, 1));
             if (file_mimetype_in_typegroup($attachment->mimetype, 'web_image')) {
                 $preview = html_writer::empty_tag('img', array('src' => $attachment->previewurl, 'alt' => '', 'class' => 'preview'));
                 $preview = html_writer::tag('a', $preview, array('href' => $attachment->fileurl));
                 $images .= $this->output->container($preview);
             } else {
                 $files .= html_writer::tag('li', $link, array('class' => $attachment->mimetype));
             }
         }
         if ($images) {
             $images = $this->output->container($images, 'images');
         }
         if ($files) {
             $files = html_writer::tag('ul', $files, array('class' => 'files'));
         }
         $o .= $images . $files;
         $o .= $this->output->container_end();
     }
     if ($o === '') {
         return '';
     }
     $o = $this->output->box($o, 'overallfeedback');
     $o = print_collapsible_region($o, 'overall-feedback-wrapper', uniqid('workshop-overall-feedback'), get_string('overallfeedback', 'workshop'), '', false, true);
     return $o;
 }
Exemplo n.º 3
0
 /**
  * Render a fact sheet.
  * @param string $name the title of the fact sheet.
  * @param string $fact the contents of the fact sheet.
  */
 public function fact_sheet($name, $fact)
 {
     static $count = 1;
     return print_collapsible_region($fact, 'qtype_stack_fact_sheet', 'qtype_stack_fact_sheet' . $count++, $name, '', true, true);
 }