/** * @brief Coloca los recursos externos, que permiten el funcionamiento del * rotador. * @param object $rotator Objeto que representa el rotador */ function putResource(&$rotator) { jimport('Amadeus.Util.Html'); AmadeusUtilHtml::includeResource('/modules/mod_rotator/js/jquery.nivo.slider.pack.js'); AmadeusUtilHtml::includeResource('/modules/mod_rotator/css/nivo-slider.css'); $document =& JFactory::getDocument(); $document->addStyleDeclaration($rotator->css); }
/** * @brief Obtiene la configuración de los campos a ser desplegados * en el formulario. * @return array */ function getFields() { jimport('Amadeus.Util.Html'); AmadeusUtilHtml::includeResource('/administrator/components/com_rotator/css/fileuploader.css'); require_once JPATH_COMPONENT . DS . 'helper.php'; $content = '<div style="font-size: 12px; font-weight: bold;padding: 2px 0 10px 20px;">'; $content .= 'Seleccione un rotador para agregarle más imágenes o banners:</div>'; $content .= RotatorHelper::listRotators('index.php?' . $this->getAction() . '&task=add&step=add'); $_fields = array(array('title' => JText::_('ALL_ROTATOR'), 'html' => $content)); return $_fields; }
/** * @brief Adiciona mas filtros, a los filtros existentes. */ function getFilters($tds = true) { $html = ''; $model =& $this->getModel(); $data = array('' => '- Seleccione el Rotador -'); jimport('Amadeus.Util.Database'); $rotators = AmadeusUtilDataBase::getData('am_rotadores', 'id,nombre', '1=1'); if ($rotators == false) { $rotators = array(); } foreach ($rotators as $rotator) { $data[$rotator->id] = $rotator->nombre; } jimport('Amadeus.Util.Html'); $config = array('value' => $model->getState('filter_rotator'), 'onchange' => 'document.adminForm.submit();', 'style' => 'display: inline;'); $html .= '<td align="right">'; $html .= AmadeusUtilHtml::select('filter_rotator', $data, $config); $html .= '</td>'; $html .= parent::getFilters(); return $html; }
/** * @brief Obtiene la configuración de los campos a ser desplegados * en el formulario. * @return array */ function getFields() { jimport('Amadeus.Util.Html'); $disabled = array(); $size = array('size' => 40); $size2 = array('size' => 7); if ($this->task == 'edit') { $disabled = array('disabled' => 'disabled', 'class' => 'disabled'); } $st_thumbs = array('disabled' => 'disabled', 'class' => 'disabled'); $thumb = JRequest::getVar('thumb', '0', 'post'); if (($this->task == 'apply' || $this->task == 'save') && $thumb == '1') { $st_thumbs = array(); } $size2 = array_merge($size2, $disabled); $configth = array_merge($size2, $st_thumbs); $confthumb = array('onchange' => 'document.adminForm.twidth.disabled = this.value=="0"; document.adminForm.theight.disabled = this.value=="0";'); $confthumb = array_merge($confthumb, $disabled); $_fields = array(array('title' => JText::_('GENERAL_CONFIGURATION'), 'fields' => array('id' => array('hidden' => true, 'type' => 'integer', 'html' => AmadeusUtilHtml::inputHidden('id', array('value' => 0))), 'nombre' => array('label' => JText::_('LABELNAME'), 'tooltip' => JText::_('TOOLTIPNAME'), 'type' => 'string', 'html' => AmadeusUtilHtml::inputText('nombre', $size)), 'class' => array('label' => JText::_('LABELCLASS'), 'tooltip' => JText::_('TOOLTIPCLASS'), 'type' => 'string', 'html' => AmadeusUtilHtml::inputText('class', $size)), 'published' => array('label' => JText::_('LABELPUBLISHED'), 'tooltip' => JText::_('TOOLTIPPUBLISHED'), 'type' => 'include', 'include' => array('1', '0'), 'html' => AmadeusUtilHtml::radioButton('published', array(0 => JText::_('UNPUBLISH'), 1 => JText::_('PUBLISH')), array('value' => 1))))), array('title' => JText::_('LOOK_CONFIGURATION'), 'fields' => array('thumb' => array('label' => JText::_('LABELTHUMB'), 'tooltip' => JText::_('TOOLTIPTHUMB'), 'type' => 'include', 'include' => array('1', '0'), 'html' => AmadeusUtilHtml::radioButton('thumb', array(0 => JText::_('JNO'), 1 => JText::_('JYES')), array_merge(array('value' => 0), $confthumb))), 'twidth' => array('label' => JText::_('LABELTWIDTH'), 'tooltip' => JText::_('TOOLTIPTWIDTH'), 'type' => 'integer', 'html' => AmadeusUtilHtml::inputText('twidth', $configth) . ' px'), 'theight' => array('label' => JText::_('LABELTHEIGHT'), 'tooltip' => JText::_('TOOLTIPTHEIGHT'), 'type' => 'integer', 'html' => AmadeusUtilHtml::inputText('theight', $configth) . ' px'), 'width' => array('label' => JText::_('LABELWIDTH'), 'tooltip' => JText::_('TOOLTIPWIDTH'), 'type' => 'integer', 'html' => AmadeusUtilHtml::inputText('width', $size2) . ' px'), 'height' => array('label' => JText::_('LABELHEIGHT'), 'tooltip' => JText::_('TOOLTIPHEIGHT'), 'type' => 'integer', 'html' => AmadeusUtilHtml::inputText('height', $size2) . ' px'))), array('title' => JText::_('CSS'), 'html' => AmadeusUtilHtml::inputArea('css', array('style' => 'width:99%', 'rows' => 20)), 'fields' => array('css' => array('label' => JText::_('LABELCSS'), 'type' => 'raw')))); return $_fields; }
/** * @brief Crea el arreglo con el area del preview de la imagen. * @param bool $visible Indica si es visible o no el elemento * @return bool; */ function getAreaPreviewImage($visible) { $confarea = array('style' => 'width: ' . $this->rotator->width . 'px; height: ' . $this->rotator->height . 'px; overflow: hidden;'); if ($visible) { $area = RotatorHelper::areaThumbnail('preview', $confarea); $area .= '<div class="qq-upload-button save-image" style="display:none;">Seleccionar</div>'; return array('title' => JText::_('IMAGE_FINAL'), 'html' => $area); } else { $image = JRequest::getVar('seeImage', '', 'post'); $thumb = JRequest::getVar('seeThumb', '', 'post'); $confarea = array_merge($confarea, array('img' => $image)); $area = AmadeusUtilHtml::inputHidden('image', array('value' => $image)); if ($this->rotator->thumb) { $config = array('thumb' => array('width' => $this->rotator->twidth, 'height' => $this->rotator->theight), 'aspectratio' => 'ratio', 'preview' => 'preview'); $area .= '<table class="banner-thumb" width="100%"><tr><td width="60%">Banner</td>'; $area .= '<td>Thumb</td></tr><tr><td class="img-banner">'; $area .= RotatorHelper::areaThumbnail('preview', $confarea) . '</td>'; $area .= '<td><div id="preview-thumb" class="preview-img" '; $area .= 'style="height:' . $this->rotator->theight . 'px;'; $area .= 'width:' . $this->rotator->twidth . 'px;overflow:hidden;">'; $area .= '<img src="' . $thumb . '" width="' . $this->rotator->twidth . '"'; $area .= ' height="' . $this->rotator->theight . '" />'; $area .= '</div></td></tr>'; $area .= '<tr><td colspan="2">'; $area .= '<div class="d-ratio">'; $area .= AmadeusUtilHtml::checkButton('ratio', array('1' => '<b>Selección proporcional</b>'), array('value' => '1')); $area .= '</div></td></tr></table>'; $area .= RotatorHelper::doJcrop('image', $config); } else { $area .= RotatorHelper::areaThumbnail('preview', $confarea) . '</td>'; } return array('title' => JText::_('IMAGE_FINAL'), 'html' => $area); } }
/** * @brief Se usa conjuntamente con AmadeusUtilHtml::imageCropField, ya que * permite ver el resultado de lo que se esta seleccionanado en la imagen. * * Entre los parametros de las configuracion se encuentran los siguientes: * + style => Corresponde al estilo que se le aplicara * + img => Es el nombre de la imagen que se va a mostrar * * @param string $name Nombre que se usara para crear el elemento. * @param array $config Configuracion adicional que se puede agregar. * @return string */ function areaThumbnail($name, $config) { $img = ''; if (isset($config['img'])) { $img = $config['img']; unset($config['img']); } $code = '<div id="' . $name . '" class="preview-img"'; $code .= AmadeusUtilHtml::_getAttributesHTML($config); $code .= '>'; if ($img) { $code .= '<img src="' . $img . '" />'; } $code .= '</div>'; return $code; }
/** * @brief Retorna filtros de acceso mas rapido, como los estados * (Publicado, Despublicado) y generalmente son listas desplegables, * Por defecto solo se configura un filtro de estado, pero se puede sobreescribir * para incluir otros * @param bool $tds Indica si el resultado muestra los tds o no. * @return string */ function getFilters($tds = true) { $model =& $this->getModel(); $html = ''; if ($tds) { $html .= '<td align="right">'; } jimport('Amadeus.Util.Html'); $config = array('value' => $model->getState('filter_published'), 'onchange' => 'document.adminForm.submit();'); $options = array('' => JText::_('SELECT_STATUS'), '1' => JText::_('PUBLISHED'), '0' => JText::_('UNPUBLISHED')); $html .= AmadeusUtilHtml::select('filter_published', $options, $config); if ($tds) { $html .= '</td>'; } return $html; }