Ejemplo n.º 1
0
 public function executeIndex()
 {
     $a = new Criteria();
     $users = UserPeer::doSelect($a);
     //print_r($users);
     $onlineusers = 0;
     foreach ($users as $user) {
         if ($user->isOnline()) {
             $onlineusers = $onlineusers + 1;
         }
     }
     //echo $onlineusers;
     $onlineusers = $onlineusers;
     if ($onlineusers == 0) {
         $onlineusers_msg = "(All members are in offline)";
     }
     if ($onlineusers == 1) {
         $onlineusers_msg = "(One member is in online)";
     }
     if ($onlineusers > 1) {
         $onlineusers_msg = "({$onlineusers} members are in online)";
     }
     $this->onlineusers_msg = $onlineusers_msg;
     if (!empty($_COOKIE["timer"])) {
         $this->redirect('/dashboard/rating');
     }
     if (!empty($_GET['post_id'])) {
         $this->getResponse()->setCookie("_post_Id", $_GET['post_id'], time() + 600, '/', sfConfig::get('app_cookies_domain'));
         $_COOKIE['_post_Id'] = 100;
     }
     $c = new Criteria();
     $c->add(ForumPeer::TYPE, 0);
     $this->publicforums = ForumPeer::doSelect($c);
     $this->categories = CategoryPeer::doSelect(new Criteria());
     $l = new Criteria();
     $l->addDescendingOrderByColumn(ThreadPeer::ID);
     $l->add(ThreadPeer::CANCEL, 0);
     $l->setLimit(5);
     $this->latest = ThreadPeer::doSelect($l);
 }
Ejemplo n.º 2
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(ThreadPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(ThreadPeer::DATABASE_NAME);
         $criteria->add(ThreadPeer::ID, $pks, Criteria::IN);
         $objs = ThreadPeer::doSelect($criteria, $con);
     }
     return $objs;
 }