if ($is_allowedToEdit) { $out .= $dialogBox->render(); // Form if (isset($displayAssigForm) && $displayAssigForm) { $out .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data">' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . "\n" . '<input type="hidden" name="cmd" value="' . $cmdToSend . '" />' . "\n" . claro_form_relay_context() . "\n" . '<fieldset>'; if (!is_null($assigId)) { $out .= '<input type="hidden" name="assigId" value="' . $assigId . '" />' . "\n"; } $out .= '<dl>' . '<dt><label for="title">' . get_lang('Assignment title') . ' <span class="required">*</span></label></dt>' . '<dd><input type="text" name="title" id="title" size="50" maxlength="200" value="' . claro_htmlspecialchars($assignment->getTitle()) . '" /></dd>' . '<dt><label for="description">' . get_lang('Description') . '<br /></label></dt>' . '<dd>' . claro_html_textarea_editor('description', $assignment->getDescription()) . '</dd>' . '<dt>' . get_lang('Submission type') . '</dt>' . '<dd>' . '<input type="radio" name="authorized_content" id="authorizeFile" value="FILE" ' . ($assignment->getSubmissionType() == "FILE" ? 'checked="checked"' : '') . ' /> <label for="authorizeFile"> ' . get_lang('File (file required, description text optional)') . '</label> <br /> <input type="radio" name="authorized_content" id="authorizeText" value="TEXT" ' . ($assignment->getSubmissionType() == "TEXT" ? 'checked="checked"' : '') . '/> <label for="authorizeText"> ' . get_lang('Text only (text required, no file)') . '</label> <br /> <input type="radio" name="authorized_content" id="authorizeTextFile" value="TEXTFILE" ' . ($assignment->getSubmissionType() == "TEXTFILE" ? 'checked="checked"' : '') . ' /> <label for="authorizeTextFile"> ' . get_lang('Text with attached file (text required, file optional)') . '</label>' . '</dd>' . '<dt>' . get_lang('Assignment type') . '</dt>' . '<dd>' . '<input type="radio" name="assignment_type" id="individual" value="INDIVIDUAL" ' . ($assignment->getAssignmentType() == "INDIVIDUAL" ? 'checked="checked"' : '') . ' /> <label for="individual"> ' . get_lang('Individual') . '</label> <br /> <input type="radio" name="assignment_type" id="group" value="GROUP" ' . ($assignment->getAssignmentType() == "GROUP" ? 'checked="checked"' : '') . ' /> <label for="group"> ' . get_lang('Groups (from groups tool, only group members can post)') . '</label>' . '</dd>' . '<dt>' . get_lang('Start date') . '</dt>' . '<dd>' . claro_html_date_form('startDay', 'startMonth', 'startYear', $assignment_data['start_date'], 'long') . ' ' . claro_html_time_form('startHour', 'startMinute', $assignment_data['start_date']) . '<p class="notice">' . get_lang('(d/m/y hh:mm)') . '</p>' . '</dd>' . '<dt>' . get_lang('End date') . '</dt>' . '<dd>' . claro_html_date_form('endDay', 'endMonth', 'endYear', $assignment_data['end_date'], 'long') . ' ' . claro_html_time_form('endHour', 'endMinute', $assignment_data['end_date']) . '<p class="notice">' . get_lang('(d/m/y hh:mm)') . '</p>' . '</dd>' . '<dt>' . get_lang('Allow late upload') . '</dt>' . '<dd> <input type="radio" name="allow_late_upload" id="allowUpload" value="YES" ' . ($assignment->getAllowLateUpload() == "YES" ? 'checked="checked"' : '') . ' /> <label for="allowUpload"> ' . get_lang('Yes, allow users to submit works after end date') . '</label> <br /> <input type="radio" name="allow_late_upload" id="preventUpload" value="NO" ' . ($assignment->getAllowLateUpload() == "NO" ? 'checked="checked"' : '') . ' /> <label for="preventUpload"> ' . get_lang('No, prevent users submitting work after the end date') . '</label>' . '</dd>' . '<dt>' . get_lang('Default works visibility') . '</dt>' . '<dd> <input type="radio" name="def_submission_visibility" id="visible" value="VISIBLE" ' . ($assignment->getDefaultSubmissionVisibility() == "VISIBLE" ? 'checked="checked"' : '') . ' /> <label for="visible"> ' . get_lang('Visible for all users') . '</label> <br /> <input type="radio" name="def_submission_visibility" id="invisible" value="INVISIBLE" ' . ($assignment->getDefaultSubmissionVisibility() == "INVISIBLE" ? 'checked="checked"' : '') . ' /> <label for="invisible"> ' . get_lang('Only visible for teacher(s) and submitter(s)') . '</label>' . '<br /><br /> <input type="checkbox" name="submission_visibility_applies_to_all" id="submission_visibility_applies_to_all_id" value="yes" />
claro_redirect(Url::Contextualize('user_work.php?authId=' . claro_get_current_group_id() . '&cmd=rqSubWrk' . '&assigId=' . $req['assignmentId'] . '&submitGroupWorkUrl=' . urlencode($_REQUEST['submitGroupWorkUrl']))); exit; } /*============================================================================ Permissions ============================================================================*/ $assignmentIsVisible = (bool) ($assignment->getVisibility() == 'VISIBLE'); $is_allowedToEditAll = (bool) claro_is_allowed_to_edit(); if (!$assignmentIsVisible && !$is_allowedToEditAll) { // if assignment is not visible and user is not course admin or upper claro_redirect(Url::Contextualize('work.php')); exit; } // upload or update is allowed between start and end date or after end date if late upload is allowed $uploadDateIsOk = $assignment->isUploadDateOk(); if ($assignment->getAssignmentType() == 'INDIVIDUAL') { // user is authed and allowed $userCanPost = (bool) (claro_is_user_authenticated() && claro_is_course_allowed() && claro_is_course_member()); } else { $userGroupList = get_user_group_list(claro_get_current_user_id()); // check if user is member of at least one group $userCanPost = (bool) (!empty($userGroupList)); } $is_allowedToSubmit = (bool) ($assignmentIsVisible && $uploadDateIsOk && $userCanPost) || $is_allowedToEditAll; /*============================================================================ Update notification ============================================================================*/ if (claro_is_user_authenticated()) { // call this function to set the __assignment__ as seen, all the submission as seen $claro_notifier->is_a_notified_ressource(claro_get_current_course_id(), $claro_notifier->get_notification_date(claro_get_current_user_id()), claro_get_current_user_id(), claro_get_current_group_id(), claro_get_current_tool_id(), $req['assignmentId']); }
PREREQUISITES =============================================================================*/ /*-------------------------------------------------------------------- REQUIRED : ASSIGNMENT INFORMATIONS --------------------------------------------------------------------*/ $assignment = new Assignment(); if (!$assignmentId || !$assignment->load($assignmentId)) { // we need to know in which assignment we are claro_redirect(Url::Contextualize('work.php')); exit; } /*-------------------------------------------------------------------- REQUIRED : USER INFORMATIONS --------------------------------------------------------------------*/ if (isset($_REQUEST['authId']) && !empty($_REQUEST['authId'])) { if ($assignment->getAssignmentType() == 'GROUP') { $sql = "SELECT `name`\n FROM `" . $tbl_group_team . "`\n WHERE `id` = " . (int) $_REQUEST['authId']; $authField = 'group_id'; } else { $sql = "SELECT CONCAT(`nom`,' ',`prenom`) as `authName`\n FROM `" . $tbl_user . "`\n WHERE `user_id` = " . (int) $_REQUEST['authId']; $authField = 'user_id'; } $authName = claro_sql_query_get_single_value($sql); } $_user = claro_get_current_user_data(); $currentUserFirstName = $_user['firstName']; $currentUserLastName = $_user['lastName']; /*-------------------------------------------------------------------- CHECK IF WE HAVE USER AND ASSIGNMENT --------------------------------------------------------------------*/ if (empty($authName)) {