Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/monara/public_html/test.athavaneng.com/themes.php on line 99

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 226

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 227

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 228

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 229

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 230

Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 231
. declare(strict_types=1); namespace core_reportbuilder\form; use context; use moodle_url; use core_form\dynamic_form; use core_reportbuilder\manager; use core_reportbuilder\permission; use core_reportbuilder\local\report\base; use core_reportbuilder\local\models\report; use core_reportbuilder\local\models\column; /** * Card view dynamic form * * @package core_reportbuilder * @copyright 2021 Mikel Martín * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class card_view extends dynamic_form { /** * Return instance of the report using the card view form * * @return base */ private function get_report(): base { $report = new report($this->optional_param('reportid', 0, PARAM_INT)); $parameters = (array) json_decode($this->optional_param('parameters', '', PARAM_RAW)); return manager::get_report_from_persistent($report, $parameters); } /** * Returns context where this form is used * * @return context */ protected function get_context_for_dynamic_submission(): context { return $this->get_report()->get_context(); } /** * Check if current user has access to this form, otherwise throw exception */ public function check_access_for_dynamic_submission(): void { permission::require_can_edit_report($this->get_report()->get_report_persistent()); } /** * Store the conditions values and operators * * @return bool */ public function process_dynamic_submission(): bool { $values = $this->get_data(); $settings = [ 'cardview_showfirsttitle' => (int)$values->showfirsttitle, // Minimum value for 'cardview_visiblecolumns' should be 1. 'cardview_visiblecolumns' => max((int)$values->visiblecolumns, 1) ]; return $this->get_report()->set_settings_values($settings); } /** * Load in existing data as form defaults */ public function set_data_for_dynamic_submission(): void { $report = $this->get_report(); $totalcolumns = column::count_records(['reportid' => $report->get_report_persistent()->get('id')]); $settings = $report->get_settings_values(); $defaults = [ // Maximum value for 'cardview_visiblecolumns' should be the report total number of columns. 'visiblecolumns' => min($settings['cardview_visiblecolumns'] ?? 1, $totalcolumns), 'showfirsttitle' => $settings['cardview_showfirsttitle'] ?? 0, ]; $this->set_data(array_merge($defaults, $this->_ajaxformdata)); } /** * Returns url to set in $PAGE->set_url() when form is being rendered or submitted via AJAX * * @return moodle_url */ protected function get_page_url_for_dynamic_submission(): moodle_url { return new moodle_url('/reportbuilder/edit.php'); } /** * Card view form definition */ public function definition(): void { $mform = $this->_form; $reportid = $this->optional_param('reportid', 0, PARAM_INT); $totalcolumns = column::count_records(['reportid' => $reportid]); $visibilityarray = []; // Generate select options from 1 to report total number of columns. for ($i = 1; $i <= max($totalcolumns, 1); $i++) { $visibilityarray[$i] = $i; } $mform->addElement('hidden', 'reportid'); $mform->setType('reportid', PARAM_INT); $mform->addElement('select', 'visiblecolumns', get_string('cardviewvisiblecolumns', 'core_reportbuilder'), $visibilityarray); $mform->setType('visiblecolumns', PARAM_INT); $mform->addElement('selectyesno', 'showfirsttitle', get_string('cardviewfirstcolumntitle', 'core_reportbuilder')); $mform->setType('showfirsttitle', PARAM_BOOL); $mform->disable_form_change_checker(); $this->add_action_buttons(false); } }