2
Contributors
5
Replies
27
Views
4 Years
Discussion Span
Last Post by LastMitch
0

Now the problem i'm having is that, everytime i move an appointment, it opens the edit screen. This is rather annoying when all you need to do is change the date of the appointment...

What does it has to do with cakePHP plugin?

I mean I don't see any code related to PHP. The code you provided is just jQuery.

Either you didn't installed cakePHP plugin correctly or you modify the cakePHP plugin and it doesn't work correctly now.

Edited by LastMitch: grammer

0

Hey LastMitch,

The cakephp plugin i linked to is essentially a wrapper around a jquery file, with some cake code so that it works with cake php projects. (so that it is able to save to the database, for example).

The cake code seems to work correctly, but here it is anyway. excerpt from a controller:

public function workdateCalendar() {
        $this -> Workdate -> recursive = 1;
        $this -> set('Workdate', $this -> paginate());
    }

    // The feed action is called to get the list of workdates (JSON)
    function feed($id = null) {
        $this -> layout = "ajax";
        $inputParameters = $this -> params['url'];
        $conditions = array('conditions' => array('UNIX_TIMESTAMP(workdate_start) >=' => $inputParameters['start'], 'UNIX_TIMESTAMP(workdate_start) <=' => $inputParameters['end']));
        $workdates = $this -> Workdate -> find('all', $conditions);
        foreach ($workdates as $workdate) {
            if ($workdate['Workdate']['workdate_all_day'] == 1) {
                $allday = true;
                $end = $workdate['Workdate']['workdate_start'];
            }
            else {
                $allday = false;
                $end = $workdate['Workdate']['workdate_end'];
            }
            $dataForFullCallender[] = array(
                'id' => $workdate['Workdate']['workdate_id'],
                'title' => $workdate['Workdate']['workdate_note'],
                'start' => $workdate['Workdate']['workdate_start'],
                'end' => $end,
                'allDay' => $allday,
                'url' => '/DbDeKust/workdates/edit/' . $workdate['Workdate']['workdate_id'],
                'details' => $workdate['Workdate']['workdate_note'],
                'className' => 'blue'
            );
        }
        $this -> set("json", json_encode($dataForFullCallender));
    }

    // The update action is called from the jquery file i linked in the OP to update date/time when a workdate is dragged or resized
    public function updateCalendar($id = null) {

        $vars = $this -> params['url'];
        $this -> Workdate -> id = $vars['id'];
        $save = $this -> Workdate -> saveField('workdate_start', $vars['start']);
        $save = $this -> Workdate -> saveField('workdate_end', $vars['end']);
        $save = $this -> Workdate -> saveField('workdate_all_day', $vars['allday']);
    }
0

Now the problem i'm having is that, everytime i move an appointment, it opens the edit screen.

Take out the /edit/

From this:

'url' => '/DbDeKust/workdates/edit/' . $workdate['Workdate']['workdate_id'],

to this:

'url' => '/DbDeKust/workdates/' . $workdate['Workdate']['workdate_id'],

I assume there's a open window (iFrame) appearing so on that iFrame disable the link (div tags or html tags) or comment it out.

0

Heya,

The thing i'm trying to achieve here, is that the user is only redirected when he clicks the appointment, not when he drags it. by removing the /edit/, the click functionality is gone.
And without the ability to edit the appointments, well, the calendar loses it's purpose.

0

The thing i'm trying to achieve here, is that the user is only redirected when he clicks the appointment, not when he drags it. by removing the /edit/, the click functionality is gone. And without the ability to edit the appointments, well, the calendar loses it's purpose.

Where is the code that redirected? I hope you understand everything is in javascript meaning your code has no php at all?

This is the only code that related to edting things:

$dataForFullCallender[] = array()

but where is the redirected code and how does the html look likes?

I'm not going to write any javascript redirected code (or modify the code) since we are in PHP section not javascript section.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.