Phundament-Packages
[ class tree: Phundament-Packages ] [ index: Phundament-Packages ] [ all elements ]

Source for file LMediaContainer.php

Documentation is available at LMediaContainer.php

  1. <?php
  2.  
  3.  
  4. /**
  5.  * class file.
  6.  *
  7.  * @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
  8.  * @copyright 2005, diemeisterei GmbH. All rights reserved.
  9.  * @author $Author: schmunk $
  10.  * @version $Revision: 601 $  $Date: 2007-02-24 23:49:30 +0100 (Sa, 24 Feb 2007) $
  11.  * @package Phundament.Packages
  12.  * @subpackage LMediaManager
  13.  */
  14.  
  15. /**
  16.  * Default display template for media files
  17.  *
  18.  * Extends this class, if you need your own templates.
  19.  *
  20.  * @package System.Web.UI.WebControls
  21.  * @subpackage MetaData
  22.  */
  23.  
  24. {
  25.     private $_info;
  26.     private $Core;
  27.  
  28.     function setLimit($value)
  29.     {
  30.         $this->setViewState("Limit"$value);
  31.     }
  32.     function getLimit()
  33.     {
  34.         return $this->getViewState("Limit"null);
  35.     }
  36.     function setOffset($value)
  37.     {
  38.         $this->setViewState("Offset"$value);
  39.     }
  40.     function getOffset()
  41.     {
  42.         return $this->getViewState("Offset"null);
  43.     }
  44.  
  45.     /**
  46.      * prepares data
  47.      * @todo array sorting
  48.      */
  49.     function onPreRender($param)
  50.     {
  51.         parent :: onPreRender($param);
  52.  
  53.         #var_dump($this->getData());
  54.         if (is_array($this->getData()))
  55.             foreach ($this->getData(AS $d)
  56.             {
  57.                 $ids[]$d['MetaRecordId'];
  58.                 $this->_info[$d['MetaRecordId']]array (
  59.                     $d['Description'],
  60.                     $d['Rank']
  61.                 );
  62.             }
  63.         else
  64.         {
  65.             $idsarray ();
  66.             $this->setVisible(false);
  67.             return;
  68.         }
  69.  
  70.         // select records from db
  71.         $Criterianew LMediaCriteria;
  72.         $Criteria->setRecordIds($ids);
  73.         $c$Criteria->build();
  74.         #$c = new Criteria;
  75.         $c->setLimit($this->Limit);
  76.         $c->setOffset($this->Offset);
  77.  
  78.         $itemsLMediaManagerCore :: queryRecords($c);
  79.  
  80.         $sortedarray ();
  81.         foreach ($items AS $key => $record)
  82.         {
  83.             $id$record->getId();
  84.             // create new id from rank field
  85.             $newId$this->_info[$id][1];
  86.             while (!empty ($sorted[$newId]))
  87.             {
  88.                 $newId$newId "!";
  89.             }
  90.             // assign record
  91.             $sorted[$newId]$record;
  92.             ksort($sorted);
  93.         }
  94.         try
  95.         {
  96.             $this->Repeater->setDataSource($sorted);
  97.             $this->Repeater->dataBind();
  98.         }
  99.         catch (Exception $e)
  100.         {
  101.             Prado :: log($e->getMessage()4"Lithron.LMediaContainer");
  102.         }
  103.  
  104.     }
  105.     function updateItem($sender$param)
  106.     {
  107.         $id$param->getItem()->MetaRecordId->Text;
  108.         #$param->getItem()->Description->Text= $this->_info[$id][0];
  109.     }
  110. }
  111. ?>

Documentation generated on Sun, 25 Feb 2007 16:10:49 +0100 by phpDocumentor 1.3.1