Skip to content

Commit

Permalink
_ added the DIV framework for new CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
urs_hunkler committed Jan 19, 2005
1 parent ef0921d commit fe32b4f
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 79 deletions.
22 changes: 15 additions & 7 deletions mod/glossary/edit.php
Expand Up @@ -85,20 +85,24 @@
<a href=\"view.php?id=$cm->id\">$glossary->name</a> -> $stredit", "form.text",
"", true, "", navmenu($course, $cm));

echo '<div id="glossary-edit" class="glossary">'; // glossary-edit wrapper start

print_heading($glossary->name);

include("edit.html");

echo '</div>'; // glossary-edit wrapper end

print_footer($course);
die;
}
print_header_simple(strip_tags("$glossary->name"), "",
"<A HREF=\"index.php?id=$course->id\">$strglossaries</A> ->
<A HREF=\"view.php?id=$cm->id\">$glossary->name</A> -> $stredit", "form.text",
"", true, "", navmenu($course, $cm));

print_heading($glossary->name);

if ($e) {
//We are updating an entry, so we compare current session user with
//existing entry user to avoid some potential problems if secureforms=off
Expand All @@ -107,11 +111,11 @@
$ineditperiod = ((time() - $old->timecreated < $CFG->maxeditingtime) || $glossary->editalways);
if ( (!$ineditperiod || $USER->id != $old->userid) and !isteacher($course->id) and $e) {
if ( $USER->id != $old->userid ) {
error("You can't edit other people's entries!");
error("You can't edit other people's entries!");
} elseif (!$ineditperiod) {
error("You can't edit this. Time expired!");
}
die;
error("You can't edit this. Time expired!");
}
die;
}

$newentry->id = $e;
Expand Down Expand Up @@ -148,7 +152,7 @@
error("Could not update this glossary entry because this concept already exist.");
}
} else {

$newentry->userid = $USER->id;
$newentry->timecreated = $timenow;
$newentry->sourceglossaryid = 0;
Expand Down Expand Up @@ -287,6 +291,8 @@
<a href=\"view.php?id=$cm->id\">$glossary->name</a> -> $stredit", "",
"", true, "", navmenu($course, $cm));

echo '<div id="glossary-edit" class="glossary">'; // glossary-edit wrapper start

$ineditperiod = ((time() - $newentry->timecreated < $CFG->maxeditingtime) || $glossary->editalways);
if ( (!$ineditperiod || $USER->id != $newentry->userid) and !isteacher($course->id) and $e) {
if ( $USER->id != $newentry->userid ) {
Expand Down Expand Up @@ -326,6 +332,8 @@
use_html_editor("text");
}

echo '</div>'; // glossary-edit wrapper end

print_footer($course);

?>
24 changes: 13 additions & 11 deletions mod/glossary/export.php
Expand Up @@ -3,28 +3,28 @@
require_once("../../config.php");
require_once("lib.php");
global $CFG, $USER;

require_variable($id); // Course Module ID

optional_variable($l,"");
optional_variable($cat,0);

if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
}
}

if (! $course = get_record("course", "id", $cm->course)) {
error("Course is misconfigured");
}
}

if (! $glossary = get_record("glossary", "id", $cm->instance)) {
error("Course module is incorrect");
}
require_login($course->id);
}

require_login($course->id);
if (!isteacher($course->id)) {
error("You must be a teacher to use this page.");
}
}

$strglossaries = get_string("modulenameplural", "glossary");
$strglossary = get_string("modulename", "glossary");
Expand All @@ -34,7 +34,7 @@
$strsearchconcept = get_string("searchconcept", "glossary");
$strsearchindefinition = get_string("searchindefinition", "glossary");
$strsearch = get_string("search");

$navigation = "";
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
Expand All @@ -46,6 +46,8 @@
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));

echo '<div id="glossary-export" class="glossary">'; // glossary-export wrapper start

echo '<p align="center"><font size="3"><b>' . stripslashes_safe($glossary->name);
echo '</b></font></p>';

Expand Down Expand Up @@ -76,7 +78,7 @@
$ffurl = "../../file.php?file=$ffurl";
}
echo '<p align="center"><a href="' . $ffurl . '" target="_blank">' . get_string("exportedfile","glossary") . '</a></p>';

echo '</center>';
glossary_print_tabbed_table_end();
print_footer();
Expand Down
2 changes: 2 additions & 0 deletions mod/glossary/formats/faq/faq_format.php
Expand Up @@ -36,8 +36,10 @@ function glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode="", $hoo

$return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $ratings, $aliases);
echo '</td></tr></table>';
echo "</div>\n"; // end container div

} else {
echo "<div id=\"glossary-edit\" class=\"glossary\">\n"; // glossary-edit container div
echo '<center>';
print_string("noentry", "glossary");
echo '</center>';
Expand Down
44 changes: 26 additions & 18 deletions mod/glossary/import.php
Expand Up @@ -7,7 +7,7 @@

require_variable($id); // Course Module ID

optional_variable($step,0);
optional_variable($step,0);
optional_variable($dest,"current"); // current | new
optional_variable($file); // file to import
optional_variable($catsincl,0); // Import Categories too?
Expand All @@ -17,20 +17,20 @@

if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
}
}

if (! $course = get_record("course", "id", $cm->course)) {
error("Course is misconfigured");
}
}

if (! $glossary = get_record("glossary", "id", $cm->instance)) {
error("Course module is incorrect");
}
require_login($course->id);
}

require_login($course->id);
if (!isteacher($course->id)) {
error("You must be a teacher to use this page.");
}
}

if ($dest != 'new' and $dest != 'current') {
$dest = 'current';
Expand All @@ -43,12 +43,14 @@
$strsearchconcept = get_string("searchconcept", "glossary");
$strsearchindefinition = get_string("searchindefinition", "glossary");
$strsearch = get_string("search");

print_header_simple(strip_tags("$glossary->name"), "",
"<a href=\"index.php?id=$course->id\">$strglossaries</a> -> $glossary->name",
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));


echo '<div id="glossary-import" class="glossary">'; // glossary-import wrapper start

echo '<p align="center"><font size="3"><b>' . stripslashes_safe($glossary->name);
echo '</b></font></p>';

Expand All @@ -67,13 +69,14 @@
include("tabs.html");

if ( !$step ) {
include("import.html");
include("import.html");

echo '</center>';
glossary_print_tabbed_table_end();
print_footer($course);
echo '</div>'; // glossary-import wrapper end
exit;
}
}

$form = data_submitted();
$file = $_FILES["file"];
Expand All @@ -98,7 +101,7 @@
if ($dest == 'new') {
// If the user chose to create a new glossary
$xmlglossary = $xml['GLOSSARY']['#']['INFO'][0]['#'];

if ( $xmlglossary['NAME'][0]['#'] ) {
unset($glossary);
$glossary->name = addslashes(utf8_decode($xmlglossary['NAME'][0]['#']));
Expand Down Expand Up @@ -154,6 +157,7 @@
echo '</center>';
glossary_print_tabbed_table_end();
print_footer($course);
echo '</div>'; // glossary-import wrapper end
exit;
} else {
//The instance has been created, so lets do course_modules
Expand Down Expand Up @@ -205,6 +209,7 @@
echo '</center>';
glossary_print_tabbed_table_end();
print_footer($course);
echo '</div>'; // glossary-import wrapper end
exit;
}
}
Expand All @@ -225,7 +230,7 @@
$permissiongranted = 1;
if ( $newentry->concept and $newentry->definition ) {
if ( !$glossary->allowduplicatedentries ) {
// checking if the entry is valid (checking if it is duplicated when should not be)
// checking if the entry is valid (checking if it is duplicated when should not be)
if ( $newentry->casesensitive ) {
$dupentry = get_record("glossary_entries","concept",$newentry->concept,"glossaryid",$glossary->id);
} else {
Expand All @@ -251,7 +256,7 @@
$newentry->format = $xmlentry['#']['FORMAT'][0]['#'];
$newentry->timecreated = time();
$newentry->timemodified = time();

// Setting the default values if no values were passed
if ( isset($xmlentry['#']['USEDYNALINK'][0]['#']) ) {
$newentry->usedynalink = $xmlentry['#']['USEDYNALINK'][0]['#'];
Expand Down Expand Up @@ -287,7 +292,7 @@
for($k = 0; $k < sizeof($xmlcats); $k++) {
$xmlcat = $xmlcats[$k];
unset($newcat);

$newcat->name = addslashes(utf8_decode($xmlcat['#']['NAME'][0]['#']));
$newcat->usedynalink = $xmlcat['#']['USEDYNALINK'][0]['#'];
if ( !$category = get_record("glossary_categories","glossaryid",$glossary->id,"name",$newcat->name) ) {
Expand Down Expand Up @@ -368,7 +373,7 @@
}
echo '</table><hr width="75%">';

// rejected entries
// rejected entries
if ($rejections) {
echo '<center><table border="0" width="70%">';
echo '<tr><td align="center" colspan="2" width="100%"><strong>' . get_string("rejectionrpt","glossary") . '</strong></tr>';
Expand All @@ -382,6 +387,9 @@
glossary_print_tabbed_table_end();

/// Finish the page

echo '</div>'; // glossary-import wrapper end

print_footer($course);

?>
6 changes: 5 additions & 1 deletion mod/glossary/index.php
Expand Up @@ -29,6 +29,8 @@

print_header_simple("$strglossarys", "", "$strglossarys", "", "", true, "", navmenu($course));

echo '<div id="glossary-index" class="glossary">'; // glossary-index wrapper start

/// Get all the appropriate data

if (! $glossarys = get_all_instances_in_course("glossary", $course)) {
Expand Down Expand Up @@ -57,7 +59,7 @@

$can_subscribe = (isstudent($course->id) or isteacher($course->id) or isadmin());

if ($show_rss = (($can_subscribe || $course->id == SITEID) &&
if ($show_rss = (($can_subscribe || $course->id == SITEID) &&
isset($CFG->enablerssfeeds) && isset($CFG->glossary_enablerssfeeds) &&
$CFG->enablerssfeeds && $CFG->glossary_enablerssfeeds)) {
$table->head[] = $strrss;
Expand Down Expand Up @@ -122,6 +124,8 @@

/// Finish the page

echo '</div>'; // glossary-index wrapper end

print_footer($course);

?>

0 comments on commit fe32b4f

Please sign in to comment.