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

Source for file Administration.php

Documentation is available at Administration.php

  1. <?php
  2.  
  3.  
  4. /**
  5. * LMediaManager 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: 246 $ $Date: 2006-06-01 17:11:24 +0200 (Do, 01 Jun 2006) $
  11. * @package Lithron.LMediaManager
  12. * @subpackage Pages
  13. */
  14.  
  15. /**
  16. * Displays main media manager administration interface
  17. *
  18. * @package Lithron.LMediaManager
  19. * @subpackage Pages
  20. */
  21. class Administration extends TPage
  22. {
  23. public $Core;
  24.  
  25. /**
  26. * @ignore
  27. */
  28. function onInit($param)
  29. {
  30. $this->Core= new LMediaManagerCore;
  31. $this->Master->enlargeContent();
  32. parent :: onInit($param);
  33. }
  34.  
  35. /**
  36. * @ignore
  37. */
  38. function onPreRender($param)
  39. {
  40. if (!$this->IsPostBack)
  41. {
  42. $this->fillGrid();
  43. }
  44. parent :: onPreRender($param);
  45. }
  46.  
  47. public function searchClicked($sender, $param)
  48. {
  49. $this->setViewstate("Set", "search");
  50. $this->setViewstate("SetParam", $sender->Page->SearchString->getText());
  51.  
  52. #$r = $this->Core->getMediaList("search", $sender->Page->SearchString->getText());
  53. $LMC= new LMediaCriteria;
  54. $LMC->setSearchString($sender->Page->SearchString->getText());
  55. $items= LMediaManagerCore :: queryRecords($LMC->build());
  56.  
  57. $this->Active->DataSource= $items;
  58. $this->Active->CurrentPageIndex= 0;
  59. $this->Active->dataBind();
  60. }
  61.  
  62. /**
  63. * Invokes database update
  64. * @todo
  65. */
  66. public function rescanDirectoryClicked()
  67. {
  68. #echo $this->deleteMissingRecords->getChecked();
  69. $files= $this->Core->updateDatabase($this->deleteMissingRecords->getChecked());
  70. Prado :: trace("Rescan done, database updated.", "Lithron.LMediaManger");
  71. $this->Active->CurrentPageIndex= 0;
  72. $this->fillGrid();
  73. #var_dump($tree);
  74. }
  75. /**
  76. * Prepares datagrids
  77. * @todo
  78. */
  79. private function fillGrid()
  80. {
  81. $LMC= new LMediaCriteria;
  82.  
  83. if ($this->getViewstate("Set") == "search")
  84. {
  85. $LMC->setSearchString($this->getViewstate("SetParam"));
  86. $items= LMediaManagerCore :: queryRecords($LMC->build());
  87. #$data = $this->Core->getMediaList("search", $this->getViewstate("SetParam"));
  88.  
  89. }
  90. else
  91. {
  92. $items= LMediaManagerCore :: queryRecords($LMC->build());
  93. #$data = $this->Core->getMediaList("active");
  94. }
  95. $this->Active->setDataSource($items);
  96. $this->Active->dataBind();
  97. Prado :: trace("Active grid filled", "Lithron.LMediaManger");
  98. }
  99.  
  100. /**
  101. * Description
  102. * @todo
  103. */
  104. public function editItem($sender, $param)
  105. {
  106. $this->Active->EditItemIndex= $param->Item->ItemIndex;
  107. $this->fillGrid();
  108. }
  109.  
  110. /**
  111. * Description
  112. * @todo
  113. */
  114. public function saveItem($sender, $param)
  115. {
  116. $conn= $this->Application->getModule("database")->getConnection("l_media_manager", "propel");
  117.  
  118. $item= $param->Item;
  119. $id= $this->Active->DataKeys[$item->ItemIndex];
  120.  
  121. $result= LMediaManagerFilesPeer :: retrieveByPK($id, $conn);
  122. $result->setDescription($item->Cells[3]->Description->Text);
  123. $result->save();
  124.  
  125. $this->Active->EditItemIndex= -1;
  126. $this->fillGrid();
  127. }
  128. /**
  129. * Description
  130. * @todo
  131. */
  132.  
  133. public function cancelItem($sender, $param)
  134. {
  135. $this->Active->EditItemIndex= -1;
  136. $this->fillGrid();
  137. }
  138. /**
  139. * Description
  140. * @todo
  141. */
  142.  
  143. public function deleteItem($sender, $param)
  144. {
  145.  
  146. #$this->deleteBook($this->DataGrid->DataKeys[$param->Item->ItemIndex]);
  147. $this->DataGrid->EditItemIndex= -1;
  148. $this->fillGrid();
  149. }
  150. /**
  151. * Description
  152. * @todo
  153. */
  154. public function changePage($sender, $param)
  155. {
  156. $this->Active->CurrentPageIndex= $param->NewPageIndex;
  157. $this->fillGrid();
  158. }
  159.  
  160. }
  161. ?>

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