Skip to content
Snippets Groups Projects
Commit 2f91513f authored by Demian Katz's avatar Demian Katz
Browse files

Finished implementing item status AJAX call.

parent 8e5abcc3
No related merge requests found
...@@ -168,6 +168,16 @@ class AjaxController extends AbstractBase ...@@ -168,6 +168,16 @@ class AjaxController extends AbstractBase
return $filtered; return $filtered;
} }
/**
* Get the view renderer
*
* @return object
*/
protected function getViewRenderer()
{
return $this->getServiceLocator()->get('viewmanager')->getRenderer();
}
/** /**
* Get Item Statuses * Get Item Statuses
* *
...@@ -196,14 +206,15 @@ class AjaxController extends AbstractBase ...@@ -196,14 +206,15 @@ class AjaxController extends AbstractBase
// need special handling. // need special handling.
$missingIds = array_flip($ids); $missingIds = array_flip($ids);
/* TODO // Get access to PHP template renderer for partials:
$renderer = $this->getViewRenderer();
// Load messages for response: // Load messages for response:
$messages = array( $messages = array(
'available' => $this->view->render('ajax/status-available.phtml'), 'available' => $renderer->render('ajax/status-available.phtml'),
'unavailable' => $this->view->render('ajax/status-unavailable.phtml'), 'unavailable' => $renderer->render('ajax/status-unavailable.phtml'),
'unknown' => $this->view->render('ajax/status-unknown.phtml') 'unknown' => $renderer->render('ajax/status-unknown.phtml')
); );
*/
// Load callnumber and location settings: // Load callnumber and location settings:
$config = ConfigReader::getConfig(); $config = ConfigReader::getConfig();
...@@ -233,12 +244,9 @@ class AjaxController extends AbstractBase ...@@ -233,12 +244,9 @@ class AjaxController extends AbstractBase
} }
// If a full status display has been requested, append the HTML: // If a full status display has been requested, append the HTML:
if ($showFullStatus) { if ($showFullStatus) {
/* TODO $current['full_status'] = $renderer->render(
$this->view->statusItems = $record; 'ajax/status-full.phtml', array('statusItems' => $record)
$current['full_status'] = $this->view->render(
'ajax/status-full.phtml'
); );
*/
} }
$current['record_number'] = array_search($current['id'], $ids); $current['record_number'] = array_search($current['id'], $ids);
$statuses[] = $current; $statuses[] = $current;
...@@ -1135,7 +1143,7 @@ class AjaxController extends AbstractBase ...@@ -1135,7 +1143,7 @@ class AjaxController extends AbstractBase
$this->params()->fromQuery('id'), $this->params()->fromQuery('id'),
$this->params()->fromQuery('source', 'VuFind') $this->params()->fromQuery('source', 'VuFind')
); );
$html = $this->view->render('record/comments-list.phtml'); $html = $this->getViewRenderer()->render('record/comments-list.phtml');
return $this->output($html, self::STATUS_OK); return $this->output($html, self::STATUS_OK);
*/ */
} }
...@@ -1207,7 +1215,7 @@ class AjaxController extends AbstractBase ...@@ -1207,7 +1215,7 @@ class AjaxController extends AbstractBase
); );
$this->view->url = $url; $this->view->url = $url;
$this->view->format = $format; $this->view->format = $format;
$html = $this->view->render('ajax/export-favorites.phtml'); $html = $this->getViewRenderer()->render('ajax/export-favorites.phtml');
return $this->output( return $this->output(
array( array(
'result' => Translator::translate('Done'), 'result' => Translator::translate('Done'),
...@@ -1278,7 +1286,7 @@ class AjaxController extends AbstractBase ...@@ -1278,7 +1286,7 @@ class AjaxController extends AbstractBase
$this->view->print = $print; $this->view->print = $print;
$this->view->electronic = $electronic; $this->view->electronic = $electronic;
$this->view->services = $services; $this->view->services = $services;
$html = $this->view->render('ajax/resolverLinks.phtml'); $html = $this->getViewRenderer()->render('ajax/resolverLinks.phtml');
// output HTML encoded in JSON object // output HTML encoded in JSON object
return $this->output($html, self::STATUS_OK); return $this->output($html, self::STATUS_OK);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment