Exemplo n.º 1
0
/**
 * Gets the title of the quiz file given as parameter.
 * @param   string    File name
 * @param   string    File path
 * @return  string    The exercise title
 */
function GetQuizName($fname, $fpath)
{
    $title = GetComment($fname);
    if (trim($title) == '') {
        if (file_exists($fpath . $fname)) {
            if (!($fp = @fopen($fpath . $fname, 'r'))) {
                //die('Could not open Quiz input.');
                return basename($fname);
            }
            $contents = @fread($fp, filesize($fpath . $fname));
            @fclose($fp);
            $title = api_get_title_html($contents);
        }
    }
    if ($title == '') {
        $title = basename($fname);
    }
    return (string) $title;
}
Exemplo n.º 2
0
<h4>
  <?php 
echo $nameTools;
?>
</h4>

<?php 
if (isset($newName)) {
    if ($newName != "") {
        //alter database record for that test
        SetComment($hotpotatoesName, $newName);
        echo "<script type='text/javascript'>window.location='" . $urlMainExercise . "exercice.php'; </script>";
    }
}
echo "<form action=\"" . $urlMainExercise . "adminhp.php\" method='post' name='form1'>";
echo "<input type=\"hidden\" name=\"hotpotatoesName\" value=\"{$hotpotatoesName}\">";
echo "<input type=\"text\" name=\"newName\" value=\"";
$lstrComment = "";
$lstrComment = GetComment($hotpotatoesName);
if ($lstrComment == "") {
    $lstrComment = GetQuizName($hotpotatoesName, $documentPath);
}
if ($lstrComment == "") {
    $lstrComment = basename($hotpotatoesName, $documentPath);
}
echo $lstrComment;
echo "\" size=40>&nbsp;";
echo "<button type=\"submit\" class=\"save\" name=\"submit\" value=\"" . get_lang('Ok') . "\">" . get_lang('Ok') . "</button>";
echo "<button type=\"button\" class=\"cancel\" name=\"cancel\" value=\"" . get_lang('Cancel') . "\" onclick=\"javascript:document.form1.newName.value='';\">" . get_lang('Cancel') . "</button>";
echo "</form>";
Display::display_footer();