public function setUp() { parent::setUp(); $view = new Omeka_View(); $this->helper = $view->getHelper('RecordUrl'); $this->mockString = $this->getMock('Item', array('getRecordUrl'), array(), '', false); $this->mockString->expects($this->any())->method('getRecordUrl')->will($this->returnValue('/boring-url')); $this->mockQuery = $this->getMock('Item', array('getRecordUrl'), array(), '', false); $this->mockQuery->expects($this->any())->method('getRecordUrl')->will($this->returnValue('/boring-url?existing=baz')); $this->mockRoute = $this->getMock('Item', array('getRecordUrl'), array(), '', false); $this->mockRoute->expects($this->any())->method('getRecordUrl')->will($this->returnValue(array('controller' => 'items', 'action' => 'browse'))); }
/** * Shortcode to display viewer. * * @param array $args * @param Omeka_View $view * @return string */ public static function shortcodeOpenLayersZoom($args, $view) { // Check required arguments $recordType = isset($args['record_type']) ? $args['record_type'] : 'Item'; $recordType = ucfirst(strtolower($recordType)); if (!in_array($recordType, array('Item', 'File'))) { return; } // Get the specified record. if (isset($args['record_id'])) { $recordId = (int) $args['record_id']; $record = get_record_by_id($recordType, $recordId); } else { $record = get_current_record(strtolower($recordType)); } if (empty($record)) { return; } $html = $view->openLayersZoom()->zoom($record); if ($html) { $html = '<link href="' . css_src('ol') . '" media="all" rel="stylesheet" type="text/css" >' . js_tag('ol') . js_tag('OpenLayersZoom') . $html; return $html; } }
/** * Shortcode for printing one or more collections * * @param array $args * @param Omeka_View $view * @return string */ public static function shortcodeCollections($args, $view) { $params = array(); if (isset($args['ids'])) { $params['range'] = $args['ids']; } if (isset($args['sort'])) { $params['sort_field'] = $args['sort']; } if (isset($args['order'])) { $params['sort_dir'] = $args['order']; } if (isset($args['is_featured'])) { $params['featured'] = $args['is_featured']; } if (isset($args['num'])) { $limit = $args['num']; } else { $limit = 10; } $collections = get_records('Collection', $params, $limit); $content = ''; foreach ($collections as $collection) { $content .= $view->partial('collections/single.php', array('collection' => $collection)); } return $content; }
/** * Shortcode to display viewer. * * @param array $args * @param Omeka_View $view * @return string */ public static function shortcodeUniversalViewer($args, $view) { $args['view'] = $view; return $view->universalViewer($args); }
/** * Shortcode to display viewer. * * @param array $args * @param Omeka_View $view * @return string */ public static function shortcodeBookReader($args, $view) { $args['view'] = $view; return $view->getBookReader($args); }