Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Abarrere on Jun 28, 2009 14:40
open dhtmlx forum
DHTML Scheduler

Hi,

I'm new to all of this, could you let me know how can I come up with a way to show events by userID, so basically our users after loging in they will see only the events that belong to them and not everything.

Some changes have to be made to the PHP files, but we don't know exactly where, our table for the events already have the userId as a column and of course every insert, update and delete should be driving by userId and eventId so those method will have to be changed too. Can you help us please.

Regards,
Abarrere.





Answer posted on Jun 29, 2009 02:11
You can use code similar to next

<?php
 include ('../../codebase/connector/scheduler_connector.php');

$user_id = intval($_GET['user']);

$res=mysql_connect("localhost","root","");
mysql_select_db("sampleDB");


$scheduler = new schedulerConnector($res);
$scheduler->event->attach("beforeProcessing","default_values");
$scheduler->render_sql("select * from events_shared where userId = ".$user_id,"event_id","start_date,end_date,text,event_type,userId");

?>

now you can use different urls for different users

scheduler.load("events.php?user=1"); 

will return data for user1 only. 

To made things more secure, you can store current user id in session, instead of providing it as part of URL

Answer posted by Abarrere on Jun 29, 2009 08:21

Setting the scheduler I'm getting the attached error, any ideas?

Regards,

Abarrere

Attachments (1)
1.JPG26.90 Kb
Answer posted by Support on Jun 29, 2009 08:57
Sorry, was a my typo, the code above has one unnecessary line. You need to change it as


include ('../../codebase/connector/scheduler_connector.php');


$user_id = intval($_GET['user']);

$res=mysql_connect("localhost","root","");
mysql_select_db("sampleDB");

$scheduler = new schedulerConnector($res);
$scheduler->render_sql("select * from events_shared where userId = ".$user_id,"event_id","start_date,end_date,text,event_type,userId");

?>

If necessary we can provide some kind of sample, which shows multi-user implementation.
Answer posted by Abarrere on Jun 29, 2009 10:37
I would really appreciate that (multiuser examples), because we are totally lost.

Thanks a lot
Abarrere


Answer posted by Support on Jun 30, 2009 01:40
Please check attached sample
Attachments (1)
Answer posted by Abarrere on Jun 30, 2009 06:12
Sorry for bugging you again, but I cannot run the samples...
I'm getting the attached error.. could you please take a look.

Regards
Abarrere
Attachments (1)
error.JPG32.38 Kb
Answer posted by Support on Jun 30, 2009 07:29
Which version of PHP you are using?
Connectors designed to work with php 5.x and may fail for php 4.x
Answer posted by Abarrere on Jun 30, 2009 08:39
This is what I am getting from the server: Version 4.4.9 so I guess that's the problem.

Anything I can do before asking the hosting company to upgrade their PHP version.

Regards
Abarrere
Answer posted by Abarrere on Jun 30, 2009 09:23
I've upgraded PHP version to 5+

Now I'm getting the attached error, could you please take a look.

Regards
Abarrere
Attachments (1)
Answer posted by Support on Jun 30, 2009 10:27
You need to give write permissions for app's folder ( to allow log writing ability ) 
Or locate and remove next line from all php files inside samples/shared_events folder

           $scheduler->enable_log("log.txt",true);

Answer posted by Abarrere on Jul 01, 2009 05:10
I did and everything works fine now, the only thing missing is that EVENTS are showing on the tab DAY or WEEK they only showed on the MONTH tab.

Do I need to do anything else so they will appear.

Thanks a lot.
Abarrere
Answer posted by Support on Jul 02, 2009 05:03
By default calendar show multi-day events ( which are longer than one day ) only in month view.
Week and Day view can show only events which is started and ended in the same day. 

We plan to extend this functionality in next version, so it will be able to see multi-day events in Week and Day view. ( currently this functionality is in beta stage ) 
Answer posted by Abarrere on Jul 02, 2009 07:19
ok I understand, but my event was a multiple event... take a look http://cerog.com//xilio/multiuser/samples/shared_events/user_1.html

Regards,
Abarrere
Answer posted by Support on Jul 02, 2009 07:40
You really have few events, which must be shown in daily|weekly view. ( for example at June 9 ) , but they are started at 00-00 , while view configured to show events only from 6:00
To change behavior just remove next line from html file

           scheduler.config.first_hour=6;
Answer posted by alejo on Oct 13, 2009 12:47
Hi, i´m trying to work with dhtmlxScheduler multiusers. I create the table calendario_eventos (events_shared) on my database and i modify the query with my userID.

include ('../includes/calendar/codebase/connector/scheduler_connector.php');

$user_id = $_SESSION['idUsuario'] ; //i use the idUser from the session to declare $user_id

$scheduler = new schedulerConnector($res);
$scheduler->render_sql("select * from calendario_eventos where userId = ".$user_id,"event_id","start_date,end_date,text,event_type,userId");


OK

But i have errors on db_common.php :

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\AppServ\www\fleni\includes\calendar\codebase\connector\db_common.php on line 552
Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in C:\AppServ\www\fleni\includes\calendar\codebase\connector\db_common.php on line 553
Fatal error: Uncaught exception 'Exception' with message 'MySQL operation failed ' in C:\AppServ\www\fleni\includes\calendar\codebase\connector\db_common.php:553 Stack trace: #0 C:\AppServ\www\fleni\includes\calendar\codebase\connector\db_common.php(381): MySQLDBDataWrapper->query('SELECT * FROM ...') #1 C:\AppServ\www\fleni\includes\calendar\codebase\connector\base_connector.php(283): DBDataWrapper->select(Object(DataRequestConfig)) #2 C:\AppServ\www\fleni\includes\calendar\codebase\connector\base_connector.php(249): Connector->render() #3 C:\AppServ\www\fleni\admin\home_adm.php(106): Connector->render_sql('select * from c...', 'event_id', 'start_date,end_...') #4 {main} thrown in C:\AppServ\www\fleni\includes\calendar\codebase\connector\db_common.php on line 553

any help?
thanks!
Answer posted by alejo on Oct 13, 2009 13:15
fixed.i forgot some lines in the code
now i have this warning

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\fleni\admin\home_adm.php:11) in C:\AppServ\www\fleni\includes\calendar\codebase\connector\base_connector.php on line 363
in that line (363):     header("Content-type:text/xml");

if i comment this line, no more warning, but it doesn´t show enything.

thanks
Answer posted by Stanislav (support) on Oct 14, 2009 02:25
You have some extra output before xml generation. Please check that you have not any debug echo|print instructions, and any custom includes has not whitespaces around php blocks.