Source for file Administration.php
Documentation is available at Administration.php
* LTranslation 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: 297 $ $Date: 2006-07-03 19:33:02 +0200 (Mo, 03 Jul 2006) $
* @package Phundament.Packages
* Displays main media manager administration interface
Prado :: setPathOfAlias("LTranslate", dirname(__FILE__ ));
Prado :: using("LTranslate.db.propel.*");
Prado :: using("LTranslate.db.propel.l_translate.*");
parent :: onInit($param);
$conn = $this->Application->getModule("database")->getConnection("l_translate");
$catalogs = CataloguePeer::doSelect(new Criteria, $conn);
$this->CatalogueId->DataSource = $catalogs;
$this->CatalogueId->DataTextField = "Name";
$this->CatalogueId->DataValueField = "CatId";
$this->CatalogueId->dataBind();
function onPreRender($param)
parent :: onPreRender($param);
function queryCatalogueId()
$catalogue_where = "messages.". $this->Application->Globalization->Culture;
$c->add(CataloguePeer::NAME, $catalogue_where);
$result = CataloguePeer::doSelect($c);
return $result[0]->getCatId();
function cleanupDatabase()
$c->addAnd(TransUnitPeer::TARGET, null);
$result = TransUnitPeer::doDelete($c);
function deleteRecord($sender, $param)
$c->addAnd(TransUnitPeer::MSG_ID, $sender->CustomData);
$result = TransUnitPeer::doDelete($c);
$conn = $this->Application->getModule("database")->getConnection("l_translate");
$c->addAscendingOrderByColumn(TransUnitPeer::SOURCE);
// query only items with same cat_id as user's culture, if user is not root
if (!$this->User->isInRole('root'))
$cat_id = $this->queryCatalogueId();
$c->add(TransUnitPeer::CAT_ID, $cat_id);
$result = TransUnitPeer::doSelect($c);
// select only current culture, even if root, if chosen catalogue is "all"
if ($this->CatalogueId->SelectedValue == "all")
$result = TransUnitPeer::doSelect($c, $conn);
} else if ($this->CatalogueId->SelectedValue != "all") {
$cat_id = $this->CatalogueId->SelectedValue;
$c->add(TransUnitPeer::CAT_ID, $cat_id);
$result = TransUnitPeer::doSelect($c, $conn);
$translation_data = $this->queryRecords();
$filter_type = $this->FilterType->SelectedValue;
if ($filter_type != "all") $translation_data = $this->filter($translation_data);
$this->TranslationGrid->setDataSource($translation_data);
$this->TranslationGrid->dataBind();
$shown_objects = array();
foreach($data as $dbObject)
if (!$dbObject->getTarget()) $shown_objects[] = $dbObject;
public function editItem($sender, $param)
$conn= $this->Application->getModule("database")->getConnection("l_translate", "propel");
$id = $this->TranslationGrid->DataKeys[$param->Item->ItemIndex];
$result = TransUnitPeer :: retrieveByPK($id, $conn);
$this->TranslationGrid->EditItemIndex = $param->Item->ItemIndex;
function saveItem($sender, $param)
$conn= $this->Application->getModule("database")->getConnection("l_translate", "propel");
$id = $this->TranslationGrid->DataKeys[$item->ItemIndex];
$result = TransUnitPeer :: retrieveByPK($id, $conn);
$result->setTarget($item->Cells[3]->Target->Text);
$this->TranslationGrid->EditItemIndex= - 1;
public function changePage($sender, $param)
$this->TranslationGrid->CurrentPageIndex= $param->NewPageIndex;
public function cancelItem($sender, $param)
$this->TranslationGrid->EditItemIndex= - 1;
|