/** * Find. Wrapper for findByIdOrHandle * @param string $id * @param array $options * @param string $outputFormat * @param string $inputFormat * @return \Jisc\api\Service\Jorum\Item $item * */ public static function find($id = '', $options = array(), $outputFormat = '', $inputFormat) { $bitstream = new Bitstream($outputFormat, $inputFormat); return $bitstream->findByIdOrHandle($id, $options); }
/** * Constructor. See base class for use of params * @see DrupalApi * @param string $params * @param array $expands * @param array $options * */ public function __construct($params = '', $expands = array(), $options = array()) { parent::__construct($params, $expands, $options); if (isset($params['nid'])) { $this->id = $params['nid']; $this->handle = 'node/' . $this->id; $this->link = '/hairdressing/api/item/' . $this->id; } if (isset($params['title'])) { $this->name = $params['title']; } if (isset($params['type'])) { $this->type = $params['type']; } if (isset($params['changed'])) { $this->lastModified = date('Y-m-d H:i:s\\.02', $params['changed']); } if (isset($params['expand'])) { $this->expand = $params['expand']; } // "metadata", "collections", "parentCommunity", "subCommunities", "logo", "all" foreach ($expands as $expand) { $method = "populate" . ucfirst($expand); $this->{$method}(); } if (false) { // uncomment when you get a minute to unit test etc $bitstream = new Bitstream(); $bitstream->setBundleName('URL_BUNDLE'); $this->setBitstreams(array($bitstream)); } }