Extend cal with own attributes?

I am new to the yii framework and is trying to extend the "cal" extension with my own attributes.

I added a new attribute “note” to my database table, the controller and the model but “cal” isn’t able to save the event when i try to. I get no errors or anything. Shouldn’t it be possible to add new attributes, og use a different database table as long as the original attributes are intact?

Did you name it in the rules of your model?

The where no rules before i added these which doesn’t change anything:

public function rules()

{


	return array('id', 'user_id', 'title','allDay','start','end','editable','note');


}

The new one is called note!

I have added the attribute to the mainController for “cal” like all the others but it doesn’t work

I can confirm that when i manually add information to the "note" attribute in the database the model contains the attribute note and it contains the right information, but i am not able to save the events

You need change eventCal.js in the assets folder




        eventDialogOK = function()

        {

            var data =

            {

                eventId: $("#EventCal_id").val(),

                title: $("#EventCal_title").val(),

                start: $("#EventCal_start").val(),

                end: $("#EventCal_end").val(),

                allDay: $('input[name=EventCal_allDay]').attr('checked'),

                editable: $('input[name=EventCal_editable]').attr('checked'),


                note: $("#EventCal_note").val()

            }




and modify views/calendar/browse.php




    <div class="row">

        <?php

        echo CHtml::label(Yii::t('Calendar', 'Editable'), "EventCal_editable");

        echo CHtml::checkBox("EventCal_editable", true);

        ?>

    </div>

    

    <div class="row">

        <?php

        echo CHtml::label(Yii::t('Calendar', 'Note'), "EventCal_note");

        echo CHtml::checkBox("EventCal_note", true);

        ?>

    </div>


    <?php echo CHtml::endForm(); ?>



It is still not working for me, i have add my attribute everywhere and it still dont save the events. I am using the calendar as a module not as a controller, is that ok? I have tried to use it as a controller but i dont understand how i make use of the calendar as a controller. How does that work? Thx in advance!

I have now tried to extend "cal" both when running it as a module and as controller and nothing helps.

Do you modify actionUpdate in the controller as you need?

Which is the POST params into actionUpdate?

What is written in the runtime/application.log about?

I do modify the actionUpdate method. Finally i found out that my new attribute “note” isn’t a part of the post into actionUpdate for some reason? I dont quite get why it’s missing!

From application.log:

Undefined index: note (C:\xampp\htdocs\calTest\protected\components\UICalendarController.php:190)

That is where i try to get the post value

$user_id = Yii::app()->user->getState(‘cal_uid’);

$title = $_POST[‘title’];

$note = $_POST[‘note’]; //The one i added

$start = $_POST[‘start’];

$end = $_POST[‘end’];

$allDay = ($_POST[‘allDay’] == ‘true’) ? 1 : 0;

$editable = ($_POST[‘editable’] == ‘true’) ? 1 : 0;

$eventId = $_POST[‘eventId’];

I finally solved the problem, i didn’t know that i hat to delete the eventCal.js from assets folder before it copies the new one :( Anyway, thanks for the help!

hi Hummer, I have the same problem, could you post your code and explain where was changed…

thx a lot.