Reputation: 185
I am developing a CakePHP app and I installed Silas Montgomery's Cake FullCalendar Plugin.
I have created a table to log when people attend to events which are managed by the plugin. So I have this model:
<?php
App::uses('AppModel', 'Model');
class Attendance extends AppModel {
public $primaryKey = 'idattendance';
public $belongsTo = array(
'PeopleAttendance' => array(
'className' => 'People',
'foreignKey' => 'idpeople',
'conditions' => '',
'fields' => '',
'order' => ''
),
'AttendanceEvent' => array(
'className' => 'FullCalendar.Event',
'foreignKey' => 'idevent',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
}
How can I call a FullCallendar action (say add() to add events) from within an Attendance view?
This works...
echo $this->Html->link(__('New Event'),'http://localhost:8888/project/full_calendar/events/add');
... but it doesn't seem "Cake-correct" to me...
What should be the best approach when using such type of plugin? Also, I haven't fully tested, but I would guess my model is not correct either...
Upvotes: 0
Views: 1032
Reputation: 34877
You can use the plugin
option to link to a plugin action:
echo $this->Html->link(
__('New Event'),
array(
'plugin' => 'full_calendar', // Define the plugin here as option
'controller' => 'events',
'action' => 'add'
)
);
Upvotes: 0
Reputation: 1595
You should add an option "plugin" to your link array:
$this->Html->link(__('New Event'), array('controller' => 'events', 'action' => 'add', 'plugin' => 'full_calendar'));
Upvotes: 1