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

/xuser/code/trunk/administrator/components/com_artofuser/libraries/jxtended/form/fields/media.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 70 lines | 37 code | 8 blank | 25 comment | 1 complexity | d3ea318c691bb3ef793f7019f1fca5db MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: media.php 352 2010-10-26 08:52:42Z eddieajau $
  4. * @package JXtended.Libraries
  5. * @subpackage Form
  6. * @copyright Copyright (C) 2008 - 2009 JXtended, LLC. All rights reserved.
  7. * @license GNU General Public License
  8. * @link http://jxtended.com
  9. */
  10. defined('JPATH_BASE') or die;
  11. juimport('jxtended.form.formfield');
  12. /**
  13. * Form Field class for JXtended Libraries.
  14. *
  15. * @package JXtended.Libraries
  16. * @subpackage Form
  17. * @since 1.1
  18. */
  19. class JFormFieldMedia extends JFormField
  20. {
  21. /**
  22. * The field type.
  23. *
  24. * @var string
  25. */
  26. protected $type = 'Media';
  27. /**
  28. * Method to get the field input.
  29. *
  30. * @return string The field input.
  31. */
  32. protected function _getInput()
  33. {
  34. static $init = false;
  35. $html = '';
  36. if (!$init)
  37. {
  38. JHtml::_('behavior.modal');
  39. $js = "
  40. function jInsertFieldValue(value,id) {
  41. document.getElementById(id).value = value;
  42. }";
  43. $doc = &JFactory::getDocument();
  44. $doc->addScriptDeclaration($js);
  45. $init = true;
  46. }
  47. $link = $this->_element->attributes('link').$this->inputId;
  48. $size = $this->_element->attributes('size') ? 'size="'.$this->_element->attributes('size').'"' : '';
  49. $class = $this->_element->attributes('class') ? 'class="'.$this->_element->attributes('class').'"' : '';
  50. $html .= '<div style="float: left;">';
  51. $html .= '<input type="text" name="'.$this->inputName.'" id="'.$this->inputId.'" value="'.htmlspecialchars($this->value).'" '.$class.$size.' />';
  52. $html .= '</div>';
  53. $html .= '<div class="button2-left">';
  54. $html .= '<div class="blank">';
  55. $html .= '<a class="modal" title="'.JText::_('SELECT').'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 650, y: 375}}">';
  56. $html .= JText::_('SELECT');
  57. $html .= '</a>';
  58. $html .= '</div>';
  59. $html .= '</div>';
  60. return $html;
  61. }
  62. }