From fc9c255cb8681fd4c2c8d4bf6c290b34fbfa417b Mon Sep 17 00:00:00 2001 From: jpuntd Date: Mon, 11 Oct 2004 18:15:10 +0000 Subject: [PATCH] removed --- .../glossary_random/block_glossary_random.php | 124 ------------------ blocks/glossary_random/db/mysql.php | 33 ----- blocks/glossary_random/db/mysql.sql | 20 --- blocks/glossary_random/prefs.html | 45 ------- blocks/glossary_random/prefs.php | 71 ---------- 5 files changed, 293 deletions(-) delete mode 100644 blocks/glossary_random/block_glossary_random.php delete mode 100644 blocks/glossary_random/db/mysql.php delete mode 100644 blocks/glossary_random/db/mysql.sql delete mode 100644 blocks/glossary_random/prefs.html delete mode 100644 blocks/glossary_random/prefs.php diff --git a/blocks/glossary_random/block_glossary_random.php b/blocks/glossary_random/block_glossary_random.php deleted file mode 100644 index 89ddb892d8..0000000000 --- a/blocks/glossary_random/block_glossary_random.php +++ /dev/null @@ -1,124 +0,0 @@ -title = get_string('blockname','block_glossary_random'); - $this->content_type = BLOCK_TYPE_TEXT; - $this->course = $course; - $this->version = 2004100700; - if(!empty($course)) { - if ($prefs=get_record("block_glossary_random","course",$course->id)) { - $this->title = $prefs->title; - } - } - } - function get_content() { - global $USER, $CFG, $THEME; - - if($this->content !== NULL) { - return $this->content; - } - - - $this->content = New object; - $this->content->text = ''; - $this->content->footer = ''; - - if ($prefs=get_record("block_glossary_random","course",$this->course->id)) { - - $glossaryid = $prefs->glossary; - $glossary=get_record("glossary", "id", $glossaryid); - $studentcanpost = $glossary->studentcanpost; //needed to decide on which footer - - //check if it's time to put a new entry in cache - if (time() > $prefs->nexttime) - { - // place glossary concept and definition in $pref->cache - $numberofentries = count_records("glossary_entries","glossaryid",$glossaryid,"approved",1)-1; - switch ($prefs->type) { - case RANDOMLY: - $i = rand(0,$numberofentries); - break; - case NEXTONE: - $i = 1 + $prefs->previous; - if ($i < $numberofentries) { - break; - } - //otherwise fall through - case LASTMODIFIED: - $i=$numberofentries; - break; - - } - - if ($entries = get_records_sql("SELECT concept, definition, format - FROM {$CFG->prefix}glossary_entries - WHERE glossaryid = {$glossaryid} and approved = 1 - ORDER BY timemodified LIMIT {$i},1")) { - - foreach ($entries as $entry) { //normally only on entry - $text = " $entry->concept
"; - $text .= clean_text($entry->definition, $entry->format); - } - - - $prefs->nexttime = usergetmidnight(time())+60*60*24*$prefs->refresh; - $prefs->cache = addslashes($text); - $prefs->previous = $i; - if (!(update_record("block_glossary_random", $prefs))) { - error("Could not update the database"); - } - } else { - $text = get_string('notyetconfigured','block_glossary_random'); - } - } - - //otherwise just return the cached text - $this->content->text = stripslashes($prefs->cache); - - // place link to glossary in the footer if the glossary is visible - - //Create a temp valid module structure (course,id) - $tempmod->course = $this->course->id; - $tempmod->id = $glossaryid; - - //Obtain the visible property from the instance - if (instance_is_visible('glossary', $tempmod)) { - - $cm = get_coursemodule_from_instance('glossary',$glossaryid, $this->course->id) ; - if ($studentcanpost) { - $footertext = $prefs->addentry; - } else { - $footertext = $prefs->viewglossary; - } - $this->content->footer = ''.$footertext.''; - - // otherwise just place some text, no link - } else { - $this->content->footer = $prefs->invisible; - } - - - } else { //nothing in the database, this block needs configuration - $this->content->text = get_string("notyetconfigured","block_glossary_random"); - } - - if (isteacheredit($this->course->id)) { //add the option to configure this block - $this->content->footer .= '
" - .get_string("configureblock","block_glossary_random").""; - } - - return $this->content; - } - - - } -?> diff --git a/blocks/glossary_random/db/mysql.php b/blocks/glossary_random/db/mysql.php deleted file mode 100644 index 1c9d6f4932..0000000000 --- a/blocks/glossary_random/db/mysql.php +++ /dev/null @@ -1,33 +0,0 @@ - - -
-

:

- - - - - - - - - - - - - - - - - - - - - -

:

:

glossary) ?>

:

:

type, ""); - helpbutton("",get_string("type","block_glossary_random"),"moodle",true,false,get_string("typehelp","block_glossary_random")); - ?>
- -

:

-

-
-

-
-

-
- - - - -
">
-
- - diff --git a/blocks/glossary_random/prefs.php b/blocks/glossary_random/prefs.php deleted file mode 100644 index 9cf336ac31..0000000000 --- a/blocks/glossary_random/prefs.php +++ /dev/null @@ -1,71 +0,0 @@ -nexttime = usergetmidnight(time())+24*60*60*$prefs->refresh; - if (!(update_record("block_glossary_random", $prefs))) { - error("Could not update record in the database."); - } - redirect("$CFG->wwwroot/course/view.php?id=$prefs->course"); - } - } - - // print form - - if (!empty($err)) { - $focus = "form.".array_shift(array_flip(get_object_vars($err))); - } else { - $focus = ""; - } - - $prefs = get_record("block_glossary_random", "course", $course); - if (!$prefs) { - $prefs->course = $course; - $prefs->title = get_string('blockname','block_glossary_random'); - $prefs->refresh = 0; - $prefs->text= get_string("notyetconfigured","block_glossary_random"); - $prefs->addentry=get_string("addentry", "block_glossary_random"); - $prefs->viewglossary=get_string("viewglossary", "block_glossary_random"); - $prefs->invisible=get_string("invisible", "block_glossary_random"); - - if (!(insert_record("block_glossary_random",$prefs))) { - error("Could not insert new record in database"); - } - } - - // select glossaries to put in dropdown box ... - - $glossaries = get_records_select_menu("glossary", "course= $course","name","id,name"); - // and quotetypes to put in dropdown box - - $type[0] = get_string("random","block_glossary_random"); - $type[1] = get_string("lastmodified","block_glossary_random"); - $type[2] = get_string("nextone","block_glossary_random"); - - print_header(get_string("blockname","block_glossary_random"), - get_string("change_configuration","block_glossary_random")); - include("prefs.html"); - print_footer(); - -/****************************************************************************** - * FUNCTIONS - *****************************************************************************/ - -function validate_form($user, &$err) { - //we might add a check for glossary selected - return; -} - - -?> -- 2.39.5