- <?php
-
-
- /**
- * LMediaManager class file.
- *
- * @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
- * @copyright 2005, diemeisterei GmbH. All rights reserved.
- * @author $Author: schmunk $
- * @version $Revision: 246 $ $Date: 2006-06-01 17:11:24 +0200 (Do, 01 Jun 2006) $
- * @package Lithron.LMediaManager
- * @subpackage Pages
- */
-
- /**
- * Displays main media manager administration interface
- *
- * @package Lithron.LMediaManager
- * @subpackage Pages
- */
- class Administration extends TPage
- {
- public $Core;
-
- /**
- * @ignore
- */
- function onInit($param)
- {
- $this->Core= new LMediaManagerCore;
- $this->Master->enlargeContent();
- parent :: onInit($param);
- }
-
- /**
- * @ignore
- */
- function onPreRender($param)
- {
- if (!$this->IsPostBack)
- {
- $this->fillGrid();
- }
- parent :: onPreRender($param);
- }
-
- public function searchClicked($sender, $param)
- {
- $this->setViewstate("Set", "search");
- $this->setViewstate("SetParam", $sender->Page->SearchString->getText());
-
- #$r = $this->Core->getMediaList("search", $sender->Page->SearchString->getText());
- $LMC= new LMediaCriteria;
- $LMC->setSearchString($sender->Page->SearchString->getText());
- $items= LMediaManagerCore :: queryRecords($LMC->build());
-
- $this->Active->DataSource= $items;
- $this->Active->CurrentPageIndex= 0;
- $this->Active->dataBind();
- }
-
- /**
- * Invokes database update
- * @todo
- */
- public function rescanDirectoryClicked()
- {
- #echo $this->deleteMissingRecords->getChecked();
- $files= $this->Core->updateDatabase($this->deleteMissingRecords->getChecked());
- Prado :: trace("Rescan done, database updated.", "Lithron.LMediaManger");
- $this->Active->CurrentPageIndex= 0;
- $this->fillGrid();
- #var_dump($tree);
- }
- /**
- * Prepares datagrids
- * @todo
- */
- private function fillGrid()
- {
- $LMC= new LMediaCriteria;
-
- if ($this->getViewstate("Set") == "search")
- {
- $LMC->setSearchString($this->getViewstate("SetParam"));
- $items= LMediaManagerCore :: queryRecords($LMC->build());
- #$data = $this->Core->getMediaList("search", $this->getViewstate("SetParam"));
-
- }
- else
- {
- $items= LMediaManagerCore :: queryRecords($LMC->build());
- #$data = $this->Core->getMediaList("active");
- }
- $this->Active->setDataSource($items);
- $this->Active->dataBind();
- Prado :: trace("Active grid filled", "Lithron.LMediaManger");
- }
-
- /**
- * Description
- * @todo
- */
- public function editItem($sender, $param)
- {
- $this->Active->EditItemIndex= $param->Item->ItemIndex;
- $this->fillGrid();
- }
-
- /**
- * Description
- * @todo
- */
- public function saveItem($sender, $param)
- {
- $conn= $this->Application->getModule("database")->getConnection("l_media_manager", "propel");
-
- $item= $param->Item;
- $id= $this->Active->DataKeys[$item->ItemIndex];
-
- $result= LMediaManagerFilesPeer :: retrieveByPK($id, $conn);
- $result->setDescription($item->Cells[3]->Description->Text);
- $result->save();
-
- $this->Active->EditItemIndex= -1;
- $this->fillGrid();
- }
- /**
- * Description
- * @todo
- */
-
- public function cancelItem($sender, $param)
- {
- $this->Active->EditItemIndex= -1;
- $this->fillGrid();
- }
- /**
- * Description
- * @todo
- */
-
- public function deleteItem($sender, $param)
- {
-
- #$this->deleteBook($this->DataGrid->DataKeys[$param->Item->ItemIndex]);
- $this->DataGrid->EditItemIndex= -1;
- $this->fillGrid();
- }
- /**
- * Description
- * @todo
- */
- public function changePage($sender, $param)
- {
- $this->Active->CurrentPageIndex= $param->NewPageIndex;
- $this->fillGrid();
- }
-
- }
- ?>