39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
class SubcripcionController extends Controller
|
||
|
|
{
|
||
|
|
public function actionModificar($id)
|
||
|
|
{
|
||
|
|
//loadSubcripcionActivadel usuario ($id)
|
||
|
|
$model = $this->loadModel(1);
|
||
|
|
|
||
|
|
// Uncomment the following line if AJAX validation is needed
|
||
|
|
// $this->performAjaxValidation($model);
|
||
|
|
|
||
|
|
if (isset($_POST['Subcripcion'])) {
|
||
|
|
$model->attributes = $_POST['Subcripcion'];
|
||
|
|
if ($model->save()) {
|
||
|
|
Yii::app()->user->setFlash('success', Yii::t('profind', 'Se ha actualizado de producto'));
|
||
|
|
$this->redirect(array('modificar', 'id' => $model->id));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
$this->render('modificar', array(
|
||
|
|
'model' => $model,
|
||
|
|
));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 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 the ID of the model to be loaded
|
||
|
|
*/
|
||
|
|
public function loadModel($id) {
|
||
|
|
$model = Subcripcion::model()->findByPk($id);
|
||
|
|
if ($model === null)
|
||
|
|
throw new CHttpException(404, Yii::t('profind', 'La página solicitada no existe.'));
|
||
|
|
|
||
|
|
return $model;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|