__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace mod_data\output;
use moodle_url;
use templatable;
use renderable;
/**
* Renderable class for the Add entries button in the database activity.
*
* @package mod_data
* @copyright 2022 Amaia Anabitarte <amaia@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class add_entries_action implements templatable, renderable {
/** @var int $id The database module id. */
private $id;
/**
* The class constructor.
*
* @param int $id The database module id.
* @param bool $hasentries Whether entries exist.
*/
public function __construct(int $id) {
$this->id = $id;
}
/**
* Export the data for the mustache template.
*
* @param \renderer_base $output The renderer to be used to render the add entries button.
* @return \stdClass or null if the user has no permission to add new entries.
*/
public function export_for_template(\renderer_base $output): ?\stdClass {
global $PAGE, $DB;
$database = $DB->get_record('data', ['id' => $this->id]);
$cm = get_coursemodule_from_instance('data', $this->id);
$currentgroup = groups_get_activity_group($cm);
$groupmode = groups_get_activity_groupmode($cm);
if (data_user_can_add_entry($database, $currentgroup, $groupmode, $PAGE->context)) {
$addentrylink = new moodle_url('/mod/data/edit.php', ['d' => $this->id, 'backto' => $PAGE->url->out(false)]);
$button = new \single_button($addentrylink, get_string('add', 'mod_data'), 'get', \single_button::BUTTON_PRIMARY);
return $button->export_for_template($output);
}
return null;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| action_bar.php | File | 13.31 KB | 0777 |
|
| add_entries_action.php | File | 2.35 KB | 0777 |
|
| defaulttemplate.php | File | 3.32 KB | 0777 |
|
| empty_database_action_bar.php | File | 2.31 KB | 0777 |
|
| fields_action_bar.php | File | 2.56 KB | 0777 |
|
| fields_mappings_action_bar.php | File | 1.82 KB | 0777 |
|
| preset_preview.php | File | 4.11 KB | 0777 |
|
| presets.php | File | 8.54 KB | 0777 |
|
| presets_action_bar.php | File | 2.04 KB | 0777 |
|
| template_editor.php | File | 5.99 KB | 0777 |
|
| template_editor_tools.php | File | 7.3 KB | 0777 |
|
| templates_action_bar.php | File | 2.49 KB | 0777 |
|
| view_action_bar.php | File | 5.37 KB | 0777 |
|
| view_footer.php | File | 5.46 KB | 0777 |
|
| zero_state_action_bar.php | File | 2.96 KB | 0777 |
|