public function actionVKatagorys($pk) { $Katagory = Katagory::model()->findByPk($pk); $Views = View::model()->findAll(); $Menus = Menu::model()->findAll(); if (isset($_POST['Katagory'])) { $Katagory->attributes = $_POST['Katagory']; if ($Katagory->save()) { $this->redirect(array('vkatagorys', 'pk' => $Katagory->id_katagory)); } } $this->render('vkatagorys', array('Katagory' => $Katagory, 'Views' => $Views, 'Menus' => $Menus)); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Katagory the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Katagory::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionCon($pk) { $Menus = Menu::model()->findAll(); $Katagorys = Katagory::model()->findAll(); $criteria = new CDbCriteria(array('order' => 'like_artikel DESC', 'limit' => 10)); $hots = Artikel::model()->findAll($criteria); $Artikel = Artikel::model()->findByPk($pk); $jml = $Artikel->con_artikel; $Artikel->con_artikel = $jml + 1; $id = Katagory::model()->findByPk(KatagoryHasArtikel::model()->find('artikel_id_artikel =' . $Artikel->id_artikel)->katagory_id_katagory)->view_id_view; if ($Artikel->save()) { $this->render('view', array("id" => $id, 'pk' => $pk, "menus" => $Menus, "katagorys" => $Katagorys, 'Artikel' => $Artikel, 'hots' => $hots)); } }