[svn r18261] Logic changes - Implemented Add to calendar an assignment with the date when it is completely closed, also when you remove it from assignment tool, it's removed into calendar too, the same case when it's edited - see FS#3583
<li>Added Removed buggy audio recorder and added new MP3 player with easy upload (FS#3515)</li>
<li>Improved Survey export (SVN#17927)</li>
<li>Students can now view their uploaded works in Work tool (FS#3486)</li>
<li>Implemented add to calendar an assignment with the date when it is completely closed, also when you remove it from assignment tool, it's removed into calendar too, the same case when it's edited, for that I had to change the value of add_calendar field into student_publication_assignment table, now when it's sent to calendar this value is the id into calendar_event table, instead this value is 0.</li>
/* For licensing terms, see /dokeos_license.txt */
/**
* @package dokeos.work
@ -6,7 +6,7 @@
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University - ability for course admins to specify wether uploaded documents are visible or invisible by default.
* @author Roan Embrechts, code refactoring and virtual course support
$sql = api_sql_query('SELECT * FROM '.Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT).' WHERE id = '."'".$row['has_properties']."'".' LIMIT 1',__FILE__,__LINE__);
$sql = api_sql_query('SELECT * FROM '.$work_assigment.' WHERE id = '."'".$row['has_properties']."'".' LIMIT 1',__FILE__,__LINE__);
$homework = mysql_fetch_array($sql);
}
@ -469,33 +470,34 @@ function display_student_publications_list($work_dir,$sub_course_dir,$currentCou
$sql_add_publication = "UPDATE ".Database :: get_course_table(TABLE_STUDENT_PUBLICATION)." SET has_properties = '".$row['has_properties']. "', view_properties=1 where id ='".$row['id']."'";
$sql_add_publication = "UPDATE ".$work_table." SET has_properties = '".$row['has_properties']. "', view_properties=1 where id ='".$row['id']."'";
api_sql_query('UPDATE '.Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT).$expires_query.$ends_query.' WHERE id = '."'".$row['has_properties']."'",__FILE__,__LINE__);
api_sql_query('UPDATE '.$work_assigment.$expires_query.$ends_query.' WHERE id = '."'".$row['has_properties']."'",__FILE__,__LINE__);
} else if($row['view_properties']=='0') {
if ($_POST['enableExpiryDate']=='1') {
$expires_query= ' SET expires_on = '."'".(($there_is_a_expire_date == true)?get_date_from_group('expires'):'0000-00-00 00:00:00')."'";
api_sql_query('UPDATE '.Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT).$expires_query.' WHERE id = '."'".$row['has_properties']."'",__FILE__,__LINE__);
$sql_add_publication = "UPDATE ".Database :: get_course_table(TABLE_STUDENT_PUBLICATION)." SET has_properties = '".$row['has_properties']. "', view_properties=1 where id ='".$row['id']."'";
api_sql_query('UPDATE '.$work_assigment.$expires_query.' WHERE id = '."'".$row['has_properties']."'",__FILE__,__LINE__);
$sql_add_publication = "UPDATE ".$work_table." SET has_properties = '".$row['has_properties']. "', view_properties=1 where id ='".$row['id']."'";
api_sql_query('UPDATE '.Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT).$ends_query.' WHERE id = '."'".$row['has_properties']."'",__FILE__,__LINE__);
$sql_add_publication = "UPDATE ".Database :: get_course_table(TABLE_STUDENT_PUBLICATION)." SET has_properties = '".$row['has_properties']. "', view_properties=1 where id ='".$row['id']."'";
api_sql_query('UPDATE '.$work_assigment.$ends_query.' WHERE id = '."'".$row['has_properties']."'",__FILE__,__LINE__);
$sql_add_publication = "UPDATE ".$work_table." SET has_properties = '".$row['has_properties']. "', view_properties=1 where id ='".$row['id']."'";
api_sql_query('UPDATE '.Database :: get_course_table(TABLE_STUDENT_PUBLICATION).' SET description = '."'".Database::escape_string($_POST['description'])."'".', qualification = '."'".Database::escape_string($_POST['qualification']['qualification'])."'".' WHERE id = '."'".$row['id']."'",__FILE__,__LINE__);
api_sql_query('UPDATE '.$work_table.' SET description = '."'".Database::escape_string($_POST['description'])."'".', qualification = '."'".Database::escape_string($_POST['qualification']['qualification'])."'".' WHERE id = '."'".$row['id']."'",__FILE__,__LINE__);
//api_sql_query('UPDATE '.Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK).' SET weight = '."'".Database::escape_string($_POST['qualification']['qualification'])."'".' WHERE course_code = '."'".api_get_course_id()."'".' AND ref_id = '."'".$row['id']."'".'',__FILE__,__LINE__);
@ -506,6 +508,22 @@ function display_student_publications_list($work_dir,$sub_course_dir,$currentCou
$mydir = $my_sub_dir.$dir_name;
$dir = $dir_name;
$display_edit_form=false;
// gets calendar_id from student_publication_assigment
$sql = "SELECT add_to_calendar FROM $work_assigment WHERE publication_id ='".$row['id']."'";
$res = api_sql_query($sql,__FILE__,__LINE__);
$calendar_id = Database::fetch_row($res);
// update from agenda if it exists
if (!empty($calendar_id[0])) {
$sql = "UPDATE ".$TABLEAGENDA."
SET title='".$dir_name."',
content = '".$dir_name."',
end_date='".get_date_from_group('ends')."'
WHERE id='".$calendar_id[0]."'";
api_sql_query($sql,__FILE__,__LINE__);
}
}
}
}
@ -1203,13 +1221,11 @@ function to_javascript_work() {
/* For licensing terms, see /dokeos_license.txt */
/**
* @package dokeos.work
@ -6,7 +6,7 @@
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University - ability for course admins to specify wether uploaded documents are visible or invisible by default.
* @author Roan Embrechts, code refactoring and virtual course support