/** * @brief Obtiene la configuración de los campos a ser desplegados * en el formulario. * @return array */ function getFields() { jimport('Amadeus.Util.Html'); require_once JPATH_COMPONENT . DS . 'helper.php'; $visible = false; if ($this->task == 'add') { $visible = true; } $disabled = array(); if ($visible) { $disabled = array('disabled' => 'disabled'); } AmadeusUtilHtml::includeResource('/administrator/components/com_rotator/js/jquery.Jcrop.min.js'); AmadeusUtilHtml::includeResource('/administrator/components/com_rotator/js/fileuploader.min.js'); AmadeusUtilHtml::includeResource('/administrator/components/com_rotator/css/fileuploader.min.css'); AmadeusUtilHtml::includeResource('/administrator/components/com_rotator/css/jquery.Jcrop.min.css'); jimport('Amadeus.Util.Database'); $orden = AmadeusUtilDataBase::countData('am_banners', 'rotator = ' . $this->rotator->id) + 1; $_fields = array(array('html' => '<h2 class="main-title">' . $this->rotator->nombre . '</h2>'), $this->getAreaUploadImages($visible), $this->getAreaPreviewImage($visible), array('title' => JText::_('GENERAL_INFORMATION'), 'fields' => array('id' => array('hidden' => true, 'type' => 'integer', 'html' => AmadeusUtilHtml::inputHidden('id', array('value' => 0)) . '<input name="step" type="hidden" value="error" />'), 'rotator' => array('hidden' => true, 'type' => 'integer', 'html' => AmadeusUtilHtml::inputHidden('rotator', array('value' => $this->rotator->id))), 'title' => array('label' => JText::_('LABELTITLE'), 'tooltip' => JText::_('TOOLTIPTITLE'), 'type' => 'string', 'html' => AmadeusUtilHtml::inputText('title', array_merge(array('size' => 60), $disabled))), 'button' => array('label' => JText::_('LABELBUTTON'), 'tooltip' => JText::_('TOOLTIPBUTTON'), 'type' => 'string', 'mandatory' => false, 'html' => AmadeusUtilHtml::inputText('button', $disabled)), 'link' => array('label' => JText::_('LABELLINK'), 'tooltip' => JText::_('TOOLTIPLINK'), 'type' => 'string', 'html' => AmadeusUtilHtml::inputText('link', array_merge(array('size' => 60), $disabled))), 'orden' => array('label' => JText::_('LABELORDEN'), 'tooltip' => JText::_('TOOLTIPORDEN'), 'type' => 'integer', 'html' => AmadeusUtilHtml::inputText('orden', array_merge(array('size' => '10', 'value' => $orden), $disabled))), '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_merge(array('value' => 1), $disabled))))), array('title' => JText::_('BANNER_INFORMATION'), 'fields' => array('description' => array('label' => JText::_('LABELDESCRIPTION'), 'tooltip' => JText::_('TOOLTIPDESCRIPTION'), 'type' => 'raw', 'html' => AmadeusUtilHtml::inputArea('description', array_merge(array('rows' => 10, 'cols' => 40, 'raw' => true), $disabled)))))); 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 un arreglo de objetos conincidente con las condiciones dadas. * @param array $fields Arreglo de campos a obtener. * @param string $conditions Condiciones para filtrar el resultado de la busqueda. * @param string $order Campo por el cual se ordena el resultado. * @param bool $first Indica si solo se requiere el primer registro o todos. * @return bool/array/object */ function data($fields = '*', $conditions = '1=1', $order = 'id', $first = false) { jimport('Amadeus.Util.Database'); return AmadeusUtilDataBase::getData($this->_table, $fields, $conditions, $order, $first); }