Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 /**
  * Package navigation page: edit package navigation if the nav type is a tree.
  *
  * It is the central place for package nav.
  */
 public function packageNavAction()
 {
     $id = $this->_request->getParam('id');
     $package = new Object_Package($id);
     $packageId = $package->getId();
     if (empty($packageId)) {
         // No title defined, redirec to list.
         $this->_redirect('/admin/client/package');
         return false;
     }
     $this->view->package = $package;
     $this->view->client = new Object_Client($package->client_id);
     // Package titles
     $this->view->titles = Repo_PackageTitle::getInstance()->getPackageTitles($packageId);
     // Create/edit form in the modal
     $this->view->nodeForm = new Form_Admin_Client_Package_NavFolder();
     // Fancy tree library
     $this->view->headScript()->appendFile('/js/libraries/fancytree/jquery.fancytree-all.min.js');
     $this->view->headLink()->appendStylesheet('/js/libraries/fancytree/skin-lion/ui.fancytree.min.css');
 }
Пример #3
0
 /**
  * Get all the titles a user is entitled, including package, team package, individual titles.
  *
  */
 public function getAllTitles()
 {
     $allPackages = array();
     $packages = Repo_UserPackage::getInstance()->getUserPackages($this->getId());
     foreach ($packages as $_package) {
         if (!isset($allPackages[$_package->id])) {
             $allPackages[$_package->id] = $_package;
         }
     }
     $teams = Repo_TeamUser::getInstance()->getUserTeams($this->getId());
     foreach ($teams as $_team) {
         $_teamId = $_team->id;
         $_packages = Repo_TeamPackage::getInstance()->getTeamPackages($_teamId);
         foreach ($_packages as $_package) {
             if (!isset($allPackages[$_package->id])) {
                 $allPackages[$_package->id] = $_package;
             }
         }
     }
     // OK get the titles for each package
     $allTitles = array();
     foreach ($allPackages as $_packageId => $_package) {
         $_titles = Repo_PackageTitle::getInstance()->getPackageTitles($_packageId);
         foreach ($_titles as $_title) {
             if (!isset($allTitles[$_title->id])) {
                 $allTitles[$_title->id] = $_title;
             }
         }
     }
     return $allTitles;
 }