| @@ 4943-4961 (lines=19) @@ | ||
| 4940 | public static function getStudentBoss($userId) |
|
| 4941 | { |
|
| 4942 | $userId = intval($userId); |
|
| 4943 | if ($userId > 0) { |
|
| 4944 | $userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER); |
|
| 4945 | $row = Database::select( |
|
| 4946 | 'DISTINCT friend_user_id AS boss_id', |
|
| 4947 | $userRelTable, |
|
| 4948 | array( |
|
| 4949 | 'where' => array( |
|
| 4950 | 'user_id = ? AND relation_type = ? LIMIT 1' => array( |
|
| 4951 | $userId, |
|
| 4952 | USER_RELATION_TYPE_BOSS, |
|
| 4953 | ) |
|
| 4954 | ) |
|
| 4955 | ) |
|
| 4956 | ); |
|
| 4957 | if (!empty($row)) { |
|
| 4958 | ||
| 4959 | return $row[0]['boss_id']; |
|
| 4960 | } |
|
| 4961 | } |
|
| 4962 | ||
| 4963 | return false; |
|
| 4964 | } |
|
| @@ 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 | } |
|