public function actionSave() { if (isset($_GET['id']) && $_GET['id']) { $note = Devnote::model()->findByPk($_GET['id']); } if (!isset($note)) { $note = new Devnote(); } $note->attributes = $_GET['Devnote']; $note->save(false); echo $note->id; Yii::app()->end(); }
public function postFilter($filterChain) { echo '<script> devnote.pageId = "' . Devnote::getPageId() . '"; </script>'; /** @var $devnotes Devnote[] */ $devnotes = Devnote::model()->findNotesForCurrentAction(); $js = ''; foreach ($devnotes as $key => $value) { $js .= 'devnote("' . $value->id . '").init({ width : "' . $value->width . '", height : "' . $value->height . '", posX : "' . $value->posX . '", posY : "' . $value->posY . '", pageId : "' . $value->pageId . '", text: "' . $value->text . '" });'; } echo '<script>' . $js . '</script>'; }