static function sortFolderBased(X_Page_Item_PItem $item1, X_Page_Item_PItem $item2) { if ($item1->getType() == X_Page_Item_PItem::TYPE_CONTAINER) { if ($item2->getType() == X_Page_Item_PItem::TYPE_CONTAINER) { return self::sortAlphabetically($item1, $item2); } else { return -1; } } else { if ($item2->getType() == X_Page_Item_PItem::TYPE_CONTAINER) { return 1; } else { return self::sortAlphabetically($item1, $item2); } } }
/** * Check the item in the collection should be filtered out * If return is false, the item will be discarded at 100% * If return is true, isn't sure that the item will be added * 'cause another plugin can prevent this * * Plugins who check per-item acl or blacklist should hook here * * @param X_Page_Item_PItem $item * @param string $provider * @param Zend_Controller_Action $controller * @return boolean true if item is ok, false if item should be discarded */ public function filterShareItems(X_Page_Item_PItem $item, $provider, Zend_Controller_Action $controller) { $providerClass = X_VlcShares_Plugins::broker()->getPluginClass($provider); $providerObj = X_VlcShares_Plugins::broker()->getPlugins($provider); if (is_a($providerObj, 'X_VlcShares_Plugins_FileSystem')) { if ($item->getType() == X_Page_Item_PItem::TYPE_ELEMENT) { $itemLocation = $item->getCustom('X_VlcShares_Plugins_FileSystem:location'); /* @var $urlHelper Zend_Controller_Action_Helper_Url */ $urlHelper = $controller->getHelper('url'); $path = $providerObj->resolveLocation($itemLocation); $thumb = new Application_Model_FsThumb(); Application_Model_FsThumbsMapper::i()->fetchByPath($path, $thumb); if ($thumb->isNew()) { $thumbUrl = X_Env::completeUrl($urlHelper->direct('thumb', 'fsthumbs', 'default', array('l' => X_Env::encode($itemLocation), 't' => 'dummy.jpg'))); } else { $thumbUrl = X_Env::completeUrl(Zend_Controller_Front::getInstance()->getBaseUrl() . $thumb->getUrl()); } //$item->setDescription($itemLocation); $item->setThumbnail($thumbUrl); } } return true; }