Source for file AdminRecord.php
Documentation is available at AdminRecord.php
* @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
* @copyright 2005, diemeisterei GmbH. All rights reserved.
* @author $Author: schmunk $
* @version $Revision: 601 $ $Date: 2007-02-24 23:49:30 +0100 (Sa, 24 Feb 2007) $
* @package Phundament.Packages
* Interface for editing or creating a record in database
public function onInit($param)
parent :: onInit($param);
$this->Page->setViewState("BackUrl", $this->Request->itemAt("back_url"));
public function onLoad($param)
parent :: onLoad($param);
$this->Type->SelectedValue= $this->Record->getType();
$this->Category->SelectedValue= $this->Record->getCategory();
Prado :: log($e->getMessage(), 8, "Lithron.LContent");
$this->Category->dataBind();
Prado :: log($e->getMessage(), 8, "Lithron.LContent");
parent :: onPreRender($param);
public function backClicked()
public function createClicked()
$this->setRecordValues($record);
public function updateClicked()
$record= $this->getViewstate("Record");
$this->setRecordValues($record);
* Loads record data or sets default value and sets button visibility
private function prepareData()
if (!$this->isPostBack && $id= $this->Request->itemAt("l_content_id"))
Prado :: trace("L_CONTENT_ID found", "Lithron.LContent");
$this->Record= $this->Core->queryRecords($id);
if (LRightsManager :: getRights($this->Record) & LPermissions :: EDIT)
$this->Application->getModule("user_message")->add("Not allowed.", "ERROR");
$this->Core->redirectToList();
$this->setViewstate("Record", $this->Record);
Prado :: log("Error while preparing data: " . $e->getMessage(), 8, "Lithron.LContent");
elseif ($this->getViewstate("Record") !== null || $this->isPostBack)
$this->Record= $this->getViewstate("Record");
$this->Culture->setText($this->Application->Globalization->getCulture());
$this->StartDate->setDate(date("m/d/y"));
$this->Buttons->dataBind();
* Sets values from template in propel object
private function setRecordValues($record)
$record->setAlias($this->Alias->getText());
$record->setCulture(strtoupper($this->Culture->getText()));
$record->setRank($this->Rank->getText());
$record->setType($this->Type->getText());
$record->setOptions($this->Options->getText());
$record->setCategory($this->Category->getText());
if ($this->CleanStartDate->getChecked() == true)
$record->setStartDate(null);
elseif ($this->StartDate->getText()) $record->setStartDate(strtotime($this->StartDate->getText()));
if ($this->CleanEndDate->getChecked() == true)
$record->setEndDate(null);
elseif ($this->EndDate->getText()) $record->setEndDate(strtotime($this->EndDate->getText()));
$record->setPreStart($this->PreStart->getText());
$record->setPostEnd($this->PostEnd->getText());
$record->setStatus($this->Status->getSelectedValue());
$record->setHeadline($this->Headline->getText());
$record->setSubline($this->Subline->getText());
$record->setText($this->Text->getText());
$record->setLastEdit(time());
LRightsManager :: setRights($record, $this->RightsPanel);
$record->save($this->Application->getModule("database")->getConnection("l_content", "propel"));
$record->setLMetaData($this->MetaData); // has to be done after save, otherwise not id available
|