Example #1
0
 /**
  * Displays a note icon.
  *
  * @param   integer  $count   The number of notes for the user
  * @param   integer  $userId  The user ID
  *
  * @return  string  A link to a modal window with the user notes
  *
  * @since   2.5
  */
 public static function notes($count, $userId)
 {
     if (empty($count)) {
         return '';
     }
     $title = JText::plural('COM_USERS_N_USER_NOTES', $count);
     echo JHtmlBootstrap::renderModal('userModal_' . (int) $userId, array('url' => JRoute::_('index.php?option=com_users&view=notes&tmpl=component&layout=modal&u_id=' . (int) $userId), 'title' => $title, 'width' => '800px', 'height' => '500px'));
     return '<a href="#userModal_' . (int) $userId . '" id="modal-' . (int) $userId . '" data-toggle="modal">' . '<span class="label label-info"><i class="icon-drawer-2"></i>' . $title . '</span></a>';
 }
Example #2
0
 /**
  * Tests the renderModal method.
  *
  * @return  void
  *
  * @since   3.6.0
  */
 public function testRenderModal()
 {
     // Get the rendered output.
     $modal = JHtmlBootstrap::renderModal();
     // Get the document instance
     $document = JFactory::getDocument();
     $this->assertArrayHasKey('/media/jui/js/bootstrap.min.js', $document->_scripts, 'Verify that the alert method initialises Bootstrap as well');
     // Check the modal's html structure
     $matcher = array('id' => 'modal', 'tag' => 'div', 'attributes' => array('class' => 'modal hide fade'), 'child' => array('attributes' => array('class' => 'modal-header'), 'tag' => 'div'), 'children' => array('count' => 2));
     $this->assertTag($matcher, $modal, 'Verify that the html structure of the modal is correct');
 }
Example #3
0
 /**
  * Returns the HTML for a image select box form field.
  *
  * @return  object    The image select box form field.
  * @since   2.0
  */
 protected function getInput()
 {
     require_once JPATH_BASE . '/components/com_joomgallery/includes/defines.php';
     $db = JFactory::getDBO();
     $doc = JFactory::getDocument();
     $required = $this->required ? ' required="required"' : '';
     $validate = $this->validate && $this->validate == 'joompositivenumeric' ? true : false;
     $class = '';
     $script = array();
     $html = array();
     $css = array();
     JHtml::_('bootstrap.tooltip');
     if ($validate) {
         $class = 'validate-' . $this->validate;
         // Add a validation script for form validation
         $script[] = '  jQuery(document).ready(function() {';
         $script[] = '    document.formvalidator.setHandler("joompositivenumeric", function(value) {';
         $script[] = '      regex = /^[1-9]+[0-9]*$/;';
         $script[] = '      return regex.test(value);';
         $script[] = '    })';
         $script[] = '  });';
     }
     // Add script for fetching the selected image in the modal dialog
     $script[] = '  function joom_selectimage(id, title, object) {';
     $script[] = '    document.getElementById(object).value            = id;';
     $script[] = '    document.getElementById(object + "_name").value  = title;';
     $script[] = '    jQuery("#modalSelectImage").modal("hide");';
     if ($validate) {
         $script[] = '    document.formvalidator.validate(document.getElementById(object));';
         $script[] = '    document.formvalidator.validate(document.getElementById(object + "_name"));';
     }
     $script[] = '  }';
     $doc->addScriptDeclaration(implode("\n", $script));
     // Remove bottom border from modal header as we will not have a title
     $css[] = '  #modalSelectImage .modal-header {';
     $css[] = '    border-bottom: none;';
     $css[] = '  }';
     $doc->addStyleDeclaration(implode("\n", $css));
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_joomgallery/tables');
     $img = JTable::getInstance('joomgalleryimages', 'Table');
     if ($this->value) {
         $img->load($this->value);
     } else {
         $img->imgtitle = '';
     }
     $link = 'index.php?option=com_joomgallery&amp;view=mini&amp;extended=0&amp;format=raw&amp;catid=0&amp;object=' . $this->id;
     $title = htmlspecialchars($img->imgtitle, ENT_QUOTES, 'UTF-8');
     $html[] = '<span class="input-append">';
     $html[] = '<input type="text" class="input-medium" id="' . $this->id . '_name" value="' . $title . '"' . $required . ' readonly="readonly" size="40" />';
     $html[] = '<a href="#modalSelectImage"  class="btn hasTooltip" role="button"  data-toggle="modal"' . ' title="' . JHtml::tooltipText('COM_JOOMGALLERY_LAYOUT_COMMON_CHOOSE_IMAGE') . '">' . '<i class="icon-image"></i> ' . JText::_('JSELECT') . '</a>';
     $html[] = JHtmlBootstrap::renderModal('modalSelectImage', array('url' => $link . '&amp;' . JSession::getFormToken() . '=1"', 'width' => '620px', 'height' => '390px'));
     $html[] = '</span>';
     if ($this->required) {
         if (!empty($class)) {
             $class .= ' ';
         }
         $class .= 'required';
     }
     $html[] = '<input class="' . $class . '" type="hidden" id="' . $this->id . '" name="' . $this->name . '" value="' . (int) $this->value . '"/>';
     return implode("\n", $html);
 }
Example #4
0
 /**
  * Returns the HTML for a thumbnail selection form field.
  *
  * @return  object    The thumbnail selection form field.
  * @since   2.0
  */
 protected function getInput()
 {
     JHtml::_('bootstrap.tooltip');
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $doc = JFactory::getDocument();
     $imagelib_id = $this->element['imagelib_id'] ? $this->element['imagelib_id'] : 'imagelib';
     $script = array();
     $html = array();
     $css = array();
     $catid = 0;
     if ($app->isAdmin()) {
         // Get category id from request
         $cids = JRequest::getVar('cid', array(), '', 'array');
         if (isset($cids[0])) {
             $catid = intval($cids[0]);
         }
         // Prepare the path for the thumbnail preview
         $path = JRoute::_('index.php?option=' . _JOOM_OPTION . '&controller=images&view=image&format=raw&type=thumb', false) . '&cid=';
     } else {
         // Get category id from request
         $catid = JRequest::getInt('catid', 0);
         // Prepare the path for the thumbnail preview
         $path = JRoute::_('index.php?option=' . _JOOM_OPTION . '&view=image&format=raw&type=thumb', false) . '&id=';
     }
     $script[] = '  function joom_selectimage(id, title, object, filename) {';
     $script[] = '    document.getElementById(object + "_id").value = id;';
     $script[] = '    document.getElementById(object + "_name").value = title;';
     $script[] = '    jQuery("#' . $this->id . '_clear").removeClass("hidden");';
     $script[] = '    if(id != "") {';
     $script[] = '      document.getElementById("' . $imagelib_id . '").src = "' . $path . '" + id';
     $script[] = '    } else {';
     $script[] = '      document.getElementById("' . $imagelib_id . '").src = "' . JURI::root(true) . '/media/system/images/blank.png";';
     $script[] = '    }';
     $script[] = '    jQuery("#modalSelectThumbnail").modal("hide");';
     $script[] = '  }';
     $script[] = '  function joom_clearthumb() {';
     $script[] = '    jQuery("#' . $this->id . '_clear").addClass("hidden");';
     $script[] = '    document.getElementById("' . $this->id . '_id").value = 0;';
     $script[] = '    document.getElementById("' . $this->id . '_name").value = "-";';
     $script[] = '    document.getElementById("' . $imagelib_id . '").src = "' . JURI::root(true) . '/media/system/images/blank.png";';
     $script[] = '    return false';
     $script[] = '  }';
     $doc->addScriptDeclaration(implode("\n", $script));
     // Remove bottom border from modal header as we will not have a title
     $css[] = '  #modalSelectThumbnail .modal-header {';
     $css[] = '    border-bottom: none;';
     $css[] = '  }';
     $doc->addStyleDeclaration(implode("\n", $css));
     // Get the image title
     $img = JTable::getInstance('joomgalleryimages', 'Table');
     if (!empty($this->value)) {
         $img->load($this->value);
     } else {
         $img->imgtitle = '-';
     }
     $title = htmlspecialchars($img->imgtitle, ENT_QUOTES, 'UTF-8');
     $link = 'index.php?option=com_joomgallery&amp;view=mini&amp;extended=0&amp;format=raw&amp;object=' . $this->id . '&amp;type=category&amp;catid=' . $catid;
     $html[] = '<span class="input-append">';
     $html[] = '<input type="text" class="input-medium" id="' . $this->id . '_name" value="' . $title . '"' . ' readonly="readonly" disabled="disabled" size="35" />';
     $html[] = '<a href="#modalSelectThumbnail"  class="btn hasTooltip" role="button"  data-toggle="modal"' . ' title="' . ($app->isAdmin() ? JHtml::tooltipText('COM_JOOMGALLERY_CATMAN_SELECT_THUMBNAIL_TIP') : JHtml::tooltipText('COM_JOOMGALLERY_COMMON_SELECT_THUMBNAIL_TIP')) . '">' . '<i class="icon-image"></i> ' . ($app->isAdmin() ? JText::_('COM_JOOMGALLERY_CATMAN_SELECT_THUMBNAIL') : JText::_('COM_JOOMGALLERY_COMMON_SELECT')) . '</a>';
     $html[] = JHtmlBootstrap::renderModal('modalSelectThumbnail', array('url' => $link . '&amp;' . JSession::getFormToken() . '=1"', 'width' => '620px', 'height' => '390px'));
     $html[] = '<button id="' . $this->id . '_clear" class="btn' . ($this->value ? '' : ' hidden') . ' hasTooltip" title="' . ($app->isAdmin() ? JHtml::tooltipText('COM_JOOMGALLERY_CATMAN_REMOVE_CATTHUMB_TIP') : JHtml::tooltipText('COM_JOOMGALLERY_COMMON_REMOVE_CATTHUMB_TIP')) . '" onclick="return joom_clearthumb()"><span class="icon-remove"></span></button>';
     $html[] = '</span>';
     $html[] = '<input type="hidden" id="' . $this->id . '_id" name="' . $this->name . '" value="' . $this->value . '"/>';
     return implode("\n", $html);
 }
Example #5
0
 /**
  * Renders the modal html.
  *
  * @param   integer  $count   The number of notes for the user
  * @param   integer  $userId  The user ID
  *
  * @return  string   The html for the rendered modal
  *
  * @since   3.4.1
  */
 public static function notesModal($count, $userId)
 {
     if (empty($count)) {
         return '';
     }
     $title = JText::plural('COM_USERS_N_USER_NOTES', $count);
     return JHtmlBootstrap::renderModal('userModal_' . (int) $userId, array('url' => JRoute::_('index.php?option=com_users&view=notes&tmpl=component&layout=modal&u_id=' . (int) $userId), 'title' => $title, 'width' => '800px', 'height' => '500px'));
 }
Example #6
0
 /**
  * Method to get the field input markup
  *
  * @return  string  The field input markup
  * @since 2.0
  */
 protected function getInput()
 {
     // Initialize variables.
     $html = array();
     $groups = $this->getGroups();
     $excluded = $this->getExcluded();
     $link = 'index.php?option=com_users&amp;view=users&amp;layout=modal&amp;tmpl=component&amp;field=' . $this->id . (isset($groups) ? '&amp;groups=' . base64_encode(json_encode($groups)) : '') . (isset($excluded) ? '&amp;excluded=' . base64_encode(json_encode($excluded)) : '');
     $required = '';
     if ($this->required) {
         $required = ' required';
         if (!empty($this->class)) {
             $this->class .= ' ';
         }
         $this->class .= 'validate-SelectUser_' . $this->id;
     }
     $attr = !empty($this->class) ? ' class="' . $this->class . '"' : '';
     $attr .= !empty($this->size) ? ' size="' . $this->size . '"' : '';
     $attr .= $this->required ? ' required' : '';
     JHtml::_('bootstrap.tooltip');
     // Build the script.
     $script = array();
     if ($this->required) {
         $script[] = '  jQuery(document).ready(function() {';
         $script[] = '    document.formvalidator.setHandler("SelectUser_' . $this->id . '", function(value) {';
         $script[] = '      if (value == "" || value == "' . JText::_('COM_JOOMGALLERY_COMMON_NO_USER') . '") {';
         $script[] = '        return false;';
         $script[] = '      }';
         $script[] = '      return true;';
         $script[] = '    })';
         $script[] = '  });';
     }
     $script[] = '  function jSelectUser_' . $this->id . '(id, title) {';
     $script[] = '    var old_id = document.getElementById("' . $this->id . '").value;';
     $script[] = '    if (old_id != id) {';
     $script[] = '      document.getElementById("' . $this->id . '").value = id;';
     $script[] = '      if (id == "") {';
     $script[] = '        document.getElementById("' . $this->id . '_name").value = "' . JText::_('COM_JOOMGALLERY_COMMON_NO_USER', true) . '";';
     $script[] = '      }';
     $script[] = '      else {';
     $script[] = '        document.getElementById("' . $this->id . '_name").value = title;';
     $script[] = '      }';
     $script[] = '      ' . $this->onchange;
     if ($this->required) {
         $script[] = '      document.formvalidator.validate(document.getElementById("' . $this->id . '"));';
         $script[] = '      document.formvalidator.validate(document.getElementById("' . $this->id . '_name"));';
     }
     $script[] = '    }';
     $script[] = '    jQuery("#modalJoomuser").modal("hide");';
     $script[] = '  }';
     // Add the script to the document head.
     JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
     // Load the current user name if available.
     $config = JoomConfig::getInstance();
     $type = $config->get('jg_realname') ? 'name' : 'username';
     $table = JTable::getInstance('user');
     if ($this->value) {
         $table->load($this->value);
     } else {
         $table->{$type} = JText::_('COM_JOOMGALLERY_COMMON_NO_USER');
         $this->value = '';
     }
     // Create a dummy text field with the user name.
     $html[] = '<div class="input-append">';
     $html[] = '  <input type="text" id="' . $this->id . '_name"' . ' value="' . htmlspecialchars($table->{$type}, ENT_COMPAT, 'UTF-8') . '"' . ' readonly' . $attr . ' />';
     // Create the user select button.
     if ($this->readonly === false) {
         $html[] = '<a href="#modalJoomuser" class="btn hasTooltip" role="button" data-toggle="modal"' . ' title="' . JHtml::tooltipText('JLIB_FORM_CHANGE_USER') . '">' . '<i class="icon-user"></i></a>';
         $html[] = JHtmlBootstrap::renderModal('modalJoomuser', array('url' => $link . '&amp;' . JSession::getFormToken() . '=1"', 'title' => JText::_('JLIB_FORM_CHANGE_USER'), 'width' => '800px', 'height' => '300px', 'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">' . JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'));
     }
     $html[] = '</div>';
     // Create the real field, hidden, that stores the user id.
     $html[] = '<input type="hidden" id="' . $this->id . '" name="' . $this->name . '" value="' . $this->value . '"' . $required . ' />';
     return implode("\n", $html);
 }
Example #7
0
<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  mod_multilangstatus
 *
 * @copyright   Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
// Include jQuery
JHtml::_('jquery.framework');
JHtml::_('bootstrap.modal');
JFactory::getDocument()->addStyleDeclaration('.navbar-fixed-bottom {z-index:1050;}');
$link = JRoute::_('index.php?option=com_languages&view=multilangstatus&tmpl=component');
?>
<div class="btn-group multilanguage">
	<a href="#multiLangModal" role="button" class="btn btn-link" data-toggle="modal" title="<?php 
echo JText::_('MOD_MULTILANGSTATUS');
?>
">
		<i class="icon-comment"></i>
		<?php 
echo JText::_('MOD_MULTILANGSTATUS');
?>
	</a>
</div>

<?php 
echo JHtmlBootstrap::renderModal('multiLangModal', array('url' => $link, 'title' => JText::_('MOD_MULTILANGSTATUS'), 'height' => '300px', 'width' => '500px'));