| @@ 1386-1401 (lines=16) @@ | ||
| 1383 | { |
|
| 1384 | $studentUserId = intval($studentUserId); |
|
| 1385 | $sessionId = intval($sessionId); |
|
| 1386 | if (!empty($sessionId) && !empty($studentUserId)) { |
|
| 1387 | $row = Database::select( |
|
| 1388 | 'last_message_id', |
|
| 1389 | Database::get_main_table(TABLE_ADVANCED_SUBSCRIPTION_QUEUE), |
|
| 1390 | array( |
|
| 1391 | 'where' => array( |
|
| 1392 | 'user_id = ? AND session_id = ?' => array($studentUserId, $sessionId), |
|
| 1393 | ) |
|
| 1394 | ) |
|
| 1395 | ); |
|
| 1396 | ||
| 1397 | if (count($row) > 0) { |
|
| 1398 | ||
| 1399 | return $row[0]['last_message_id']; |
|
| 1400 | } |
|
| 1401 | } |
|
| 1402 | ||
| 1403 | return false; |
|
| 1404 | } |
|
| @@ 4956-4974 (lines=19) @@ | ||
| 4953 | public static function getStudentBoss($userId) |
|
| 4954 | { |
|
| 4955 | $userId = intval($userId); |
|
| 4956 | if ($userId > 0) { |
|
| 4957 | $userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
|
| 4958 | $row = Database::select( |
|
| 4959 | 'DISTINCT friend_user_id AS boss_id', |
|
| 4960 | $userRelTable, |
|
| 4961 | array( |
|
| 4962 | 'where' => array( |
|
| 4963 | 'user_id = ? AND relation_type = ? LIMIT 1' => array( |
|
| 4964 | $userId, |
|
| 4965 | USER_RELATION_TYPE_BOSS, |
|
| 4966 | ) |
|
| 4967 | ) |
|
| 4968 | ) |
|
| 4969 | ); |
|
| 4970 | if (!empty($row)) { |
|
| 4971 | ||
| 4972 | return $row[0]['boss_id']; |
|
| 4973 | } |
|
| 4974 | } |
|
| 4975 | ||
| 4976 | return false; |
|
| 4977 | } |
|