openTag() публичный статический Метод

Generates an open HTML element.
public static openTag ( string $tag, array $htmlOptions = [] ) : string
$tag string the tag name.
$htmlOptions array the element attributes.
Результат string the generated HTML element tag.
Пример #1
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     $id = $this->resolveId($id);
     echo TbHtml::openTag('div', array('class' => 'select2'));
     if ($this->hasModel()) {
         if ($this->asDropDownList) {
             echo TbHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions);
         } else {
             echo TbHtml::activeHiddenField($this->model, $this->attribute, $this->htmlOptions);
         }
     } else {
         if ($this->asDropDownList) {
             echo TbHtml::dropDownList($name, $this->value, $this->data, $this->htmlOptions);
         } else {
             echo TbHtml::hiddenField($name, $this->value, $this->htmlOptions);
         }
     }
     echo '</div>';
     if ($this->assetPath !== false) {
         $this->publishAssets($this->assetPath);
         $this->registerCssFile('/select2.css');
         if ($this->registerJs) {
             $this->registerScriptFile('/select2.js', CClientScript::POS_END);
         }
     }
     if ($this->bindPlugin) {
         $options = !empty($this->pluginOptions) ? CJavaScript::encode($this->pluginOptions) : '';
         $this->getClientScript()->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').select2({$options});");
     }
 }
Пример #2
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     $this->attachBehavior('TbWidget', new TbWidget());
     $this->copyId();
     $this->htmlOptions['data-spy'] = 'affix';
     if (isset($this->offset)) {
         if (is_string($this->offset)) {
             $this->offset = array('top', $this->offset);
         }
         if (is_array($this->offset) && count($this->offset) === 2) {
             list($position, $offset) = $this->offset;
             $this->htmlOptions['data-offset-' . $position] = $offset;
         }
     }
     echo TbHtml::openTag($this->tagName, $this->htmlOptions);
 }
Пример #3
0
 /**
  * Renders the field if no selector has been provided
  */
 public function renderField()
 {
     if (null === $this->selector) {
         $options = array();
         list($name, $id) = $this->resolveNameID();
         $options['id'] = $id . '_datetimepicker';
         TbHtml::addCssClass('input-append', $options);
         echo TbHtml::openTag('div', $options);
         if ($this->hasModel()) {
             echo TbHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
         } else {
             echo TbHtml::textField($name, $this->value, $this->htmlOptions);
         }
         echo TbHtml::openTag('span', array('class' => 'add-on'));
         echo '<i data-time-icon="' . $this->iconTime . '" data-date-icon="' . $this->iconDate . '"></i>';
         echo TbHtml::closeTag('span');
         echo TbHtml::closeTag('div');
     }
 }
Пример #4
0
 /**
  * Renders the field if no selector has been provided
  */
 public function renderField()
 {
     if (null === $this->selector) {
         $options = array();
         list($name, $id) = $this->resolveNameID();
         $options['id'] = $id . '_datetimepicker';
         TbHtml::addCssClass('input-group date form_datetime', $options);
         echo TbHtml::openTag('div', $options);
         if ($this->hasModel()) {
             echo TbHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
         } else {
             echo TbHtml::textField($name, $this->value, $this->htmlOptions);
         }
         echo TbHtml::openTag('span', array('class' => 'input-group-addon'));
         echo '<i class="glyphicon glyphicon-th"' . '></i>';
         echo TbHtml::closeTag('span');
         echo TbHtml::closeTag('div');
     }
 }
Пример #5
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     $this->attachBehavior('TbWidget', new TbWidget());
     $this->copyId();
     TbHtml::addCssClass('collapse', $this->htmlOptions);
     if (isset($this->parent)) {
         TbArray::defaultValue('data-parent', $this->parent, $this->htmlOptions);
     }
     if (isset($this->toggle) && $this->toggle) {
         TbHtml::addCssClass('in', $this->htmlOptions);
     }
     if (isset($this->view)) {
         $controller = $this->getController();
         if (isset($controller) && $controller->getViewFile($this->view) !== false) {
             $this->content = $this->controller->renderPartial($this->view, $this->viewData, true);
         }
     }
     echo TbHtml::openTag($this->tagName, $this->htmlOptions);
     echo $this->content;
 }
Пример #6
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     /* @var $user CWebUser */
     $user = Yii::app()->getUser();
     if (count($user->getFlashes(false)) == 0) {
         return;
     }
     echo TbHtml::openTag('div', $this->htmlOptions);
     foreach ($this->alerts as $color => $alert) {
         if (isset($alert['visible']) && !$alert['visible']) {
             continue;
         }
         if ($user->hasFlash($color)) {
             $htmlOptions = TbArray::popValue('htmlOptions', $alert, array());
             TbArray::defaultValue('closeText', $this->closeText, $htmlOptions);
             TbArray::defaultValue('block', $this->block, $htmlOptions);
             TbArray::defaultValue('fade', $this->fade, $htmlOptions);
             echo TbHtml::alert($color, $user->getFlash($color), $htmlOptions);
         }
     }
     echo '</div>';
     $this->registerEvents("#{$this->htmlOptions['id']} > .alert", $this->events);
 }
Пример #7
0
<?php 
echo TbHtml::openTag('tr');
foreach ($asientos as $asiento) {
    //Por cada Asiento
    echo TbHtml::tag('td', array(), $asiento->LugaresLug);
}
echo TbHtml::closeTag('tr');
Пример #8
0
Файл: about.php Проект: cicb/tpc
<div class="controles" style="height:100%;min-height:400px;">
		<h2><i class="fa fa-th"></i> Acerca del panel de control </h2>			
<br>

<?php 
echo TbHtml::openTag('div', array('class' => ' box box4  text-left'));
$this->beginWidget('CMarkdown', array('purifyOutput' => true));
try {
    $changelog = readfile("changelog");
} catch (Exception $e) {
    $changelog = "### Version 1.0 ";
}
$this->endWidget();
echo TbHtml::closeTag('div');
?>

</div>
Пример #9
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     $brand = $this->brandLabel !== false ? TbHtml::navbarBrandLink($this->brandLabel, $this->brandUrl, $this->brandOptions) : '';
     ob_start();
     foreach ($this->items as $item) {
         if (is_string($item)) {
             echo $item;
         } else {
             $widgetClassName = TbArray::popValue('class', $item);
             if ($widgetClassName !== null) {
                 $this->controller->widget($widgetClassName, $item);
             }
         }
     }
     $items = ob_get_clean();
     ob_start();
     if ($this->collapse !== false) {
         TbHtml::addCssClass('nav-collapse', $this->collapseOptions);
         ob_start();
         /* @var TbCollapse $collapseWidget */
         $collapseWidget = $this->controller->widget('bootstrap.widgets.TbCollapse', array('toggle' => false, 'content' => $items, 'htmlOptions' => $this->collapseOptions));
         $collapseContent = ob_get_clean();
         echo TbHtml::navbarCollapseLink('#' . $collapseWidget->getId());
         echo $brand . $collapseContent;
     } else {
         echo $brand . $items;
     }
     $containerContent = ob_get_clean();
     $containerOptions = TbArray::popValue('containerOptions', $this->htmlOptions, array());
     TbHtml::addCssClass($this->fluid ? 'container-fluid' : 'container', $containerOptions);
     ob_start();
     echo TbHtml::openTag('div', $containerOptions);
     echo $containerContent;
     echo '</div>';
     $content = ob_get_clean();
     echo TbHtml::navbar($content, $this->htmlOptions);
 }
Пример #10
0
 /**
  * Widget's initialization method
  */
 public function init()
 {
     $this->attachBehavior('TbWidget', new TbWidget());
     TbArray::defaultValue('id', $this->getId(), $this->htmlOptions);
     TbArray::defaultValue('role', 'dialog', $this->htmlOptions);
     TbArray::defaultValue('tabindex', '-1', $this->htmlOptions);
     TbHtml::addCssClass('modal', $this->htmlOptions);
     if ($this->fade) {
         TbHtml::addCssClass('fade', $this->htmlOptions);
     }
     if (is_array($this->footer)) {
         $this->footer = implode('&nbsp;', $this->footer);
     }
     $this->initOptions();
     $this->initEvents();
     echo TbHtml::openTag('div', $this->htmlOptions) . PHP_EOL;
     echo TbHtml::openTag('div', array('class' => 'modal-dialog' . $this->size)) . PHP_EOL;
     echo TbHtml::openTag('div', array('class' => 'modal-content')) . PHP_EOL;
     echo TbHtml::modalHeader($this->header);
     if (!isset($this->content)) {
         ob_start();
     }
 }
Пример #11
0
 public function testOpenTag()
 {
     $I = $this->codeGuy;
     $html = TbHtml::openTag('p', array('class' => 'tag'));
     $p = $I->createNode($html, 'p');
     $I->seeNodeCssClass($p, 'tag');
 }
Пример #12
0
 /**
  * Generates a tabbable menu.
  * @param string $type the menu type.
  * @param array $tabs the tab configurations.
  * @param array $htmlOptions additional HTML attributes.
  * @return string the generated menu.
  */
 public static function tabbable($type, $tabs, $htmlOptions = array())
 {
     $htmlOptions = self::addClassName('tabbable', $htmlOptions);
     $placement = self::popOption('placement', $htmlOptions);
     if (!empty($placement)) {
         $htmlOptions = self::addClassName('tabs-' . $placement, $htmlOptions);
     }
     $menuOptions = self::popOption('menuOptions', $htmlOptions, array());
     $contentOptions = self::popOption('contentOptions', $htmlOptions, array());
     $contentOptions = self::addClassName('tab-content', $contentOptions);
     $panes = array();
     $menu = TbHtml::nav($type, self::normalizeTabs($tabs, $panes), $menuOptions);
     $content = TbHtml::tag('div', $contentOptions, implode('', $panes));
     $output = TbHtml::openTag('div', $htmlOptions);
     $output .= $placement === self::TABS_PLACEMENT_BELOW ? $content . $menu : $menu . $content;
     $output .= '</div>';
     return $output;
 }
Пример #13
0
 /**
  * Renders a table body row.
  *
  * @param integer $row the row number (zero-based).
  */
 public function renderTableRow($row)
 {
     $htmlOptions = array();
     if ($this->rowHtmlOptionsExpression !== null) {
         $data = $this->dataProvider->data[$row];
         $options = $this->evaluateExpression($this->rowHtmlOptionsExpression, array('row' => $row, 'data' => $data));
         if (is_array($options)) {
             $htmlOptions = $options;
         }
     }
     if ($this->rowCssClassExpression !== null) {
         $data = $this->dataProvider->data[$row];
         $class = $this->evaluateExpression($this->rowCssClassExpression, array('row' => $row, 'data' => $data));
     } elseif (is_array($this->rowCssClass) && ($n = count($this->rowCssClass)) > 0) {
         $class = $this->rowCssClass[$row % $n];
     }
     if (!empty($class)) {
         if (isset($htmlOptions['class'])) {
             $htmlOptions['class'] .= ' ' . $class;
         } else {
             $htmlOptions['class'] = $class;
         }
     }
     echo TbHtml::openTag('tr', $htmlOptions);
     foreach ($this->columns as $column) {
         echo $this->displayExtendedSummary && !empty($this->extendedSummary['columns']) ? $this->parseColumnValue($column, $row) : $column->renderDataCell($row);
     }
     echo TbHtml::closeTag('tr');
 }
Пример #14
0
 /**
  * Generates a tabbable menu.
  * @param array $tabs the tab configurations.
  * @param array $htmlOptions additional HTML attributes.
  * @return string the generated menu.
  */
 public static function tabbable($tabs, $htmlOptions = array())
 {
     $htmlOptions = self::addClassName('tabbable', $htmlOptions);
     $placement = self::popOption('placement', $htmlOptions);
     if (!empty($placement)) {
         $htmlOptions = self::addClassName('tabs-' . $placement, $htmlOptions);
     }
     $menuOptions = self::popOption('menuOptions', $htmlOptions, array());
     $contentOptions = self::popOption('contentOptions', $htmlOptions, array());
     $contentOptions = self::addClassName('tab-content', $contentOptions);
     $menuItems = array();
     foreach ($tabs as $i => &$tabOptions) {
         $icon = self::popOption('icon', $tabOptions);
         $label = self::popOption('label', $tabOptions, '');
         $id = $tabOptions['id'] = self::popOption('id', $tabOptions, 'tab_' . ($i + 1));
         $active = self::getOption('active', $tabOptions, false);
         $disabled = self::popOption('disabled', $tabOptions, false);
         $linkOptions = self::popOption('linkOptions', $tabOptions, array());
         $linkOptions['data-toggle'] = 'tab';
         $itemOptions = self::popOption('itemOptions', $tabOptions, array());
         $items = self::popOption('items', $tabOptions, array());
         $menuItem = array('icon' => $icon, 'label' => $label, 'url' => '#' . $id, 'active' => $active, 'disabled' => $disabled, 'itemOptions' => $itemOptions, 'linkOptions' => $linkOptions, 'items' => $items);
         $menuItems[] = $menuItem;
     }
     ob_start();
     echo TbHtml::openTag('div', $htmlOptions);
     echo TbHtml::tabs($menuItems, $menuOptions);
     echo TbHtml::openTag('div', $contentOptions);
     foreach ($tabs as &$tabOptions) {
         if (self::popOption('active', $tabOptions, false)) {
             $tabOptions = self::addClassName('active', $tabOptions);
         }
         $tabContent = self::popOption('content', $tabOptions, '');
         $tabOptions = self::addClassName('tab-pane', $tabOptions);
         echo TbHtml::tag('div', $tabOptions, $tabContent);
     }
     echo '</div></div>';
     return ob_get_clean();
 }
Пример #15
0
 public function actionGenerarNumerados($EventoId, $FuncionesId, $ZonasId)
 {
     // Genera asientos numerados de una zona
     // Si le han pasado el id de zona
     $zona = Zonas::model()->findByPk(compact('EventoId', 'FuncionesId', 'ZonasId'));
     if ($zona->generarLugares()) {
         echo TbHtml::openTag('div', array('style' => 'color:#FFF'));
         echo TbHtml::tag('h2', array(), 'Se han generado los lugares.');
         echo TbHtml::tag('p', array(), 'Los lugares se han registrado conforme a la configuración que ústed acaba de definir.');
         echo "<br>";
         echo TbHtml::link(' Regresar a zonas', array('editorSubzona', 'EventoId' => $EventoId, 'FuncionesId' => $FuncionesId, 'ZonasId' => $ZonasId, 'SubzonaId' => 1), array('class' => 'btn btn-large btn-primary fa fa-arrow-left'));
         echo TbHtml::closeTag('div');
     }
 }
Пример #16
0
Файл: form.php Проект: cicb/tpc
    $usrval = new Usrval('search');
    $usrval->UsuarioId = $model->UsuariosId;
    //$usrval->UsrValRef='evento.EventoId';
    //$usrval->UsrValRef2='funciones.FuncionesId';
    $usrval->usrValIdRef2 = 'TODAS';
    $this->widget('bootstrap.widgets.TbGridView', array('id' => 'usrval-grid', 'dataProvider' => $usrval->search(), 'template' => "{items}\n{pager}", 'type' => 'striped hover', 'columns' => array(array('header' => 'Evento', 'value' => 'coalesce(@$data->evento->EventoNom,$data->usrValIdRef)'), array('header' => 'Funcion', 'value' => 'coalesce(@$data->funcion->funcionesTexto,$data->usrValIdRef2)'), array('class' => 'CButtonColumn', 'header' => '', 'template' => ' {eliminar} {permisos} ', 'buttons' => array('eliminar' => array('label' => '<span class="text-error fa fa-times-circle"> Quitar</span>', 'url' => 'Yii::app()->createUrl("usuarios/desasignarEvento",array(
													"id"=>$data->UsuarioId,
													"evento"=>$data->usrValIdRef,
													"nick"=>"' . $model->UsuariosNick . '",
													"funcion"=>$data->usrValIdRef2))', 'click' => 'function(event){
													$.get( $(this).attr("href")).done( function(){ $.fn.yiiGridView.update("usrval-grid"); });
													event.preventDefault(); }'), 'permisos' => array('label' => TbHtml::button('Reportes', array('class' => 'btn btn-info', 'data-toggle' => 'modal', 'data-target' => '#modal-permisos-reportes'))))))));
    ?>
		</div><!-- asignacion de eventos-->
<?php 
    $asignadosHtml = TbHtml::openTag('div', array('class' => 'text-center'));
    $asignadosHtml .= TbHtml::dropDownList('eventos_asignados', 0, CHtml::listData($model->getEventosAsignados(), 'EventoId', 'EventoNom'), array('class' => 'span3 ', 'empty' => 'SELECCIONE UN EVENTO'));
    $asignadosHtml .= "<br/><br/>";
    $asignadosHtml .= TbHtml::tag('table', array('id' => 'tabla-reportes'), '');
    $asignadosHtml .= TbHtml::closeTag('div');
    $this->widget('bootstrap.widgets.TbModal', array('id' => 'modal-permisos-reportes', 'header' => 'Reportes permitidos', 'htmlOptions' => array('class' => 'text-center'), 'content' => $asignadosHtml, 'footer' => TbHtml::button('Cerrar', array('data-dismiss' => 'modal'))));
    ?>



<br />
<?php 
    $this->widget('bootstrap.widgets.TbModal', array('id' => 'conModal', 'header' => 'Cambio de contraseña', 'content' => $this->renderPartial('_cambioContrasena', array('model' => $model), true, true), 'footer' => implode(' ', array(CHtml::ajaxSubmitButton('Confirmar', Yii::app()->createUrl('usuarios/cambiarClave', array('id' => $model->UsuariosId, 'nick' => $model->UsuariosNick)), array('type' => 'POST', 'data' => 'js:{up: $("#up").val() }', 'success' => 'js:function(string){ $("#formulario").html(string);
													$("#btn-cambiar-clave").attr("data-dismiss","modal");
													$("#btn-cambiar-clave").val("Continuar...");
						 }'), array('class' => 'btn btn-primary ', 'disabled' => true, 'data-dismiss' => false, 'id' => 'btn-cambiar-clave')), TbHtml::button('Cerrar', array('data-dismiss' => 'modal'))))));
Пример #17
0
 /**
  * Renders the modal markup
  */
 public function renderModal()
 {
     echo TbHtml::openTag('div', $this->htmlOptions) . PHP_EOL;
     $this->renderModalHeader();
     $this->renderModalBody();
     $this->renderModalFooter();
     echo '</div>' . PHP_EOL;
 }
Пример #18
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     $brand = $this->brandLabel !== false ? TbHtml::navbarBrandLink($this->brandLabel, $this->brandUrl, $this->brandOptions) : '';
     ob_start();
     if (!Yii::app()->user->isGuest) {
         $menus = $this->Menudata();
     } else {
         $menus[0] = array();
     }
     $menus[1] = array('class' => 'bootstrap.widgets.TbNav', 'htmlOptions' => array('class' => 'pull-right'), 'items' => array(array('label' => '网站前台', 'url' => Yii::app()->request->hostInfo . Yii::app()->baseUrl), array('label' => '站点配置', 'url' => array('/settings/index'), 'visible' => !Yii::app()->user->isGuest), array('label' => '登录', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest), array('label' => Yii::app()->user->name, 'url' => '#', 'items' => array(array('label' => '个人资料', 'icon' => 'user', 'url' => '#'), array('label' => '退出', 'icon' => 'off', 'url' => array('/site/logout'))), 'visible' => !Yii::app()->user->isGuest)));
     $this->items = $menus;
     foreach ($this->items as $item) {
         if (is_string($item)) {
             echo $item;
         } else {
             $widgetClassName = TbArray::popValue('class', $item);
             if ($widgetClassName !== null) {
                 $this->controller->widget($widgetClassName, $item);
             }
         }
     }
     $items = ob_get_clean();
     ob_start();
     if ($this->collapse !== false) {
         TbHtml::addCssClass('nav-collapse', $this->collapseOptions);
         ob_start();
         /* @var TbCollapse $collapseWidget */
         $collapseWidget = $this->controller->widget('bootstrap.widgets.TbCollapse', array('toggle' => false, 'content' => $items, 'htmlOptions' => $this->collapseOptions));
         $collapseContent = ob_get_clean();
         echo TbHtml::navbarCollapseLink('#' . $collapseWidget->getId());
         echo $brand . $collapseContent;
     } else {
         echo $brand . $items;
     }
     $containerContent = ob_get_clean();
     $containerOptions = TbArray::popValue('containerOptions', $this->htmlOptions, array());
     TbHtml::addCssClass($this->fluid ? 'container-fluid' : 'container', $containerOptions);
     ob_start();
     echo TbHtml::openTag('div', $containerOptions);
     echo $containerContent;
     echo '</div>';
     $content = ob_get_clean();
     echo TbHtml::navbar($content, $this->htmlOptions);
 }