/** * Display user logins list * @access public * @param string $templateFile * @param array $list * @param int $page * @param int $browser * @param int $loginDate * @param int $sortField * @param int $orderBy * @return void */ public function loginsUser($templateFile, $list, $page, $browser, $loginDate, $sortField, $orderBy) { $dotGeoip = new Dot_Geoip(); $geoIpWorking = true; $this->tpl->setFile('tpl_main', 'user/' . $templateFile . '.tpl'); $this->tpl->setBlock('tpl_main', 'browser', 'browser_row'); $browserArray = Dot_UserAgent_Utilities::getBrowserArray(); foreach ($browserArray as $key => $val) { $this->tpl->setVar('BROWSERNAME', ucfirst($val['uaBrowser'])); if (strtolower($val['uaBrowser']) == strtolower($browser)) { $this->tpl->setVar('BROWSERSEL', 'selected'); } else { $this->tpl->setVar('BROWSERSEL', ''); } $this->tpl->parse('browser_row', 'browser', true); } $this->tpl->setVar('FILTERDATE', $loginDate); $this->tpl->setBlock('tpl_main', 'list', 'list_block'); $this->tpl->paginator($list['pages']); $this->tpl->setVar('PAGE', $page); $this->tpl->setVar('FILTER_URL', '/admin/user/logins'); $sortableFields = array('username', 'dateLogin'); foreach ($sortableFields as $field) { $linkSort = '/admin/user/logins/sort/' . $field . '/order/'; $linkSort .= $orderBy == 'asc' ? 'desc' : 'asc'; $this->tpl->setVar('LINK_SORT_' . strtoupper($field), $linkSort); if ($field != $sortField) { $sortClass = 'sortable'; } elseif ($orderBy == 'asc') { $sortClass = 'sort_up'; } else { $sortClass = 'sort_down'; } $this->tpl->setVar('CLASS_SORT_' . strtoupper($field), $sortClass); } foreach ($list['data'] as $k => $v) { $country = $dotGeoip->getCountryByIp($v['ip']); if ($country['response'] != 'OK' && $geoIpWorking === true) { $geoIpWorking = false; $this->session->message['txt'] = $country['response']; $this->session->message['type'] = 'warning'; } $this->tpl->setVar('ID', $v['id']); $this->tpl->setVar('USERID', $v['userId']); $this->tpl->setVar('USERNAME', $v['username']); $this->tpl->setVar('IP', $v['ip']); $this->tpl->setVar('COUNTRYIMAGE', strtolower($country[0])); $this->tpl->setVar('COUNTRYNAME', $country[1]); $this->tpl->setVar('REFERER', $v['referer']); $this->tpl->setVar('WHOISURL', $this->settings->whoisUrl); $this->tpl->setVar('USERAGENT', $v['userAgent']); $this->tpl->setVar('BROWSERIMAGE', Dot_UserAgent_Utilities::getBrowserIcon($v['userAgent'])); $os = Dot_UserAgent_Utilities::getOsIcon($v['userAgent']); $this->tpl->setVar('OSIMAGE', $os['icon']); $this->tpl->setVar('OSMAJOR', $os['major']); $this->tpl->setVar('OSMINOR', $os['minor']); $this->tpl->setVar('DATELOGIN', Dot_Kernel::timeFormat($v['dateLogin'], 'long')); $this->tpl->parse('list_block', 'list', true); } }