getModule(); $userNameSql = getSqlForNameInDisplayFormat(array('first_name'=>'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users'); $query = "SELECT login_id, $userNameSql AS user_name, user_ip, logout_time, login_time, vtiger_loginhistory.status FROM $module->baseTable INNER JOIN vtiger_users ON vtiger_users.user_name = $module->baseTable.user_name"; $search_key = $this->get('search_key'); $value = $this->get('search_value'); if(!empty($search_key) && !empty($value)) { $query .= " WHERE $module->baseTable.$search_key = '$value'"; } //Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7996 $query .= " ORDER BY login_time DESC"; return $query; } public function getListViewLinks() { return array(); } /** * Function which will get the list view count * @return - number of records */ public function getListViewCount() { $db = PearDatabase::getInstance(); $module = $this->getModule(); $listQuery = "SELECT count(*) AS count FROM $module->baseTable INNER JOIN vtiger_users ON vtiger_users.user_name = $module->baseTable.user_name"; $search_key = $this->get('search_key'); $value = $this->get('search_value'); if(!empty($search_key) && !empty($value)) { $listQuery .= " WHERE $module->baseTable.$search_key = '$value'"; } $listResult = $db->pquery($listQuery, array()); return $db->query_result($listResult, 0, 'count'); } }