Beispiel #1
0
 /**
  * Creates a new poke
  * @param $to
  */
 public static function send($to)
 {
     $session = SessionHandler::getInstance();
     $o = new Poke();
     $o->from = $session->id;
     $o->to = $to;
     $o->time = sql_datetime(time());
     $o->store();
 }
Beispiel #2
0
 /**
  * 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 Poke the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Poke::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Beispiel #3
0
<?php

namespace cd;

$session->requireLoggedIn();
switch ($this->owner) {
    case 'send':
        // child = user to poke
        if (Bookmark::exists(BOOKMARK_USERBLOCK, $session->id, $this->child)) {
            echo 'User has blocked you from access';
            return;
        }
        echo 'A poke was sent to the user.<br/><br/>';
        Poke::send($this->child);
        echo ahref('u/profile/' . $this->child, 'Continue');
        break;
    case 'show':
        // shows my recieved pokes
        echo '<h1>My recieved pokes</h1>';
        $list = Poke::getPokes($session->id);
        foreach ($list as $poke) {
            echo 'Poke from ' . UserLink::render($poke->from) . ' sent at ' . $poke->time . '<br/>';
        }
        break;
    default:
        echo 'no such view: ' . $this->owner;
}