public static function getUsersOnline($Age = 1)
 {
     $TheOnline = new self();
     $Onlines = $TheOnline->fetchAll("Date + INTERVAL {$Age} MINUTE > NOW()", "IDLocation");
     $Ret = array();
     foreach ($Onlines as $Online) {
         $TheOnline = new self();
         $TheOnline->copyFromDb($Online);
         $TheOnline->User = App_Model_User::getUserById($Online->IDUser);
         if ($TheOnline->IDLocation) {
             $TheOnline->Location = Mappa_Model_Luogo::get($Online->IDLocation);
         }
         $Ret[] = $TheOnline;
     }
     return $Ret;
 }
 public function preDispatch()
 {
     list($IDUser, $Name) = explode(' ', $this->_getParam('pg'), 2);
     if ('index' != $this->getRequest()->getActionName() && 'permalink' != $this->getRequest()->getActionName()) {
         return;
     }
     if (!isset($Name)) {
         if (!Zend_Auth::getInstance()->hasIdentity()) {
             $this->_helper->_redirector('auth', 'error', 'default');
         }
         $this->_forward($IDUser);
         return;
     }
     try {
         $this->view->pg = App_Model_User::getUserById($IDUser);
         $this->view->title = $this->view->pg->Name . ' ' . $this->view->pg->Surname;
         $this->view->titleImg = $this->view->normalize($this->view->title);
         $this->view->headTitle()->append($this->view->title);
     } catch (Exception $e) {
         $this->view->pg = $Name;
         $this->getRequest()->setActionName('notFound');
     }
 }
Beispiel #3
0
 public function __toString()
 {
     $date = new Zend_Date($this->Date);
     $author = App_Model_User::getUserById($this->IDUser);
     return str_replace(array('%date%', '%author%', '%tag%', '%text%'), array($date->toString('H:m:s'), $author, $this->Tag, $this->Text), $this->_template[$this->Type]);
 }