[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+*********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 *************************************************************************************/ 10 class Settings_LoginHistory_ListView_Model extends Settings_Vtiger_ListView_Model { 11 12 /** 13 * Funtion to get the Login history basic query 14 * @return type 15 */ 16 public function getBasicListQuery() { 17 $module = $this->getModule(); 18 $userNameSql = getSqlForNameInDisplayFormat(array('first_name'=>'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users'); 19 20 $query = "SELECT login_id, $userNameSql AS user_name, user_ip, logout_time, login_time, vtiger_loginhistory.status FROM $module->baseTable 21 INNER JOIN vtiger_users ON vtiger_users.user_name = $module->baseTable.user_name"; 22 23 $search_key = $this->get('search_key'); 24 $value = $this->get('search_value'); 25 26 if(!empty($search_key) && !empty($value)) { 27 $query .= " WHERE $module->baseTable.$search_key = '$value'"; 28 } 29 //Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7996 30 $query .= " ORDER BY login_time DESC"; 31 return $query; 32 } 33 34 public function getListViewLinks() { 35 return array(); 36 } 37 38 /** 39 * Function which will get the list view count 40 * @return - number of records 41 */ 42 43 public function getListViewCount() { 44 $db = PearDatabase::getInstance(); 45 46 $module = $this->getModule(); 47 $listQuery = "SELECT count(*) AS count FROM $module->baseTable INNER JOIN vtiger_users ON vtiger_users.user_name = $module->baseTable.user_name"; 48 49 $search_key = $this->get('search_key'); 50 $value = $this->get('search_value'); 51 52 if(!empty($search_key) && !empty($value)) { 53 $listQuery .= " WHERE $module->baseTable.$search_key = '$value'"; 54 } 55 56 $listResult = $db->pquery($listQuery, array()); 57 return $db->query_result($listResult, 0, 'count'); 58 } 59 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |