Issue: Consider using renderable for summary and detailed view.
Issue: Consider using renderable for summary and detailed view.
It might be more practical to use Renderable and Template to output the content of the summary and detailed view. This is optional.
Oh no!
You are trying to upload something other than an image. Please upload a .png, .jpg, .jpeg, .gif, .bmp, .tiff or .ico.Incoming!
Drop your designs to start your upload.
Tasks
0assigned to @32khsa1mst
added InProgress label
removed InProgress label
unassigned @32khsa1mst
assigned to @32khsa1mst
- Maintainer
Approach to implement the renderables for summary and detailed views.
-
Create renderable file for the table - This is the Connector between data and the templates.
-
Create the mustache template for the tables - templates
-
It is recommended to create the separate small functions out of the detailed view HTML function. and use the functions there.
-
- Maintainer
Example for renderable -
`namespace assignsubmission_dta\output;
use moodle_url; use renderable; use templatable;
class summary_table implements renderable, templatable { public $summary; public $recommendations; public $assignsubmission_dta_component_name;
public function __construct($summary, $recommendations, $assignsubmission_dta_component_name) { $this->summary = $summary; $this->recommendations = $recommendations; $this->assignsubmission_dta_component_name = $assignsubmission_dta_component_name; } public function export_for_template(\renderer_base $output) { $data = new \stdClass(); // Map your existing logic for building the table data here $data->summary_table = $this->get_summary_table_data(); $data->recommendations_table = $this->get_recommendations_table_data(); return $data; } private function get_summary_table_data() { // Logic from your existing function to create summary table $summary_data = []; // example of what might go into summary_data $summary_data[] = [ 'label' => get_string('total_items', $this->assignsubmission_dta_component_name), 'value' => $this->summary->assignsubmission_dta_result_count(), ]; // Add other rows similarly return $summary_data; } private function get_recommendations_table_data() { $recommendation_data = []; foreach ($this->recommendations as $recommendation) { $recommendation_data[] = [ 'topic' => $recommendation->topic, 'exercise_name' => $recommendation->exercise_name, 'url' => $recommendation->url, 'difficulty' => $recommendation->difficulty, 'score' => $recommendation->score, ]; } return $recommendation_data; }
} `
- You're only seeing other activity in the feed. To add a comment, switch to one of the following options.