/** * Creates the blocks main content * * @return string */ public function get_content() { $this->content = new stdClass(); $this->content->text = ''; $this->content->footer = ''; $rankingsize = isset($this->config->ranking_rankingsize) ? trim($this->config->ranking_rankingsize) : 0; $weekstart = strtotime(date('d-m-Y', strtotime('-' . date('w') . ' days'))); $rankinglastweek = block_ranking_get_students_by_date($rankingsize, $weekstart, time()); $monthstart = strtotime(date('Y-m-01')); $rankinglastmonth = block_ranking_get_students_by_date($rankingsize, $monthstart, time()); $rankinggeral = block_ranking_get_students($rankingsize); $rankingstables = block_ranking_print_students($rankinglastmonth, $rankinglastweek, $rankinggeral); $individualranking = block_ranking_print_individual_ranking(); $this->content->text = $rankingstables . $individualranking; $this->content->footer .= html_writer::tag('p', html_writer::link(new moodle_url('/blocks/ranking/report.php', array('courseid' => $this->page->course->id)), get_string('see_full_ranking', 'block_ranking'), array('class' => 'btn btn-default'))); return $this->content; }
/** * Creates the blocks main content * * @return string */ public function get_content() { $this->content = new stdClass; $this->content->text = ''; $this->content->footer = ''; $rankingsize = isset($this->config->ranking_rankingsize) ? trim($this->config->ranking_rankingsize) : 0; $weekstart = strtotime(date('d-m-Y', strtotime('-'.date('w').' days'))); $rankinglastweek = block_ranking_get_students_by_date($rankingsize, $weekstart, time()); $monthstart = strtotime(date('Y-m-01')); $rankinglastmonth = block_ranking_get_students_by_date($rankingsize, $monthstart, time()); $rankinggeral = block_ranking_get_students($rankingsize); if(has_capability('local/collegestructure:manage', context_system::instance())){ $rankingstables = block_ranking_print_students($rankinglastmonth, $rankinglastweek, $rankinggeral); } $individualranking = block_ranking_print_individual_ranking(); $this->content->text = $rankingstables . $individualranking; $this->content->footer .= html_writer::tag('p', html_writer::link( new moodle_url( '/blocks/ranking/report.php', array('courseid' => $this->page->course->id) ), '<button>'.get_string('see_full_ranking', 'block_ranking').'</button>', array() ) ); return $this->content; }