/** * Add a button * * @param string $buttonId * @param array $data * @param integer $level * @param integer $sortOrder * @param string|null $region That button should be displayed in ('toolbar', 'header', 'footer', null) * @return void */ public function add($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'toolbar') { if (!isset($this->_buttons[$level])) { $this->_buttons[$level] = array(); } $data['id'] = empty($data['id']) ? $buttonId : $data['id']; $data['button_key'] = $data['id'] . '_button'; $data['region'] = empty($data['region']) ? $region : $data['region']; $data['level'] = $level; $sortOrder = $sortOrder ?: (count($this->_buttons[$level]) + 1) * 10; $data['sort_order'] = empty($data['sort_order']) ? $sortOrder : $data['sort_order']; $this->_buttons[$level][$buttonId] = $this->itemFactory->create(['data' => $data]); }
/** * Process Parents by child * * @param int $productId * @param int $stockId * @param int $websiteId * @return $this */ protected function _processParents($productId, $stockId = Stock::DEFAULT_STOCK_ID, $websiteId = null) { $parentIds = array(); foreach ($this->getProductTypeInstances() as $typeInstance) { /* @var $typeInstance AbstractType */ $parentIds = array_merge($parentIds, $typeInstance->getParentIdsByChild($productId)); } if (!$parentIds) { return $this; } $productTypes = $this->getProductsType($parentIds); /** @var Item $item */ $item = $this->_stockItemFactory->create(); foreach ($parentIds as $parentId) { $parentType = isset($productTypes[$parentId]) ? $productTypes[$parentId] : null; $item->setData(array('stock_id' => $stockId))->setOrigData()->loadByProduct($parentId); $status = self::STATUS_IN_STOCK; $qty = 0; if ($item->getId()) { $status = $item->getIsInStock(); $qty = $item->getQty(); } $this->_processChildren($parentId, $parentType, $qty, $status, $item->getStockId(), $websiteId); } return $this; }
public static function from_xml($alias, $itnum, $xmlbuffer) { $xml = new SimpleXMLElement($xmlbuffer); $doc = ItemFactory::node($xml, '//xml'); $compound_object = new CompoundObject($alias, $itnum); $compound_object->title = (string) $doc->title; $compound_object->file = (string) $doc->find; dmGetCompoundObjectInfo($alias, $itnum, $compound_xml_buffer); $compound_xml = new SimpleXMLElement($compound_xml_buffer); $type = $compound_xml->xpath('//cpd/type'); if ((string) $type[0] == 'Monograph') { $pages = $compound_xml->xpath('//cpd/node/page'); } else { $pages = $compound_xml->xpath('//cpd/page'); } $num = 1; foreach ($pages as $page) { $subitnum = (string) $page->pageptr; $item = ItemFactory::create($alias, $subitnum, NULL); $compound_object->add_item($item, $num++); } return $compound_object; }
<? include("config.php"); $collection = Collection::from_alias($_GET['CISOROOT']); $current_item = ItemFactory::create($_GET['CISOROOT'], $_GET['CISOPTR'], $_GET['CISOSHOW']); $show_all = (isset($_GET["show_all"])) ? $_GET["show_all"] : false; if(isset($_GET['search'])) { $search_status = new SearchStatus($_GET['search']); } $css_includes = array('screen/viewer'); if(get_class($current_item) == 'Image') { $js_includes = array('jquery-ui-1.7.1.custom.min', 'jquery.event.drag-1.5.min', 'dmmonocle.min', 'compound_object_browser'); $css_includes = array_merge($css_includes, array('dmmonocle','smoothness/jquery-ui-1.7.custom')); } define("FACEBOX",'display'); $breadcrumbs = array( 'Home' => SEEKING_MICHIGAN_HOST, 'Discover' => SEEKING_MICHIGAN_HOST.'/discover', 'Collections' => SEEKING_MICHIGAN_HOST.'/discover', $collection->name => $collection->url(), 'Item Viewer' => ''); app()->partial('header', array('body_class' => 'discover', 'breadcrumbs' => $breadcrumbs,
<?php include "config.php"; $alias = isset($_GET["CISOROOT"]) ? $_GET["CISOROOT"] : 0; $itnum = isset($_GET["CISOPTR"]) ? $_GET["CISOPTR"] : 0; $current_item = ItemFactory::create($alias, $itnum); // get the format of the image - 8in wide for protrait layout, 10.5in for landscape if (get_class($current_item) == 'CompoundObject') { if ($current_item->is_overall_layout_portrait()) { $size = "8.5in 11in"; } else { $size = "11in 8.5in"; } } elseif (get_class($current_item) == 'Image') { if ($current_item->is_portrait()) { $size = "8.5in 11in"; } else { $size = "11in 8.5in"; } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <script type="text/javascript" src="<?php echo SEEKING_MICHIGAN_HOST; ?> /js/jquery.js"></script> <script type="text/javascript"> $(window).load(function(){ window.print();