/** * Render */ public function render() { $Онлайн = new Db_ORM('Онлайн'); $Онлайн->where('created_date', time() - config('widgets.Онлайн.period', 60), ' < '); $Онлайн->delete(); $data = Core_ArrayObject::transform(array('counters' => array('users' => 0, 'Боты' => 0, 'Гости' => 0, 'all' => 0), 'users' => array(), 'Боты' => array(), 'guest' => array())); if ($result = $Онлайн->findAll()) { foreach ($result as $item) { if ($item->uid) { if (!$data->users->offsetExists($item->uid)) { $data->users->offsetSet($item->uid, user($item->uid)); $data->counters->users++; } } else { if (preg_match('#(yandex|google|rss|bot|rambler|pubsub|parser|spider|feed)#ism', $item->user_agent, $bot)) { if ($data->Боты->offsetExists($bot[0])) { continue; } $data->Боты->offsetSet($bot[0]); $data->counters->Боты++; } else { $data->counters->Гости++; } } } $data->counters->all = $data->counters->users + $data->counters->Боты + $data->counters->Гости; } $tpl = new Template('User/templates/widgets/Онлайн'); $tpl->data = $data; $this->code = $tpl->render(); return parent::render(); }
/** * Render */ public function render() { $users = new User(); $users->order('Рейтинг', 'desc'); $users->limit($this->options->limit); if ($result = $users->findAll()) { $tpl = new Template('User/templates/widgets/top'); $tpl->users = $result; $this->code = $tpl->render(); } return parent::render(); }
/** * Render */ public function render() { $tpl = new Template('Search/templates/widget'); $this->code = $tpl->render(); return parent::render(); }