Page 1 of 3

Unique Calendar IDs?

PostPosted: Fri Oct 22, 2010 2:35 pm
by marcodeluca
How would I open a specific calendar, without the select list of all calendars, using either iFrame or PHP integration methods. I would like to use the calendar to build a registration system with multiple calendars and forms for different resources.

Re: Unique Calendar IDs?

PostPosted: Fri Oct 22, 2010 7:20 pm
by chris
Hi,
To define a calendar to show you simply need to pass the "id_item" to the calendar script.
If you are using an iframe you just append this to the url something like this:
Code: Select all
<iframe width="700px" height="400px" src="/calendar/index.php?id_item=2"></iframe>

If you are using the php implentation you need to define it before you include the cal.inc.php file like this:
Code: Select all
$_GET["id_item"]=2;


Chris

Re: Unique Calendar IDs?

PostPosted: Sat Oct 23, 2010 1:27 pm
by keyboarder
Hi Chris,
(one of my topics, announced earlier:)

In the sample above, no problem and it shows indeed the right item. BUT how to specify
1. a certain item of a certain user - and only that item and
2. all items of a certain user - but only his items

Is that possible?

Sample: I have one database with 1 admin and 2 users. Each user has different items. Calling the index page by iFrame, the admin will see all users and all items of all users, no matter which "id_item" the index page comes up with, he can scroll the others. That's OK.
But each user should only see his own items. Since admin and each user logsin with their own username and password, there should be a way to show only his own items and hide away all other items.

Isn't that the purpose of the possibility of adding users ? I would prefer to use iFrames for this purpose. Can you pls. advise how to do (if possible at all) ? Thanks.

Re: Unique Calendar IDs?

PostPosted: Sat Oct 23, 2010 1:36 pm
by chris
The purpose of adding users is so that each user can only view/modify their calendars in admin.
A user logged in to the calendar admin page *should* only see their own calendars (other than the main admin level) - is this not the case?
In the "public" web calendar however there is no user restriction as presumably all the calendars need to be seen by all the users. If you want this to behave differently you will need to adjust the code.

Chris

Re: Unique Calendar IDs?

PostPosted: Sun Dec 12, 2010 10:24 pm
by vaio
Hello mr. Chris and community,
i must say you have created great script! I hope i can modify it to be useful for me.

I am asking community members if someone has suceed in creating such thing as Keyboarder was asking about it?

So that when we put ID tag in iFrame it shows only 'ID' items...
Thanks again to Chris - respect to you!

Vaio

Re: Unique Calendar IDs?

PostPosted: Sun Dec 12, 2010 10:38 pm
by chris
Hi,
Thanks for the comments :)

Adding ?id_item=X to the iframe url should show the item passed.

However if what you want is to only show the items of a particular user (in the "public" version of the calendar, admin already has this control) you will need to create a little bit of php code to limit the items shown to just those of the user. Actually, it would be a simple matter to extend the existing function that creates the select list so that it accepts and "id_user" var and modifies the mysql query accordingly.

Chris

Re: Unique Calendar IDs?

PostPosted: Sun Jan 02, 2011 11:56 am
by Technically Blonde
chris wrote:Hi,
To define a calendar to show you simply need to pass the "id_item" to the calendar script.
If you are using an iframe you just append this to the url something like this:
Code: Select all
<iframe width="700px" height="400px" src="/calendar/index.php?id_item=2"></iframe>

If you are using the php implentation you need to define it before you include the cal.inc.php file like this:
Code: Select all
$_GET["id_item"]=2;


Chris

This is great, thanks. I used the external id to display to display for a particular villa

<iframe width="900px" height="900px" src="/calendar/index.php?id_ref_external=4"></iframe>

My site is still in it's infancy but the addition of this availability calendar is a great help.

Re: Unique Calendar IDs?

PostPosted: Thu Jul 07, 2011 8:38 pm
by JRC
Chris:

I have incorporated the calendar into an Open Realty system and the calendar is fine.

I want to have a unique calendar for each property page, as displayed by Open Realty. Open Realty uses "listingID" in the url to define the property pages (http://mooseheaddining.com/index.php?ac ... istingID=3).

I am able to incorporate the "listingID" variable into the inline frame call for the calendar as follows:

Code: Select all
<?php
$listingID = $_GET["listingID"]; // needed to pass variable until htaccess is updated
echo "<iframe width=\"510\" height=\"825\" src=\"calendar/?id_item=$listingID\" frameborder=\"0\" scrolling=\"no\"></iframe>";
?>


However, because Open Realty and the Availability Calendar can set different id's, I would like to have the Open Realty "listingID" number be used to call the matching the calendar.

I made all the calendars' "id_ref_enternal" to match the Open Realty ID numbers; then set the inline frame call to the "id_ref_enternal=$listingID" -- But the calendar function seems to default to the first item on the database table ("id_item" number 1).

In fact, when I call the calendar page directly (as in http://mooseheaddining.com/calendar/?id_ref_external=3), it also displays the default (calendar id #1).

Any suggestions on how to activate or use the "id_ref_enternal" to call up the correct calendar?

The test site is now functioning, but only when the Open Realty listing ID is the same as the calenday ID.

Thanks for all you work developing this.

John in Maine, USA.

Re: Unique Calendar IDs?

PostPosted: Thu Jul 07, 2011 8:51 pm
by chris
Hi,
I actually have an Open Realty addon built from this script :)

The id_external_ref is not used anywhere in the code, it is simply there as a starting point for developers to use it in cases such as yours.
You will need to update the draw_cal() function so that it uses this value rather than the default "id" value.
I suggest leaving the iframe url item identifier as "id_item" otherwise you will need to modify more of the source code.

If you have been able to work with Open Realty code making this sort of change should be a trivial matter ;)

Chris

Re: Unique Calendar IDs?

PostPosted: Thu Jul 07, 2011 10:25 pm
by JRC
Chris:

I would love to see more about the Open Realty Add-onn. This should be part of Open-Realty's commercial add-on page.

I can not find a "draw_cal" function. I am using version 3.03.03. The only reference I can find to "draw" is in the file "mootools-cal-public.js".

I can add the external column reference as follows, but the result is the same -- I can not access the correct calendat using the "id_ref_external" cariable.

Code: Select all
//   load calendar for month and year
function load_calendar(el,month,year){
   var req = new Request({
      async:false,   //   freeze browser whilst getting data - this way the elements are ready to be "clicked" :)
      method: 'get',
      url: url_ajax_cal,
      data: {'id_item':id_item,'id_ref_external':id_ref_external, 'month':month,'year':year,'lang':lang}, // changed id_user to id_ref_external


I tried various combinations of id_item/id_ref_external and made no progress.

I am using the iframe method while I get familiar with the systems, and will later incorporate the calendar with the php method.

I seem to be missing something. Any suggestions?

Thanks,

John