|
@@ 1548-1598 (lines=51) @@
|
| 1545 |
|
* @author Juan Carlos Raña <[email protected]> |
| 1546 |
|
* @return int current database status of discuss visibility and change it if get action page |
| 1547 |
|
*/ |
| 1548 |
|
public function check_visibility_discuss() |
| 1549 |
|
{ |
| 1550 |
|
$tbl_wiki = $this->tbl_wiki; |
| 1551 |
|
$page = $this->page; |
| 1552 |
|
$condition_session = $this->condition_session; |
| 1553 |
|
$groupfilter = $this->groupfilter; |
| 1554 |
|
$course_id = api_get_course_int_id(); |
| 1555 |
|
|
| 1556 |
|
$sql = 'SELECT * FROM '.$tbl_wiki.' |
| 1557 |
|
WHERE |
| 1558 |
|
c_id = '.$course_id.' AND |
| 1559 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1560 |
|
'.$groupfilter.$condition_session.' |
| 1561 |
|
ORDER BY id ASC'; |
| 1562 |
|
$result = Database::query($sql); |
| 1563 |
|
$row = Database::fetch_array($result); |
| 1564 |
|
|
| 1565 |
|
$status_visibility_disc = $row['visibility_disc']; |
| 1566 |
|
|
| 1567 |
|
//change status |
| 1568 |
|
if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
| 1569 |
|
if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'showdisc' && $status_visibility_disc == 0) { |
| 1570 |
|
$status_visibility_disc = 1; |
| 1571 |
|
} |
| 1572 |
|
if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'hidedisc' && $status_visibility_disc == 1) { |
| 1573 |
|
$status_visibility_disc = 0; |
| 1574 |
|
} |
| 1575 |
|
|
| 1576 |
|
$sql = 'UPDATE '.$tbl_wiki.' SET visibility_disc="'.Database::escape_string($status_visibility_disc).'" |
| 1577 |
|
WHERE |
| 1578 |
|
c_id = '.$course_id.' AND |
| 1579 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1580 |
|
'.$groupfilter.$condition_session; |
| 1581 |
|
Database::query($sql); |
| 1582 |
|
|
| 1583 |
|
// Although the value now is assigned to all (not only the first), |
| 1584 |
|
// these three lines remain necessary. |
| 1585 |
|
// They do that by changing the page state is made when you press |
| 1586 |
|
// the button and not have to wait to change his page |
| 1587 |
|
$sql = 'SELECT * FROM '.$tbl_wiki.' |
| 1588 |
|
WHERE |
| 1589 |
|
c_id = '.$course_id.' AND |
| 1590 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1591 |
|
'.$groupfilter.$condition_session.' |
| 1592 |
|
ORDER BY id ASC'; |
| 1593 |
|
$result = Database::query($sql); |
| 1594 |
|
$row = Database::fetch_array($result); |
| 1595 |
|
} |
| 1596 |
|
|
| 1597 |
|
return $row['visibility_disc']; |
| 1598 |
|
} |
| 1599 |
|
|
| 1600 |
|
/** |
| 1601 |
|
* Lock add discussion |
|
@@ 1605-1656 (lines=52) @@
|
| 1602 |
|
* @author Juan Carlos Raña <[email protected]> |
| 1603 |
|
* @return int current database status of lock dicuss and change if get action |
| 1604 |
|
*/ |
| 1605 |
|
public function check_addlock_discuss() |
| 1606 |
|
{ |
| 1607 |
|
$tbl_wiki = $this->tbl_wiki; |
| 1608 |
|
$page = $this->page; |
| 1609 |
|
$condition_session = $this->condition_session; |
| 1610 |
|
$groupfilter = $this->groupfilter; |
| 1611 |
|
$course_id = api_get_course_int_id(); |
| 1612 |
|
|
| 1613 |
|
$sql = 'SELECT * FROM '.$tbl_wiki.' |
| 1614 |
|
WHERE |
| 1615 |
|
c_id = '.$course_id.' AND |
| 1616 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1617 |
|
'.$groupfilter.$condition_session.' |
| 1618 |
|
ORDER BY id ASC'; |
| 1619 |
|
$result = Database::query($sql); |
| 1620 |
|
$row = Database::fetch_array($result); |
| 1621 |
|
|
| 1622 |
|
$status_addlock_disc = $row['addlock_disc']; |
| 1623 |
|
|
| 1624 |
|
//change status |
| 1625 |
|
if (api_is_allowed_to_edit() || api_is_platform_admin()) { |
| 1626 |
|
if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lockdisc' && $status_addlock_disc == 0) { |
| 1627 |
|
$status_addlock_disc = 1; |
| 1628 |
|
} |
| 1629 |
|
if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlockdisc' && $status_addlock_disc == 1) { |
| 1630 |
|
$status_addlock_disc = 0; |
| 1631 |
|
} |
| 1632 |
|
|
| 1633 |
|
$sql = 'UPDATE '.$tbl_wiki.' SET |
| 1634 |
|
addlock_disc="'.Database::escape_string($status_addlock_disc).'" |
| 1635 |
|
WHERE |
| 1636 |
|
c_id = '.$course_id.' AND |
| 1637 |
|
reflink = "'.Database::escape_string($page).'" AND |
| 1638 |
|
'.$groupfilter.$condition_session; |
| 1639 |
|
Database::query($sql); |
| 1640 |
|
|
| 1641 |
|
// Although the value now is assigned to all (not only the first), |
| 1642 |
|
// these three lines remain necessary. |
| 1643 |
|
// They do that by changing the page state is made when you press |
| 1644 |
|
// the button and not have to wait to change his page |
| 1645 |
|
$sql = 'SELECT * FROM '.$tbl_wiki.' |
| 1646 |
|
WHERE |
| 1647 |
|
c_id = '.$course_id.' AND |
| 1648 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1649 |
|
'.$groupfilter.$condition_session.' |
| 1650 |
|
ORDER BY id ASC'; |
| 1651 |
|
$result = Database::query($sql); |
| 1652 |
|
$row = Database::fetch_array($result); |
| 1653 |
|
} |
| 1654 |
|
|
| 1655 |
|
return $row['addlock_disc']; |
| 1656 |
|
} |
| 1657 |
|
|
| 1658 |
|
/** |
| 1659 |
|
* Lock rating discussion |
|
@@ 1663-1714 (lines=52) @@
|
| 1660 |
|
* @author Juan Carlos Raña <[email protected]> |
| 1661 |
|
* @return int current database status of rating discuss and change it if get action |
| 1662 |
|
*/ |
| 1663 |
|
public function check_ratinglock_discuss() |
| 1664 |
|
{ |
| 1665 |
|
$tbl_wiki = $this->tbl_wiki; |
| 1666 |
|
$page = $this->page; |
| 1667 |
|
$condition_session = $this->condition_session; |
| 1668 |
|
$groupfilter = $this->groupfilter; |
| 1669 |
|
$course_id = api_get_course_int_id(); |
| 1670 |
|
|
| 1671 |
|
$sql = 'SELECT * FROM '.$tbl_wiki.' |
| 1672 |
|
WHERE |
| 1673 |
|
c_id = '.$course_id.' AND |
| 1674 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1675 |
|
'.$groupfilter.$condition_session.' |
| 1676 |
|
ORDER BY id ASC'; |
| 1677 |
|
$result = Database::query($sql); |
| 1678 |
|
$row = Database::fetch_array($result); |
| 1679 |
|
$status_ratinglock_disc = $row['ratinglock_disc']; |
| 1680 |
|
|
| 1681 |
|
//change status |
| 1682 |
|
if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
| 1683 |
|
if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lockrating' && $status_ratinglock_disc == 0) { |
| 1684 |
|
$status_ratinglock_disc = 1; |
| 1685 |
|
} |
| 1686 |
|
if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlockrating' && $status_ratinglock_disc == 1) { |
| 1687 |
|
$status_ratinglock_disc = 0; |
| 1688 |
|
} |
| 1689 |
|
|
| 1690 |
|
$sql = 'UPDATE '.$tbl_wiki.' |
| 1691 |
|
SET ratinglock_disc="'.Database::escape_string($status_ratinglock_disc).'" |
| 1692 |
|
WHERE |
| 1693 |
|
c_id = '.$course_id.' AND |
| 1694 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1695 |
|
'.$groupfilter.$condition_session; |
| 1696 |
|
//Visibility. Value to all,not only for the first |
| 1697 |
|
Database::query($sql); |
| 1698 |
|
|
| 1699 |
|
// Although the value now is assigned to all (not only the first), |
| 1700 |
|
// these three lines remain necessary. They do that by changing the |
| 1701 |
|
// page state is made when you press the button and not have to wait |
| 1702 |
|
// to change his page |
| 1703 |
|
$sql = 'SELECT * FROM '.$tbl_wiki.' |
| 1704 |
|
WHERE |
| 1705 |
|
c_id = '.$course_id.' AND |
| 1706 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1707 |
|
'.$groupfilter.$condition_session.' |
| 1708 |
|
ORDER BY id ASC'; |
| 1709 |
|
$result = Database::query($sql); |
| 1710 |
|
$row = Database::fetch_array($result); |
| 1711 |
|
} |
| 1712 |
|
|
| 1713 |
|
return $row['ratinglock_disc']; |
| 1714 |
|
} |
| 1715 |
|
|
| 1716 |
|
/** |
| 1717 |
|
* Notify page changes |