public function run() { $options = $this->options; $iconClass = $this->iconClass; $title = $this->encodeTitle ? Html::encode($this->title) : $this->title; $desc = $this->encodeDesc ? Html::encode($this->desc) : $this->desc; $extra = $this->encodeExtra ? Html::encode($this->extra) : $this->extra; $buttons = $this->renderButtons(); $content = <<<EOF <div class="weui_icon_area"><i class="{$iconClass} weui_icon_msg"></i></div> <div class="weui_text_area"> <h2 class="weui_msg_title">{$title}</h2> <p class="weui_msg_desc">{$desc}</p> </div> <div class="weui_opr_area"> <p class="weui_btn_area"> {$buttons} </p> </div> <div class="weui_extra_area"> {$extra} </div> EOF; return Html::tag('div', $content, $options); }
protected function renderLoading() { $options = $this->options; $label = ArrayHelper::getValue($this, 'label', '数据加载中'); Html::addCssClass($options, ['weui_loading_toast']); Html::addCssStyle($options, ['display' => 'none']); $content = <<<EOF <div class="weui_mask_transparent"></div> <div class="weui_toast"> <div class="weui_loading"> <div class="weui_loading_leaf weui_loading_leaf_0"></div> <div class="weui_loading_leaf weui_loading_leaf_1"></div> <div class="weui_loading_leaf weui_loading_leaf_2"></div> <div class="weui_loading_leaf weui_loading_leaf_3"></div> <div class="weui_loading_leaf weui_loading_leaf_4"></div> <div class="weui_loading_leaf weui_loading_leaf_5"></div> <div class="weui_loading_leaf weui_loading_leaf_6"></div> <div class="weui_loading_leaf weui_loading_leaf_7"></div> <div class="weui_loading_leaf weui_loading_leaf_8"></div> <div class="weui_loading_leaf weui_loading_leaf_9"></div> <div class="weui_loading_leaf weui_loading_leaf_10"></div> <div class="weui_loading_leaf weui_loading_leaf_11"></div> </div> <p class="weui_toast_content">{$label}</p> </div> EOF; return Html::tag('div', $content, $options); }
protected function getButtonsHtml() { $buttons = ''; foreach ($this->buttons as $button) { /* @var $button array */ Html::addCssClass($button, [Button::BTN_DIALOG]); $buttons .= Button::widget($button); } return $buttons; }
/** * @param string|array $type * @param string $tagName * @return string * @see http://mp.weixin.qq.com/wiki/2/ae9782fb42e47ad79eb7b361c2149d16.html#Icon */ public static function icon($type, $tagName = 'i') { if (!is_array($type)) { $type = [$type]; } foreach ($type as &$t) { $t = static::ICON_PREFIX . $t; } $options = []; Html::addCssClass($options, $type); return static::tag($tagName, '', $options); }
public function run() { $icon = $this->encodeIcon ? Html::encode($this->icon) : $this->icon; $label = $this->encodeLabel ? Html::encode($this->label) : $this->label; $content = <<<EOF <div class="weui_grid_icon"> {$icon} </div> <p class="weui_grid_label"> {$label} </p> EOF; return \xj\weui\Html::tag($this->tagName, $content, $this->options); }
/** * Renders the widget. */ public function run() { return Html::tag($this->tagName, $this->encodeLabel ? Html::encode($this->label) : $this->label, $this->options); }