Example #1
0
    $cmd = null;
}
if (isset($_REQUEST['downloadMode'])) {
    $downloadMode = $_REQUEST['downloadMode'];
} else {
    $downloadMode = 'all';
}
$req['assignmentId'] = isset($_REQUEST['assigId']) && !empty($_REQUEST['assigId']) && ctype_digit($_REQUEST['assigId']) ? (int) $_REQUEST['assigId'] : false;
/*============================================================================
    Prerequisites
  ============================================================================*/
/*--------------------------------------------------------------------
ASSIGNMENT INFORMATIONS
--------------------------------------------------------------------*/
$assignment = new Assignment();
if (!$req['assignmentId'] || !$assignment->load($req['assignmentId'])) {
    // we NEED to know in which assignment we are, so if assigId is not set
    // relocate the user to the previous page
    claro_redirect(Url::Contextualize('work.php'));
    exit;
}
/*============================================================================
    Group Publish Option
  ============================================================================*/
// redirect to the submission form prefilled with a .url document targetting the published document
/**
 * @todo $_REQUEST['submitGroupWorkUrl'] must be treated in  filter process
 */
if (isset($_REQUEST['submitGroupWorkUrl']) && !empty($_REQUEST['submitGroupWorkUrl']) && claro_is_in_a_group()) {
    claro_redirect(Url::Contextualize('user_work.php?authId=' . claro_get_current_group_id() . '&cmd=rqSubWrk' . '&assigId=' . $req['assignmentId'] . '&submitGroupWorkUrl=' . urlencode($_REQUEST['submitGroupWorkUrl'])));
    exit;
Example #2
0
 //  count author's submissions for the name of directory
 if ($result['authors'] != $previousAuthors) {
     $i = 1;
     $previousAuthors = $result['authors'];
 } else {
     $i++;
 }
 $authorsDir = replace_dangerous_char($result['authors']) . '/';
 if (!is_dir($zipPath . $assigDir . '/' . $authorsDir)) {
     mkdir($zipPath . $assigDir . '/' . $authorsDir, CLARO_FILE_PERMISSIONS, true);
 }
 if ($downloadScore && !(isset($currAssigId) && $currAssigId == $result['assignment_id'])) {
     $course = new Claro_Course(claro_get_current_course_id());
     $course->load();
     $assignment = new Assignment();
     $assignment->load($result['assignment_id']);
     $currAssigId = $result['assignment_id'];
     $scoreList = new CLWRK_AssignementScoreList($assignment);
     if (!$downloadOnlyCurrentMembersSubmissions) {
         $scoreList->setOptAllUsers();
     }
     $scoreListIterator = $scoreList->getScoreList();
     $scoreListRenderer = new CLWRK_ScoreListRenderer($course, $assignment, $scoreListIterator);
     file_put_contents($zipPath . $assigDir . '/scores.html', $scoreListRenderer->render());
 }
 $submissionPrefix = $assigDir . $authorsDir . replace_dangerous_char(get_lang('Submission')) . '_' . $i . '_';
 // attached file
 if (!empty($result['submitted_doc_path'])) {
     if (file_exists($assignmentPath . $result['submitted_doc_path'])) {
         copy($assignmentPath . $result['submitted_doc_path'], $zipPath . '/' . $submissionPrefix . $result['submitted_doc_path']);
     }
Example #3
0
}
if (isset($_REQUEST['downloadMode'])) {
    $downloadMode = $_REQUEST['downloadMode'];
} else {
    $downloadMode = 'all';
}
/*============================================================================
                HANDLING FORM DATA : CREATE/EDIT ASSIGNMENT
  =============================================================================*/
if (!is_null($cmd)) {
    // instanciate assignment object
    $assignment = new Assignment();
    if (!is_null($assigId)) {
        // we handle a particular assignment, no form has been posted (delete, change visibility , ask for edition)
        // read assignment
        if (!$assignment->load($assigId)) {
            // could not read assignment
            $cmd = null;
            $assigId = null;
        }
    }
    if (isset($_REQUEST['submitAssignment']) && !is_null($cmd)) {
        // form submitted
        if (isset($_REQUEST['title'])) {
            $assignment->setTitle(strip_tags(trim($_REQUEST['title'])));
        }
        if (!isset($_REQUEST['description']) || trim(strip_tags($_REQUEST['description'], $allowedTags)) == '') {
            $assignment->setDescription('');
            // avoid multiple br tags to be added when editing an empty form
        } else {
            $assignment->setDescription(trim($_REQUEST['description']));
Example #4
0
$cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : '';
$assignmentId = isset($_REQUEST['assigId']) && !empty($_REQUEST['assigId']) && ctype_digit($_REQUEST['assigId']) ? (int) $_REQUEST['assigId'] : false;
$authId = isset($_REQUEST['authId']) ? (int) $_REQUEST['authId'] : '';
if (!empty($_REQUEST['submitGroupWorkUrl'])) {
    $submitGroupWorkUrl = urldecode($_REQUEST['submitGroupWorkUrl']);
} else {
    $submitGroupWorkUrl = null;
}
/*============================================================================
                          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';
    }