|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 if (!isset($sortorder)) { 00003 $sortorder = ''; 00004 } 00005 if (!isset($sortkey)) { 00006 $sortkey = ''; 00007 } 00008 00009 //make sure variables are properly cleaned 00010 $sortkey = clean_param($sortkey, PARAM_ALPHA);// Sorted view: CREATION | UPDATE | FIRSTNAME | LASTNAME... 00011 $sortorder = clean_param($sortorder, PARAM_ALPHA); // it defines the order of the sorting (ASC or DESC) 00012 00013 $toolsrow = array(); 00014 $browserow = array(); 00015 $inactive = array(); 00016 $activated = array(); 00017 00018 if (!has_capability('mod/glossary:approve', $context) && $tab == GLOSSARY_APPROVAL_VIEW) { 00020 $tab = $defaulttab; 00021 } 00022 00023 00024 $browserow[] = new tabobject(GLOSSARY_STANDARD_VIEW, 00025 $CFG->wwwroot.'/mod/glossary/view.php?id='.$id.'&mode=letter', 00026 get_string('standardview', 'glossary')); 00027 00028 $browserow[] = new tabobject(GLOSSARY_CATEGORY_VIEW, 00029 $CFG->wwwroot.'/mod/glossary/view.php?id='.$id.'&mode=cat', 00030 get_string('categoryview', 'glossary')); 00031 00032 $browserow[] = new tabobject(GLOSSARY_DATE_VIEW, 00033 $CFG->wwwroot.'/mod/glossary/view.php?id='.$id.'&mode=date', 00034 get_string('dateview', 'glossary')); 00035 00036 $browserow[] = new tabobject(GLOSSARY_AUTHOR_VIEW, 00037 $CFG->wwwroot.'/mod/glossary/view.php?id='.$id.'&mode=author', 00038 get_string('authorview', 'glossary')); 00039 00040 if ($tab < GLOSSARY_STANDARD_VIEW || $tab > GLOSSARY_AUTHOR_VIEW) { // We are on second row 00041 $inactive = array('edit'); 00042 $activated = array('edit'); 00043 00044 $browserow[] = new tabobject('edit', '#', get_string('edit')); 00045 } 00046 00048 00049 $tabrows = array(); 00050 $tabrows[] = $browserow; // Always put these at the top 00051 if ($toolsrow) { 00052 $tabrows[] = $toolsrow; 00053 } 00054 00055 00056 ?> 00057 <div class="glossarydisplay"> 00058 00059 00060 <?php if ($showcommonelements) { print_tabs($tabrows, $tab, $inactive, $activated); } ?> 00061 00062 <div class="entrybox"> 00063 00064 <?php 00065 00066 if (!isset($category)) { 00067 $category = ""; 00068 } 00069 00070 00071 switch ($tab) { 00072 case GLOSSARY_CATEGORY_VIEW: 00073 glossary_print_categories_menu($cm, $glossary, $hook, $category); 00074 break; 00075 case GLOSSARY_APPROVAL_VIEW: 00076 glossary_print_approval_menu($cm, $glossary, $mode, $hook, $sortkey, $sortorder); 00077 break; 00078 case GLOSSARY_AUTHOR_VIEW: 00079 $search = ""; 00080 glossary_print_author_menu($cm, $glossary, "author", $hook, $sortkey, $sortorder, 'print'); 00081 break; 00082 case GLOSSARY_IMPORT_VIEW: 00083 $search = ""; 00084 $l = ""; 00085 glossary_print_import_menu($cm, $glossary, 'import', $hook, $sortkey, $sortorder); 00086 break; 00087 case GLOSSARY_EXPORT_VIEW: 00088 $search = ""; 00089 $l = ""; 00090 glossary_print_export_menu($cm, $glossary, 'export', $hook, $sortkey, $sortorder); 00091 break; 00092 case GLOSSARY_DATE_VIEW: 00093 if (!$sortkey) { 00094 $sortkey = 'UPDATE'; 00095 } 00096 if (!$sortorder) { 00097 $sortorder = 'desc'; 00098 } 00099 glossary_print_alphabet_menu($cm, $glossary, "date", $hook, $sortkey, $sortorder); 00100 break; 00101 case GLOSSARY_STANDARD_VIEW: 00102 default: 00103 glossary_print_alphabet_menu($cm, $glossary, "letter", $hook, $sortkey, $sortorder); 00104 if ($mode == 'search' and $hook) { 00105 echo "<h3>$strsearch: $hook</h3>"; 00106 } 00107 break; 00108 } 00109 echo '<hr />'; 00110 ?>