public function actionSave() { $object = new CDashboardItem(); $object->setAttributes(CRequest::getArray($object::getClassName())); if ($object->validate()) { $object->save(); if ($this->continueEdit()) { $this->redirect("groupdashboard.php?action=edit&id=" . $object->getId()); } else { $this->redirect("groupdashboard.php?action=index&id=" . $object->group_id); } return true; } $this->setData("object", $object); $this->renderView("_users/groupdashboard/edit.tpl"); }
public function actionSave() { $item = new CDashboardItem(); $item->setAttributes(CRequest::getArray($item::getClassName())); if ($item->validate()) { $item->save(); $this->redirect("?action=list"); return true; } $parents = new CArrayList(); foreach (CActiveRecordProvider::getWithCondition(TABLE_DASHBOARD, "user_id = " . CSession::getCurrentUser()->getId() . " and parent_id = 0")->getItems() as $ar) { $item = new CDashboardItem($ar); $parents->add($item->getId(), $item->title); foreach ($item->children->getItems() as $child) { $parents->add($child->getId(), " - " . $child->title); } } $this->setData("parents", $item); $this->setData("item", $item); $this->renderView("_dashboard/edit.tpl"); }