Exemplo n.º 1
0
 public function sendAction()
 {
     $request = $this->getRequest();
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('index', 'index');
     }
     // Get our form and validate it
     $form = $this->getSendForm();
     if (!$form->isValid($request->getPost())) {
         $this->view->form = $form;
         $val = $form->getValues();
         return $this->_helper->redirector->gotoUrl($val['goto']);
     }
     $val = $form->getValues();
     // create a tweet and store it in the Database
     $profile = Zend_Auth::getInstance()->getIdentity();
     $t = new Tweet();
     $t->setMessage($val['message']);
     TweetTable::store($t, $profile->getId());
     // then redirect to the previous page
     return $this->_helper->redirector->gotoUrl($val['goto']);
 }
Exemplo n.º 2
0
 public function getFollowStream($cutoff_time, $limit) {
   $a=array();
   $id=$this->_id;
   if ($cutoff_time)
     $t="AND TIMESTAMP < '".
        HypertableConnection::format_timestamp_ns($cutoff_time)."' ";
   else
     $t='';
   $result=HypertableConnection::query("SELECT follow_stream FROM user ".
               "WHERE ROW='$id' $t CELL_LIMIT $limit");
   if (!$result or !count($result->cells))
     return $a;
   foreach ($result->cells as $cell) {
     array_push($a, TweetTable::load($cell->value));
   }
   $this->_cutoff=$result->cells[count($result->cells)-1]->key->timestamp;
   return $a;
 }