public function actionAdd() { if (Yii::app()->request->isPostRequest) { $rate = new Rates(); $rate->comment_id = (int) Yii::app()->request->getParam('comment_id'); $rate->rate = (int) Yii::app()->request->getParam('rate'); if ($rate->save()) { echo $rate->getRate($rate->comment_id); } else { echo 'error'; } } else { throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } }
function edit_place($mode = '') { if ($mode == 'rates') { $r = new Rates(); $r->where('id', Input::get('rowid')); $r->get(); if (Input::get('colid') == 'rate_per_day') { $r->rate_per_day = Input::get('new'); } if (Input::get('colid') == 'pagibig_amount') { $r->pagibig_amount = Input::get('new'); } $r->save(); exit; } if ($mode == 'jo_days') { $j = new Jo_days(); $j->where('id', Input::get('rowid')); $j->get(); if (Input::get('colid') == 'hours') { $j->hours = Input::get('new'); } if (Input::get('colid') == 'days') { $j->days = Input::get('new'); } $j->save(); exit; } if ($mode == 'status') { $c = new Cos_status(); $c->where('id', Input::get('rowid')); $c->get(); $c->status = Input::get('new'); $c->save(); exit; } }