Phundament-Packages
[ class tree: Phundament-Packages ] [ index: Phundament-Packages ] [ all elements ]

Source for file LContentCore.php

Documentation is available at LContentCore.php

  1. <?php
  2.  
  3.  
  4. /**
  5.  * LContentCore 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 LContent
  13.  */
  14. /**
  15.  * Mainly provides database access for LContent database
  16.  *
  17.  * @package System.Util
  18.  * @subpackage Cores
  19.  */
  20. Prado :: setPathOfAlias("LContent"dirname(__FILE__));
  21. Prado :: using("LContent.db.propel.*");
  22. Prado :: using("LContent.db.propel.l_content.*");
  23. class LContentCore extends TControl
  24. {
  25.     const STATUS_OFF1;
  26.     const STATUS_STAGING2;
  27.     const STATUS_PUBLISHED3;
  28.  
  29.     /**
  30.      * returns records from database
  31.      *
  32.      * @param integer,Criteria 
  33.      * @return LContent object
  34.      */
  35.     public function queryRecords($cnull)
  36.     {
  37.         $this->Application->getModule("database")->getConnection("l_content""propel");
  38.         if (is_numeric($c))
  39.         {
  40.             Prado :: trace("Querying database by id ($c)""Lithron.LContent");
  41.             return LContentPeer :: retrieveByPK($c$this->Application->getModule("database")->getConnection("l_content""propel"));
  42.         }
  43.         if ($c == null)
  44.             $cnew Criteria;
  45.         Prado :: trace("Querying database by criteria""Lithron.LContent");
  46.         $resultLContentPeer :: doSelect($c$this->Application->getModule("database")->getConnection("l_content""propel"));
  47.         return $result;
  48.     }
  49.  
  50.     /**
  51.      * deletes record in database
  52.      */
  53.     public function deleteRecordById($id)
  54.     {
  55.         $cnew Criteria();
  56.         $c->add(LMetaDataPeer :: OWNER_ID"lcontent");
  57.         $c->add(LMetaDataPeer :: OWNER_RECORD_ID$id);
  58.         LMetaDataPeer :: doDelete($c);
  59.  
  60.         $record$this->queryRecords($id);
  61.         $record->delete();
  62.  
  63.         $this->Application->getModule("user_message")->add("Content record #" $record->getId(" deleted"1);
  64.         $this->redirectToList();
  65.     }
  66.  
  67.     /**
  68.      * saves record in database and performs redirect
  69.      */
  70.     public function saveRecord($record)
  71.     {
  72.         $record->save($this->Application->getModule("database")->getConnection("l_content""propel"));
  73.  
  74.         Prado :: trace("LContent record saved""Lithron.LContent");
  75.         $this->Application->getModule("user_message")->add("Content record #" $record->getId(" saved"1);
  76.  
  77.         self :: redirectToList();
  78.     }
  79.  
  80.     /**
  81.      * redirects to user to admin or content
  82.      */
  83.     public function redirectToList()
  84.     {
  85.         if (is_object($this->Page))
  86.         {
  87.             $backUrl$this->Page->getViewState("BackUrl");
  88.             if ($backUrl !== null)
  89.             {
  90.                 $url$backUrl;
  91.                 $this->Page->setViewState("BackUrl"null);
  92.             }
  93.             else
  94.                 $url"packages.LContent.AdminList";
  95.         }
  96.         else
  97.             $url"packages.LContent.AdminList";
  98.         Prado :: trace("Redirecting to {$url} ...""Lithron.LContentCore");
  99.  
  100.         Lithron :: saveLogging($this->Application);
  101.         $url$this->Service->constructUrl($url);
  102.         $this->Response->redirect($url);
  103.     }
  104.  
  105.     /**
  106.      * returns brick configuration options from application.xml
  107.      */
  108.     public function getConfiguration($option)
  109.     {
  110.         $val$this->Application->getParameters()->itemAt($option);
  111.         $brickssplit(","$val);
  112.         if (is_array($bricks))
  113.             foreach ($bricks as $brick)
  114.             {
  115.                 $ds[$brick]$brick;
  116.                 try
  117.                 {
  118.                     if (@include ($brick ".php"))
  119.                     {
  120.                         $dummyPrado :: createComponent($brick)// TODO
  121.                         if (method_exists($dummy"getDescriptiveName"))
  122.                             $ds[$brick]$dummy->getDescriptiveName();
  123.                     }
  124.                 }
  125.                 catch (Exception $e)
  126.                 {
  127.                     Prado :: log("Problem reading php file for: {$brick}"4"Lithron.LContent");
  128.                 }
  129.                 Prado :: trace("Configuration option: {$brick}""Lithron.LContent");
  130.             }
  131.         return $ds;
  132.     }
  133. }
  134. ?>

Documentation generated on Sun, 25 Feb 2007 16:10:02 +0100 by phpDocumentor 1.3.1