Phundament-Packages
[ class tree: Phundament-Packages ] [ index: Phundament-Packages ] [ 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: 601 $  $Date: 2007-02-24 23:49:30 +0100 (Sa, 24 Feb 2007) $
  11.  * @package Phundament.Packages
  12.  * @subpackage LMediaManager
  13.  */
  14.  
  15. /**
  16.  * Displays main media manager administration interface
  17.  *
  18.  * @package Admin.Pages
  19.  * @subpackage LMediaManager
  20.  */
  21. class Administration extends TPage
  22. {
  23.     public $Core;
  24.  
  25.     /**
  26.      * @ignore
  27.      */
  28.     function onInit($param)
  29.     {
  30.         parent :: onInit($param);
  31.         $this->Corenew LMediaManagerCore;
  32.     }
  33.  
  34.     /**
  35.      * @ignore
  36.      */
  37.     function onPreRender($param)
  38.     {
  39.         parent :: onPreRender($param);
  40.  
  41.         #    if (!$this->IsPostBack)
  42.         #    {
  43.         $this->fillGrid();
  44.         #    }
  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.         $LMCnew LMediaCriteria;
  54.         $LMC->setSearchString($sender->Page->SearchString->getText());
  55.         $itemsLMediaManagerCore :: queryRecords($LMC->build());
  56.  
  57.         $this->Active->DataSource$items;
  58.         $this->Active->CurrentPageIndex0;
  59.         $this->Active->dataBind();
  60.     }
  61.  
  62.     /**
  63.      * Invokes database update
  64.      * @todo
  65.      */
  66.     public function rescanDirectoryClicked($sender$param)
  67.     {
  68.         $this->Application->getModule("user_message")->add("Rescanning Media Database"1);
  69.  
  70.         $dir($sender->NamingContainer->findControl('ScanDirectoryOverride')->TextLMediaManagerCore :: getMediaDir(.
  71.         $sender->NamingContainer->findControl('ScanDirectoryOverride')->Text $sender->NamingContainer->findControl('ScanDirectory')->SelectedValue;
  72.         // TODO - this is ugly
  73.         $files$this->Core->updateDatabase($dir$this->deleteMissingRecords->getChecked()$sender->NamingContainer->findControl('RightsPanel'));
  74.         Prado :: trace("Rescan done, database updated.""Lithron.LMediaManger");
  75.  
  76.         $this->Active->CurrentPageIndex0;
  77.         $this->fillGrid();
  78.     }
  79.  
  80.     /**
  81.      * Prepares datagrids
  82.      * @todo
  83.      */
  84.     private function fillGrid()
  85.     {
  86.         $LMCnew LMediaCriteria;
  87.  
  88.         if ($this->getViewstate("Set"== "search")
  89.         {
  90.             $LMC->setSearchString($this->getViewstate("SetParam"));
  91.             $c$LMC->build();
  92.             LRightsManager :: restrictCriteria($c"LMediaManagerFilesPeer");
  93.             $itemsLMediaManagerCore :: queryRecords($c);
  94.             #$data = $this->Core->getMediaList("search", $this->getViewstate("SetParam"));
  95.  
  96.         }
  97.         else
  98.         {
  99.             $c$LMC->build();
  100.             LRightsManager :: restrictCriteria($c"LMediaManagerFilesPeer");
  101.             $itemsLMediaManagerCore :: queryRecords($c);
  102.             #$data = $this->Core->getMediaList("active");
  103.         }
  104.         $this->Active->setDataSource($items);
  105.         $this->Active->dataBind();
  106.         Prado :: trace("Active grid filled""Lithron.LMediaManger");
  107.     }
  108.  
  109.     /**
  110.     * Description
  111.     * @todo
  112.     */
  113.     public function editItem($sender$param)
  114.     {
  115.         $conn$this->Application->getModule("database")->getConnection("l_media_manager""propel");
  116.         $id$this->Active->DataKeys[$param->Item->ItemIndex];
  117.         $resultLMediaManagerFilesPeer :: retrieveByPK($id$conn);
  118.  
  119.         if (LRightsManager :: getRights($resultLPermissions :: EDIT)
  120.         {
  121.             $this->Active->EditItemIndex$param->Item->ItemIndex;
  122.             $this->fillGrid();
  123.         }
  124.         else
  125.         {
  126.             $this->Application->getModule("user_message")->add("Not allowed.");
  127.             return;
  128.         }
  129.  
  130.     }
  131.  
  132.     /**
  133.     * Description
  134.     * @todo
  135.     */
  136.     public function saveItem($sender$param)
  137.     {
  138.         $conn$this->Application->getModule("database")->getConnection("l_media_manager""propel");
  139.  
  140.         $item$param->Item;
  141.         $id$this->Active->DataKeys[$item->ItemIndex];
  142.  
  143.         $resultLMediaManagerFilesPeer :: retrieveByPK($id$conn);
  144.         $result->setDescription($item->Cells[3]->Description->Text);
  145.         $result->save();
  146.  
  147.         $this->Active->EditItemIndex= -1;
  148.         $this->fillGrid();
  149.     }
  150.     /**
  151.      * Description
  152.      * @todo
  153.      */
  154.  
  155.     public function cancelItem($sender$param)
  156.     {
  157.         $this->Active->EditItemIndex= -1;
  158.         $this->fillGrid();
  159.     }
  160.     /**
  161.      * Description
  162.      * @todo
  163.      */
  164.  
  165.     public function deleteItem($sender$param)
  166.     {
  167.         $this->DataGrid->EditItemIndex= -1;
  168.         $this->fillGrid();
  169.     }
  170.     /**
  171.      * Description
  172.      * @todo
  173.      */
  174.     public function changePage($sender$param)
  175.     {
  176.         $this->Active->CurrentPageIndex$param->NewPageIndex;
  177.         $this->fillGrid();
  178.     }
  179.     /**
  180.      * Description
  181.      * @todo
  182.      */
  183.     public function reloadPage($sender$param)
  184.     {
  185.         $this->Service->reload();
  186.     }
  187.  
  188. }
  189. ?>

Documentation generated on Sun, 25 Feb 2007 16:09:14 +0100 by phpDocumentor 1.3.1