diff --git a/application/views/scripts/courses/list.phtml b/application/views/scripts/courses/list.phtml
deleted file mode 100755
index d333a5dd..00000000
--- a/application/views/scripts/courses/list.phtml
+++ /dev/null
@@ -1,10 +0,0 @@
- 'view'
- );
-
-while ($this->courses->hasNext()) {
- $course = $this->courses->getNextCourse();
- $params['course'] = $this->getStringFromOsidId($course->getId());
- print "\n\t
";
- print "\n\t".$course->getDescription()."
";
-}
diff --git a/src/Controller/Courses.php b/src/Controller/Courses.php
index 04713179..3d9a06c0 100755
--- a/src/Controller/Courses.php
+++ b/src/Controller/Courses.php
@@ -66,31 +66,31 @@ public function __construct(Runtime $osidRuntime, IdMap $osidIdMap, TermHelper $
$this->namesType = new \phpkit_type_URNInetType('urn:inet:middlebury.edu:record:person_names');
}
- /**
- * Print out a list of all courses.
- *
- * @return void
- *
- * @since 4/21/09
- */
- public function listAction()
+ #[Route('/courses/list/{catalog}', name: 'list_courses')]
+ public function listAction($catalog = NULL)
{
- if ($this->_getParam('catalog')) {
- $catalogId = $this->osidIdMap->fromString($this->_getParam('catalog'));
+ $data = [
+ 'courses' => [],
+ ];
+ if ($catalog) {
+ $catalogId = $this->osidIdMap->fromString($catalog);
$lookupSession = $this->osidRuntime->getCourseManager()->getCourseLookupSessionForCatalog($catalogId);
- $this->view->title = 'Courses in '.$lookupSession->getCourseCatalog()->getDisplayName();
+ $data['title'] = 'Courses in '.$lookupSession->getCourseCatalog()->getDisplayName();
} else {
$lookupSession = $this->osidRuntime->getCourseManager()->getCourseLookupSession();
- $this->view->title = 'Courses in All Catalogs';
+ $data['title'] = 'Courses in All Catalogs';
}
$lookupSession->useFederatedCourseCatalogView();
- $this->view->courses = $lookupSession->getCourses();
-
- $this->setSelectedCatalogId($lookupSession->getCourseCatalogId());
- $this->view->headTitle($this->view->title);
+ $courses = $lookupSession->getCourses();
+ while ($courses->hasNext()) {
+ $data['courses'][] = $courses->getNextCourse();
+ }
+ // $this->setSelectedCatalogId($lookupSession->getCourseCatalogId());
+ // $this->view->headTitle($this->view->title);
+ // $this->view->menuIsCourses = true;
- $this->view->menuIsCourses = true;
+ return $this->render('courses/list.html.twig', $data);
}
#[Route('/courses/view/{course}/{term}', name: 'view_course')]
diff --git a/templates/courses/list.html.twig b/templates/courses/list.html.twig
new file mode 100755
index 00000000..f56ddca3
--- /dev/null
+++ b/templates/courses/list.html.twig
@@ -0,0 +1,4 @@
+{% for course in courses %}
+
+ {{ course.description | raw }}
+{% endfor %}