Esempio n. 1
0
 public function delete()
 {
     $stmt = Komentar::getInstance()->prepare("DELETE FROM " . self::$table_name . " WHERE id = :id");
     $stmt->bindParam(':id', $this->id, PDO::PARAM_INT);
     if ($stmt->execute()) {
         return true;
     } else {
         foreach (Komentar::getInstance()->errorInfo() as $error) {
             echo $error . '<br />';
         }
         return false;
     }
 }
Esempio n. 2
0
<?php

require "../config.php";
$komentar = new Komentar();
$komentar->ime = $_POST['ime_koment'];
$komentar->email = $_POST['email_koment'];
$komentar->komentar = $_POST['koment'];
$komentar->tekst_id = $_POST['tekst_id'];
$komentar->datum = date('Y-m-d H:i:s');
$komentar->insert();
Esempio n. 3
0
								<h6><i><?php 
    echo time_ago($stat['DATETIME_STATUS']);
    ?>
</i></h6>
							</span>
						</div>
						<div class="panel-body">
							<div><?php 
    echo $stat['KONTEN'];
    ?>
</div>
							<hr style="height:1px; margin-top:5px;"> 
						</div>
						<?php 
    $criteria = new CDbCriteria();
    $komen = Komentar::model()->get_data_komentar($stat['ID_STATUS_USERS']);
    ?>
						<div class="m-t-sm h6" style="margin-left:10px; padding-bottom: 0px; margin-top:-30px;">
							<a href class="text-muted m-xs"><i class="icon-action-redo"></i> <?php 
    echo count($komen) . ' Comments';
    ?>
</a>
							<a href class="text-muted m-xs"><i class="icon-star"> Like</i></a>
						</div>
						<!-- .comment-reply -->
						<?php 
    $i = 0;
    foreach ($komen as $k) {
        if (!empty($k['FOTO'])) {
            $photoKomen = '/images/profile/' . $k['FOTO'];
        } else {
Esempio n. 4
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']);
}
Esempio n. 5
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));
 }
 /**
  * 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 Komentar the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Komentar::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 7
0
    ?>
</h3></a>
					<span class="datum"><?php 
    echo $date->format('d.m.Y');
    ?>
 | <?php 
    echo $koment->broj === "1" ? $koment->broj . " komentar" : $koment->broj . " komentara";
    ?>
</span>
				</div>
			</li>
	  <?php 
}
?>
</ul>

<ul id="komentari">
	<?php 
$side = Komentar::getAll("where status = 1 order by datum desc");
foreach ($side as $text) {
    $date = new DateTime($text->datum);
    ?>
			<li class="koment">
				<?php 
    echo $text->ime . " - " . $text->komentar;
    ?>
			</li>
	  <?php 
}
?>
</ul>
Esempio n. 8
0
    $file_name = $_FILES['img']['name'];
    $file_type_explode = explode("/", $_FILES['img']['type']);
    $file_type = "." . $file_type_explode[1];
    $ime = $_POST['ime'];
    $ime = str_replace("ć", "c", $ime);
    $ime = str_replace("Ć", "c", $ime);
    $output = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $ime);
    move_uploaded_file($file_tmp, "../images/takmicari/" . $output . $file_type);
    $slika = $_POST['slika'];
    $article->slika = file_exists("../images/takmicari/" . $slika) ? "{$slika}" : $ime . $file_type;
    $article->update();
    header("Location: admin.php?id=2&cat=dodaj_takmicara.php");
}
//prihvatanje komentara
if (isset($_GET['dodajkom'])) {
    $kom = new Komentar();
    $kom->komentar_id = $_GET['dodajkom'];
    $kom->status = "1";
    $kom->update();
    header("Location: admin.php?id=2");
}
//brisanje komentara
if (isset($_GET['brisikom'])) {
    $db = Singleton::getInstance();
    $conn = $db->conn;
    $id = $_GET['brisikom'];
    $q = $conn->query("delete from komentari where komentar_id='{$id}'");
    header("Location: admin.php?id=2");
}
//dodavanje motivacije
if (isset($_POST['dodaj_motivacion'])) {