| @@ 298-320 (lines=23) @@ | ||
| 295 | * @param string $order |
|
| 296 | * @return array |
|
| 297 | */ |
|
| 298 | public function getUserAgreementList($courseId, $sessionId, $order = null) |
|
| 299 | { |
|
| 300 | $courseId = intval($courseId); |
|
| 301 | $sessionId = intval($sessionId); |
|
| 302 | ||
| 303 | $table = Database::get_main_table('session_rel_course_rel_user_legal'); |
|
| 304 | $userTable = Database::get_main_table(TABLE_MAIN_USER); |
|
| 305 | $sql = "SELECT * |
|
| 306 | FROM $table s INNER JOIN $userTable u |
|
| 307 | ON u.user_id = s.user_id |
|
| 308 | WHERE c_id = $courseId AND session_id = $sessionId "; |
|
| 309 | ||
| 310 | if (!empty($order)) { |
|
| 311 | $sql .= $order; |
|
| 312 | } |
|
| 313 | $result = Database::query($sql); |
|
| 314 | $data = array(); |
|
| 315 | if (Database::num_rows($result) > 0) { |
|
| 316 | $data = Database::store_result($result, 'ASSOC'); |
|
| 317 | } |
|
| 318 | ||
| 319 | return $data; |
|
| 320 | } |
|
| 321 | ||
| 322 | /** |
|
| 323 | * @param int $courseId |
|
| @@ 535-555 (lines=21) @@ | ||
| 532 | * @param string $name |
|
| 533 | * @return array |
|
| 534 | */ |
|
| 535 | public static function getGroupListFilterByName($name, $categoryId, $courseId) |
|
| 536 | { |
|
| 537 | $name = trim($name); |
|
| 538 | if (empty($name)) { |
|
| 539 | return array(); |
|
| 540 | } |
|
| 541 | $name = Database::escape_string($name); |
|
| 542 | $courseId = intval($courseId); |
|
| 543 | $table_group = Database::get_course_table(TABLE_GROUP); |
|
| 544 | $sql = "SELECT * FROM $table_group |
|
| 545 | WHERE c_id = $courseId AND name LIKE '%$name%'"; |
|
| 546 | ||
| 547 | if (!empty($categoryId)) { |
|
| 548 | $categoryId = intval($categoryId); |
|
| 549 | $sql .= " AND category_id = $categoryId"; |
|
| 550 | } |
|
| 551 | $sql .= " ORDER BY name"; |
|
| 552 | $result = Database::query($sql); |
|
| 553 | ||
| 554 | return Database::store_result($result, 'ASSOC'); |
|
| 555 | } |
|
| 556 | ||
| 557 | /** |
|
| 558 | * Set group properties |
|