/administrator/components/com_easyblog/elements/blogs.php

https://bitbucket.org/pastor399/newcastleunifc · PHP · 69 lines · 51 code · 8 blank · 10 comment · 2 complexity · fec240406042491af9810bba54360330 MD5 · raw file

  1. <?php
  2. /**
  3. * @package EasyBlog
  4. * @copyright Copyright (C) 2010 Stack Ideas Private Limited. All rights reserved.
  5. * @license GNU/GPL, see LICENSE.php
  6. * EasyBlog is free software. This version may have been modified pursuant
  7. * to the GNU General Public License, and as distributed it includes or
  8. * is derivative of works licensed under the GNU General Public License or
  9. * other free or open source software licenses.
  10. * See COPYRIGHT.php for copyright notices and details.
  11. */
  12. defined('_JEXEC') or die('Restricted access');
  13. class JElementBlogs extends JElement
  14. {
  15. var $_name = 'Blogs';
  16. function fetchElement($name, $value, &$node, $control_name)
  17. {
  18. require_once( JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'constants.php' );
  19. require_once( EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'helper.php' );
  20. $mainframe = JFactory::getApplication();
  21. $doc = JFactory::getDocument();
  22. EasyBlogHelper::loadHeaders();
  23. JHTML::_( 'behavior.modal' );
  24. $id = '';
  25. if( $value == '0' )
  26. {
  27. $value = JText::_( 'Select an entry' );
  28. }
  29. else
  30. {
  31. $blog = EasyBlogHelper::getTable( 'Blog' );
  32. $blog->load( $value );
  33. $value = $blog->title;
  34. $id = $blog->id;
  35. }
  36. ob_start();
  37. ?>
  38. <script type="text/javascript">
  39. EasyBlog(function($) {
  40. window.insertBlog = function(id, name) {
  41. $( '#item_id' ).val( id );
  42. $( '#item_value' ).val( name );
  43. $.Joomla("squeezebox").close();
  44. };
  45. });
  46. </script>
  47. <div style="float:left;">
  48. <input type="text" id="item_value" readonly="readonly" value="<?php echo $value; ?>" disabled="disabled" style="background: #ffffff;width: 200px;" />
  49. </div>
  50. <div class="button2-left">
  51. <div class="blank">
  52. <a rel="{handler: 'iframe', size: {x: 750, y: 475}}" href="<?php echo JRoute::_( 'index.php?option=com_easyblog&view=blogs&tmpl=component&browse=1&browsefunction=insertBlog' );?>" title="Select an Article" class="modal"><?php echo JText::_( 'Select' ); ?></a>
  53. </div>
  54. </div>
  55. <input type="hidden" id="item_id" name="<?php echo $control_name;?>[<?php echo $name;?>]" value="<?php echo $id;?>" />
  56. <?php
  57. $html = ob_get_contents();
  58. ob_end_clean();
  59. return $html;
  60. }
  61. }