meeting-room-booking-system / mrbs-code

MRBS application code
Other
127 stars 63 forks source link

report export and hide help and report in navigation #2092

Open jberanek opened 6 years ago

jberanek commented 6 years ago

Hi! I installed mrbs with version 1.7.0 and there are two thing i would like to change, but I don't know how:

1) Is it possible two hide the help and rooms link for unauthenticated users? I know how to change the page level in mrbs_auth.inc. But the links should be invisible when you are not logged in...

By the way: can someone explain how i have to understand e.g. this line in mrbs_auth.inc: $page_level['help.php'] = ($auth['deny_public_access']) ? 1 : 0;

what does "1" stand for and what does "0" stand for ? At first I tought the first number stands for the page level, the second says if ($auth['deny_public_access']) is true or not? but if i change the first numer to "2", nothing changes. every unlogged user can see help.php

2) Is ist possible to export the report to a seprate HTML file? when I choss HTML as export format it is attached to the actual site, but I would like to have the result displayed in a new tab if possible.

Thank you very much

Reported by: vgwirges

Original Ticket: mrbs/support-requests/1381

jberanek commented 6 years ago

(1) You will have to modify the code in the function print_nav() in Themes/default/header.inc

The numbers in mrbs_auth.inc denote the minimum level of access that a user must have to view the page. '0' means everybody can see ity, '1' means you must be a logged in user and '2' means admins.

Changing the first number will make no difference unless $auth['deny_public_access'] is true, ie you have set it in your config file. In PHP

$x = ($y) ? $a : $b;

is short for

if ($y)
{
  $x = $a;
 }
 else
 {
   $x = $b;
 }

(2) You could try adding the attribute target="_blank" to the <form> tag in report.php.

Original comment by: campbell-m

jberanek commented 6 years ago

Thank you very much for the good explanation. Just one more question: what would be the code for problem #1? How do I include "if the user is authenticated then print help button"? or "do not show print button when user is not logged in"?

Original comment by: vgwirges

jberanek commented 6 years ago

You would have to do this

  if (!$simple)
  {
    $user = getUserName();
    $level = authGetUserLevel($user);

    echo "<li>\n";
    print_goto_date($day, $month, $year, $area, $room);
    echo "</li>\n";

    if ($level > 0)
    {
      echo "<li>\n";
      print_help($query_string);
      echo "</li>\n";

      echo "<li>\n";
      print_rooms($query_string);
      echo "</li>\n";
    }

    echo "<li>\n";
    print_report($query_string);
    echo "</li>\n";

    echo "<li>\n";
    print_search($day, $month, $year, $area, $room, $search_str);
    echo "</li>\n";

    // etc.

Original comment by: campbell-m

jberanek commented 6 years ago

Thank you

Original comment by: *anonymous