[ PHPXref.com ] [ Generated: Thu Jul 24 12:24:35 2008 ] [ Concerto 2.1.2 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/main/modules/collections/ -> namebrowse.act.php (source)

   1  <?php
   2  /**
   3   * @package concerto.modules.collections
   4   * 
   5   * @copyright Copyright &copy; 2005, Middlebury College
   6   * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
   7   *
   8   * @version $Id: namebrowse.act.php,v 1.24.2.1 2006/06/26 20:46:11 adamfranco Exp $
   9   */ 
  10  
  11  require_once(POLYPHONY."/main/library/AbstractActions/MainWindowAction.class.php");
  12  require_once(HARMONI."/Primitives/Collections-Text/HtmlString.class.php");
  13  require_once (MYDIR."/main/library/printers/CollectionsPrinter.static.php");
  14  
  15  /**
  16   * 
  17   * 
  18   * @package concerto.modules.collections
  19   * 
  20   * @copyright Copyright &copy; 2005, Middlebury College
  21   * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  22   *
  23   * @version $Id: namebrowse.act.php,v 1.24.2.1 2006/06/26 20:46:11 adamfranco Exp $
  24   */
  25  class namebrowseAction 
  26      extends MainWindowAction
  27  {
  28      /**
  29       * Check Authorizations
  30       * 
  31       * @return boolean
  32       * @access public
  33       * @since 4/26/05
  34       */
  35  	function isAuthorizedToExecute () {
  36          return TRUE;
  37      }
  38      
  39      /**
  40       * Return the heading text for this action, or an empty string.
  41       * 
  42       * @return string
  43       * @access public
  44       * @since 4/26/05
  45       */
  46  	function getHeadingText () {
  47          return _("Browse Collections By Name");
  48      }
  49      
  50      /**
  51       * Build the content for this action
  52       * 
  53       * @return boolean
  54       * @access public
  55       * @since 4/26/05
  56       */
  57  	function buildContent () {
  58          $actionRows =& $this->getActionRows();
  59          $harmoni =& Harmoni::instance();
  60          
  61          ob_start();
  62          
  63          CollectionsPrinter::printFunctionLinks();
  64          
  65          print "<p>";
  66          print _("Below are listed the availible <em>Collections</em>, organized by name.");
  67          print "</p>\n<p>";
  68          print _("Some <em>Collections</em>, <em>Exhibitions</em>, <em>Assets</em>, and <em>Slide-Shows</em> may be restricted to certain users or groups of users. Log in above to ensure your greatest access to all parts of the system.");
  69          print "</p>";
  70          
  71          $actionRows->add(new Block(ob_get_contents(), STANDARD_BLOCK), "100%", null, CENTER, CENTER);
  72          ob_end_clean();
  73          
  74          
  75          // Get the Repositoriess
  76          $repositoryManager =& Services::getService("Repository");
  77          $allRepositories =& $repositoryManager->getRepositories();
  78          
  79          $exhibitionRepositoryType =& new Type ('System Repositories', 
  80                                              'edu.middlebury.concerto', 'Exhibitions');
  81          
  82          // put the drs into an array and order them.
  83          // @todo, do authorization checking
  84          $repositoryArray = array();
  85          $repositoryTitles = array();
  86          while($allRepositories->hasNext()) {
  87              $repository =& $allRepositories->next();
  88  
  89              // include all but Exhibitions repository.
  90              if (!$exhibitionRepositoryType->isEqual($repository->getType())) {
  91                  $id =& $repository->getId();
  92                  $repositoryTitles[$id->getIdString()] = $repository->getDisplayName();
  93                  $repositoryArray[$id->getIdString()] =& $repository;
  94              }
  95          }
  96          array_multisort($repositoryTitles, SORT_ASC, SORT_STRING, $repositoryArray);
  97          
  98          // print the Results
  99          $resultPrinter =& new ArrayResultPrinter($repositoryArray, 1, 20, "printRepositoryShort", $harmoni);
 100          $resultLayout =& $resultPrinter->getLayout($harmoni);
 101          $actionRows->add($resultLayout, "100%", null, LEFT, CENTER);
 102      }
 103  }
 104  
 105  
 106  // Callback function for printing Repositories
 107  function printRepositoryShort(& $repository, & $harmoni) {
 108      ob_start();
 109      
 110      $repositoryId =& $repository->getId();
 111      print  "\n\t<div style='font-weight: bold' title='"._("ID#").": ".
 112              $repositoryId->getIdString()."'>".$repository->getDisplayName()."</div>";
 113      $description =& HtmlString::withValue($repository->getDescription());
 114      $description->trim(500);
 115      print  "\n\t<div style='font-size: smaller;'>".$description->asString()."</div>";    
 116      
 117      RepositoryPrinter::printRepositoryFunctionLinks($harmoni, $repository);
 118      $xLayout =& new XLayout();
 119      $layout =& new Container($xLayout, BLANK, 1);
 120      $layout2 =& new Block(ob_get_contents(), EMPHASIZED_BLOCK);
 121      $layout->add($layout2, null, null, CENTER, CENTER);
 122      ob_end_clean();
 123      return $layout;
 124  }
 125  
 126  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]