예제 #1
0
 /**
     @param $url String
     @return $item OmekaItem || null
     Tries to fetch an OmekaItem given its URL.
     Obeys Omeka->$dbUsage.
 */
 public static function getItemFromUrl($url)
 {
     if (Config::getOmeka()->getDbUsage()) {
         return self::getItemFromDbByUrl($url);
     } else {
         if (self::$urlItemMap === null) {
             self::$urlItemMap = array();
             foreach (Config::getOmeka()->getItems() as $item) {
                 self::$urlItemMap[$item->getUrl()] = $item;
             }
         }
         if (array_key_exists($url, self::$urlItemMap)) {
             return self::$urlItemMap[$url];
         }
         return null;
     }
 }
예제 #2
0
 /**
     @param $urn String urn of an OmekaItem
     @return $item OmekaItem||null
     This method obeys $dbUsage.
     In case of $dbUsage getItem doesn't trigger all items to be fetched.
 */
 public function getItem($urn)
 {
     if ($this->items === null) {
         if ($this->getDbUsage()) {
             return OmekaItem::getItemFromDb($urn);
         } else {
             $this->getItems();
         }
     }
     if (array_key_exists($urn, $this->items)) {
         return $this->items[$urn];
     }
     return null;
 }
예제 #3
0
 /**
     @return $item OmekaItem || null
     Tries to return the OmekaItem that this file belongs to.
     Obeys Omeka->$dbUsage.
 */
 public function getItem()
 {
     return OmekaItem::getItemFromUrl($this->getItemUrl());
 }