Exemple #1
0
 function build()
 {
     $dateFormat = $this->dateFormat;
     //JDate::toFormat() is deprecated. CONVERT Legacy Joomla Format
     //Minutes : ‰M > i
     $dateFormat = str_replace("%M", "i", $dateFormat);
     //remove the %
     $dateFormat = str_replace("%", "", $dateFormat);
     $formatedDate = $this->dataValue;
     if ($this->dataValue && $this->dataValue != "0000-00-00" && $this->dataValue != "00:00:00" && $this->dataValue != "0000-00-00 00:00:00") {
         jimport("joomla.utilities.date");
         $date = JFactory::getDate($this->dataValue);
         $formatedDate = $date->format($dateFormat);
         $config = JFactory::getConfig();
         // If a known filter is given use it.
         switch (strtoupper($this->filter)) {
             case 'SERVER_UTC':
                 // Convert a date to UTC based on the server timezone.
                 if (intval($this->dataValue)) {
                     // Get a date object based on the correct timezone.
                     $date = JFactory::getDate($this->dataValue, 'UTC');
                     $date->setTimezone(new DateTimeZone($config->get('offset')));
                     // Format the date string.
                     $formatedDate = $date->format($dateFormat, true);
                 }
                 break;
             case 'USER_UTC':
                 // Convert a date to UTC based on the user timezone.
                 if (intval($this->dataValue)) {
                     // Get a date object based on the correct timezone.
                     $date = JFactory::getDate($this->dataValue, 'UTC');
                     $user = JFactory::getUser();
                     $date->setTimezone(new DateTimeZone($user->getParam('timezone', $config->get('offset'))));
                     // Format the date string.
                     $formatedDate = $date->format($dateFormat, true);
                 }
                 break;
         }
     } else {
         $formatedDate = "";
     }
     //Create the input
     $dom = JDom::getInstance('html.form.input.text', array_merge($this->options, array('dataValue' => $formatedDate, 'submitEventName' => null)));
     $dom->addClass('input-small');
     $htmlInput = $dom->output();
     //Create the icon
     $htmlIcon = JDom::_('html.icon', array('icon' => 'calendar'));
     //Create the button (suffix -btn is to trigger the calendar)
     $htmlButton = JDom::_('html.link.button', array('content' => $htmlIcon, 'domClass' => 'btn', 'domId' => $this->getInputId() . '-btn'));
     $html = '';
     $html .= '<div class="btn-group">';
     $html .= '<div class="input-append">' . LN;
     $html .= $htmlInput . LN;
     $html .= $htmlButton . LN;
     $html .= '</div>' . LN;
     $html .= '</div>';
     return $html;
 }
Exemple #2
0
 function buildIconsLib($library)
 {
     //Get the icons availability
     $icons = array();
     switch ($library) {
         case '':
             $icons = $this->getIcons();
             break;
         case 'icomoon':
             $jdom = JDom::getInstance('html.icon.icomoon');
             $icons = $jdom->getIcons();
             break;
         case 'glyphicon':
             $jdom = JDom::getInstance('html.icon.glyphicon');
             $icons = $jdom->getIcons();
             break;
     }
     if (empty($icons)) {
         return;
     }
     return $this->renderIcons($library, $icons);
 }
Exemple #3
0
 function buildControl()
 {
     $id = $this->getInputId();
     $html = '';
     //Create the input
     $dom = JDom::getInstance('html.form.input.text', array_merge($this->options, array()));
     $dom->addClass('input-mini');
     $htmlInput = $dom->output();
     //Create the color
     $htmlColor = JDom::_('html.fly.color', array_merge($this->options, array('width' => 12, 'height' => 12, 'selectors' => array('id' => $id . '-pick'))));
     //Create the icon
     $htmlIcon = JDom::_('html.icon', array('icon' => 'glyphicon-tint'));
     //Create the button (suffix -btn is to trigger the calendar)
     $htmlButton = JDom::_('html.link.button', array('content' => $htmlIcon, 'domClass' => 'btn', 'domId' => $id . '-btn'));
     $html = '';
     //Render the control
     if ($this->hidden) {
         $html .= $htmlInput . LN;
     }
     //Place the hidden input out of the control
     $html .= '<div class="btn-group">' . LN;
     $html .= '<div class="input-prepend input-append">' . LN;
     if (!$this->hidden) {
         //Prepend
         $html .= '<span class="add-on">#</span>';
         //Input mini
         $html .= $htmlInput . LN;
     }
     //Append
     $html .= '<span class="add-on">' . $htmlColor . '</span>' . LN;
     $html .= $htmlButton . LN;
     //Close the control
     $html .= '</div>' . LN;
     $html .= '</div>' . LN;
     return $html;
 }
Exemple #4
0
 protected function pathToUrl($path, $raw = false)
 {
     $base = JDom::getInstance()->getPathSite();
     $uri = JDom::getInstance()->getUriJDomBase();
     $path = str_replace("\\", "/", $path);
     $base = str_replace("\\", "/", $base);
     $escaped = preg_replace("/\\//", "\\/", $base);
     $relUrl = $uri . preg_replace("/^" . $escaped . "/", "", $path);
     if ($raw) {
         return $relUrl;
     }
     return JURI::root(true) . $relUrl;
 }
Exemple #5
0
JLoader::register('RtiprintModelThirdusergroups', JPATH_COMPONENT . DS . 'models' . DS . 'thirdusergroups.php');
JLoader::register('RtiprintModelThirdusergroup', JPATH_COMPONENT . DS . 'models' . DS . 'thirdusergroup.php');
JLoader::register('RtiprintModelThirdcategories', JPATH_COMPONENT . DS . 'models' . DS . 'thirdcategories.php');
JLoader::register('RtiprintModelThirdcategory', JPATH_COMPONENT . DS . 'models' . DS . 'thirdcategory.php');
JLoader::register('RtiprintModelThirdcontents', JPATH_COMPONENT . DS . 'models' . DS . 'thirdcontents.php');
JLoader::register('RtiprintModelThirdcontent', JPATH_COMPONENT . DS . 'models' . DS . 'thirdcontent.php');
// Handle cross compatibilities
require_once dirname(__FILE__) . DS . 'mvc.php';
// Load the component Dependencies
require_once dirname(__FILE__) . DS . 'helper.php';
// Always use the Javascript framework for UI
JHTML::_("behavior.framework");
// Configure paths
$lang = JFactory::getLanguage();
if ($app->isSite()) {
    $lang->load('com_rtiprint', JPATH_SITE);
    CkJController::addModelPath(JPATH_SITE_RTIPRINT . DS . 'models');
} else {
    $lang->load('com_rtiprint', JPATH_ADMINISTRATOR);
    CkJController::addModelPath(JPATH_ADMIN_RTIPRINT . DS . 'models');
}
// Set the table directory
JTable::addIncludePath(JPATH_ADMIN_RTIPRINT . DS . 'tables');
//Instance JDom
if (!isset($app->dom)) {
    jimport('jdom.dom');
    if (!class_exists('JDom')) {
        JError::raiseError(null, 'JDom plugin is required');
    }
    JDom::getInstance();
}
Exemple #6
0
 function buildControlBootstrap()
 {
     $html = '';
     $id = $this->getInputId();
     //$idView = $this->getInputId('view');
     $idView = $id . '-view';
     //Optimized
     //Create hidden input (file)
     $htmlInputHidden = '<input type="file" id="<%DOM_ID%>" name="<%INPUT_NAME%>" ' . ' style="display:none;"' . ' value="<%VALUE%>"' . '/>' . LN;
     //Create a visible text field (stylable)
     $onFocus = 'jQuery(this).closest(\'div\').find(\'input[id=\\"' . $id . '\\"]\').trigger(\'click\');';
     $dom = JDom::getInstance('html.form.input.text', array('dataValue' => $this->dataValue, 'domId' => $idView, 'selectors' => array('onFocus' => $onFocus, 'readonly' => '')));
     $dom->addClass('input-large');
     //for cross compatibility (remove margin and float)
     $dom->addClass('inputfix');
     if ($this->hidden) {
         $dom->addStyle('display', 'none');
     }
     $htmlInputView = $dom->output();
     // Create the upload button
     $htmlIconBrowse = JDom::_('html.icon', array('icon' => 'icomoon-folder-open'));
     //Create the button to trigger the input
     $htmlButtonBrowse = JDom::_('html.link.button', array('content' => $htmlIconBrowse, 'domClass' => 'btn buttonfix', 'link_js' => 'jQuery(\'input[id=' . $id . ']\').trigger("click");'));
     // Original file input is hidden
     $html .= $htmlInputHidden;
     //Visible input
     $html .= $htmlInputView;
     //Browse button
     $html .= $htmlButtonBrowse;
     return $html;
 }
Exemple #7
0
 /**
  * Method to get the field input markup.
  *
  * @access	protected
  *
  * @return	string	The field input markup.
  *
  * @since	11.1
  */
 protected function getInput()
 {
     //When Bootstrap is used in native, modal picker is instancied with JDom
     $version = new JVersion();
     if ($version->isCompatible('3.0')) {
         $dom = JDom::getInstance();
         $dom->set('extension', 'com_rtiprint');
         $html = JDom::_('html.form.input.select.modalpicker', array('dataKey' => $this->id, 'domName' => $this->name, 'dataValue' => $this->value, 'nullLabel' => $this->_nullLabel, 'title' => $this->_title, 'width' => $this->width, 'height' => $this->height, 'route' => array('option' => $this->_option, 'view' => $this->_view, 'layout' => 'modal', 'object' => $this->id), 'tasks' => $this->getTasks()));
         return $html;
     }
     // Legacy not using JDom
     JHtml::_('behavior.modal', 'a.modal');
     //Instance vars
     $labelKey = $this->_labelKey;
     $table = $this->_table;
     $label = JText::_($this->_nullLabel);
     // Build the script.
     $script = array();
     $script[] = '	function jSelectItem(id, title, object) {';
     $script[] = '		document.id(object + "_id").value = id;';
     $script[] = '		document.id(object + "_name").value = title;';
     $script[] = '		SqueezeBox.close();';
     $script[] = '	}';
     // Add the script to the document head.
     JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
     $link = 'index.php?option=' . $this->_option . '&amp;view=' . $this->_view . '&amp;layout=modal&amp;tmpl=component&amp;object=' . $this->id;
     $title = $this->_title;
     if (empty($title)) {
         $title = $label;
     }
     $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
     // The current item display field.
     $html = array();
     $html[] = '<div class="fltlft">';
     $html[] = '  <input type="text" id="' . $this->id . '_name" value="' . $title . '" disabled="disabled" size="25" />';
     $html[] = '</div>';
     // The item select button.
     $html[] = '<div class="button2-left">';
     $html[] = '  <div class="blank">';
     $html[] = '	<a class="modal" title="' . $label . '"  href="' . $link . '" rel="{handler: \'iframe\', size: {x: ' . $this->width . ', y: ' . $this->height . '}}">' . JText::_('JSELECT') . '</a>';
     $html[] = '  </div>';
     $html[] = '</div>';
     $scriptReset = "document.id('" . $this->id . "_id').value = '';";
     $scriptReset .= "document.id('" . $this->id . "_name').value = '" . htmlspecialchars($label, ENT_QUOTES, 'UTF-8') . "';";
     // The clear button.
     $html[] = '<div class="button2-left">';
     $html[] = '  <div class="blank">';
     $html[] = '	<a class="" title="' . htmlspecialchars(JText::_('JCLEAR'), ENT_QUOTES, 'UTF-8') . '"  onclick="' . htmlspecialchars($scriptReset, ENT_QUOTES, 'UTF-8') . '">' . JText::_('JCLEAR') . '</a>';
     $html[] = '  </div>';
     $html[] = '</div>';
     $tasks = $this->getTasks();
     if ($tasks && count($tasks)) {
         foreach ($tasks as $taskName => $task) {
             $label = isset($task['label']) ? JText::_($task['label']) : '';
             $desc = isset($task['description']) ? JText::_($task['description']) : $label;
             $jsCommand = isset($task['jsCommand']) ? $task['jsCommand'] : null;
             $icon = isset($task['icon']) ? $task['icon'] : $taskName;
             $html[] = '<div class="button2-left">';
             $html[] = '  <div class="blank">';
             $html[] = '	<a class="" title="' . $label . '" ' . ($jsCommand ? ' onclick="' . htmlspecialchars($jsCommand, ENT_QUOTES, 'UTF-8') . '"' : '') . '>' . JText::_($label) . '</a>';
             $html[] = '  </div>';
             $html[] = '</div>';
         }
     }
     // The active item id field.
     if (0 == (int) $this->value) {
         $value = '';
     } else {
         $value = (int) $this->value;
     }
     // class='required' for client side validation
     $class = '';
     if ($this->required) {
         $class = ' class="required modal-value"';
     }
     $html[] = '<input type="hidden" id="' . $this->id . '_id"' . $class . ' name="' . $this->name . '" value="' . $value . '" />';
     return implode("\n", $html);
 }