Exemplo n.º 1
0
    $idresource = required_param('idresource', PARAM_INT);
    if (confirm_sesskey()) {
        $resources = $DB->get_records('bookingrooms_resources', array('id' => $idresource));
        foreach ($resources as $resource) {
            $DB->delete_records('bookingrooms_roomresource', array('resources_id' => $resource->id));
        }
        $DB->delete_records('bookingrooms_resources', array('id' => $idresource));
        $action = "view";
    } else {
        print_error("ERROR");
    }
}
// Implementation action view
// Displays a table with all the resources
if ($action == 'view') {
    $table = tables::getResources();
}
// Views of the action
//**************************************************************************************************************************************************
if ($action == 'edit') {
    $o = '';
    $title = get_string('editresource', 'local_bookingrooms');
    $PAGE->navbar->add(get_string('roomsreserve', 'local_bookingrooms'));
    $PAGE->navbar->add(get_string('adjustments', 'local_bookingrooms'));
    $PAGE->navbar->add(get_string('seeandmodresources', 'local_bookingrooms'), 'resources.php');
    $PAGE->navbar->add($title, '');
    $PAGE->set_title($title);
    $PAGE->set_heading($title);
    $o .= $OUTPUT->header();
    $o .= $OUTPUT->heading(get_string('editresource', 'local_bookingrooms'));
    $o .= '<h4>' . get_string('resource', 'local_bookingrooms') . ': ' . $resourcename->name . '</h4>';