I am currently trying to implement an editable dropdown list that allows users to view their event, click it and have a dropdown and set their event to another event.
Sounds fairly simple and I feel like I’ve got the logic right, but I’m not sure I have the syntax right or not looking at the correct model.
The problem is I’m having to go through 1 model : Eventattendees to get to the Event model.
I want the eventattendee, to look at the full list of events and update their eventattendee model with the new event ID.
The code for my editabledetailview in my view.php in the eventattend folder.
array(
'name' => 'event_id',
'type' => 'raw',
'value' => CHtml::encode($model->event->name),
'editable' => array(
'type' => 'select',
'url' => '/admin/eventAttend/EditableSaver',
'source' => EventAttendees::getEventLists(),
'options' => array('params' => array(Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken)),
),
),
And the functions in my eventattendee model
public static function getEventList() {
$model = Event::model()->findAll();
// CHtml::listData($model, )
return $model;
// $eventDetail = Event::model()->findByPk($event_id);
}
public function getEventLists() {
$eventList = self::getEventList();
return isset($eventList[$this->id]) ?
$eventList[$this->id] : "Unknown id ({$this->id})";
}
So I want to list all the events in the event model, then update the event ID when they click on a new event for the event attendees model. From looking at examples, this code is how it seems it should work to do the above.