hi,
I would like to know how to manually insert into the schedule. I have it from the page as follows:
global $DB_SERVER,$DB_PORT,$DB_NAME,$DB_USER,$DB_PASSWORD;
$res = pg_connect(“host=$DB_SERVER port=$DB_PORT dbname=$DB_NAME user=$DB_USER password=$DB_PASSWORD”);
function insercion($action){
$status = $action->get_status();
$id_evento = $action->get_value(“id_evento”);
$start_date = $action->get_value(“start_date”);
$end_date = $action->get_value(“end_date”);
$evento_nombre = $action->get_value(“evento_nombre”);
$detalles = $action->get_value(“detalles”);
if ($status == “inserted”){
$scheduler->sql->query(""INSERT INTO eventos (id_evento, start_date,end_date,evento_nombre) VALUES ((id_evento, start_date,end_date,evento_nombre) );
$action->success();
}
}
$scheduler = new schedulerConnector($res,“Postgre”);
$scheduler->event->attach(“afterProcessing”,“insercion”);
$scheduler->render_table(“eventos”,“id_evento”,“start_date,end_date,evento_nombre,detalles”);
how to capture the values to create a new event
Hello,
you can use addEvent method to insert new event
dhtmlx.com/dhxdocs/doku.php?id=d … r_addevent
In order to send request with an event that is added by addEvent method you can use the following method:
dataProcessor.setUpdated(event_id,true,“inserted”);
dataProcessor.sendData();
Here dataProcessor is DataProcessor object.
a) If you want to intercept insert action, you need to use beforeInsert , not the afterProcessing server side event.
b)
$action->success();
need to be replaced with
$action->success($new_id_value); //inform about new ID of event
hi,
thank you very much for answering my question and thanks for your effort and dedication.
what happens is this this is my page events.php
<?php
include (’…/componentes/codebase/connector/scheduler_connector.php’);
include_once(’…/componentes/codebase/connector/db_postgre.php’);
require_once("…/componentes/comunicacion.inc");
global $DB_SERVER,$DB_PORT,$DB_NAME,$DB_USER,$DB_PASSWORD;
$res = pg_connect(“host=$DB_SERVER port=$DB_PORT dbname=$DB_NAME user=$DB_USER password=$DB_PASSWORD”);
function insercion($action){
$status = $action->get_status();
if ($status == “inserted”){
$scheduler->sql->query(“insert”,"INSERT INTO eventos(id_evento,start_date,end_date,evento_nombre,detalles) VALUES (“xxxx,xxxx,xxxx,xxxxx”);
$action->success();
}
}
$scheduler = new schedulerConnector($res,“Postgre”);
$scheduler->event->attach(“afterProcessing”,“insercion”);
$scheduler->render_table(“eventos”,“id_evento”,“start_date,end_date,evento_nombre,detalles”);
?>
What
I would like to know is how to receive data from the timetable on the
events page I noticed that when you create an event sent by the POST
method
1262619087106_!nativeeditor_status | inserted |
1262619087106_end_date | 2010-01-04 06:05 |
1262619087106_id | 1262619087106 |
1262619087106_start_date | 2010-01-04 06:00 |
1262619087106_text | example event text description |
ids | 1262619087106 |
how can I retrieve the data on my sales page to send the attachment manually
insistence and apologize for any inconvenience caused and thanks for your time
If you mean the same page where scheduler resides, you can use
var ev = scheduler.getEvent(id);
var text = ev.text;
var start_date = scheduler.template.xml_format(ev.start_date);
var end_date = scheduler.template.xml_format(ev.start_date);
Id - id of added|updated event.
thank you very much for your response
but what I need is to receive the data on the webpage dataprocesor
constructs the page where the calendar is this:
function init() {
scheduler.config.xml_date=“%Y-%m-%d %H:%i”;
scheduler.config.lightbox.sections=[
{name:“description”, height:130, map_to:“text”, type:“textarea” , focus:true},
//{name:“location”, height:43, type:“textarea”, map_to:“details” },
{name:“time”, height:72, type:“time”, map_to:“auto”}
]
scheduler.config.first_hour=4;
//scheduler.locale.labels.section_location=“Location”;
scheduler.config.details_on_create=true;
scheduler.config.details_on_dblclick=true;
scheduler.init(‘scheduler_here’,null,“month”);
scheduler.load(“events.php?uid=”+scheduler.uid());
var dp = new dataProcessor(“events.php”);
dp.init(scheduler);
}
your code if I would serve on that page but I need to recover the data on page events.php that is:
include (‘…/componentes/codebase/connector/scheduler_connector.php’);
include_once(‘…/componentes/codebase/connector/db_postgre.php’);
require_once(“…/componentes/comunicacion.inc”);
global $DB_SERVER,$DB_PORT,$DB_NAME,$DB_USER,$DB_PASSWORD;
$res = pg_connect(“host=$DB_SERVER port=$DB_PORT dbname=$DB_NAME user=$DB_USER password=$DB_PASSWORD”);
function insercion($action){
$status = $action->get_status();
if ($status == “inserted”){
//$action->set_status(“deleted”);
$scheduler->sql->query(“insert”,"INSERT INTO eventos(id_evento,start_date,end_date,evento_nombre,detalles) VALUES (xxxxx,xxxx,xxxxx,xxxx);
$action->success();
}
}
$scheduler = new schedulerConnector($res,“Postgre”);
//$scheduler->enable_log(“log.txt”,true);
$scheduler->event->attach(“afterProcessing”,“insercion”);
$scheduler->render_table(“eventos”,“id_evento”,“start_date,end_date,evento_nombre,detalles”);
and when I check the events page I get the following error:
Fatal error: Uncaught exception ‘Exception’ with message
‘Incorrect incoming data, ID of incoming records not recognized’ in
/var/www/sitiosphp/medicos/componentes/codebase/connector/dataprocessor.php:64
Stack
trace:
#0
/var/www/sitiosphp/medicos/componentes/codebase/connector/base_connector.php(336):
DataProcessor->process(Object(DataConfig),
Object(DataRequestConfig))
#1
/var/www/sitiosphp/medicos/componentes/codebase/connector/base_connector.php(290):
Connector->render()
#2 /var/www/sitiosphp/medicos/scripts/events.php(32):
Connector->render_table(‘eventos’, ‘id_evento’,
‘start_date,end_…’)
#3 {main} thrown in /var/www/sitiosphp/medicos/componentes/codebase/connector/dataprocessor.php on line 64
thanks for your time
calendario_postgresql.html.zip (1.12 KB)
events.php.zip (710 Bytes)
hi,
This would serve to the page that draws the schedule
var ev = scheduler.getEvent(id);
var text = ev.text;
var start_date = scheduler.template.xml_format(ev.start_date);
var end_date = scheduler.template.xml_format(ev.start_date);
as I do the same but from a php page
Fatal error: Uncaught exception ‘Exception’ with message ‘Incorrect incoming data, ID of incoming records not recognized’
Such error can occurs if you are calling
events.php?editing=true
which marks dataprocessor call, but there is no valid $_POST[“ids”] value.
if ($status == “inserted”){
$id_evento = $action->get_id();
$start_date = $action->get_value(“start_date”);
$end_date = $action->get_value(“end_date”);
$evento_nombre = $action->get_value(“evento_nombre”);
$detalles = $action->get_value(“detalles”);
$scheduler->sql->query(“insert”,“INSERT INTO eventos(id_evento,start_date,end_date,evento_nombre,detalles) VALUES (’{$id_evento}’,’{$start_date}’,’{$end_date}’,’{$evento_nombre}’,’{$detalles}’)”);
$action->success(); // <= parameter need to be added if ID is changes
}
thanks for your response and your time
not
if you could help me as I fix the problem because what I want is to
delete operations, insert and update manually and retrieve the data in
the php page that assumed it to this form:
$id_evento = $action->get_id();
$start_date = $action->get_value(“start_date”);
$end_date = $action->get_value(“end_date”);
$evento_nombre = $action->get_value(“evento_nombre”);
$detalles = $action->get_value(“detalles”);
and if this is not good or if I’m wrong
$scheduler->sql->query(“insert”,“INSERT INTO
eventos(id_evento,start_date,end_date,evento_nombre,detalles) VALUES
(‘{$id_evento}’,‘{$start_date}’,‘{$end_date}’,‘{$evento_nombre}’,‘{$detalles}’)”);
$action->success();
please help, thanks
Inside any server side event ( beforeInsert, beforeUpdate, beforeDelete, etc. ) you can use the same code as above to fetch parameters and execute your custom SQL
To have custom logic for insert|update|delete you will need to attach code for 3 above mentioned events.
function my_code($action){
$id_evento = $action->get_id();
$start_date = $action->get_value(“start_date”);
$end_date = $action->get_value(“end_date”);
$evento_nombre = $action->get_value(“evento_nombre”);
$detalles = $action->get_value(“detalles”);
$sch->sql->query(“insert”,“INSERT INTO eventos(id_evento,start_date,end_date,evento_nombre,detalles) VALUES (’{$id_evento}’,’{$start_date}’,’{$end_date}’,’{$evento_nombre}’,’{$detalles}’)”);
$action->success();
}
$sch->event(“beforeInsert”,my_code)
$sch->render…