Replacing deprecated function is_allowed_to_edit() with api_is_allowed_to_edit()

skala
Julio Montoya 14 years ago
parent 4a2d11e4c4
commit 15ac06c527
  1. 12
      main/newscorm/learnpath_functions.inc.php
  2. 2
      main/newscorm/resourcelinker.inc.php
  3. 19
      main/newscorm/resourcelinker.php
  4. 2
      main/resourcelinker/resourcelinker.inc.php
  5. 14
      main/resourcelinker/resourcelinker.php

@ -409,7 +409,7 @@ function display_learnpath_chapters($parent_item_id = 0, $tree = array (), $leve
echo ">".$row['prerequisite']."</td>\n";
// Showing the edit, delete and move icons.
if (is_allowed_to_edit()) {
if (api_is_allowed_to_edit()) {
$myaction = 'move_item';
if ($i < $num_modules) {
// If we are still under the number of chapters in this section, show "move down".
@ -464,7 +464,7 @@ function display_learnpath_chapters($parent_item_id = 0, $tree = array (), $leve
echo "<td>";
}
if (is_allowed_to_edit()) {
if (api_is_allowed_to_edit()) {
if ($row_items['prerequisite'] != '') {
$prereq = $row_items['prerequisite'];
@ -552,7 +552,7 @@ function display_all_learnpath() {
echo "</b><br /><i><div class=text align=justify>{$row['learnpath_description']}</div></i></td>";
// Showing the edit, delete and publish icons.
if (is_allowed_to_edit()) {
if (api_is_allowed_to_edit()) {
echo "<td bgcolor=\"$color2\" align=center><a href='learnpath_handler.php?lp_id={$row['lp_id']}&action=add&type=learnpathcategory'&SQMSESSID=36812c2dea7d8d6e708d5e6a2f09b0b9><img src='../img/0.gif' width='13' height='13' border='0' title='$lang_add_learnpath_chapter_to_path'></a></td>";
echo "<td bgcolor=\"$color2\" align=center><a href='".api_get_self()."?action=editpath&id=".$row['lp_id']."'&SQMSESSID=36812c2dea7d8d6e708d5e6a2f09b0b9><img src=\"../img/edit.gif\" border=\"0\" title=\"$lang_edit_learnpath\"></a></td>";
echo "<td bgcolor=\"$color2\" align=center><a href='".api_get_self()."?action=deletepath&id=".$row['lp_id']."'&SQMSESSID=36812c2dea7d8d6e708d5e6a2f09b0b9><img src=\"../img/delete.gif\" border=\"0\" title=\"$lang_delete_learnpath\" onclick=\"javascript: return confirmation('".$row['learnpath_name']."');\"></a></td>";
@ -590,7 +590,7 @@ function display_learnpath_items($categoryid) {
$result_items = Database::query($sql_items);
$number_items = Database::num_rows($result_items);
$i = 1;
error_log('Selected item under '.$categoryid, 0);
//error_log('Selected item under '.$categoryid, 0);
while ($row_items = Database::fetch_array($result_items)) {
echo "<tr><td colspan='2' valign='top'>";
@ -605,8 +605,8 @@ function display_learnpath_items($categoryid) {
echo "<td>";
}
if (is_allowed_to_edit()) {
error_log('Is allowed to edit item'.$row_items['id'], 0);
if (api_is_allowed_to_edit()) {
//error_log('Is allowed to edit item'.$row_items['id'], 0);
// TODO: Fix by adding true prerequisites parsing (and cycle through).
// Over simplification here, we transform prereq_id field into prerequisite field.
if ($row_items['prerequisite'] != '') {

@ -68,7 +68,7 @@ function show_documents($folder) {
// Documents are a special case: The teacher can add an invisible document (it will be viewable by the user)
// other tools do not have this feature.
if (is_allowed_to_edit()) {
if (api_is_allowed_to_edit()) {
$visibility = "ip.visibility<>'2'";
} else {
$visibility = "ip.visibility='1'";

@ -480,55 +480,50 @@ while ($row=Database::fetch_array($result_select_active)) {
<td width="26%"><b><?php echo get_lang('CourseResources'); ?></b></td>
</tr>
<?php
if (is_allowed_to_edit() || in_array(TOOL_DOCUMENT, $active_modules)) {
if (api_is_allowed_to_edit() || in_array(TOOL_DOCUMENT, $active_modules)) {
?>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Document&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Documents')."</a>"; ?></td>
</tr>
<?php
}
if (is_allowed_to_edit() || in_array(TOOL_CALENDAR_EVENT, $active_modules)) {
if (api_is_allowed_to_edit() || in_array(TOOL_CALENDAR_EVENT, $active_modules)) {
?>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Agenda&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Agenda')."</a>"; ?></td>
</tr>
<?php
}
if (is_allowed_to_edit() || in_array(TOOL_ANNOUNCEMENT, $active_modules)) {
if (api_is_allowed_to_edit() || in_array(TOOL_ANNOUNCEMENT, $active_modules)) {
?>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Ad_Valvas&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('AdValvas')."</a>"; ?></td>
</tr>
<?php
}
if (is_allowed_to_edit() || in_array(TOOL_BB_FORUM, $active_modules)) {
if (api_is_allowed_to_edit() || in_array(TOOL_BB_FORUM, $active_modules)) {
?>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Forum&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Forum')."</a>"; ?></td>
</tr>
<?php
}
if (is_allowed_to_edit() || in_array(TOOL_LINK, $active_modules)) {
if (api_is_allowed_to_edit() || in_array(TOOL_LINK, $active_modules)) {
?>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Link&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Links')."</a>"; ?></td>
</tr>
<?php
}
if (is_allowed_to_edit() || in_array(TOOL_QUIZ, $active_modules)) {
if (api_is_allowed_to_edit() || in_array(TOOL_QUIZ, $active_modules)) {
?>
<tr>
<td><?php echo "<a href=\"".api_get_self()."?content=Exercise&action=$action&id=$id&lp_id=$learnpath_id&parent_item_id=$chapter_id&source_forum=$source_forum&originalresource=no\">".get_lang('Exercise')."</a>"; ?></td>
</tr>
<?php
}
} else {
?>
<!--tr>
<td width="26%"><b><?php echo get_lang('ExportableCourseResources'); ?></b></td>
</tr-->
@ -686,7 +681,7 @@ if ($content == 'chapter') {
// 2. we come to the resource linker for the first time (documents = default). In this case it can only be shown if
// a. one is a teacher (documents can be shown even if the tool is inactive)
// b. one is a student AND the documents tool is active. Student cannot add documents if the documents tool is inactive (teacher can do this)
if ($content == 'Document' || (empty($content) && (is_allowed_to_edit() || in_array(TOOL_DOCUMENT, $active_modules))) && !$_GET['showresources']) {
if ($content == 'Document' || (empty($content) && (api_is_allowed_to_edit() || in_array(TOOL_DOCUMENT, $active_modules))) && !$_GET['showresources']) {
// setting variables for file locations
$baseServDir = $_configuration['root_sys'];
$courseDir = $_course['path'].'/document';

@ -72,7 +72,7 @@ function show_documents($folder)
// documents are a special case: the teacher can add an invisible document (it will be viewable by the user)
// other tools do not have this feature. This only counts
if (is_allowed_to_edit())
if (api_is_allowed_to_edit())
{
$visibility="ip.visibility<>'2'";
}

@ -435,7 +435,7 @@ while ($row=Database::fetch_array($result_select_active))
<td width="26%"><b><?php echo get_lang('CourseResources'); ?></b></td>
</tr>
<?php
if (is_allowed_to_edit() OR in_array(TOOL_DOCUMENT,$active_modules))
if (api_is_allowed_to_edit() OR in_array(TOOL_DOCUMENT,$active_modules))
{
?>
<tr>
@ -443,7 +443,7 @@ while ($row=Database::fetch_array($result_select_active))
</tr>
<?php
}
if (is_allowed_to_edit() OR in_array(TOOL_CALENDAR_EVENT,$active_modules))
if (api_is_allowed_to_edit() OR in_array(TOOL_CALENDAR_EVENT,$active_modules))
{
?>
<tr>
@ -451,7 +451,7 @@ while ($row=Database::fetch_array($result_select_active))
</tr>
<?php
}
if (is_allowed_to_edit() OR in_array(TOOL_ANNOUNCEMENT,$active_modules))
if (api_is_allowed_to_edit() OR in_array(TOOL_ANNOUNCEMENT,$active_modules))
{
?>
<tr>
@ -459,7 +459,7 @@ while ($row=Database::fetch_array($result_select_active))
</tr>
<?php
}
if (is_allowed_to_edit() OR in_array(TOOL_BB_FORUM,$active_modules))
if (api_is_allowed_to_edit() OR in_array(TOOL_BB_FORUM,$active_modules))
{
?>
<tr>
@ -467,7 +467,7 @@ while ($row=Database::fetch_array($result_select_active))
</tr>
<?php
}
if (is_allowed_to_edit() OR in_array(TOOL_LINK,$active_modules))
if (api_is_allowed_to_edit() OR in_array(TOOL_LINK,$active_modules))
{
?>
<tr>
@ -475,7 +475,7 @@ while ($row=Database::fetch_array($result_select_active))
</tr>
<?php
}
if (is_allowed_to_edit() OR in_array(TOOL_QUIZ,$active_modules))
if (api_is_allowed_to_edit() OR in_array(TOOL_QUIZ,$active_modules))
{
?>
<tr>
@ -665,7 +665,7 @@ if ($content == "chapter")
// 2. we come to the resource linker for the first time (documents = default). In this case it can only be shown if
// a. one is a teacher (documents can be shown even if the tool is inactive)
// b. one is a student AND the documents tool is active. Student cannot add documents if the documents tool is inactive (teacher can do this)
if ($content == "Document" OR (empty($content) AND (is_allowed_to_edit() OR in_array(TOOL_DOCUMENT,$active_modules))) AND !$_GET['showresources'])
if ($content == "Document" OR (empty($content) AND (api_is_allowed_to_edit() OR in_array(TOOL_DOCUMENT,$active_modules))) AND !$_GET['showresources'])
{
// setting variables for file locations
$baseServDir = $_configuration['root_sys'];

Loading…
Cancel
Save