Hi, how could I accomplish this please. I have a color coding with my calendar. Wich is nice. But I would like to ADD another coding color but over it Like a little COLORED DOT over the days in year vie. See my attachement so you see what I mean. And it’s gonna be based on the color stored in DB per events
tks
Seby
Or at least, could it be possible la little like google calendar, to have in month view, little color square next to the left of the event header title.
tks
Seby
Hi,
you can change the event date template for the month view (replace a default “dot” by any HTML content):
docs.dhtmlx.com/scheduler/api__s … plate.html
In the Year view the only attribute you can add depending on event properties is the class name. The Year view doesn’t have any template for an event. Just for inspiration try this trick:
// CSS
.year_event:before {
content:"• ";
}
//JS
scheduler.templates.event_class = function(start,end,ev){
return "year_event";
};
Hi, ok, I understand the CSS trick, but if the information is coming from database to pass a color for instance. How to pass a color from database in the events.php for instance and than pass it to be displayed one the calendar.
tks
seby
I tried this, and it worked
scheduler.templates.event_bar_date = function(start,end,ev){
return "<img style='width:9px;height:9px;' src='http://www.mywesite.com/images/bullet_blue.png'/><b>"+scheduler.templates.event_date(start)+"</b> ";
};
But is the word blue in the png image had to be changed on the fly from database. How could I pass a query from event.php to that page where I put the js.
tks
seby
Hi,
you can add another property to event for example “marker_color” (blue, red, green, etc.) in the database, load it with standard properties of the event. Then use:
scheduler.templates.event_bar_date = function(start,end,ev){
return "<img style='width:9px;height:9px;' src='http://www.mywesite.com/images/bullet_" +
ev.marker_color + ".png'/><b>" +
scheduler.templates.event_date(start)+"</b> ";
};
All you need is a collection of “.png” pics with used colors.
Hi, tks, this is what I want to accomplish, but I don’t know how to retrieve that from events.php. Maybe i’m not sure how it’s working. Could you provide how do I retrieve from database and pass it to the marke you’re talking about please?
tks
Seby
here’s my php event. So let’s say my color was in sessions table. How would I retrieve this and then pass it to the html file?
tks
Seby
<?php
session_start();
include ('../../../codebase/connector/scheduler_connector.php');
include ('../../common/config.php');
$res=mysql_connect($server, $user, $pass);
mysql_select_db($db_name);
mysql_query("SET NAMES utf8");
$scheduler = new schedulerConnector($res);
/*$list = new OptionsConnector($res);
$list->render_table("types","typeid","typeid(value),name(label)");*/
//-------------Sub Type dropdown ..........................
$OtherDropdown = new OptionsConnector($res);
$OtherDropdown->render_sql("select id as value, session_type as label from session_type where user_id = '".$_SESSION['user_id']."'","","value,label");
//$OtherDropdown->render_table("session_type","session_type","id(value),session_type(label)");
$scheduler->set_options("session_type",$OtherDropdown);
//------------- Eof Sub Type dropdown ..........................
//-------------Photographers dropdown ..........................
$OtherDropdown2 = new OptionsConnector($res);
$OtherDropdown2->render_sql("select id as value, full_name as label from photographers where user_id = '".$_SESSION['user_id']."'","","value,label");
$scheduler->set_options("photographers",$OtherDropdown2);
//------------- Eof Photographers dropdown ..........................
//-------------Rooms dropdown ..........................
$OtherDropdown2 = new OptionsConnector($res);
$OtherDropdown2->render_sql("select id as value, room_name as label from rooms where user_id = '".$_SESSION['user_id']."'","","value,label");
$scheduler->set_options("rooms",$OtherDropdown2);
//------------- Eof Rooms dropdown ..........................
//-------------RealSubType dropdown ..........................
$OtherDropdown = new OptionsConnector($res);
$OtherDropdown->render_sql("select id as value, session_subtype as label from session_subtype where user_id = '".$_SESSION['user_id']."'","","value,label");
//$OtherDropdown->render_table("session_type","session_type","id(value),session_type(label)");
$scheduler->set_options("realsubtype",$OtherDropdown);
//------------- Eof RealSubType dropdown ..........................
//-------------Reference dropdown ..........................
$OtherDropdown3 = new OptionsConnector($res);
$OtherDropdown3->render_sql("select id as value, session_reference as label from session_reference where user_id = '".$_SESSION['user_id']."'","","value,label");
//$OtherDropdown->render_table("session_type","session_type","id(value),session_type(label)");
$scheduler->set_options("reference",$OtherDropdown3);
//------------- Eof Reference dropdown ..........................
$clients = new OptionsConnector($res);
$clients->render_sql("select id as value, full_name as label from clients where user_id = '".$_SESSION['user_id']."'","","value,label");
$scheduler->set_options("clients",$clients);
//$scheduler->enable_log("log.txt",true);
function mycode($action){
$action->set_value("user_id", $_SESSION['user_id']);
}
$scheduler->event->attach("beforeProcessing", "mycode");
/*
function validatecode($data)
{
$start_date=$data->get_value("start_date");
if($data->get_value("start_date"))
{
$photographers_id=$data->get_value("photographers_id");
$rooms_id=$data->get_value("rooms_id");
$user_id=$data->get_value("user_id");
$id=$data->get_value("id");
if($photographers_id!=0 && $photographers_id!="" && $photographers_id!="null")
{
$sql_chk_photo = mysql_query("select id from sessions where id!='".$id."' AND user_id='".$user_id."' AND photographers_id = '".$photographers_id."' AND '".$start_date."' between start_date AND end_date");
if(mysql_num_rows($sql_chk_photo))
{
$error=2;
}
}
if($rooms_id!=0 && $rooms_id!="" && $rooms_id!="null")
{
$sql_chk_room = mysql_query("select id from sessions where id!='".$id."' AND user_id='".$user_id."' AND rooms_id = '".$rooms_id."' AND '".$start_date."' between start_date AND end_date");
if(mysql_num_rows($sql_chk_room))
{
$error=3;
}
}
if($error==2 || $error==3)
{
$data->set_response_text("Already this Photographer or Room assigned on this time. Please Use Different");
$data->invalid();
}
}
}
$scheduler->event->attach("beforeInsert","validatecode");
$scheduler->event->attach("beforeUpdate","validatecode");*/
//$scheduler->enable_log("log.txt",true);
//$scheduler = new schedulerConnector($res);
//$scheduler->render_table("events","event_id","start_date,end_date,event_name,details,types,clients");
if ($scheduler->is_select_mode()){ // ' code for loading data
$SQL = "SELECT s.*, p.full_name, r.room_name from sessions as s left join session_reference as sr on sr.id=s.session_reference left join session_subtype as st on st.id=s.session_subtype left join rooms as r on r.id=s.rooms_id left join photographers as p on p.id=s.photographers_id WHERE s.user_id='".$_SESSION['user_id']."' ".$_SESSION['pid']." ";
$scheduler->render_sql($SQL,"id","start_date,end_date,session_name,session_name,session_notes,session_type,session_location,type,photographers_id,rooms_id, session_reference,session_subtype,client_id,full_name,room_name", "", "");
}
else { // code for other operations - i.e. update/insert/delete
$scheduler->render_table("sessions","id","start_date,end_date,session_name,session_notes,session_type,session_location,type,photographers_id,rooms_id,session_subtype,session_reference,client_id,user_id");
}
$ac="";
if($ac="delete")
{
mysql_query("DELETE FROM cal_todo where session_id='".$id."' AND user_id='".$_SESSION['user_id']."' ");
}
?>
Any help on retrieving variabels please?
tks
Seby