public function init() { parent::init(); $session = \Yii::$app->session; $flashes = $session->getAllFlashes(); $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; foreach ($flashes as $type => $data) { //TOAST if (strpos($type, 'toast') !== false) { if (isset($this->toastTypes[$type])) { $data = (array) $data; foreach ($data as $i => $message) { /* initialize css class for each alert box */ $tipo = $this->toastTypes[$type]; Toast::widget(['tipo' => $tipo, 'mensaje' => $message]); } $session->removeFlash($type); } } else { if (isset($this->alertTypes[$type])) { $data = (array) $data; foreach ($data as $i => $message) { //echo '<pre>';print_r($i);die(); /* initialize css class for each alert box */ $this->options['class'] = $this->alertTypes[$type] . $appendCss; /* assign unique id to each alert box */ $this->options['id'] = $this->getId() . '-' . $type . '-' . $i; echo \yii\bootstrap\Alert::widget(['body' => $message, 'closeButton' => $this->closeButton, 'options' => $this->options]); } $session->removeFlash($type); } } } }
public function init() { parent::init(); // $session = \Yii::$app->getSession(); // $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; $this->line = in_array($this->line, $this->lineType) ? $this->line : 'horizontal'; }
/** * @inheritdoc */ public function init() { parent::init(); if (Yii::$app instanceof Application) { $view = $this->getView(); $session = Yii::$app->getSession(); $flashes = $session->getAllFlashes(); $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; foreach ($flashes as $type => $data) { if (isset($this->alertTypes[$type])) { $data = (array) $data; foreach ($data as $i => $message) { /* initialize css class for each alert box */ $this->options['class'] = $this->alertTypes[$type] . $appendCss; /* assign unique id to each alert box */ $this->options['id'] = $this->getId() . '-' . $type . '-' . $i; echo \yii\bootstrap\Alert::widget(['body' => $message, 'closeButton' => $this->closeButton, 'options' => $this->options]); if ($this->delay > 0) { $js = 'jQuery("#' . $this->options['id'] . '").fadeTo(' . $this->delay . ', 0.00, function() { $(this).slideUp("slow", function() { $(this).remove(); }); });'; $view->registerJs($js); } } $session->removeFlash($type); } } } }
/** * */ public function init() { parent::init(); $columns = []; foreach ($this->columns as $columnConfiguration) { if (!$this->sortAction) { unset($columnConfiguration['orderBy']); } if (!isset($columnConfiguration['orderBy'])) { $columnConfiguration['columnType'] = 'simple'; } else { // Tri demandé $columnConfiguration['columnType'] = 'sort'; if ($this->sortClausesSessionKey) { if (!isset($columnConfiguration['iconType'])) { $columnConfiguration['iconType'] = 'alphabet'; } } } if (!isset($columnConfiguration['cssClass'])) { $columnConfiguration['cssClass'] = ''; } $columns[] = $columnConfiguration; } $this->columns = $columns; }
public function init() { parent::init(); $boxClassNames = ['box']; $boxClassNames[] = 'box-' . $this->style; if ($this->solid) { $boxClassNames[] = 'box-solid'; } $opt = Html::beginTag('div', ['class' => implode(' ', $boxClassNames)]); // header $opt .= Html::beginTag('div', ['class' => 'box-header with-border']); $opt .= Html::tag('h3', $this->title, ['class' => 'box-title']); if (count($this->tools) > 0) { $predefinedBtns = ['collapse' => Html::button(Html::icon('minus'), ['class' => 'btn btn-box-tool', 'title' => '折叠', 'data' => ['widget' => 'collapse', 'toggle' => 'tooltip']]), 'remove' => Html::button(Html::icon('times'), ['class' => 'btn btn-box-tool', 'title' => '移除', 'data' => ['widget' => 'remove', 'toggle' => 'tooltip']])]; for ($i = 0; $i < count($this->tools); $i++) { $alias = $this->tools[$i]; if (isset($predefinedBtns[$alias])) { $this->tools[$i] = $predefinedBtns[$alias]; } } $opt .= Html::beginTag('div', ['class' => 'box-tools pull-right']); $opt .= implode('', $this->tools); $opt .= Html::endTag('div'); } $opt .= Html::endTag('div'); // body $opt .= Html::beginTag('div', ['class' => 'box-body']); echo $opt; }
public function init() { parent::init(); if ($this->placeholder === null) { $this->placeholder = 'Search'; } }
/** * Initializes the widget. */ public function init() { parent::init(); echo Html::beginTag('div', ['class' => 'modal fade', 'id' => $this->modalId, 'role' => "dialog"]); echo Html::beginTag('div', ['class' => 'modal-dialog ' . $this->modalSize]); echo Html::beginTag('div', ['class' => 'modal-content']); echo Html::beginTag('div', ['class' => 'modal-header']); echo Html::beginTag('button', ['type' => "button", 'class' => "close", 'data-dismiss' => "modal"]); echo Html::beginTag('span', ['aria-hidden' => "true"]); echo "×"; echo Html::endTag('span'); echo Html::beginTag('span', ['class' => "sr-only"]); echo "Close"; echo Html::endTag('span'); echo Html::endTag('button'); echo Html::beginTag('h4', ['class' => "modal-title"]); echo Html::endTag('h4'); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'modal-body']); echo Html::beginTag('div', ['class' => 'content', 'style' => 'overflow:auto;']); echo Html::endTag('div'); echo Html::endTag('div'); /* modal-footer tak hapus. Kayaknya ga pernah kepake. Biar tampilan modalnya bagus, ga ada garis bawah pengganggu echo Html::beginTag('div', ['class'=>'modal-footer']); echo Html::endTag('div');*/ echo Html::endTag('div'); echo Html::endTag('div'); echo Html::endTag('div'); if ($this->registerAsset) { ModalAsset::register($this->getView()); } }
/** * @inheritdoc */ public function init() { parent::init(); if ($this->model === null) { throw new InvalidConfigException('The "model" property must be set.'); } }
public function init() { parent::init(); foreach (\Yii::$app->session->getAllFlashes() as $key => $type) { echo Html::tag('div', Html::tag('p', \Yii::$app->params[$key]), ['class' => 'alert ' . $this->msgTypes[$type]]); } }
public function run() { parent::init(); $session = \Yii::$app->getSession(); $flashes = $session->getAllFlashes(); $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; $alerts = ''; foreach ($flashes as $type => $messages) { if (!isset($this->alertTypes[$type])) { /* initialize css class for each alert box */ $type = self::FLASH_INFO; } if (!is_array($messages)) { $messages = [$messages]; } foreach ($messages as $message) { $this->options['class'] = $this->alertTypes[$type] . $appendCss; /* assign unique id to each alert box */ $this->options['id'] = $this->getId() . '-' . $type; $body = Html::tag('i', '', ['class' => 'fa fa-' . $this->alertIcons[$type]]) . $message; $alerts .= Alert::widget(['body' => $body, 'closeButton' => $this->closeButton, 'options' => $this->options]); } $session->removeFlash($type); } if ($alerts) { return strtr($this->template, ['{alerts}' => $alerts]); } return null; }
public function init() { parent::init(); $session = \Yii::$app->getSession(); $flashes = $session->getAllFlashes(); $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; if (empty($flashes)) { return false; } foreach ($flashes as $type => $message) { //type check for more messages with the same type like "success-1" foreach ($this->alertTypes as $k => $t) { if (preg_match('/' . $k . '/', $type, $subpattern)) { $type = $subpattern[0]; break; } } if (isset($this->alertTypes[$type])) { /* initialize css class for each alert box */ $this->options['class'] = $this->alertTypes[$type] . $appendCss; /* assign unique id to each alert box */ $this->options['id'] = $this->getId() . '-' . $type; echo '<div class="cakebake-accounts-alert">'; echo \yii\bootstrap\Alert::widget(['body' => $message, 'closeButton' => $this->closeButton, 'options' => $this->options]); echo '</div>'; $session->removeFlash($type); } } }
public function init() { parent::init(); // TODO: Change the autogenerated stub $this->pluginOptions = array_replace($this->pluginOptions, ['uploadUrl' => Url::toRoute('/attachments/file/upload'), 'initialPreview' => $this->model->isNewRecord ? [] : $this->model->getInitialPreview(), 'initialPreviewConfig' => $this->model->isNewRecord ? [] : $this->model->getInitialPreviewConfig()]); $this->options = array_replace($this->options, ['id' => $this->id, 'multiple' => true]); }
public function init() { if (!isset($this->clientOptions['room'])) { throw new ErrorException('Need set room name to Sidecar::widget()'); } parent::init(); }
/** * Initializes the widget. */ public function init() { parent::init(); $session = \Yii::$app->getSession(); $flashes = $session->getAllFlashes(); $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; foreach ($flashes as $type => $data) { if (isset($this->alertTypes[$type])) { $data = (array)$data; foreach ($data as $i => $message) { /* initialize css class for each alert box */ $this->options['class'] = $this->alertTypes[$type] . $appendCss; /* assign unique id to each alert box */ $this->options['id'] = $this->getId() . '-' . $type . '-' . $i; echo \yii\bootstrap\Alert::widget([ 'body' => $message, 'closeButton' => $this->closeButton, 'options' => $this->options, ]); } $session->removeFlash($type); } } }
public function init() { parent::init(); if ($this->bgclass === null) { $this->bgclass = 'bg-aqua'; } if ($this->class === null) { $this->class = 'col-md-3 col-sm-6 col-xs-12'; } if ($this->description === null) { $this->description = '70% Increase in 30 Days'; } if ($this->icon === null) { $this->icon = 'fa fa-bookmark-o'; } if ($this->progress === null) { $this->progress = '70'; } if ($this->title === null) { $this->title = 'Messages'; } if ($this->subtitle === null) { $this->subtitle = '1,410'; } }
/** * Initializes the widget. */ public function init() { parent::init(); $this->clientOptions = false; Html::addCssClass($this->options, 'navbar'); if ($this->options['class'] === 'navbar') { Html::addCssClass($this->options, 'navbar-default'); } Html::addCssClass($this->brandOptions, 'navbar-brand'); if (empty($this->options['role'])) { $this->options['role'] = 'navigation'; } $options = $this->options; $tag = ArrayHelper::remove($options, 'tag', 'nav'); echo Html::beginTag($tag, $options); if ($this->renderInnerContainer) { if (!isset($this->innerContainerOptions['class'])) { Html::addCssClass($this->innerContainerOptions, 'container'); } echo Html::beginTag('div', $this->innerContainerOptions); } echo Html::beginTag('div', ['class' => 'navbar-header']); if ($this->brandLabel !== null) { Html::addCssClass($this->brandOptions, 'navbar-brand'); echo Html::a($this->brandLabel, $this->brandUrl === null ? Yii::$app->homeUrl : $this->brandUrl, $this->brandOptions); } echo Html::endTag('div'); $options = $this->containerOptions; $tag = ArrayHelper::remove($options, 'tag', 'div'); echo Html::beginTag($tag, $options); }
/** * Initializes the widget. */ public function init() { parent::init(); echo Html::beginTag('div', ['class' => 'main-sidebar']); echo Html::beginTag('div', ['class' => 'sidebar']); if (isset($this->user) and count($this->user) > 0) { $image = isset($this->user['image']) ? $this->user['image'] : ''; $username = isset($this->user['username']) ? $this->user['username'] : ''; echo Html::beginTag('div', ['class' => 'user-panel']); echo Html::beginTag('div', ['class' => 'pull-left image']); echo '<img src="' . $image . '" class="img-circle" alt="user" />'; echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'pull-left info']); echo Html::tag('p', $username); echo Html::tag('a', '<i class="fa fa-circle text-success"></i> Online'); echo Html::endTag('div'); echo Html::endTag('div'); } if (isset($this->search) and count($this->search) > 0) { $method = isset($this->search['method']) ? $this->search['method'] : 'get'; $action = isset($this->search['action']) ? $this->search['action'] : ''; echo Html::beginTag('form', ['method' => $method, 'action' => $action, 'class' => 'sidebar-form']); echo Html::beginTag('div', ['class' => 'input-group']); echo Html::input('text', 'q', '', ['class' => 'form-control', 'placeholder' => 'Search...']); echo Html::beginTag('span', ['class' => 'input-group-btn']); echo Html::submitButton(Html::tag('i', '', ['class' => 'fa fa-search']), ['id' => 'search-btn', 'class' => "btn btn-flat"]); echo Html::endTag('span'); echo Html::endTag('div'); echo Html::endTag('form'); } }
public function init() { parent::init(); $session = \Yii::$app->getSession(); $flashes = $session->getAllFlashes(); $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; foreach ($flashes as $type => $data) { if (isset($this->alertTypes[$type])) { $data = (array) $data; foreach ($data as $i => $message) { /* initialize css class for each alert box */ $this->options['class'] = $this->alertTypes[$type] . $appendCss; /* assign unique id to each alert box */ $this->options['id'] = $this->getId() . '-' . $type . '-' . $i; echo Growl::widget(['body' => $message, 'closeButton' => $this->closeButton, 'options' => $this->options, 'delay' => false, 'pluginOptions' => ['showProgressbar' => false, 'placement' => ['from' => 'top', 'align' => 'right']]]); /* echo \yii\bootstrap\Alert::widget([ 'body' => $message, 'closeButton' => $this->closeButton, 'options' => $this->options, ]);*/ } $session->removeFlash($type); } } }
public function init() { if ($this->mappingCategoryId == false && !empty(Yii::$app->MappingComponent->updateMappingCategory)) { $this->mappingCategoryId = Yii::$app->MappingComponent->updateMappingCategory; } parent::init(); }
public function init() { parent::init(); $this->model = isset($this->model) ? $this->model : new \brainy\uploader\models\Photo(); $this->attribute = isset($this->attribute) ? $this->attribute : "image"; $this->setPluginOptions(); }
public function init() { parent::init(); if (!$this->content) { $this->content = 'Hello Widgets'; } }
public function init() { parent::init(); $session = \Yii::$app->session; $flashes = $session->getAllFlashes(); $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; $this->options['placement'] ?? 'top'; foreach ($flashes as $type => $data) { if (isset($this->alertTypes[$type])) { $data = (array) $data; foreach ($data as $i => $message) { if ($type == 'error') { $type = 'warning'; } $this->options['type'] = $type; $this->options['icon'] = $this->alertTypes[$type]; if (is_array($message)) { $message = implode($message, '<br>'); } unset($this->options['id'], $this->options['class']); $this->createJs($message, $this->options); } $session->removeFlash($type); } } }
/** * Initializes the widget. */ public function init() { parent::init(); if (!isset($this->options['class'])) { Html::addCssClass($this->options, 'list-group'); } }
public function init() { parent::init(); assert(isset($this->api)); assert(isset($this->invoiceId)); assert(isset($this->amount)); }
public function init() { parent::init(); if ($this->bgclass === null) { $this->bgclass = 'bg-aqua'; } if ($this->class === null) { $this->class = 'col-md-3 col-sm-6 col-xs-12'; } if ($this->description === null) { $this->description = 'More info'; } if ($this->icon === null) { $this->icon = 'fa fa-shopping-cart'; } if ($this->link === null) { $this->link = '#'; } if ($this->title === null) { $this->title = '150'; } if ($this->subtitle === null) { $this->subtitle = 'New Orders'; } }
/** * Initializes the widget. */ public function init() { parent::init(); $this->initOptions(); echo Html::beginTag('div', $this->options) . "\n"; echo $this->renderBodyBegin() . "\n"; }
public function init() { parent::init(); $this->clientOptions = false; Html::addCssClass($this->options, 'navbar'); if ($this->inverse) { Html::addCssClass($this->options, 'navbar-inverse'); } else { Html::addCssClass($this->options, 'navbar-default'); } if ($this->fixed) { Html::addCssClass($this->options, 'navbar-fixed-' . $this->position); } Html::addCssClass($this->brandOptions, 'navbar-brand'); echo Html::beginTag('div', $this->options); if ($this->padded) { if (empty($this->containerOptions['class'])) { Html::addCssClass($this->containerOptions, 'container'); } echo Html::beginTag('div', $this->containerOptions); } Html::addCssClass($this->headerOptions, 'navbar-header'); echo Html::beginTag('div', $this->headerOptions); echo $this->renderToggleButton(); if ($this->brandLabel !== null) { echo Html::a($this->brandLabel, $this->brandUrl, $this->brandOptions); } echo Html::endTag('div'); if ($this->collapse) { echo Html::beginTag('div', ['class' => "collapse navbar-collapse navbar-{$this->options['id']}-collapse"]); } else { echo Html::beginTag('div', $this->notCollapseOptions); } }
public function init() { parent::init(); if ($this->controls === null) { $this->controls = ['<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span><span class="sr-only">Previous</span>', '<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span><span class="sr-only">Next</span>']; } }
public function init() { parent::init(); $this->_inputStr = '<div class="form-group">'; $this->_inputStr .= Html::activeLabel($this->model, $this->attribute); $this->_inputStr .= Html::activeDropDownList($this->model, $this->attribute, \common\models\User::getUserGroup(), $this->options); $this->_inputStr .= '</div>'; }
/** * Initialization * * Initialize widget and build menu elements */ public function init() { parent::init(); $this->_menuItems = []; if (!Yii::$app->user->isGuest) { $this->_menuItems = $this->buildMenu(); } }