Get current user's session

In Joomla 2.5, I want to be able to show the logged in user’s shift schedule for that user only. I know how to filter the schedule to get that output, but I was wondering if there was a way to get the current user’s id so I can filter for events with that particular user’s id.

I know I can do so in PHP:

$user =& JFactory::getUser();
return $user->id;

But I can’t find of a good entry point to insert that into the scheduler’s source code or scheduler_include.html?? Any assistance/help would be appreciated.

there is special option in “Access rights” tab in scheduler admin panel - “Private mode”, which will show only currect user’s events in scheduler. Isn’t it the same what you want?

Private mode means the user can only see the events they’ve created, right? Well, the idea is I want to have a shift schedule that’s being managed by an admin user. The admin can pick a user’s id from a dropdown menu and assign a shift block to that user. The assigned user can’t create their own shift, but I would like for them to be able to see their own shift schedule that’s made up by the admin.

Selecting events from database is implemented in codebase/dhtmlxSchedulerConfigurator.php:

public function getEventsRec($usergroups) {
		$this->scheduler = new schedulerConnector($this->connection);

		if ($this->settings['settings_posts'] == 'true') {
			// selecting wordpress posts as events
		} else {
			// sets access rights at server side
			if (!$this->can('add', $usergroups))
			if (!$this->can('edit', $usergroups)) {
			// correct processing recurring events
			if ($this->settings['settings_repeat'] == 'true') {
				$this->scheduler->event->attach("beforeProcessing", Array($this, "delete_related"));
				$this->scheduler->event->attach("afterProcessing", Array($this, "insert_related"));
			// processing event user
			$this->scheduler->event->attach("beforeProcessing", Array($this, "set_event_user"));
			$this->scheduler->event->attach("afterProcessing", Array($this, "after_set_event_user"));
			$fields = 'start_date,end_date';
			if ($this->settings['customfieldsList']) {
				$fields .= ",".$this->settings['customfieldsList'];
			$fields .= ',rec_type,event_pid,event_length,user';
			if ($this->settings['settings_map'] == 'true') $fields .= ',lat,lng';
			$this->scheduler->event->attach("beforeRender", Array($this, "render_username"));
			if ($this->settings['templates_username'] == 'true') {
				$username_query = ',1 AS username';
				$username_field = ",1(username)";
			} else
				$username_query = $username_field = "";
			if ($this->settings['privatemode'] == 'on') {
				// rendering events when private mode is turned on
				$this->scheduler->event->attach("beforeRender", Array($this, "private_remove_updated"));
				$query = "SELECT event_id,".$fields.$username_query." FROM `".$this->prefix.$this->tableEventsRec."` WHERE `user`='".($this->userid)."' OR `event_pid`!=0";
				$fields .= $username_field;
				$this->scheduler->render_sql($query,"event_id", $fields);
			} else {
				// rendering events is here
				$query = $query = "SELECT event_id,".$fields.$username_query." FROM `".$this->prefix.$this->tableEventsRec."`";
				$fields .= $username_field;

Here are some comments for code to understand it better.