@@ 1590-1623 (lines=34) @@ | ||
1587 | * @param integer Item ID |
|
1588 | * @return array A list of all the "brother items" (or an empty array on failure) |
|
1589 | */ |
|
1590 | public function get_brother_chapters($id) |
|
1591 | { |
|
1592 | $course_id = api_get_course_int_id(); |
|
1593 | if ($this->debug > 0) { |
|
1594 | error_log('New LP - In learnpath::get_brother_chapters()', 0); |
|
1595 | } |
|
1596 | ||
1597 | if (empty($id)|| $id != strval(intval($id))) { |
|
1598 | return array (); |
|
1599 | } |
|
1600 | ||
1601 | $lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
|
1602 | $sql_parent = "SELECT * FROM $lp_item |
|
1603 | WHERE c_id = ".$course_id." AND id = $id AND item_type='dokeos_chapter'"; |
|
1604 | $res_parent = Database::query($sql_parent); |
|
1605 | if (Database :: num_rows($res_parent) > 0) { |
|
1606 | $row_parent = Database :: fetch_array($res_parent); |
|
1607 | $parent = $row_parent['parent_item_id']; |
|
1608 | $sql_bros = "SELECT * FROM $lp_item |
|
1609 | WHERE |
|
1610 | c_id = ".$course_id." AND |
|
1611 | parent_item_id = $parent AND |
|
1612 | id = $id AND |
|
1613 | item_type='dokeos_chapter' |
|
1614 | ORDER BY display_order"; |
|
1615 | $res_bros = Database::query($sql_bros); |
|
1616 | $list = array (); |
|
1617 | while ($row_bro = Database :: fetch_array($res_bros)) { |
|
1618 | $list[] = $row_bro; |
|
1619 | } |
|
1620 | return $list; |
|
1621 | } |
|
1622 | return array (); |
|
1623 | } |
|
1624 | ||
1625 | /** |
|
1626 | * Gets all the items belonging to the same parent as the item given |
|
@@ 1631-1658 (lines=28) @@ | ||
1628 | * @param integer Item ID |
|
1629 | * @return array A list of all the "brother items" (or an empty array on failure) |
|
1630 | */ |
|
1631 | public function get_brother_items($id) |
|
1632 | { |
|
1633 | $course_id = api_get_course_int_id(); |
|
1634 | if ($this->debug > 0) { |
|
1635 | error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0); |
|
1636 | } |
|
1637 | ||
1638 | if (empty ($id) || $id != strval(intval($id))) { |
|
1639 | return array (); |
|
1640 | } |
|
1641 | ||
1642 | $lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
|
1643 | $sql_parent = "SELECT * FROM $lp_item WHERE c_id = $course_id AND id = $id"; |
|
1644 | $res_parent = Database::query($sql_parent); |
|
1645 | if (Database :: num_rows($res_parent) > 0) { |
|
1646 | $row_parent = Database :: fetch_array($res_parent); |
|
1647 | $parent = $row_parent['parent_item_id']; |
|
1648 | $sql_bros = "SELECT * FROM $lp_item WHERE c_id = ".$course_id." AND parent_item_id = $parent |
|
1649 | ORDER BY display_order"; |
|
1650 | $res_bros = Database::query($sql_bros); |
|
1651 | $list = array (); |
|
1652 | while ($row_bro = Database :: fetch_array($res_bros)) { |
|
1653 | $list[] = $row_bro; |
|
1654 | } |
|
1655 | return $list; |
|
1656 | } |
|
1657 | return array (); |
|
1658 | } |
|
1659 | ||
1660 | /** |
|
1661 | * Get the specific prefix index terms of this learning path |