/** * List. * * @param Zend_Db_Table_Rowset_Abstract $portals * @return string */ public static function listAssets($assets) { $html = Functions_View::HTML_DEFAULT_EMPTY; if ($assets && $assets->count()) { $html .= '<table class="table table-striped table-bordered">'; $html .= '<thead><tr class="off"><th class="text-center sort" data-sort="name">Document</th><th class="text-center sort" data-sort="created">Created</th>'; $html .= '<th class="text-center sort" data-sort="modified">Last Modified</th>'; $html .= '<th class="text-center sort" data-sort="desc">Description</th></tr></thead>'; $html .= '<tbody>'; foreach ($assets as $_asset) { $_a = new Object_MediaAsset($_asset->id); $html .= '<tr rel="' . $_asset->id . '" class="noClickThrough">'; $html .= '<td class="selectMedia name" rel="' . $_a->getPublicLink() . '"><div>' . $_a->getPreviewHtml('300px') . '</div>' . $_asset->name . '</td>'; $html .= '<td class="created">' . Functions_Common::formattedDay($_asset->created_datetime, parent::STD_DATE_FORMAT) . '</td>'; $html .= '<td class="modified">' . Functions_Common::formattedDay($_asset->modified_datetime, parent::STD_DATE_FORMAT) . '</td>'; $html .= '<td class="desc">' . $_asset->description . '</td>'; $html .= '</tr>'; } $html .= '</tbody>'; $html .= '</table>'; } return $html; }
/** * Generate a package manifest. * * @param integer $packageId * @return array | false */ protected function _generateManifest($packageId) { $package = new Object_Package($packageId); if (!$package->getId()) { return false; } // Get all the title manifests. $titles = Repo_PackageTitle::getInstance()->getPackageTitles($packageId); $titleManifests = array(); if ($titles && $titles->count()) { foreach ($titles as $_t) { $titleManifests[] = Manager_Manifest_Title::getInstance()->getManifest($_t->id); } } // Get all the page manifests. $pages = Repo_PackageTitle::getInstance()->getPackagePages($packageId); $pageManifests = array(); if (is_array($pages) && !empty($pages)) { foreach ($pages as $_p) { $pageManifests[] = Manager_Manifest_Page::getInstance()->getManifest($_p['page_id']); } } $manifest = array('version' => $package->version, 'id' => $package->id, 'title' => $package->name, 'manifestVersion' => $package->getManifestVersion(), 'remoteControlEnabled' => true, 'description' => $package->description, 'nav_type' => $package->nav_type, 'nav_data' => $package->nav_data, 'titles' => $titleManifests, 'pages' => $pageManifests); if ($package->media_asset_id) { $media = new Object_MediaAsset($package->media_asset_id); $manifest['thumbnail'] = $media->getExternalLink(); } return $manifest; }
/** * Generate a title manifest. * * @param integer $titleId * @return array | false */ protected function _generateManifest($titleId, $includePages = false) { $title = new Object_Title($titleId); if (!$title->getId()) { return false; } // Get the page ids. $pages = Repo_TitlePage::getInstance()->getTitlePages($titleId); $pageIds = array(); if ($pages && $pages->count()) { foreach ($pages as $_p) { $pageIds[] = $_p->page_id; } } $manifest = array('version' => $title->version, 'id' => $title->id, 'title' => $title->name, 'type' => $title->type, 'isLocked' => true, 'description' => $title->description, 'isEditable' => $title->is_editable, 'pageIds' => $pageIds); if ($title->nav_type == 'tree') { $manifest['menu'] = $title->getMenu(); } if ($includePages) { $pageManifests = array(); if (is_array($pageIds) && !empty($pageIds)) { foreach ($pages as $_p) { $pageManifests[] = Manager_Manifest_Page::getInstance()->getManifest($_p->id); } $manifest['pages'] = $pageManifests; } } if ($title->media_asset_id) { $media = new Object_MediaAsset($title->media_asset_id); $manifest['thumbnail'] = $media->getExternalLink(); } return $manifest; }