Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UNL_GraduateBulletin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ryan Dee
UNL_GraduateBulletin
Commits
b22cf779
Commit
b22cf779
authored
12 years ago
by
Brett Bieber
Browse files
Options
Downloads
Patches
Plain Diff
Add a custom driver which searches for graduate courses
parent
278e62d3
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/UNL/Catalog.php
+35
-14
35 additions, 14 deletions
src/UNL/Catalog.php
src/UNL/Catalog/CourseSearch/DBSearcher.php
+10
-0
10 additions, 0 deletions
src/UNL/Catalog/CourseSearch/DBSearcher.php
with
45 additions
and
14 deletions
src/UNL/Catalog.php
+
35
−
14
View file @
b22cf779
...
@@ -381,21 +381,14 @@ class UNL_Catalog
...
@@ -381,21 +381,14 @@ class UNL_Catalog
if
(
!
isset
(
$id
)
&&
isset
(
$_GET
[
'id'
]))
{
if
(
!
isset
(
$id
)
&&
isset
(
$_GET
[
'id'
]))
{
$id
=
$_GET
[
'id'
];
$id
=
$_GET
[
'id'
];
}
}
// Do not cache course search results
//UNL_UndergraduateBulletin_Editions::$editions = array(2012,2011,2010);
//UNL_UndergraduateBulletin_Editions::$latest = 2012;
UNL_Services_CourseApproval
::
setCachingService
(
new
UNL_Services_CourseApproval_CachingService_Null
());
UNL_Services_CourseApproval
::
setXCRIService
(
new
UNL_UndergraduateBulletin_CourseDataDriver
());
$course_data
=
new
UNL_Services_CourseApproval_Search
();
if
(
$listings
=
$course_data
->
byAny
(
$id
.
' 8'
))
{
$course_data
=
$this
->
getCourseSearcher
();
if
(
$listings
=
$course_data
->
bySubject
(
$id
,
0
,
-
1
))
{
$subject
=
new
UNL_Services_CourseApproval_SubjectArea
(
$id
);
$subject
=
new
UNL_Services_CourseApproval_SubjectArea
(
$id
);
$this
->
p
->
doctitle
=
'<title>UNL | Graduate Studies Bulletin | Courses for '
.
$subject
->
subject
.
'</title>'
;
$this
->
p
->
doctitle
=
'<title>UNL | Graduate Studies Bulletin | Courses for '
.
$subject
->
subject
.
'</title>'
;
if
(
count
(
$listings
))
{
if
(
count
(
$listings
))
{
$savvy
=
new
Savvy
();
$savvy
=
$this
->
getCourseRenderer
();
$savvy
->
setEscape
(
'htmlentities'
);
$savvy
->
setClassToTemplateMapper
(
new
UNL_UndergraduateBulletin_ClassToTemplateMapper
());
$savvy
->
setTemplatePath
(
$this
->
undergraduate_bulletin_dir
.
'/www/templates/html/'
);
$this
->
p
->
maincontentarea
.
=
'<a name="'
.
$subject
->
subject
.
'"></a><div class="subject" id="div_'
.
$subject
->
subject
.
'">'
.
PHP_EOL
$this
->
p
->
maincontentarea
.
=
'<a name="'
.
$subject
->
subject
.
'"></a><div class="subject" id="div_'
.
$subject
->
subject
.
'">'
.
PHP_EOL
.
'<h2 class="sec_header" id="'
.
$subject
->
subject
.
'">Courses for '
.
$subject
->
subject
.
' ('
.
$subject
->
subject
.
') </h2>'
.
PHP_EOL
;
.
'<h2 class="sec_header" id="'
.
$subject
->
subject
.
'">Courses for '
.
$subject
->
subject
.
' ('
.
$subject
->
subject
.
') </h2>'
.
PHP_EOL
;
foreach
(
$listings
as
$course
)
{
foreach
(
$listings
as
$course
)
{
...
@@ -412,6 +405,35 @@ class UNL_Catalog
...
@@ -412,6 +405,35 @@ class UNL_Catalog
}
}
}
}
/**
* Get the course search service
*
* @return UNL_Services_CourseApproval_Search
*/
protected
function
getCourseSearcher
()
{
// Do not cache course search results
UNL_Services_CourseApproval
::
setCachingService
(
new
UNL_Services_CourseApproval_CachingService_Null
());
UNL_Services_CourseApproval
::
setXCRIService
(
new
UNL_UndergraduateBulletin_CourseDataDriver
());
$driver
=
new
UNL_Catalog_CourseSearch_DBSearcher
();
$course_data
=
new
UNL_Services_CourseApproval_Search
(
$driver
);
return
$course_data
;
}
protected
function
getCourseRenderer
()
{
static
$savvy
=
false
;
if
(
!
$savvy
)
{
$savvy
=
new
Savvy
();
$savvy
->
setEscape
(
'htmlentities'
);
$savvy
->
setClassToTemplateMapper
(
new
UNL_UndergraduateBulletin_ClassToTemplateMapper
());
$savvy
->
setTemplatePath
(
$this
->
undergraduate_bulletin_dir
.
'/www/templates/html/'
);
}
return
$savvy
;
}
public
function
send404
(
$message
=
'404 Not found.'
)
public
function
send404
(
$message
=
'404 Not found.'
)
{
{
header
(
'HTTP/1.0 404 Not Found'
);
header
(
'HTTP/1.0 404 Not Found'
);
...
@@ -431,8 +453,7 @@ class UNL_Catalog
...
@@ -431,8 +453,7 @@ class UNL_Catalog
}
else
{
}
else
{
$format
=
'toHtml'
;
$format
=
'toHtml'
;
}
}
$savvy
=
new
Savvy
();
$savvy
=
$this
->
getCourseRenderer
();
$savvy
->
setTemplatePath
(
$this
->
undergraduate_bulletin_dir
.
'/www/templates/html/'
);
$this
->
p
->
maincontentarea
.
=
$savvy
->
render
(
$listing
,
'Listing.tpl.php'
);
$this
->
p
->
maincontentarea
.
=
$savvy
->
render
(
$listing
,
'Listing.tpl.php'
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/UNL/Catalog/CourseSearch/DBSearcher.php
0 → 100644
+
10
−
0
View file @
b22cf779
<?php
class
UNL_Catalog_CourseSearch_DBSearcher
extends
UNL_UndergraduateBulletin_CourseSearch_DBSearcher
{
function
getQueryResult
(
$query
,
$offset
=
0
,
$limit
=
null
)
{
$query
=
'SELECT DISTINCT courses.id, courses.xml FROM courses INNER JOIN crosslistings ON courses.id=crosslistings.course_id WHERE crosslistings.courseNumber >= "500" AND ('
.
$query
.
');'
;
return
new
UNL_UndergraduateBulletin_CourseSearch_DBSearchResults
(
$query
,
$offset
,
$limit
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment