phpScheduleIt
June 20, 2013, 06:45:02 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: phpScheduleIt 2.4.2 has been released!
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Admin should see reservations of all users in dashboard.  (Read 382 times)
vitality22
Newbie
*

Karma: 0
Posts: 5


« on: June 14, 2012, 07:08:59 PM »

Hello,

can you please tell me, how i can implement that a special user can see all upcoming reservations of all users on his dashboard startpage (today, tomorrow,....)? This should only affect this special user, but if it is easier, it can be for all admin users or for a new usergroup.
I searched through the code and looked in DashboardPresenter.php, UpcomingReservations.php, ReservationViewRepository.php and ReservationSTatus.php but i could not find the right code for this.
It would be very nice to get some help.

By the way: I tried to register with a german freemailer adress (@arcor.de) but it was declared as spam. Perhaps you can fix that so that german users can register to that forum. With my own .com domain i had no problems to register.

Thank you very much!
Tom
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5506


WWW
« Reply #1 on: June 18, 2012, 01:45:47 PM »

Here's what I would do:

Change Controls/Dashboard/UpcomingReservations constructor to accept a boolean

Code:
public function __construct(SmartyPage $smarty, $showAllUsers = false)

Pass that right into the presenter

Code:
$this->presenter = new UpcomingReservationsPresenter($this, new ReservationViewRepository(), $showAllUsers);

Change the presenter to recognize it
Code:
public function __construct(IUpcomingReservationsControl $control, IReservationViewRepository $repository, $showAllUsers = false)
{
$this->control = $control;
$this->repository = $repository;
$this->showAllUsers = $showAllUsers;
}

Line 52 becomes:

Code:
if ($this->showAllUsers)
{
$currentUserId = ReservationViewRepository::ALL_USERS;
}
$reservations = $this->repository->GetReservationList($now, $lastDate, $currentUserId, ReservationUserLevel::ALL);

Then in DashboardPresenter Initialize(), add it that control again for your special user:

Code:
public function Initialize()
{
$announcement = new AnnouncementsControl(new SmartyPage());
$upcomingReservations = new UpcomingReservations(new SmartyPage());

$this->_page->AddItem($announcement);
$this->_page->AddItem($upcomingReservations);

if ($specialUser)
{
$this->_page->AddItem(new UpcomingReservations(new SmartyPage(), true));
}
}
Logged
vitality22
Newbie
*

Karma: 0
Posts: 5


« Reply #2 on: June 19, 2012, 07:54:45 PM »

Thank you for your help and for taking the time to write that detailed. I will try soon and report about the results.
Logged
andyrav
Jr. Member
**

Karma: 0
Posts: 68


« Reply #3 on: June 20, 2012, 05:07:30 AM »

can you add this as a option
if admin tick to see all bookings?

Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5506


WWW
« Reply #4 on: June 25, 2012, 01:35:58 PM »

I'll add this to my list.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!