|
@@ 1404-1454 (lines=51) @@
|
| 1401 |
|
* @author Juan Carlos Raña <[email protected]> |
| 1402 |
|
* @return int current database status of discuss visibility and change it if get action page |
| 1403 |
|
*/ |
| 1404 |
|
public function check_visibility_discuss() |
| 1405 |
|
{ |
| 1406 |
|
$tbl_wiki = $this->tbl_wiki; |
| 1407 |
|
$page = $this->page; |
| 1408 |
|
$condition_session = $this->condition_session; |
| 1409 |
|
$groupfilter = $this->groupfilter; |
| 1410 |
|
$course_id = api_get_course_int_id(); |
| 1411 |
|
|
| 1412 |
|
$sql = 'SELECT * FROM '.$tbl_wiki.' |
| 1413 |
|
WHERE |
| 1414 |
|
c_id = '.$course_id.' AND |
| 1415 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1416 |
|
'.$groupfilter.$condition_session.' |
| 1417 |
|
ORDER BY id ASC'; |
| 1418 |
|
$result = Database::query($sql); |
| 1419 |
|
$row = Database::fetch_array($result); |
| 1420 |
|
|
| 1421 |
|
$status_visibility_disc = $row['visibility_disc']; |
| 1422 |
|
|
| 1423 |
|
//change status |
| 1424 |
|
if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
| 1425 |
|
if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'showdisc' && $status_visibility_disc == 0) { |
| 1426 |
|
$status_visibility_disc = 1; |
| 1427 |
|
} |
| 1428 |
|
if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'hidedisc' && $status_visibility_disc == 1) { |
| 1429 |
|
$status_visibility_disc = 0; |
| 1430 |
|
} |
| 1431 |
|
|
| 1432 |
|
$sql = 'UPDATE '.$tbl_wiki.' SET visibility_disc="'.Database::escape_string($status_visibility_disc).'" |
| 1433 |
|
WHERE |
| 1434 |
|
c_id = '.$course_id.' AND |
| 1435 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1436 |
|
'.$groupfilter.$condition_session; |
| 1437 |
|
Database::query($sql); |
| 1438 |
|
|
| 1439 |
|
// Although the value now is assigned to all (not only the first), |
| 1440 |
|
// these three lines remain necessary. |
| 1441 |
|
// They do that by changing the page state is made when you press |
| 1442 |
|
// the button and not have to wait to change his page |
| 1443 |
|
$sql = 'SELECT * FROM '.$tbl_wiki.' |
| 1444 |
|
WHERE |
| 1445 |
|
c_id = '.$course_id.' AND |
| 1446 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1447 |
|
'.$groupfilter.$condition_session.' |
| 1448 |
|
ORDER BY id ASC'; |
| 1449 |
|
$result = Database::query($sql); |
| 1450 |
|
$row = Database::fetch_array($result); |
| 1451 |
|
} |
| 1452 |
|
|
| 1453 |
|
return $row['visibility_disc']; |
| 1454 |
|
} |
| 1455 |
|
|
| 1456 |
|
/** |
| 1457 |
|
* Lock add discussion |
|
@@ 1461-1512 (lines=52) @@
|
| 1458 |
|
* @author Juan Carlos Raña <[email protected]> |
| 1459 |
|
* @return int current database status of lock dicuss and change if get action |
| 1460 |
|
*/ |
| 1461 |
|
public function check_addlock_discuss() |
| 1462 |
|
{ |
| 1463 |
|
$tbl_wiki = $this->tbl_wiki; |
| 1464 |
|
$page = $this->page; |
| 1465 |
|
$condition_session = $this->condition_session; |
| 1466 |
|
$groupfilter = $this->groupfilter; |
| 1467 |
|
$course_id = api_get_course_int_id(); |
| 1468 |
|
|
| 1469 |
|
$sql = 'SELECT * FROM '.$tbl_wiki.' |
| 1470 |
|
WHERE |
| 1471 |
|
c_id = '.$course_id.' AND |
| 1472 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1473 |
|
'.$groupfilter.$condition_session.' |
| 1474 |
|
ORDER BY id ASC'; |
| 1475 |
|
$result = Database::query($sql); |
| 1476 |
|
$row = Database::fetch_array($result); |
| 1477 |
|
|
| 1478 |
|
$status_addlock_disc = $row['addlock_disc']; |
| 1479 |
|
|
| 1480 |
|
//change status |
| 1481 |
|
if (api_is_allowed_to_edit() || api_is_platform_admin()) { |
| 1482 |
|
if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lockdisc' && $status_addlock_disc == 0) { |
| 1483 |
|
$status_addlock_disc = 1; |
| 1484 |
|
} |
| 1485 |
|
if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlockdisc' && $status_addlock_disc == 1) { |
| 1486 |
|
$status_addlock_disc = 0; |
| 1487 |
|
} |
| 1488 |
|
|
| 1489 |
|
$sql = 'UPDATE '.$tbl_wiki.' SET |
| 1490 |
|
addlock_disc="'.Database::escape_string($status_addlock_disc).'" |
| 1491 |
|
WHERE |
| 1492 |
|
c_id = '.$course_id.' AND |
| 1493 |
|
reflink = "'.Database::escape_string($page).'" AND |
| 1494 |
|
'.$groupfilter.$condition_session; |
| 1495 |
|
Database::query($sql); |
| 1496 |
|
|
| 1497 |
|
// Although the value now is assigned to all (not only the first), |
| 1498 |
|
// these three lines remain necessary. |
| 1499 |
|
// They do that by changing the page state is made when you press |
| 1500 |
|
// the button and not have to wait to change his page |
| 1501 |
|
$sql = 'SELECT * FROM '.$tbl_wiki.' |
| 1502 |
|
WHERE |
| 1503 |
|
c_id = '.$course_id.' AND |
| 1504 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1505 |
|
'.$groupfilter.$condition_session.' |
| 1506 |
|
ORDER BY id ASC'; |
| 1507 |
|
$result = Database::query($sql); |
| 1508 |
|
$row = Database::fetch_array($result); |
| 1509 |
|
} |
| 1510 |
|
|
| 1511 |
|
return $row['addlock_disc']; |
| 1512 |
|
} |
| 1513 |
|
|
| 1514 |
|
/** |
| 1515 |
|
* Lock rating discussion |
|
@@ 1519-1570 (lines=52) @@
|
| 1516 |
|
* @author Juan Carlos Raña <[email protected]> |
| 1517 |
|
* @return int current database status of rating discuss and change it if get action |
| 1518 |
|
*/ |
| 1519 |
|
public function check_ratinglock_discuss() |
| 1520 |
|
{ |
| 1521 |
|
$tbl_wiki = $this->tbl_wiki; |
| 1522 |
|
$page = $this->page; |
| 1523 |
|
$condition_session = $this->condition_session; |
| 1524 |
|
$groupfilter = $this->groupfilter; |
| 1525 |
|
$course_id = api_get_course_int_id(); |
| 1526 |
|
|
| 1527 |
|
$sql = 'SELECT * FROM '.$tbl_wiki.' |
| 1528 |
|
WHERE |
| 1529 |
|
c_id = '.$course_id.' AND |
| 1530 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1531 |
|
'.$groupfilter.$condition_session.' |
| 1532 |
|
ORDER BY id ASC'; |
| 1533 |
|
$result = Database::query($sql); |
| 1534 |
|
$row = Database::fetch_array($result); |
| 1535 |
|
$status_ratinglock_disc = $row['ratinglock_disc']; |
| 1536 |
|
|
| 1537 |
|
//change status |
| 1538 |
|
if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
| 1539 |
|
if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lockrating' && $status_ratinglock_disc == 0) { |
| 1540 |
|
$status_ratinglock_disc = 1; |
| 1541 |
|
} |
| 1542 |
|
if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlockrating' && $status_ratinglock_disc == 1) { |
| 1543 |
|
$status_ratinglock_disc = 0; |
| 1544 |
|
} |
| 1545 |
|
|
| 1546 |
|
$sql = 'UPDATE '.$tbl_wiki.' |
| 1547 |
|
SET ratinglock_disc="'.Database::escape_string($status_ratinglock_disc).'" |
| 1548 |
|
WHERE |
| 1549 |
|
c_id = '.$course_id.' AND |
| 1550 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1551 |
|
'.$groupfilter.$condition_session; |
| 1552 |
|
//Visibility. Value to all,not only for the first |
| 1553 |
|
Database::query($sql); |
| 1554 |
|
|
| 1555 |
|
// Although the value now is assigned to all (not only the first), |
| 1556 |
|
// these three lines remain necessary. They do that by changing the |
| 1557 |
|
// page state is made when you press the button and not have to wait |
| 1558 |
|
// to change his page |
| 1559 |
|
$sql = 'SELECT * FROM '.$tbl_wiki.' |
| 1560 |
|
WHERE |
| 1561 |
|
c_id = '.$course_id.' AND |
| 1562 |
|
reflink="'.Database::escape_string($page).'" AND |
| 1563 |
|
'.$groupfilter.$condition_session.' |
| 1564 |
|
ORDER BY id ASC'; |
| 1565 |
|
$result = Database::query($sql); |
| 1566 |
|
$row = Database::fetch_array($result); |
| 1567 |
|
} |
| 1568 |
|
|
| 1569 |
|
return $row['ratinglock_disc']; |
| 1570 |
|
} |
| 1571 |
|
|
| 1572 |
|
/** |
| 1573 |
|
* Notify page changes |