$sql = "SELECT * FROM $table_class WHERE id='".$class_id."'";
$res = Database::query($sql, __FILE__, __LINE__);
return mysql_fetch_array($res, MYSQL_ASSOC);
return Database::fetch_array($res, 'ASSOC');
}
/**
* Change the name of a class
@ -111,7 +111,7 @@ class ClassManager
$sql = "SELECT * FROM $table_class_user cu, $table_user u WHERE cu.class_id = '".$class_id."' AND cu.user_id = u.user_id";
$res = Database::query($sql, __FILE__, __LINE__);
$users = array ();
while ($user = mysql_fetch_array($res, MYSQL_ASSOC))
while ($user = Database::fetch_array($res, 'ASSOC'))
{
$users[] = $user;
}
@ -174,7 +174,7 @@ class ClassManager
$sql = "SELECT * FROM $table_class_course cc, $table_course c WHERE cc.class_id = '".$class_id."' AND cc.course_code = c.code";
$res = Database::query($sql, __FILE__, __LINE__);
$courses = array ();
while ($course = mysql_fetch_array($res, MYSQL_ASSOC))
while ($course = Database::fetch_array($res, 'ASSOC'))
{
$courses[] = $course;
}
@ -253,7 +253,7 @@ class ClassManager
$sql = "SELECT cl.* FROM $table_class cl, $table_course_class cc WHERE cc.course_code = '".mysql_real_escape_string($course_code)."' AND cc.class_id = cl.id";
$res = Database::query($sql, __FILE__, __LINE__);
$classes = array ();
while ($class = mysql_fetch_array($res, MYSQL_ASSOC))
while ($class = Database::fetch_array($res, 'ASSOC'))
//$query="update `$dbTable` set path='$upload_path/$filename',visibility='$default_visibility', filetype='$filetype' where path='$upload_path/$filename'";
$query="update $dbTable set path='$upload_path/$filename',visibility='$default_visibility', filetype='$filetype' where path='$upload_path/$filename'";
@ -940,7 +940,7 @@ function prereqcheck($id_in_path)
//4.a.4 Get the prerequisite item
$sql6 = "SELECT * FROM $tbl_learnpath_item WHERE (id='$id_in_path3')";
$result6 = Database::query($sql6);
$row6 = mysql_fetch_array($result6);
$row6 = Database::fetch_array($result6);
//4.a.5 Get a link to the prerequisite item
$prereqname = display_addedresource_link_in_learnpath($row6['item_type'], $row6['ref'], '', $id_in_path3, 'builder', 'nolink'); //this is the prereq of the step we want to open
@ -986,7 +986,7 @@ function prereqcheck($id_in_path)
$sql_items3 = "SELECT * FROM $tbl_lp_item WHERE parent_item_id='$id_in_path2'";
$result_items3 = Database::query($sql_items3);
$allcompleted = true;
while ($row3 = mysql_fetch_array($result_items3))
while ($row3 = Database::fetch_array($result_items3))
{
//4.b.3 Cycle through items in the prerequisite chapter
//4.b.3.1 Get data ready to use
@ -1002,7 +1002,7 @@ function prereqcheck($id_in_path)
//4.b.3.2 Get user-item relation
$sql_items4 = "SELECT * FROM $tbl_learnpath_user WHERE (learnpath_item_id='$id_in_path4' and user_id=$user_id)";
$result_items4 = Database::query($sql_items4);
$row4 = mysql_fetch_array($result_items4);
$row4 = Database::fetch_array($result_items4);
//4.b.3.3 If any of these elements is not 'completed', the overall completion status is false
if ($row4['status'] != "completed" and $row4['status'] != 'passed')
{
@ -1019,7 +1019,7 @@ function prereqcheck($id_in_path)
//4.b.4.b Something was not completed. Return corresponding message
$sql5 = "SELECT * FROM $tbl_learnpath_chapter WHERE (lp_id='$learnpath_id' and id='$id_in_path2')";
$sql="SELECT * from $document_table, $item_property_table WHERE id=ref AND tool = '".TOOL_DOCUMENT."' AND $visibility AND to_group_id = 0 AND to_user_id IS NULL ORDER BY path ASC";
$result=Database::query($sql,__FILE__,__LINE__);
while ($row=mysql_fetch_array($result))
while ($row=Database::fetch_array($result))
{
if (!$folder)
{
@ -169,7 +169,7 @@ function show_documents($folder)
// echo '<br/>';
// }// if (str_replace($folder.'/','',$conform_folder)!==$folder)
} // else (if (!$folder))
} //while ($row=mysql_fetch_array($result))
} //while ($row=Database::fetch_array($result))
// this is code for the case that we are in a subfolder
if ($good_paths)
@ -282,31 +282,31 @@ function display_addedresource_link($type, $id, $style='')
$result = Database::query("SELECT * FROM `$tbl_posts` posts, `$TBL_FORUMS` forum WHERE forum.forum_id=posts.forum_id and post_id=$id",__FILE__,__LINE__);
$myrow = mysql_fetch_array($result);
$myrow = Database::fetch_array($result);
// grabbing the title of the post
$sql_title = "SELECT * FROM `$tbl_posts_text` WHERE post_id=".$myrow["post_id"];
$sql = "SELECT * FROM ".$tbl_announcement." a, ".$item_property_table." i WHERE i.tool = '".TOOL_ANNOUNCEMENT."' AND a.id=i.ref AND i.visibility='1' AND i.to_group_id = 0 AND i.to_user_id IS NULL ORDER BY a.display_order ASC";
$sql = "SELECT * FROM ".$TBL_FORUMS." forums, ".$TBL_CATAGORIES." categories WHERE forums.forum_category=categories.cat_id ORDER BY forums.forum_category DESC";
$sqlcategories = "SELECT * FROM ".$tbl_categories." ORDER by display_order DESC";
$resultcategories = Database::query($sqlcategories) or die;
while ($myrow = @ mysql_fetch_array($resultcategories))
while ($myrow = @ Database::fetch_array($resultcategories))
{
$sql_links = "SELECT * FROM ".$link_table.", ".$item_property_table." WHERE category_id='".$myrow["id"]."' AND tool = '".TOOL_LINK."' AND id=ref AND visibility='1' ORDER BY display_order DESC";
$query="SELECT t1.user_id,username,picture_uri,t2.status FROM $tbl_user t1,$tbl_course_user t2 WHERE t1.user_id=t2.user_id AND course_code='$_cid' AND (t1.user_id='".$_user['user_id']."' OR t2.status='1')";
@ -505,7 +505,7 @@ function get_roles($content,$id, $scope='course')
//$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";
$sql="SELECT role_id FROM $table WHERE $id_field = '$id' AND scope='".$scope."'";
$sql="SELECT * from $document_table, $item_property_table WHERE id=ref AND tool = '".TOOL_DOCUMENT."' AND $visibility AND to_group_id = 0 AND to_user_id IS NULL ORDER BY path ASC";
$result=Database::query($sql,__FILE__,__LINE__);
while ($row=mysql_fetch_array($result))
while ($row=Database::fetch_array($result))
{
if (!$folder)
{
@ -165,7 +165,7 @@ function show_documents($folder)
// echo '<br/>';
// }// if (str_replace($folder.'/','',$conform_folder)!==$folder)
} // else (if (!$folder))
} //while ($row=mysql_fetch_array($result))
} //while ($row=Database::fetch_array($result))
// this is code for the case that we are in a subfolder
if ($good_paths)
@ -277,31 +277,31 @@ function display_addedresource_link($type, $id, $style='')
$result = Database::query("SELECT * FROM `$tbl_posts` posts, `$TBL_FORUMS` forum WHERE forum.forum_id=posts.forum_id and post_id=$id",__FILE__,__LINE__);
$myrow = mysql_fetch_array($result);
$myrow = Database::fetch_array($result);
// grabbing the title of the post
$sql_title = "SELECT * FROM `$tbl_posts_text` WHERE post_id=".$myrow["post_id"];
$sql = "SELECT * FROM ".$tbl_announcement." a, ".$item_property_table." i WHERE i.tool = '".TOOL_ANNOUNCEMENT."' AND a.id=i.ref AND i.visibility='1' AND i.to_group_id = 0 AND i.to_user_id IS NULL ORDER BY a.display_order ASC";
$sql = "SELECT * FROM ".$tbl_posts." post, ".$tbl_posts_text." post_text WHERE post_text.post_id=post.post_id and post.topic_id=$thread ORDER BY post_text.post_id ASC";
$sqlcategories = "SELECT * FROM ".$tbl_categories." ORDER by display_order DESC";
$resultcategories = Database::query($sqlcategories) or die;
while ($myrow = @ mysql_fetch_array($resultcategories))
while ($myrow = @ Database::fetch_array($resultcategories))
{
$sql_links = "SELECT * FROM ".$link_table.", ".$item_property_table." WHERE category_id='".$myrow["id"]."' AND tool = '".TOOL_LINK."' AND id=ref AND visibility='1' ORDER BY display_order DESC";