Lithron.LMediaManager
[ class tree: Lithron.LMediaManager ] [ index: Lithron.LMediaManager ] [ all elements ]

Source for file LMediaBrick.php

Documentation is available at LMediaBrick.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: 259 $ $Date: 2006-06-07 01:03:06 +0200 (Mi, 07 Jun 2006) $
  11. * @package Lithron.LMediaManager
  12. * @subpackage WebControls
  13. */
  14.  
  15. /**
  16. * Displays a media file
  17. *
  18. * @package System.Web.UI.WebControls
  19. * @subpackage Bricks
  20. */
  21.  
  22. class LMediaBrick extends LBrick
  23. {
  24. private $CC;
  25. public $ContentObject;
  26.  
  27. /**
  28. * @return A string with the name
  29. */
  30. public function getDescriptiveName()
  31. {
  32. return "Media File (basic)";
  33. }
  34.  
  35. /**
  36. * @return Page path for admin page
  37. */
  38. public function getAdministrationPage()
  39. {
  40. return "packages.LMediaManager.Administration";
  41. }
  42.  
  43. /**
  44. * Adds admin snippets
  45. */
  46. public function __construct()
  47. {
  48. parent :: __construct();
  49. $admin= '<com:TListBox ID="MediaId" Width="100%" Rows="10"/>';
  50. $this->addAdminSnippet($admin);
  51. }
  52.  
  53. /**
  54. * @todo
  55. */
  56. public function onLoad($param)
  57. {
  58. parent :: onLoad($param);
  59. $this->prepareContent();
  60. }
  61.  
  62. /**
  63. * @todo
  64. */
  65. public function onPreRender($param)
  66. {
  67. parent :: onPreRender($param);
  68. if ($this->User->isInRole("admin"))
  69. $this->prepareAdmin();
  70. $this->prepareContent();
  71.  
  72. }
  73.  
  74. /**
  75. * parses descriptions for selection
  76. */
  77. protected function prepareAdmin()
  78. {
  79. $this->CC= Lithron :: singleton("LMediaManagerCore");
  80.  
  81. $Criteria= new LMediaCriteria;
  82. $Criteria->setActive(true);
  83. $items= LMediaManagerCore :: queryRecords($Criteria->build());
  84. $ds= array ();
  85. if (is_array($items))
  86. foreach ($items as $item)
  87. {
  88. $ds[$item->getId()]= $item->getDescription();
  89. }
  90. $this->AdminControls->MediaId->setDataSource($ds);
  91. $this->AdminControls->MediaId->dataBind();
  92. }
  93.  
  94. /**
  95. * created content object
  96. */
  97. protected function prepareContent()
  98. {
  99. $parm= $this->getParameters();
  100. if ($parm instanceof TMap && isset ($parm["MediaId"]))
  101. $this->ContentObject= LMediaManagerCore :: queryRecords($parm["MediaId"]);
  102. if (!is_object($this->ContentObject))
  103. $this->ContentObject= new LMediaManagerFiles();
  104. }
  105.  
  106. }
  107. ?>

Documentation generated on Tue, 20 Jun 2006 05:15:13 +0200 by phpDocumentor 1.3.0RC4