/administrator/components/com_joomfish/models/ContentElementTable.php

https://bitbucket.org/stager94/skmz-joomla · PHP · 92 lines · 34 code · 10 blank · 48 comment · 4 complexity · 18c65486bc7e62c2a2067f7c1b695c16 MD5 · raw file

  1. <?php
  2. /**
  3. * Joom!Fish - Multi Lingual extention and translation manager for Joomla!
  4. * Copyright (C) 2003 - 2011, Think Network GmbH, Munich
  5. *
  6. * All rights reserved. The Joom!Fish project is a set of extentions for
  7. * the content management system Joomla!. It enables Joomla!
  8. * to manage multi lingual sites especially in all dynamic information
  9. * which are stored in the database.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * as published by the Free Software Foundation; either version 2
  14. * of the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
  24. *
  25. * The "GNU General Public License" (GPL) is available at
  26. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  27. * -----------------------------------------------------------------------------
  28. * $Id: ContentElementTable.php 1551 2011-03-24 13:03:07Z akede $
  29. * @package joomfish
  30. * @subpackage Models
  31. *
  32. */
  33. // Don't allow direct linking
  34. defined( '_JEXEC' ) or die( 'Restricted access' );
  35. include_once(dirname(__FILE__).DS."ContentElementTableField.php");
  36. /**
  37. * Description of a content element table.
  38. *
  39. * @package joomfish
  40. * @subpackage administrator
  41. * @copyright 2003 - 2011, Think Network GmbH, Munich
  42. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
  43. * @version $Revision: 1551 $
  44. * @author Alex Kempkens <joomfish@thinknetwork.com>
  45. */
  46. class ContentElementTable {
  47. var $Name;
  48. var $Fields;
  49. var $Filter;
  50. /** Standard constructor
  51. */
  52. function ContentElementTable( $tableElement ) {
  53. $this->Name = trim( $tableElement->getAttribute( 'name' ) );
  54. $tableFields = $tableElement->getElementsByTagName( 'field' );
  55. $this->Fields =array();
  56. $this->IndexedFields =array();
  57. foreach( $tableFields as $tablefieldElement ) {
  58. $field = new ContentElementTablefield( $tablefieldElement );
  59. $this->Fields[] = $field;
  60. $this->IndexedFields[$field->Name] = $field;
  61. }
  62. $filterElement = $tableElement->getElementsByTagName('filter');
  63. if( $filterElement && $filterElement->length>0 ) {
  64. $this->Filter = $filterElement->item(0)->textContent;
  65. }
  66. }
  67. /** Retrieves one field based on the name
  68. * @param string Fieldname
  69. * @return object field
  70. */
  71. function getField( $name ) {
  72. $ret_field = null;
  73. foreach( $this->Fields as $field ) {
  74. if ($field->Name == $name ) {
  75. $ret_field = $field;
  76. break;
  77. }
  78. }
  79. return $ret_field;
  80. }
  81. }
  82. ?>