Hello,
I found in the docs dat we can send data from the scheduler to the database using this:
var dp = new dataProcessor(url)
dp.init(myobj)
But when I do the following, it gets into an infinite loop (above code are last lines of below code):
myAppProfile.directive('dhxScheduler', function() {
return {
restrict: 'A',
scope: false,
transclude: true,
template:'<div class="dhx_cal_navline" ng-transclude></div><div class="dhx_cal_header"></div><div class="dhx_cal_data"></div>',
link:function ($scope, $element, $attrs, $controller){
//default state of the scheduler
if (!$scope.scheduler)
$scope.scheduler = {};
$scope.scheduler.mode = $scope.scheduler.mode || "month";
$scope.scheduler.date = $scope.scheduler.date || new Date();
//watch data collection, reload on changes
$scope.$watch($attrs.data, function(collection){
if(collection) {
scheduler.clearAll();
scheduler.parse(collection, "json");
}
}, true);
//watch mode and date
$scope.$watch(function(){
return $scope.scheduler.mode + $scope.scheduler.date.toString();
}, function(nv, ov) {
var mode = scheduler.getState();
if (nv.date != mode.date || nv.mode != mode.mode)
scheduler.setCurrentView($scope.scheduler.date, $scope.scheduler.mode);
}, true);
//size of scheduler
$scope.$watch(function() {
return $element[0].offsetWidth + "." + $element[0].offsetHeight;
}, function() {
scheduler.setCurrentView();
});
//styling for dhtmlx scheduler
$element.addClass("dhx_cal_container");
//init scheduler
scheduler.config.xml_date="%Y-%m-%d %H:%i";
scheduler.init($element[0], new Date(), "month");
scheduler.load("agendaController.php", "json");
var dp = new dataProcessor("agendaController.php");
dp.init(scheduler);
}
}
});
This is my controller code:
include('connections.php');
include('/db-connector/scheduler_connector.php');
$scheduler = new JSONSchedulerConnector($conn);
$scheduler->render_table("events","id","start_date,end_date,text");
can anyone help me with getting started saving events to db? Thanks!