Beispiel #1
0
                        AND `course_id` = ?d", $insertedAsset_id, $insertedModule_id, $course_id);

                // determine the default order of this Learning path
                $order = 1 + intval(Database::get()->querySingle("SELECT MAX(`rank`) AS max
                        FROM `lp_rel_learnPath_module`
                        WHERE `learnPath_id` = ?d", $_SESSION['path_id'])->max);

                // finally : insert in learning path
                Database::get()->query("INSERT INTO `lp_rel_learnPath_module`
                        (`learnPath_id`, `module_id`, `specificComment`, `rank`, `lock`, `visible`)
                        VALUES (?d, ?d, ?s, ?d, 'OPEN', 1)", $_SESSION['path_id'], $insertedModule_id, $langDefaultModuleAddedComment, $order);
                $addedDoc = $filenameDocument;
                $InfoBox = $addedDoc . " " . $langDocInsertedAsModule . "<br />";
                $style = "success";
                $tool_content .= "<table class='table-default'><tr>";
                $tool_content .= disp_message_box($InfoBox, $style);
                $tool_content .= "</tr></table>";
                $tool_content .= "<br />";
            } else {
                // check if this is this LP that used this document as a module
                $sql = "SELECT * FROM `lp_rel_learnPath_module` AS LPM,
                             `lp_module` AS M,
                             `lp_asset` AS A
                        WHERE M.`module_id` =  LPM.`module_id`
                          AND M.`startAsset_id` = A.`asset_id`
                          AND A.`path` = ?s
                          AND LPM.`learnPath_id` = ?d
                          AND M.`course_id` = ?d";
                @$num = Database::get()->querySingle($sql, $insertDocument, $_SESSION['path_id'], $course_id)->count;
                if ($num) {
                    if ($num == 0) { // used in another LP but not in this one, so reuse the module id reference instead of creating a new one
            Database::get()->query("UPDATE `lp_rel_learnPath_module`\n                    SET `rank` = ?d\n                    WHERE `learnPath_module_id` =  ?d\n                    AND `learnPath_id` = ?d", $nextLPMOrder, $thisLPMId, $_SESSION['path_id']);
            Database::get()->query("UPDATE `lp_rel_learnPath_module`\n                    SET `rank` = ?d\n                    WHERE `learnPath_module_id` =  ?d\n                    AND `learnPath_id` = ?d", $thisLPMOrder, $nextLPMId, $_SESSION['path_id']);
            break;
        }
        // STEP 1 : FIND THE ORDER OF THE ANNOUNCEMENT
        if ($module->learnPath_module_id == $thisLPMId) {
            $thisLPMOrder = $module->rank;
            $thisLPMOrderFound = true;
        }
    }
}
$tool_content .= "<fieldset><legend>{$langLearningPathData}</legend><table class='table-default'>";
//############################ LEARNING PATH NAME BOX ################################\\
$tool_content .= "<tr><th width='70'>{$langTitle}:</th>";
if ($cmd == "updateName") {
    $tool_content .= disp_message_box(nameBox(LEARNINGPATH_, UPDATE_, $langModify));
} else {
    $tool_content .= "<td>" . nameBox(LEARNINGPATH_, DISPLAY_);
}
$tool_content .= "</td></tr>";
//############################ LEARNING PATH COMMENT BOX #############################\\
$tool_content .= "\n    <tr>\n      <th width=\"90\">{$langComments}:</th>\n      <td>";
if ($cmd == "updatecomment") {
    $tool_content .= commentBox(LEARNINGPATH_, UPDATE_);
} elseif ($cmd == "delcomment") {
    $tool_content .= commentBox(LEARNINGPATH_, DELETE_);
} else {
    $tool_content .= commentBox(LEARNINGPATH_, DISPLAY_);
}
$tool_content .= "</td>\n    </tr>\n    </table>\n    </fieldset>\n    <fieldset>\n    <legend>{$langLearningPathConfigure}</legend>\n    <table class='table-default'>";
// -------------------- create label -------------------
Beispiel #3
0
function display_my_documents($dialogBox, $style)
{
    global $curDirName;
    global $curDirPath;
    global $parentDir;
    global $langUp;
    global $langName;
    global $langSize;
    global $langDate;
    global $langAddModulesButton;
    global $fileList;
    global $themeimg;
    global $langSelection, $langDirectory, $course_code;
    $output = '';
    /*
     * DISPLAY
     */
    $dspCurDirName = htmlspecialchars($curDirName);
    // $cmdCurDirPath = rawurlencode($curDirPath);
    $cmdParentDir = rawurlencode($parentDir);
    $output .= '<form action="' . $_SERVER['SCRIPT_NAME'] . '?course=' . $course_code . '" method="POST">';
    /* --------------------------------------
       DIALOG BOX SECTION
       -------------------------------------- */
    $colspan = 5;
    if (!empty($dialogBox)) {
        $output .= disp_message_box($dialogBox, $style) . "<br />";
    }
    /* --------------------------------------
       CURRENT DIRECTORY LINE
       -------------------------------------- */
    /* CURRENT DIRECTORY */
    if ($curDirName) {
        $output .= '
        <table class="table-default">
        <tr>
          <td width="1" class="right">' . icon('fa-folder-o') . '</td>
          <td>' . $langDirectory . ': <b>' . $dspCurDirName . '</b></td>';
        /* GO TO PARENT DIRECTORY */
        if ($curDirName) {
            $linkup = "<a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;openDir={$cmdParentDir}'>";
            $output .= "<td width='1'>{$linkup}<img src='{$themeimg}/folder_up.png' " . "hspace='5' alt='{$langUp}' title='langUp' /></a></td>" . "<td width='10' class='right'><small>{$linkup}{$langUp}</a></small></td>";
        }
        $output .= '</tr></table>';
    }
    $output .= '
    <div class="table-responsive">
    <table class="table-default" >';
    $output .= "\n    <tr class='list-header'>\n      <th colspan='2'><div align='left'>&nbsp;&nbsp;{$langName}</div></th>\n      <th>{$langSize}</th>\n      <th>{$langDate}</th>\n      <th>{$langSelection}</th>\n    </tr>";
    /* --------------------------------------
       DISPLAY FILE LIST
       -------------------------------------- */
    if ($fileList) {
        $iterator = 0;
        $ind = 1;
        while (list($fileKey, $fileName) = each($fileList['name'])) {
            if ($ind % 2 == 0) {
                $style = 'class="even"';
            } else {
                $style = 'class="odd"';
            }
            $dspFileName = htmlspecialchars($fileList['filename'][$fileKey]);
            $cmdFileName = str_replace("%2F", "/", rawurlencode($curDirPath . "/" . $fileName));
            if ($fileList['visible'][$fileKey] == 0) {
                continue;
                // skip the display of this file
            }
            if ($fileList['type'][$fileKey] == A_FILE) {
                $image = choose_image($fileName);
                $size = format_file_size($fileList['size'][$fileKey]);
                $date = nice_format($fileList['date'][$fileKey]);
                $file_url = file_url($fileList['path'][$fileKey], $dspFileName);
                $play_url = file_playurl($fileList['path'][$fileKey], $dspFileName);
                $urlFileName = MultimediaHelper::chooseMediaAhrefRaw($file_url, $play_url, $dspFileName, $dspFileName);
            } elseif ($fileList['type'][$fileKey] == A_DIRECTORY) {
                $image = 'fa-folder';
                $size = '&nbsp;';
                $date = '&nbsp;';
                $urlFileName = '<a href="' . $_SERVER['SCRIPT_NAME'] . '?course=' . $course_code . '&amp;openDir=' . $cmdFileName . '">' . $dspFileName . '</a>';
            }
            $output .= '
                <tr ' . $style . '>
                <td class="center" width="1">' . icon($image, '') . '</td>
                <td align="left">' . $urlFileName . '</td>
                <td width="80" class="center">' . $size . '</td>
                <td width="80" class="center">' . $date . '</td>';
            if ($fileList['type'][$fileKey] == A_FILE) {
                $iterator++;
                $output .= '
                <td width="10" class="center">
                        <input type="checkbox" name="insertDocument_' . $iterator . '" id="insertDocument_' . $iterator . '" value="' . $curDirPath . "/" . $fileName . '" />
                        <input type="hidden" name="filenameDocument_' . $iterator . '" id="filenameDocument_' . $iterator . '" value="' . $dspFileName . '" />
                </td>';
            } else {
                $output .= '<td>&nbsp;</td>';
            }
            $output .= '</tr>';
            /* COMMENTS */
            if ($fileList['comment'][$fileKey] != "") {
                $fileList['comment'][$fileKey] = htmlspecialchars($fileList['comment'][$fileKey]);
                $fileList['comment'][$fileKey] = parse_user_text($fileList['comment'][$fileKey]);
                $output .= '
                <tr class="even">
                <td>&nbsp;</td>
                <td colspan="' . $colspan . '"><span class="comment">' . $fileList['comment'][$fileKey] . '</span></td>
                </tr>';
            }
            $ind++;
        }
        // end each ($fileList)
        // form button
        $output .= '
    <tr>
      <th colspan="' . $colspan . '"><div class="pull-right">
        <input type="hidden" name="openDir" value="' . $curDirPath . '" />
        <input type="hidden" name="maxDocForm" value ="' . $iterator . '" />
        <input class="btn btn-primary" type="submit" name="submitInsertedDocument" value="' . $langAddModulesButton . '">        
      </th>
    </tr>';
    } else {
        $output .= '<tr><td colspan="4">&nbsp;</td></tr>';
    }
    $output .= '</table></div></form>';
    return $output;
}
Beispiel #4
0
                $order = 1 + intval(Database::get()->querySingle("SELECT MAX(`rank`) AS max\n\t\t\t\t\tFROM `lp_rel_learnPath_module`\n\t\t\t\t\tWHERE `learnPath_id` = ?d", $_SESSION['path_id'])->max);
                // finally : insert in learning path
                Database::get()->query("INSERT INTO `lp_rel_learnPath_module`\n\t\t\t\t\t(`learnPath_id`, `module_id`, `specificComment`, `rank`,`lock`, `visible`)\n\t\t\t\t\tVALUES (?d, ?d, '', ?d,'OPEN', 1)", $_SESSION['path_id'], $thisLinkModule->module_id, $order);
                $dialogBox .= q($row->title) . " : " . $langLinkInsertedAsModule . "<br />";
                $style = "success";
            } else {
                $dialogBox .= q($row->title) . " : " . $langLinkAlreadyUsed . "<br />";
                $style = "caution";
            }
        }
    }
    $iterator++;
}
if (isset($dialogBox) && $dialogBox != "") {
    $tool_content .= "<table width=\"99%\"><tr>";
    $tool_content .= disp_message_box($dialogBox, $style);
    $tool_content .= "</td></tr></table>";
    $tool_content .= "<br />";
}
$tool_content .= showlinks();
//$tool_content .= "<br />";
//$tool_content .= disp_tool_title($langPathContentTitle);
//$tool_content .= '<a href="learningPathAdmin.php?course=$course_code">&lt;&lt;&nbsp;'.$langBackToLPAdmin.'</a>';
// display list of modules used by this learning path
//$tool_content .= display_path_content();
$tool_content .= action_bar(array(array('title' => $langBack, 'url' => "learningPathAdmin.php?course={$course_code}&amp;path_id=" . (int) $_SESSION['path_id'], 'icon' => 'fa-reply', 'level' => 'primary-label')));
draw($tool_content, 2, null, $head_content);
function showlinks()
{
    global $langName, $langSelection, $langAddModulesButton, $course_id, $course_code, $themeimg;
    $result = Database::get()->queryArray("SELECT * FROM link WHERE course_id = ?d ORDER BY `order` DESC", $course_id);
Beispiel #5
0
                  FROM `lp_module`
                  WHERE `name` = ?s
                    AND `module_id` != ?d
                    AND `course_id` = ?d", $_POST['newName'], $_POST['module_id'], $course_id)->count;
            if ($num == 0) { // "name" doesn't already exist
                // if no error occurred, update module's name in the database
                Database::get()->query("UPDATE `lp_module`
                        SET `name`= ?s
                        WHERE `module_id` = ?d
                        AND `course_id` = ?d", $_POST['newName'], $_POST['module_id'], $course_id);
            } else {
                $tool_content .= disp_message_box($langErrorNameAlreadyExists, "caution");
                $tool_content .= "<br />";
            }
        } else {
            $tool_content .= disp_message_box($langErrorEmptyName, "caution");
            $tool_content .= "<br />";
        }
        break;

    //display the form to modify the comment
    case "rqComment" :
        if (isset($_GET['module_id']) && is_numeric($_GET['module_id'])) {
            $module_id = intval($_GET['module_id']);
            //get current comment from DB
            $comment = Database::get()->querySingle("SELECT `comment`
                    FROM `lp_module`
                    WHERE `module_id` = ?d
                    AND `course_id` = ?d", $_GET['module_id'], $course_id);
            if ($comment && $comment->comment) {
                $tool_content .= "<form method='post' action='" . $_SERVER['SCRIPT_NAME'] . "?course=$course_code'>
            $insertedExercice_id = Database::get()->query("INSERT INTO lp_module\n                (course_id, name, comment, contentType, launch_data)\n                VALUES (?d, ?s, ?s, ?s, ?s) ", $course_id, $exercise->title, $comment, CTEXERCISE_, '')->lastInsertID;
            // create new asset
            $insertedAsset_id = Database::get()->query("INSERT INTO lp_asset\n                (path, module_id, comment)\n                VALUES (?s, ?d, ?s)", $insertedExercise, $insertedExercice_id, '')->lastInsertID;
            Database::get()->query("UPDATE lp_module\n                  SET startAsset_id = ?d\n                WHERE module_id = ?d\n                  AND course_id = ?d", $insertedAsset_id, $insertedExercice_id, $course_id);
            insertInLearningPath($insertedExercice_id, $order);
            $messBox .= "<tr>" . disp_message_box($exercise->title . " :  " . $langExInsertedAsModule . "<br>", "success") . "</td></tr>";
        } else {
            // exercise is already used as a module in another learning path , so reuse its reference
            // check if this is this LP that used this exercise as a module
            $num = Database::get()->querySingle("SELECT COUNT(*) AS count\n                 FROM lp_rel_learnPath_module AS LPM,\n                      lp_module AS M,\n                      lp_asset AS A\n                WHERE M.module_id = LPM.module_id\n                  AND M.startAsset_id = A.asset_id\n                  AND A.path = ?s\n                  AND LPM.learnPath_id = ?d\n                  AND M.course_id = ?d", $insertedExercise, $_SESSION['path_id'], $course_id)->count;
            if ($num == 0) {
                // used in another LP but not in this one, so reuse the module id reference instead of creating a new one
                insertInLearningPath($thisExerciseModule->module_id, $order);
                $messBox .= "<tr>" . disp_message_box(q($exercise->title) . " : " . $langExInsertedAsModule . "<br>", "success") . "</td></tr>";
            } else {
                $messBox .= "<tr>" . disp_message_box(q($listex->title) . " : " . $langExAlreadyUsed . "<br>", "caution") . "</td></tr>";
            }
        }
    }
    // end if request
}
//end while
$tool_content .= "<table width='100%' class='tbl_alt'>";
$tool_content .= $messBox;
$tool_content .= "</table><br />";
//STEP ONE : display form to add an exercise
$tool_content .= display_my_exercises("", "");
//STEP TWO : display learning path content
//$tool_content .= disp_tool_title($langPathContentTitle);
//$tool_content .= '<a href="learningPathAdmin.php?course=$course_code">&lt;&lt;&nbsp;'.$langBackToLPAdmin.'</a>';
// display list of modules used by this learning path
Beispiel #7
0
				WHERE `module_id` = ?d
				AND `learnPath_id` = ?d";
        Database::get()->query($sql, $_POST['newRaw'], $_SESSION['lp_module_id'], $_SESSION['path_id']);

        $dialogBox = $langRawHasBeenChanged;
    }
}


$tool_content .= '<hr noshade="noshade" size="1" />';

//####################################################################################\\
//############################### DIALOG BOX SECTION #################################\\
//####################################################################################\\
if (!empty($dialogBox)) {
    $tool_content .= disp_message_box($dialogBox);
}

// form to change raw needed to pass the exercise
$sql = "SELECT `lock`, `raw_to_pass`
        FROM `lp_rel_learnPath_module` AS LPM
       WHERE LPM.`module_id` = ?d
         AND LPM.`learnPath_id` = ?d";

$learningPath_module = Database::get()->querySingle($sql, $_SESSION['lp_module_id'], $_SESSION['path_id']);

// if this module blocks the user if he doesn't complete
if (isset($learningPath_module->lock) && $learningPath_module->lock == 'CLOSE' && isset($learningPath_module->raw_to_pass)) {
    $tool_content .= '<form method="POST" action="' . $_SERVER['SCRIPT_NAME'] . '?course=' . $course_code . '">' . "\n"
            . '<label for="newRaw">' . $langChangeRaw . '</label>' . "\n"
            . '<input type="text" value="' . htmlspecialchars($learningPath_module->raw_to_pass) . '" name="newRaw" id="newRaw" size="3" maxlength="3" /> % ' . "\n"