/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Komentar();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Komentar'])) {
         $model->attributes = $_POST['Komentar'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id_komentar));
         }
     }
     $this->render('create', array('model' => $model));
 }
예제 #2
0
    }
    //Return the data back to formE.php
    echo json_encode($form_data);
}
if (isset($_POST['member'])) {
    $errors = array();
    //To store errors
    $form_data = array();
    //Pass back the data to `formE.php`
    for ($i = 0; $i < count($_POST['member']['k_id']); $i++) {
        $zadatakKorisnik = new ZadatakKorisnik();
        $zadatakKorisnik->korisnik_id = $_POST['member']['k_id'][$i];
        $zadatakKorisnik->zadatak_id = $_SESSION['last_inserted_id'];
        $zadatakKorisnik->created_at = date('YMd hms');
        $zadatakKorisnik->expire_at = date('YMd hms', strtotime($_POST['member']['expire_at'][$i]));
        $zadatakKorisnik->prioritet_id = $_POST['member']['prioritet_id'][$i];
        $zadatakKorisnik->save();
        $komentar = new Komentar();
        $komentar->korisnici_id = $_SESSION['user_id'];
        $komentar->zadatak_id = $_SESSION['last_inserted_id_zk'];
        $komentar->tekst = $_POST['member']['tekst'][$i];
        $komentar->created_at = date('YMd hms');
        $komentar->save();
        $form_data['posted'] = 'Podaci su uspješno upisani u bazu';
    }
    //Return the data back to formE.php
    echo json_encode($form_data);
}
if (isset($_GET['delete'])) {
    ZadatakKorisnik::delete($_GET['delete']);
}
예제 #3
0
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $id = Yii::app()->user->getId();
     if (empty($id)) {
         $this->redirect(Yii::app()->user->returnUrl . 'site/login');
     }
     $profile = TransaksiRegistrasi::model()->get_data_profile($id);
     $profile = (object) $profile;
     $criteria = new CDbCriteria();
     $model = new StatusUsers();
     $user = new Users();
     $komen = new Komentar();
     // $criteria->limit = 1;
     $criteria->order = 'ID_STATUS_USERS DESC';
     // $status = Status::model()->findAll($criteria);
     $status = $model->get_all_data();
     // $model->DATETIME_STATUS = $this->time_ago($_POST['DATETIME_STATUS']);
     if (isset($_POST['StatusUsers'])) {
         // $model->attributes=$_POST['Status'];
         // echo date('Y-m-d').'-'.time('H-i-s'); die();
         $model->ID_FANBASE = 1;
         $model->ID_USERS = Yii::app()->user->getId();
         $model->KONTEN = $_POST['StatusUsers']['KONTEN'];
         if ($model->save()) {
             $this->redirect(Yii::app()->user->returnUrl . 'timeline');
         }
     }
     if (isset($_POST['idstat'])) {
         $komen->ID_STATUS_USERS = $_POST['idstat'];
         $komen->ID_USERS = $id;
         $komen->KOMENTAR = $_POST['komen'];
         if ($komen->save()) {
             $this->redirect(Yii::app()->user->returnUrl . 'timeline');
         }
     }
     $this->render('index', array('model' => $model, 'status' => $status, 'profile' => $profile));
 }