PageRenderTime 51ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/contentmanager/code/trunk/administrator/components/com_contentmanager/tables/splash.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 139 lines | 64 code | 8 blank | 67 comment | 8 complexity | 44abfb6baddf09bce4e0ef902e9d03cd MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: splash.php 52 2009-05-25 11:26:19Z eddieajau $
  4. * @copyright Copyright (C) 2009 New Life in IT Pty Ltd. All rights reserved.
  5. * @license GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
  6. * @link http://www.theartofjoomla.com
  7. */
  8. // no direct access
  9. defined('_JEXEC') or die;
  10. /**
  11. * @package TAOJ.ContentManager
  12. * @subpackage com_contentmanager
  13. */
  14. class ContentManagerTableSplash extends JTable
  15. {
  16. /** @var
  17. * int unsigned
  18. */
  19. var $id = null;
  20. /**
  21. * @var varchar
  22. */
  23. var $title = null;
  24. /**
  25. * @var varchar
  26. */
  27. var $alias = null;
  28. /**
  29. * @var text
  30. * */
  31. var $body = null;
  32. /**
  33. * @var tinyint
  34. * */
  35. var $published = null;
  36. /**
  37. * @var text
  38. */
  39. var $access = null;
  40. /**
  41. * @var text
  42. */
  43. var $params = null;
  44. /**
  45. * @var text
  46. */
  47. var $media = null;
  48. /**
  49. * @var int
  50. */
  51. var $created_user_id = null;
  52. /**
  53. * @var datetime
  54. */
  55. var $created_date = null;
  56. /**
  57. * @var int
  58. */
  59. var $modified_user_id = null;
  60. /**
  61. * @var datetime
  62. */
  63. var $modified_date = null;
  64. /**
  65. * @var int
  66. */
  67. var $checked_out = null;
  68. /**
  69. * @var datetime
  70. */
  71. var $checked_out_time = null;
  72. /**
  73. * @var text
  74. */
  75. var $metakey = null;
  76. /**
  77. * @var text
  78. */
  79. var $metadesc = null;
  80. /**
  81. * @param database A database connector object
  82. */
  83. function __construct(&$db)
  84. {
  85. parent::__construct('#__taoj_contentmanager_splashes', 'id', $db);
  86. }
  87. function check()
  88. {
  89. // check for valid name
  90. if (trim($this->title) == '') {
  91. $this->_error = JText::_('Record must contain a title');
  92. return false;
  93. }
  94. if (empty($this->alias)) {
  95. $this->alias = strtolower($this->title);
  96. }
  97. // clean the alias
  98. $this->alias = str_replace('&', 'and', $this->alias);
  99. $this->alias = preg_replace('#[\s\-]+#', '-', $this->alias);
  100. $this->alias = preg_replace('#[^A-Z0-9\~\.\-\_]#i', '', $this->alias);
  101. return true;
  102. }
  103. /**
  104. * Override store
  105. */
  106. function store($updateNulls=false)
  107. {
  108. $app = &JFactory::getApplication();
  109. $user = &JFactory::getUser();
  110. $now = &JFactory::getDate();
  111. if ($this->id == 0) {
  112. $this->created_date = $now->toMySQL();
  113. $this->created_user_id = $user->get('id');
  114. }
  115. else {
  116. $this->modified_date = $now->toMySQL();
  117. $this->modified_user_id = $user->get('id');
  118. }
  119. if (is_array($this->params)) {
  120. $registry = new JRegistry;
  121. $registry->loadArray($this->params);
  122. $this->params = $registry->toString();
  123. }
  124. if (is_array($this->media)) {
  125. $registry = new JRegistry;
  126. $registry->loadArray($this->media);
  127. $this->media = $registry->toString();
  128. }
  129. return parent::store($updateNulls);
  130. }
  131. }