Should fix bugs when using gradebook, works and agenda see #3660

skala
Julio Montoya 14 years ago
parent fda65c4e74
commit 8c4aa18a70
  1. 113
      main/calendar/agenda.inc.php
  2. 69
      main/work/work.lib.php
  3. 17
      main/work/work.php

@ -736,23 +736,46 @@ function selectAll(cbList,bSelect,showwarning)
msg_err3 = document.getElementById(\"err_end_date\"); msg_err3 = document.getElementById(\"err_end_date\");
msg_err4 = document.getElementById(\"err_title\"); msg_err4 = document.getElementById(\"err_title\");
var error = false;
if (start_date > ends_date) { if (start_date > ends_date) {
if ($('#empty_end_date').is(':checked')) {
msg_err1.innerHTML=\"\";
msg_err2.innerHTML=\"\";
msg_err3.innerHTML=\"\";
} else {
error = true;
msg_err1.style.display =\"block\"; msg_err1.style.display =\"block\";
msg_err1.innerHTML=\"".get_lang('EndDateCannotBeBeforeTheStartDate')."\"; msg_err1.innerHTML=\"".get_lang('EndDateCannotBeBeforeTheStartDate')."\";
msg_err2.innerHTML=\"\";msg_err3.innerHTML=\"\"; msg_err2.innerHTML=\"\";
} else if (!checkDate(start_month,start_day,start_year)) { msg_err3.innerHTML=\"\";
}
}
if (!checkDate(start_month,start_day,start_year)) {
msg_err2.style.display =\"block\"; msg_err2.style.display =\"block\";
msg_err2.innerHTML=\"".get_lang('InvalidDate')."\"; msg_err2.innerHTML=\"".get_lang('InvalidDate')."\";
msg_err1.innerHTML=\"\";msg_err3.innerHTML=\"\"; msg_err1.innerHTML=\"\";
} else if (!checkDate(ends_month,ends_day,ends_year)) { msg_err3.innerHTML=\"\";
error = true;
}
if (!checkDate(ends_month,ends_day,ends_year)) {
msg_err3.style.display =\"block\"; msg_err3.style.display =\"block\";
msg_err3.innerHTML=\"".get_lang('InvalidDate')."\"; msg_err3.innerHTML=\"".get_lang('InvalidDate')."\";
msg_err1.innerHTML=\"\";msg_err2.innerHTML=\"\"; msg_err1.innerHTML=\"\";msg_err2.innerHTML=\"\";
} else if (document.new_calendar_item.title.value == '') { error = true;
}
if (document.new_calendar_item.title.value == '') {
msg_err4.style.display =\"block\"; msg_err4.style.display =\"block\";
msg_err4.innerHTML=\"".get_lang('FieldRequired')."\"; msg_err4.innerHTML=\"".get_lang('FieldRequired')."\";
msg_err1.innerHTML=\"\";msg_err2.innerHTML=\"\";msg_err3.innerHTML=\"\"; msg_err1.innerHTML=\"\";msg_err2.innerHTML=\"\";msg_err3.innerHTML=\"\";
} else { error = true;
}
if (error == false) {
if (cbList) { if (cbList) {
if (cbList.length < 1) { if (cbList.length < 1) {
if (!confirm(\"".get_lang('Send2All')."\")) { if (!confirm(\"".get_lang('Send2All')."\")) {
@ -765,6 +788,8 @@ function selectAll(cbList,bSelect,showwarning)
document.new_calendar_item.submit(); document.new_calendar_item.submit();
} }
} }
function reverseAll(cbList) function reverseAll(cbList)
@ -1073,12 +1098,17 @@ function store_new_agenda_item() {
$start_date = (int)$_POST['fyear']."-".(int)$_POST['fmonth']."-".(int)$_POST['fday']." ".(int)$_POST['fhour'].":".(int)$_POST['fminute'].":00"; $start_date = (int)$_POST['fyear']."-".(int)$_POST['fmonth']."-".(int)$_POST['fday']." ".(int)$_POST['fhour'].":".(int)$_POST['fminute'].":00";
$end_date = (int)$_POST['end_fyear']."-".(int)$_POST['end_fmonth']."-".(int)$_POST['end_fday']." ".(int)$_POST['end_fhour'].":".(int)$_POST['end_fminute'].":00"; $end_date = (int)$_POST['end_fyear']."-".(int)$_POST['end_fmonth']."-".(int)$_POST['end_fday']." ".(int)$_POST['end_fhour'].":".(int)$_POST['end_fminute'].":00";
$title = Database::escape_string($title); $title = Database::escape_string($title);
$content = Database::escape_string($content); $content = Database::escape_string($content);
$start_date = Database::escape_string($start_date); $start_date = Database::escape_string($start_date);
$end_date = Database::escape_string($end_date); $end_date = Database::escape_string($end_date);
if ($_POST['empty_end_date'] == 1) {
$end_date = "0000-00-00 00:00:00";
}
// store in the table calendar_event // store in the table calendar_event
$sql = "INSERT INTO ".$TABLEAGENDA." (title,content, start_date, end_date) $sql = "INSERT INTO ".$TABLEAGENDA." (title,content, start_date, end_date)
VALUES ('".$title."','".$content."', '".$start_date."','".$end_date."')"; VALUES ('".$title."','".$content."', '".$start_date."','".$end_date."')";
@ -1628,6 +1658,10 @@ function store_edited_agenda_item($id_attach,$file_comment) {
$start_date = api_get_utc_datetime($start_date); $start_date = api_get_utc_datetime($start_date);
$end_date = api_get_utc_datetime($end_date); $end_date = api_get_utc_datetime($end_date);
if ($_POST['empty_end_date'] == 1) {
$end_date = "0000-00-00 00:00:00";
}
// 1.b. the actual saving in calendar_event table // 1.b. the actual saving in calendar_event table
$edit_result = save_edit_agenda_item($id, $title, $content, $start_date, $end_date); $edit_result = save_edit_agenda_item($id, $title, $content, $start_date, $end_date);
@ -2254,20 +2288,27 @@ function show_add_form($id = '') {
//echo "before get_agenda_item".$_SESSION['allow_individual_calendar']; //echo "before get_agenda_item".$_SESSION['allow_individual_calendar'];
$item_2_edit=get_agenda_item($id); $item_2_edit=get_agenda_item($id);
$title = $item_2_edit['title']; $title = $item_2_edit['title'];
$content= $item_2_edit['content']; $content= $item_2_edit['content'];
// start date // start date
if ($item_2_edit['start_date'] != '0000-00-00 00:00:00') {
$item_2_edit['start_date'] = api_get_local_time($item_2_edit['start_date']); $item_2_edit['start_date'] = api_get_local_time($item_2_edit['start_date']);
list($datepart, $timepart) = split(" ", $item_2_edit['start_date']); list($datepart, $timepart) = split(" ", $item_2_edit['start_date']);
list($year, $month, $day) = explode("-", $datepart); list($year, $month, $day) = explode("-", $datepart);
list($hours, $minutes, $seconds) = explode(":", $timepart); list($hours, $minutes, $seconds) = explode(":", $timepart);
}
// end date // end date
if ($item_2_edit['end_date'] != '0000-00-00 00:00:00') {
$item_2_edit['end_date'] = api_get_local_time($item_2_edit['end_date']); $item_2_edit['end_date'] = api_get_local_time($item_2_edit['end_date']);
list($datepart, $timepart) = split(" ", $item_2_edit['end_date']); list($datepart, $timepart) = split(" ", $item_2_edit['end_date']);
list($end_year, $end_month, $end_day) = explode("-", $datepart); list($end_year, $end_month, $end_day) = explode("-", $datepart);
list($end_hours, $end_minutes, $end_seconds) = explode(":", $timepart); list($end_hours, $end_minutes, $end_seconds) = explode(":", $timepart);
}
// attachments // attachments
edit_added_resources("Agenda", $id); edit_added_resources("Agenda", $id);
@ -2319,12 +2360,14 @@ function show_add_form($id = '') {
} }
echo '</div> echo '</div>
</div>'; </div>';
} }
// start date and time // start date and time
echo '<div class="row"> echo '<div class="row">';
<div class="label"> echo '<div class="label">
'.get_lang('StartDate').' '.get_lang('StartDate').'
</div> </div>
<div class="formw"> <div class="formw">
@ -2374,7 +2417,10 @@ function show_add_form($id = '') {
} ?> } ?>
</select> </select>
<a href="javascript:openCalendar('new_calendar_item', 'f')"><?php Display::display_icon('calendar_select.gif', get_lang('Select'), array ('style' => 'vertical-align: middle;')); ?></a> <a href="javascript:openCalendar('new_calendar_item', 'f')">
<?php Display::display_icon('calendar_select.gif', get_lang('Select'), array ('style' => 'vertical-align: middle;')); ?>
</a>
&nbsp;<?php echo get_lang('StartTime').": "; ?>&nbsp; &nbsp;<?php echo get_lang('StartTime').": "; ?>&nbsp;
<select name="fhour" onchange="javascript:document.new_calendar_item.end_fhour.value=this.value;"> <select name="fhour" onchange="javascript:document.new_calendar_item.end_fhour.value=this.value;">
<!-- <option value="--">--</option> --> <!-- <option value="--">--</option> -->
@ -2408,7 +2454,32 @@ function show_add_form($id = '') {
echo ' </div> echo ' </div>
</div>'; </div>';
echo '<div class="row">
<div class="label">
</div><div class="formw">';
echo Display::input('checkbox', 'empty_end_date', 1, array('id'=>'empty_end_date', 'checked'=>"checked")).' '.get_lang('NoEndDate');
echo '</div></div>';
echo '<script>
$(function() {
$("#empty_end_date").click(function(){
if ($("#empty_end_date").is(":checked")) {
$("#end_date_span").hide();
} else {
$("#end_date_span").show();
}
});';
if ($item_2_edit['end_date'] == '0000-00-00 00:00:00') {
echo '$("#end_date_span").hide();';
}
echo '
});
</script>';
// end date and time // end date and time
echo '<span id="end_date_span">';
echo '<div class="row"> echo '<div class="row">
<div class="label"> <div class="label">
'.get_lang('EndDate').' '.get_lang('EndDate').'
@ -2416,7 +2487,8 @@ function show_add_form($id = '') {
<div class="formw"> <div class="formw">
<div id="err_end_date" style="display:none;color:red"></div>'; <div id="err_end_date" style="display:none;color:red"></div>';
?> ?>
<select name="end_fday">
<select id="end_fday" name="end_fday">
<?php <?php
// small loop for filling all the dates // small loop for filling all the dates
// 2do: the available dates should be those of the selected month => february is from 1 to 28 (or 29) and not to 31 // 2do: the available dates should be those of the selected month => february is from 1 to 28 (or 29) and not to 31
@ -2432,7 +2504,7 @@ function show_add_form($id = '') {
}?> }?>
</select> </select>
<!-- month: january -> december --> <!-- month: january -> december -->
<select name="end_fmonth"> <select id="end_fmonth" name="end_fmonth">
<?php <?php
foreach (range(1, 12) as $i) { foreach (range(1, 12) as $i) {
// values have to have double digits // values have to have double digits
@ -2443,7 +2515,7 @@ function show_add_form($id = '') {
{ echo "<option value=\"".$value."\">".$MonthsLong[$i-1]."</option>"; } { echo "<option value=\"".$value."\">".$MonthsLong[$i-1]."</option>"; }
}?> }?>
</select> </select>
<select name="end_fyear"> <select id="end_fyear" name="end_fyear">
<option value="<?php echo ($end_year-1) ?>"><?php echo ($end_year-1) ?></option> <option value="<?php echo ($end_year-1) ?>"><?php echo ($end_year-1) ?></option>
<option value="<?php echo $end_year ?>" selected> <?php echo $end_year ?> </option> <option value="<?php echo $end_year ?>" selected> <?php echo $end_year ?> </option>
<?php <?php
@ -2452,10 +2524,12 @@ function show_add_form($id = '') {
echo "<option value=\"$value\">$value</option>"; echo "<option value=\"$value\">$value</option>";
} ?> } ?>
</select> </select>
<a href="javascript:openCalendar('new_calendar_item', 'end_f')"><?php Display::display_icon('calendar_select.gif', get_lang('Select'), array ('style' => 'vertical-align: middle;')); ?></a> <a href="javascript:openCalendar('new_calendar_item', 'end_f')">
<?php echo Display::span(Display::return_icon('calendar_select.gif', get_lang('Select'), array('style' => 'vertical-align: middle;')), array ('id'=>'end_date_calendar_icon')); ?>
</a>
&nbsp;<?php echo get_lang('EndTime').": "; ?>&nbsp; &nbsp;<?php echo get_lang('EndTime').": "; ?>&nbsp;
<select name="end_fhour"> <select id="end_fhour" name="end_fhour">
<!-- <option value="--">--</option> --> <!-- <option value="--">--</option> -->
<?php <?php
foreach (range(0, 23) as $i) { foreach (range(0, 23) as $i) {
@ -2469,7 +2543,7 @@ function show_add_form($id = '') {
} ?> } ?>
</select> </select>
<select name="end_fminute"> <select id="end_fminute" name="end_fminute">
<!-- <option value="<?php echo $end_minutes; ?>"><?php echo $end_minutes; ?></option> --> <!-- <option value="<?php echo $end_minutes; ?>"><?php echo $end_minutes; ?></option> -->
<!-- <option value="--">--</option> --> <!-- <option value="--">--</option> -->
<?php <?php
@ -2484,9 +2558,10 @@ function show_add_form($id = '') {
} }
} ?> } ?>
</select> </select>
<?php <?php
echo ' </div> echo ' </div>
</div>'; </div> </span>';
// the title of the agenda item // the title of the agenda item
echo ' <div class="row"> echo ' <div class="row">
@ -2641,7 +2716,9 @@ function show_add_form($id = '') {
echo "<option value=\"$value\">$value</option>"; echo "<option value=\"$value\">$value</option>";
} ?> } ?>
</select> </select>
<a href="javascript:openCalendar('new_calendar_item', 'repeat_end_')"><?php Display::display_icon('calendar_select.gif', get_lang('Select'), array ('style' => 'vertical-align: middle;')); ?></a> <a href="javascript:openCalendar('new_calendar_item', 'repeat_end_')">
<?php Display::display_icon('calendar_select.gif', get_lang('Select'), array ('style' => 'vertical-align: middle;')); ?>
</a>
</td> </td>
</tr> </tr>
</table> </table>

@ -492,40 +492,21 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
//$form_folder-> addElement('textarea', 'description', get_lang('Description'), array('rows' => 5, 'cols' => 50)); //$form_folder-> addElement('textarea', 'description', get_lang('Description'), array('rows' => 5, 'cols' => 50));
$form_folder->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'work', 'Width' => '100%', 'Height' => '200')); $form_folder->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'work', 'Width' => '100%', 'Height' => '200'));
$qualification_input[] = FormValidator :: createElement('text','qualification');
$form_folder -> addGroup($qualification_input, 'qualification', get_lang('QualificationNumeric'), 'size="10"');
if ($row['weight'] > 0) {
$weight_input[] = FormValidator :: createElement('text', 'weight');
$form_folder -> addGroup($weight_input, 'weight', get_lang('WeightInTheGradebook'), 'size="10"');
}
$there_is_a_end_date = false;
if ($row['view_properties'] == '1') { if ($row['weight'] > 0) {
if ($homework['expires_on'] != '0000-00-00 00:00:00') {
$homework['expires_on'] = api_get_local_time($homework['expires_on']);
$there_is_a_expire_date = true;
$form_folder -> addGroup(create_group_date_select(), 'expires', get_lang('ExpiresAt'));
}
if ($homework['ends_on'] != '0000-00-00 00:00:00') {
$homework['ends_on'] = api_get_local_time($homework['ends_on']);
$there_is_a_end_date = true;
$form_folder -> addGroup(create_group_date_select(), 'ends', get_lang('EndsAt'));
}
if ($there_is_a_expire_date && $there_is_a_end_date) {
$form_folder -> addRule(array('expires', 'ends'), get_lang('DateExpiredNotBeLessDeadLine'), 'comparedate');
} }
} else { $there_is_a_end_date = false;
$form_folder -> addElement('html', '<div class="row"> $form_folder -> addElement('html', '<div class="row">
<div class="label">&nbsp;</div> <div class="label">&nbsp;</div>
<div class="formw"> <div class="formw">
<a href="javascript://" onclick="javascript: return plus();" ><span id="plus">&nbsp;<img style="vertical-align:middle;" src="../img/div_show.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'</span></a> <a href="javascript://" onclick="javascript: return plus();" ><span id="plus">&nbsp;<img style="vertical-align:middle;" src="../img/div_show.gif" alt="" />&nbsp;'.get_lang('AdvancedParameters').'</span></a>
</div> </div>
</div> '); </div> ');
$form_folder->addElement('html', '<div id="options" style="display: none;">'); $form_folder->addElement('html', '<div id="options" style="display: none;">');
if (empty($default)) { if (empty($default)) {
@ -537,15 +518,31 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
list($d_year, $d_month, $d_day) = split('-', $parts[0]); list($d_year, $d_month, $d_day) = split('-', $parts[0]);
list($d_hour, $d_minute) = split(':', $parts[1]); list($d_hour, $d_minute) = split(':', $parts[1]);
//if ($row['view_properties'] == '1') {
$qualification_input[] = FormValidator :: createElement('text','qualification');
$form_folder -> addGroup($qualification_input, 'qualification', get_lang('QualificationNumeric'), 'size="10"');
if ((int)$row['weight'] == 0) { if ((int)$row['weight'] == 0) {
$form_folder -> addElement('checkbox', 'make_calification', null, get_lang('MakeQualifiable'), 'onclick="javascript: if(this.checked){document.getElementById(\'option3\').style.display = \'block\';}else{document.getElementById(\'option3\').style.display = \'none\';}"'); $form_folder -> addElement('checkbox', 'make_calification', null, get_lang('MakeQualifiable'), 'onclick="javascript: if(this.checked){document.getElementById(\'option3\').style.display = \'block\';}else{document.getElementById(\'option3\').style.display = \'none\';}"');
$form_folder -> addElement('html', '<div id=\'option3\' style="display:none">'); $form_folder -> addElement('html', '<div id=\'option3\' style="display:none">');
$weight_input2[] = FormValidator :: createElement('text', 'weight'); $weight_input2[] = FormValidator :: createElement('text', 'weight');
$form_folder -> addGroup($weight_input2, 'weight', get_lang('WeightInTheGradebook'), 'size="10"'); $form_folder -> addGroup($weight_input2, 'weight', get_lang('WeightInTheGradebook'), 'size="10"');
$form_folder -> addElement('html', '</div>'); $form_folder -> addElement('html', '</div>');
} else {
$weight_input[] = FormValidator :: createElement('text', 'weight');
$form_folder -> addGroup($weight_input, 'weight', get_lang('WeightInTheGradebook'), 'size="10"');
//$form_folder->freeze();
} }
if ($homework['expires_on'] == '0000-00-00 00:00:00') {
if ($homework['expires_on'] != '0000-00-00 00:00:00') {
$homework['expires_on'] = api_get_local_time($homework['expires_on']);
$there_is_a_expire_date = true;
$form_folder -> addGroup(create_group_date_select(), 'expires', get_lang('ExpiresAt'));
} else {
$homework['expires_on'] = api_get_local_time(); $homework['expires_on'] = api_get_local_time();
$there_is_a_expire_date = true; $there_is_a_expire_date = true;
$form_folder -> addElement('checkbox', 'enableExpiryDate',null,get_lang('EnableExpiryDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option1\').style.display = \'block\';}else{document.getElementById(\'option1\').style.display = \'none\';}"'); $form_folder -> addElement('checkbox', 'enableExpiryDate',null,get_lang('EnableExpiryDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option1\').style.display = \'block\';}else{document.getElementById(\'option1\').style.display = \'none\';}"');
@ -553,19 +550,29 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
$form_folder -> addGroup(create_group_date_select(), 'expires', get_lang('ExpiresAt')); $form_folder -> addGroup(create_group_date_select(), 'expires', get_lang('ExpiresAt'));
$form_folder -> addElement('html', '</div>'); $form_folder -> addElement('html', '</div>');
} }
if ($homework['ends_on'] == '0000-00-00 00:00:00') {
if ($homework['ends_on'] != '0000-00-00 00:00:00') {
$homework['ends_on'] = api_get_local_time($homework['ends_on']);
$there_is_a_end_date = true;
$form_folder -> addGroup(create_group_date_select(), 'ends', get_lang('EndsAt'));
} else {
$homework['ends_on'] = api_get_local_time(); $homework['ends_on'] = api_get_local_time();
$there_is_a_end_date = true; $there_is_a_end_date = true;
$form_folder -> addElement('checkbox', 'enableEndDate', null, get_lang('EnableEndDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option2\').style.display = \'block\';}else{document.getElementById(\'option2\').style.display = \'none\';}"'); $form_folder -> addElement('checkbox', 'enableEndDate', null, get_lang('EnableEndDate'), 'onclick="javascript: if(this.checked){document.getElementById(\'option2\').style.display = \'block\';}else{document.getElementById(\'option2\').style.display = \'none\';}"');
$form_folder -> addElement('html', '<div id=\'option2\' style="display:none">'); $form_folder -> addElement('html', '<div id=\'option2\' style="display:none">');
$form_folder -> addGroup(create_group_date_select(), 'ends', get_lang('EndsAt')); $form_folder -> addGroup(create_group_date_select(), 'ends', get_lang('EndsAt'));
$form_folder -> addElement('html', '</div>'); $form_folder -> addElement('html', '</div>');
$form_folder -> addRule(array('expires', 'ends'), get_lang('DateExpiredNotBeLessDeadLine'), 'comparedate');
} }
if ($there_is_a_expire_date && $there_is_a_end_date) {
$form_folder -> addRule(array('expires', 'ends'), get_lang('DateExpiredNotBeLessDeadLine'), 'comparedate'); $form_folder -> addRule(array('expires', 'ends'), get_lang('DateExpiredNotBeLessDeadLine'), 'comparedate');
$form_folder -> addElement('html', '</div>');
} }
$form_folder -> addElement('html', '</div>');
$form_folder -> addElement('style_submit_button', 'submit', get_lang('ModifyDirectory'), 'class="save"'); $form_folder -> addElement('style_submit_button', 'submit', get_lang('ModifyDirectory'), 'class="save"');
if ($there_is_a_end_date) { if ($there_is_a_end_date) {
$end_date_array = convert_date_to_array($homework['ends_on'], 'ends'); $end_date_array = convert_date_to_array($homework['ends_on'], 'ends');
@ -655,12 +662,20 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
$sql = "SELECT add_to_calendar FROM $work_assigment WHERE publication_id ='".$row['id']."'"; $sql = "SELECT add_to_calendar FROM $work_assigment WHERE publication_id ='".$row['id']."'";
$res = Database::query($sql); $res = Database::query($sql);
$calendar_id = Database::fetch_row($res); $calendar_id = Database::fetch_row($res);
$dir_name = sprintf(get_lang('HandingOverOfTaskX'), $dir_name);
$end_date = "0000-00-00 00:00:00:";
if ($_POST['enableExpiryDate'] == '1') {
$end_date = get_date_from_group('ends');
}
// update from agenda if it exists // update from agenda if it exists
if (!empty($calendar_id[0])) { if (!empty($calendar_id[0])) {
$sql = "UPDATE ".$TABLEAGENDA." $sql = "UPDATE ".$TABLEAGENDA."
SET title='".$dir_name."', SET title='".$dir_name."',
content = '".$dir_name."', content = '".Database::escape_string($_POST['description'])."',
end_date='".get_date_from_group('ends')."' end_date = '".$end_date."'
WHERE id='".$calendar_id[0]."'"; WHERE id='".$calendar_id[0]."'";
Database::query($sql); Database::query($sql);
} }

@ -496,22 +496,23 @@ if (!empty($_REQUEST['new_dir'])) {
// Insert into agenda // Insert into agenda
$agenda_id = 0; $agenda_id = 0;
$end_date = '';
if (isset($_POST['add_to_calendar']) && $_POST['add_to_calendar'] == 1) { if (isset($_POST['add_to_calendar']) && $_POST['add_to_calendar'] == 1) {
require_once api_get_path(SYS_CODE_PATH).'calendar/agenda.inc.php'; require_once api_get_path(SYS_CODE_PATH).'calendar/agenda.inc.php';
require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php'; require_once api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php';
$course = isset($course_info) ? $course_info : null; $course = isset($course_info) ? $course_info : null;
$date = time(); $date = time();
$title = Security::remove_XSS($_POST['new_dir']); $title = sprintf(get_lang('HandingOverOfTaskX'), $_POST['new_dir']);
if (!empty($_POST['type1'])) { if (!empty($_POST['type1'])) {
$date = get_date_from_select('expires'); $end_date = get_date_from_select('expires');
$title = sprintf(get_lang('HandingOverOfTaskX'),Security::remove_XSS($_POST['new_dir']));
} }
$content = '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.substr(Security::remove_XSS($dir_name_sql), 1).'" >'.Security::remove_XSS($_POST['new_dir']).'</a> - '.Security::remove_XSS($_POST['description']); $description = isset($_POST['description']) ? $_POST['description'] : '';
$content = '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;curdirpath='.api_substr($dir_name_sql, 1).'" >'.$_POST['new_dir'].'</a>'.$description;
$agenda_id = agenda_add_item($course, $title, $content, $date, '', array('GROUP:'.$toolgroup), 0); $agenda_id = agenda_add_item($course, $title, $content, $date, $end_date, array('GROUP:'.$toolgroup), 0);
} }
$sql_add_publication = "INSERT INTO " . $work_table . " SET " . $sql_add_publication = "INSERT INTO " . $work_table . " SET
"url = '".Database::escape_string($dir_name_sql)."', url = '".Database::escape_string($dir_name_sql)."',
title = '', title = '',
description = '".Database::escape_string($_POST['description'])."', description = '".Database::escape_string($_POST['description'])."',
author = '', author = '',
@ -556,9 +557,7 @@ if (!empty($_REQUEST['new_dir'])) {
$sql_add_publication = "UPDATE ".$work_table." SET "."has_properties = ".Database::insert_id().", view_properties = 1 ".' where id = '.$id; $sql_add_publication = "UPDATE ".$work_table." SET "."has_properties = ".Database::insert_id().", view_properties = 1 ".' where id = '.$id;
Database::query($sql_add_publication); Database::query($sql_add_publication);
} else { } else {
$sql_add_homework = "INSERT INTO $TSTDPUBASG SET $sql_add_homework = "INSERT INTO $TSTDPUBASG SET
expires_on = '0000-00-00 00:00:00', expires_on = '0000-00-00 00:00:00',
ends_on = '0000-00-00 00:00:00', ends_on = '0000-00-00 00:00:00',

Loading…
Cancel
Save