Skip to content
Snippets Groups Projects
Commit f70c2563 authored by Brett Bieber's avatar Brett Bieber
Browse files

Remove Subjects, this data will come from CREQ data not local mysql

parent 18f1e3f4
No related branches found
No related tags found
No related merge requests found
...@@ -40,15 +40,6 @@ Log In to Database: ...@@ -40,15 +40,6 @@ Log In to Database:
SSH to ucommsrv, run mysql -u ... SSH to ucommsrv, run mysql -u ...
Add a Subject Code:
Add record in the 'subjects' table in MySQL.
Link Subject Code to AREA of Study:
Add record to 'department_has_subject' table.
Setup: Setup:
copy config.sample.php to config.inc.php copy config.sample.php to config.inc.php
......
...@@ -77,8 +77,6 @@ class UNL_Catalog ...@@ -77,8 +77,6 @@ class UNL_Catalog
{ {
if (isset($_GET['view'])) { if (isset($_GET['view'])) {
switch($_GET['view']) { switch($_GET['view']) {
case 'subjects':
case 'subject':
case 'courses': case 'courses':
case 'course': case 'course':
case 'search': case 'search':
...@@ -96,12 +94,6 @@ class UNL_Catalog ...@@ -96,12 +94,6 @@ class UNL_Catalog
public function run() public function run()
{ {
switch($this->view) { switch($this->view) {
case 'subjects':
$this->showSubjects();
break;
case 'subject':
$this->showSubject();
break;
case 'courses': case 'courses':
$this->showCourses(); $this->showCourses();
break; break;
...@@ -152,7 +144,6 @@ class UNL_Catalog ...@@ -152,7 +144,6 @@ class UNL_Catalog
$db =& $this->getDatabaseConnection(); $db =& $this->getDatabaseConnection();
$q = $db->escape($q); $q = $db->escape($q);
// $subjects_found = $search->subjects($q);
$listings_found = $search->listings($q); $listings_found = $search->listings($q);
$this->p->maincontentarea = $this->p->maincontentarea =
...@@ -160,10 +151,6 @@ class UNL_Catalog ...@@ -160,10 +151,6 @@ class UNL_Catalog
array($listings_found), array($listings_found),
$this->p->maincontentarea); $this->p->maincontentarea);
/*
if (($depts_found + $subjects_found + $listings_found) == 0) {
$this->p->maincontentarea .= '<p>No course matches could be found for that, you might try searching for something else.</p>';
}*/
} else { } else {
$this->p->maincontentarea .= '<h2>Please enter a search string</h2>'; $this->p->maincontentarea .= '<h2>Please enter a search string</h2>';
} }
...@@ -179,44 +166,6 @@ class UNL_Catalog ...@@ -179,44 +166,6 @@ class UNL_Catalog
$this->p->maincontentarea .= $this->getCourseRenderer()->render($this, 'Index.tpl.php'); $this->p->maincontentarea .= $this->getCourseRenderer()->render($this, 'Index.tpl.php');
} }
/**
* Displays all subject codes within the system.
*/
public function showSubjects()
{
$this->p->doctitle = '<title>Courses | Graduate Studies Bulletin | University of Nebraska-Lincoln</title>';
$subject = $this->factory('subjects');
$subject->orderBy('id');
if ($subject->find()) {
$format = 'html';
if (isset($_GET['format'])) {
$format = $_GET['format'];
}
switch ($format) {
case 'html':
default:
$this->p->maincontentarea .= '<h1>Choose a Subject Code</h1><ul>';
while ($subject->fetch()) {
$this->p->maincontentarea .= '<li><a href="'.$subject->getURI($this).'">'.$subject->id.'</a> '.$subject->name.'</li>';
}
$this->p->maincontentarea .= '</ul>';
break;
case 'xml':
$this->p->maincontentarea .= '<?xml version="1.0" encoding="UTF-8" ?>
<subjects xmlns:xlink="http://www.w3.org/1999/xlink">';
while ($subject->fetch()) {
$this->p->maincontentarea .= '<s xlink:href="'.$subject->getURI($this).'" xml:id="'.$subject->id.'">'.htmlspecialchars($subject->name).'</s>'.PHP_EOL;
}
$this->p->maincontentarea .= '</subjects>';
break;
}
} else {
$this->p->maincontentarea .= 'No subjects could be found.';
}
}
/** /**
* Pseudo function for displaying all courses within a subject area. * Pseudo function for displaying all courses within a subject area.
* *
......
...@@ -45,39 +45,4 @@ class UNL_Catalog_Search ...@@ -45,39 +45,4 @@ class UNL_Catalog_Search
<!-- Google Search Result Snippet Ends --></div>'; <!-- Google Search Result Snippet Ends --></div>';
} }
public function subjects($q)
{
$subjects = $this->catalog->factory('subjects');
$subjects->whereAdd("id LIKE '%$q%' OR name LIKE '%$q%'");
$subjects->orderBy('name');
$this->catalog->p->maincontentarea .= '<div id="cats" class="searchtab">';
if ($r = $subjects->find()) {
$this->catalog->p->maincontentarea .= '<h2>'.$r.' matching subject areas:</h2><ul>';
while ($subjects->fetch()) {
$this->catalog->p->maincontentarea .= '<li><a href="'.$subjects->getURI($this->catalog).'">'.$subjects->name.' ('.$subjects->id.')</a></li>';
}
$this->catalog->p->maincontentarea .= '</ul>';
}
$this->catalog->p->maincontentarea .= '</div>';
return $r;
}
public function listings($q)
{
$where = "subject_id LIKE '%$q%' OR number LIKE '%$q%' OR title LIKE '%$q%'";
$listings = $this->catalog->factory('course_listings');
$courses = $this->catalog->factory('courses');
$listings->joinAdd($courses);
$listings->whereAdd($where);
$listings->orderBy('subject_id, number');
$this->catalog->p->maincontentarea .= '<div id="catl" class="searchtab">';
if ($r = $listings->find()) {
$this->catalog->p->maincontentarea .= '<h2>'.$r.' matching courses:</h2>';
while ($listings->fetch()) {
$this->catalog->showCourse($listings, true);
}
}
$this->catalog->p->maincontentarea .= '</div>';
return $r;
}
} }
<?php
/**
* Table Definition for subjects
*/
require_once 'DB/DataObject.php';
class UNL_Catalog_Subjects extends DB_DataObject
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
public $__table = 'subjects'; // table name
public $id; // string(10) not_null primary_key
public $name; // string(255) not_null
public $description; // blob(65535) not_null blob
/* Static get */
function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('UNL_Catalog_Subjects',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
public function getURI(UNL_Catalog $catalog)
{
switch ($catalog->uri_format) {
case 'REST':
case 'rest':
return $catalog->uri.$this->id.'/';
break;
case 'querystring':
default:
return $catalog->uri.'courses/'.$this->id;
}
}
}
[subjects]
id = 130
name = 130
description = 194
[subjects__keys]
id = K
[subjects]
\ No newline at end of file
...@@ -5,6 +5,3 @@ information about all programs of graduate study offered at the University of ...@@ -5,6 +5,3 @@ information about all programs of graduate study offered at the University of
Nebraska&ndash;Lincoln. The dynamic bulletin found here will be changing Nebraska&ndash;Lincoln. The dynamic bulletin found here will be changing
periodically throughout the year as needed for updating policies, faculty and periodically throughout the year as needed for updating policies, faculty and
curriculum.</a></p> curriculum.</a></p>
<div class="grid9 first">
<h2 class="sec_main"><a href="<?php echo $context->uri; ?>?view=subjects">Courses</a></h2>
</div>
<ul> <ul>
<li><a href="@@UNL_CATALOG_URI@@">Graduate Bulletin Home</a></li> <li><a href="@@UNL_CATALOG_URI@@">Graduate Bulletin Home</a></li>
<li><a href="@@UNL_CATALOG_URI@@?view=subjects">Courses</a></li>
</ul> </ul>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment