Esempio n. 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;
 }
Esempio n. 2
0
 /**
  * Get package info by id.
  *
  * Example requeset: /admin/ajax/package-info/id/1
  */
 public function packageInfoAction()
 {
     // Valid upload for a page.
     $id = $this->_request->getParam('id');
     if ($id > 0) {
         $object = new Object_Package($id);
         if (!$object->getId()) {
             $this->_responseErrorString = 'Invalid id';
             $this->_sendAjaxResponse();
         }
     }
     $info = array('id' => $id, 'name' => $object->name);
     $this->_responseArray = array('package' => $info);
     $this->_sendAjaxResponse();
 }
 /**
  * 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');
 }