예제 #1
1
 public function run()
 {
     if ($this->encode) {
         $this->text = Html::encode($this->text);
     }
     if (!$this->minimal) {
         $maxOembedCount = 3;
         // Maximum OEmbeds
         $oembedCount = 0;
         // OEmbeds used
         $this->text = preg_replace_callback('/(https?:\\/\\/.*?)(\\s|$)/i', function ($match) use(&$oembedCount, &$maxOembedCount) {
             // Try use oembed
             if ($maxOembedCount > $oembedCount) {
                 $oembed = UrlOembed::GetOembed($match[0]);
                 if ($oembed) {
                     $oembedCount++;
                     return $oembed;
                 }
             }
             return Html::a($match[1], Html::decode($match[1]), array('target' => '_blank')) . $match[2];
         }, $this->text);
     }
     // get user and space details from guids
     $this->text = self::translateMentioning($this->text, $this->minimal ? false : true);
     // create image tag for emojis
     $this->text = self::translateEmojis($this->text, $this->minimal ? false : true);
     if ($this->maxLength != 0) {
         $this->text = \humhub\libs\Helpers::truncateText($this->text, $this->maxLength);
     }
     return nl2br($this->text);
 }
예제 #2
0
 public function getUserRole()
 {
     $roles = \Yii::$app->authManager->getRolesByUser($this->user_id);
     $role = '         -';
     foreach ($roles as $key => $value) {
         $role = $key;
     }
     return Html::decode($role);
 }
예제 #3
0
 public function save_signature()
 {
     $user = User::findIdentity(Yii::$app->user->id);
     $user->signature = Functions::clear_text($this->signature);
     if ($user->save()) {
         return Html::decode($user->signature);
     }
     return false;
 }
예제 #4
0
파일: Post.php 프로젝트: Dominus77/blog
 /**
  * @inheritdoc
  *
  *  [
  *      'class' => TimestampBehavior::className(),
  *      'createdAtAttribute' => 'created_at',
  *      'updatedAtAttribute' => 'updated_at',
  *      'value' => function() {
  *          return date('U'); // unix timestamp
  *      },
  *  ]
  */
 public function behaviors()
 {
     return ['timestamp' => ['class' => TimestampBehavior::className()], 'search' => ['class' => SearchBehavior::className(), 'searchScope' => function ($model) {
         /** @var \yii\db\ActiveQuery $model */
         $model->select(['id', 'title', 'anons', 'content']);
         $model->andWhere(['publish_status' => [self::STATUS_PUBLISH, self::STATUS_ARCHIVE]]);
     }, 'searchFields' => function ($model) {
         /** @var self $model */
         return [['name' => 'title', 'value' => $model->title, 'type' => SearchBehavior::FIELD_TEXT], ['name' => 'body', 'value' => strip_tags(Html::decode(Markdown::convert($model->anons))), 'type' => SearchBehavior::FIELD_TEXT], ['name' => 'url', 'value' => '/blog/default/' . $model->id, 'type' => SearchBehavior::FIELD_KEYWORD], ['name' => 'content', 'value' => Markdown::convert($model->content), 'type' => SearchBehavior::FIELD_UNSTORED]];
     }]];
 }
예제 #5
0
 protected function renderLink($block)
 {
     if (isset($block['refkey'])) {
         if (($ref = $this->lookupReference($block['refkey'])) !== false) {
             $block = array_merge($block, $ref);
         } else {
             return $block['orig'];
         }
     }
     $block['url'] = $this->handleInternalUrls($block['url']);
     $internalLink = false;
     $baseUrl = Url::base(true);
     if (substr($block['url'], 0, 1) == '/' || substr($block['url'], 0, strlen($baseUrl)) == $baseUrl) {
         $internalLink = true;
     }
     return Html::a($this->renderAbsy($block['text']), Html::decode($block['url']), ['target' => $internalLink ? '_self' : '_blank']);
 }
 public function run()
 {
     if ($this->encode) {
         $this->text = Html::encode($this->text);
     }
     if (!$this->minimal) {
         $maxOembedCount = 3;
         // Maximum OEmbeds
         $oembedCount = 0;
         // OEmbeds used
         $that = $this;
         $this->text = preg_replace_callback('/(https?:\\/\\/.*?)(\\s|$)/i', function ($match) use(&$oembedCount, &$maxOembedCount, &$that) {
             if ($that->edit) {
                 return Html::a($match[0], Html::decode($match[0]), array('target' => '_blank'));
             }
             // Try use oembed
             if ($maxOembedCount > $oembedCount) {
                 $oembed = UrlOembed::GetOembed($match[0]);
                 if ($oembed) {
                     $oembedCount++;
                     return $oembed;
                 }
             }
             return Html::a($match[1], Html::decode($match[1]), array('target' => '_blank')) . $match[2];
         }, $this->text);
         // mark emails
         $this->text = preg_replace_callback('/[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.[a-zA-Z]{2,3})/', function ($match) {
             return Html::mailto($match[0]);
         }, $this->text);
     }
     // get user and space details from guids
     $this->text = self::translateMentioning($this->text, $this->minimal ? false : true);
     // create image tag for emojis
     $this->text = self::translateEmojis($this->text, $this->minimal ? false : true);
     if ($this->maxLength != 0) {
         $this->text = \humhub\libs\Helpers::truncateText($this->text, $this->maxLength);
     }
     $output = nl2br($this->text);
     $this->trigger(self::EVENT_BEFORE_OUTPUT, new ParameterEvent(['output' => &$output]));
     return $output;
 }
예제 #7
0
                <td class="label" valign="top"><?php 
echo yii::t('friendlink', 'link_logo');
?>
:</td>
                <td>
                    <input type="text" name="link_img" class="easyui-filebox"  width="100px" buttonText="选择图片"/>
                </td>
             </tr>
             <tr>
                <td class="label" valign="top"><?php 
echo yii::t('friendlink', 'url_logo');
?>
:</td>
                <td>
                    <input type="text" name="url_logo" class="easyui-textbox" value="<?php 
echo isset($link_logo) ? Html::decode($link_logo) : '';
?>
">
                </td>
             </tr>
              <tr>
              <td class="label">&nbsp; </td>
              <td style="height:60px">
               <?php 
echo Html::input("submit", "submit", Yii::t('app', 'button_submit'), ['class' => 'button']);
?>
                <?php 
echo Html::input("reset", "reset", Yii::t("app", 'button_reset'), ['class' => 'button']);
?>
                <input name="id" type="hidden" value="<?php 
echo isset($arrLink['id']) ? $arrLink['id'] : 0;
예제 #8
0
">
        <div class="col-sm-6" style="padding-left:0px;">
            <?php 
echo $form->field($model, 'shop', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('店铺', ['class' => 'control-label col-sm-4'])->textInput(['readonly' => 'readonly']);
?>
            <?php 
echo $form->field($model, 'platform', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('平台', ['class' => 'control-label col-sm-4'])->textInput(['readonly' => 'readonly']);
?>
            <?php 
echo $form->field($model, 'commodity_id', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('ID', ['class' => 'control-label col-sm-4'])->textInput(['readonly' => 'readonly']);
?>
            <?php 
echo $form->field($model, 'sku', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('SKU', ['class' => 'control-label col-sm-4'])->textInput();
?>
            <?php 
echo $form->field($model, 'handle_time', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('执行时间', ['class' => 'control-label col-sm-4'])->textInput(['onfocus' => Html::decode('WdatePicker({dateFmt:&quot;yyyy-MM-dd HH:mm:ss&quot;,minDate:&quot;%y-%M-%d %H:%m:%s&quot;})')]);
?>
            <?php 
echo $form->field($model, 'rule', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('要求', ['class' => 'control-label col-sm-4'])->textarea();
?>
            <?php 
echo $form->field($model, 'credit', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->dropDownList(ArrayHelper::map($this->context->credits, 'value', 'text'))->label('买手信用', ['class' => 'control-label col-sm-4']);
?>
            <?php 
echo $form->field($model, 'trade_num', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('最近30天交易不超', ['class' => 'control-label col-sm-4']);
?>
            <?php 
echo $form->field($model, 'remark', ['horizontalCssClasses' => ['wrapper' => 'col-sm-8']])->label('备注', ['class' => 'control-label col-sm-4'])->textarea();
?>
        </div>
        <div class="col-sm-6" style="padding-left:0px;">
예제 #9
0
        }
        $res .= Html::a(Html::encode($dn->name), 'http://192.168.9.26:10001/?db=LIVE_2014#id=' . $dn->id . '&view_type=form&model=delivery.note&menu_id=527&action=502') . ' (' . $dn->state . ')';
    }
    return $res;
}, 'format' => 'html', 'options' => ['width' => '300']], ['label' => 'Invoices', 'format' => '', 'value' => function ($model, $key, $index, $column) {
    $res = '<ul class="list-group">';
    foreach ($model->invoices as $inv) {
        // if($res) $res.='<br/>';
        $val = $inv->currency->name . ' ' . Yii::$app->formatter->asDecimal($inv->amount_total);
        $validCurrency = $model->pricelist->currency_id == $inv->currency_id ? true : false;
        switch ($validCurrency) {
            case false:
                $res .= '<li class="list-group-item">' . Html::a(Html::decode('<span class="bg-danger">' . $inv->name . ' - ' . $val . ' (' . $inv->state . ')</span>'), 'http://192.168.9.26:10001/?db=LIVE_2014#id=' . $inv->id . '&view_type=form&model=account.invoice&menu_id=220&action=241') . '</li>';
                break;
            default:
                $res .= '<li class="list-group-item">' . Html::a(Html::decode($inv->name . ' - ' . $val . ' (' . $inv->state . ')'), 'http://192.168.9.26:10001/?db=LIVE_2014#id=' . $inv->id . '&view_type=form&model=account.invoice&menu_id=220&action=241') . '</li>';
                break;
        }
    }
    $res .= '<ul>';
    return $res;
}, 'format' => 'html', 'options' => ['width' => '400px']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}{done}', 'buttons' => ['view' => function ($url, $model, $key) {
    if ($model->state == 'draft' || $model->state == 'cancel') {
        return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', 'http://192.168.9.26:10001/?db=LIVE_2014&debug=#id=' . $model->id . '&view_type=form&model=sale.order&menu_id=255&action=305');
    } else {
        return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', 'http://192.168.9.26:10001/?db=LIVE_2014&debug=#id=' . $model->id . '&view_type=form&model=sale.order&menu_id=254&action=302');
    }
}, 'done' => function ($url, $model, $key) {
    if (!Yii::$app->user->isGuest) {
        if ($model->state != 'done' && $model->state != 'cancel' && $model->state != 'draft') {
            return Html::a('<span class="glyphicon glyphicon-check"></span>', ['sale-order/to-done', 'id' => $model->id], ['onclick' => new JsExpression('
예제 #10
0
<?php

use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $message string */
?>
<div class="app-message">
    <?php 
echo Html::decode($message);
?>
</div>

<?php 
// Utilities required for javascript
$this->registerJsFile('@web/static_files/js/form.utils.min.js', ['depends' => \yii\web\JqueryAsset::className()]);
$js = <<<JS
    jQuery(document).ready(function(){

        // Send the new height to the parent window
        Utils.postMessage({
            height: \$("html").height()
        });

    });
JS;
$this->registerJs($js, $this::POS_END, 'message');
예제 #11
0
 public function actionUpdate()
 {
     $id = (int) \yii::$app->request->post('id', 0);
     $show_order = (int) \Yii::$app->request->post('show_order', 0);
     $link_name = Html::decode(trim(\yii::$app->request->post('link_name', '')));
     $url_logo = \Yii::$app->request->post('url_logo', '');
     $link_url = \Yii::$app->request->post('link_url', '');
     if (isset($_FILES['link_img']['error']) && $_FILES['link_img']['error'] == 0 || !isset($_FILES['link_img']['error']) && isset($_FILES['link_img']['tmp_name']) && $_FILES['link_img']['tmp_name'] != 'none') {
         $image = new ImageD();
         $img_up_info = @basename($image->UploadImage($_FILES['link_img'], 'afficheimg'));
         $link_logo = "/images/afficheimg/" . $img_up_info;
     } elseif (!empty($url_logo)) {
         $link_logo = $url_logo;
     } else {
         $link_logo = "";
     }
     //如果有新上传的图片,删除原来的图片
     if (!empty($img_up_info)) {
         $old_logo = FriendLink::find()->select(['link_logo'])->where('id=' . $id)->column();
         if (strpos($old_logo, 'http://') === false && strpos($old_logo, 'https://') === false) {
             $image_name = basename($old_logo);
             @unlink(\Yii::getAlias('static') . '/images/afficheimg/' . $image_name);
         }
     }
     /* 如果没有http:// 补上 */
     if (strpos($link_url, 'http://') === false && strpos($link_url, 'https://') === false) {
         $link_url = 'http://' . trim($link_url);
     } else {
         $link_url = trim($link_url);
     }
     $status = FriendLink::modRowFriendLink($id, ['link_name' => $link_name, 'link_url' => $link_url, 'link_logo' => $link_logo, 'show_order' => $show_order]);
     if ($status) {
         AdminLog::admin_log($link_name, 'edit', 'friendlink');
     }
     $link[] = ['text' => \Yii::t('common', 'back_list'), 'href' => Url::to('/friend-link/list')];
     $this->system_msg(\yii::t('common', 'edit') . "&nbsp;" . Html::encode($link_name) . "&nbsp;" . \Yii::t('common', 'attradd_succed'), 0, $link);
 }
예제 #12
0
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\goods\Type */
/* @var $form yii\widgets\ActiveForm */
?>


<?php 
$form = ActiveForm::begin(['id' => 'type-form', 'options' => ['class' => 'form-horizontal'], 'fieldConfig' => ['labelOptions' => ['class' => 'col-sm-2 control-label'], 'template' => '{label} <div class="col-sm-8">{input}{error}{hint}</div>']]);
?>

<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo Html::decode(Yii::t('Goods', 'type_form_title'));
?>
    </div>
    <div class="panel-body">
        <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true])->hint(Yii::t('Goods', 'type_form_name_hint'));
?>
    </div>
</div>

<div class="form-group col-sm-12">
    <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('Goods', 'create') : Yii::t('Goods', 'update'), ['class' => $model->isNewRecord ? 'btn btn-success col-sm-1' : 'btn btn-primary col-sm-1']);
?>
</div>
예제 #13
0
        }
        ?>
                    <div class="comment-author-name">
                        <span><?php 
        echo $comment->getAuthorName();
        ?>
</span>
                        <span class="comment-date">
                            <?php 
        echo $comment->getPostedDate();
        ?>
                        </span>
                    </div>
                    <div class="comment-body">
                        <?php 
        echo Html::decode($comment->getContent());
        ?>
                    </div>
                </div>
            </div>
            <?php 
        if ($comment->hasChildren()) {
            ?>
                <ul class="children">
                    <?php 
            echo $this->render('_list', ['comments' => $comment->children, 'maxLevel' => $maxLevel]);
            ?>
                </ul>
            <?php 
        }
        ?>
예제 #14
0
파일: _form.php 프로젝트: wordnews/wei_shop
use yii\helpers\Html;
use yii\widgets\ActiveForm;
?>

<div class="category-form shop-form">

    <?php 
$form = ActiveForm::begin(['options' => ['class' => 'form-horizontal'], 'fieldConfig' => ['template' => "{label}\n<div class=\"col-xs-5\">{input}</div>\n{hint}\n{error}"]]);
?>

    <?php 
echo $form->field($model, 'cat_name')->textInput(['maxlength' => true])->label(null, ['class' => 'col-sm-2 control-label']);
?>

    <?php 
echo Html::decode($form->field($model, 'parent_id')->dropDownList(\yii\helpers\ArrayHelper::map($catList, 'cat_id', 'cat_name'))->label(null, ['class' => 'col-sm-2 control-label']));
?>

    <?php 
echo $form->field($model, 'sort_order')->textInput()->label(null, ['class' => 'col-sm-2 control-label']);
?>

    <?php 
if ($model->is_show === null) {
    $model->is_show = 1;
}
?>
    <?php 
echo $form->field($model, 'is_show')->radioList(['1' => '是', '0' => '否'], ['style' => 'margin-top:7px'])->label(null, ['class' => 'col-sm-2 control-label']);
?>
예제 #15
0
 public function actionEditPost()
 {
     $id = (int) \Yii::$app->request->post('id');
     $item_name = Html::decode(\Yii::$app->request->post('item_name'));
     $item_url = Html::decode(\Yii::$app->request->post('item_url'));
     $item_ifshow = \Yii::$app->request->post('item_ifshow');
     $item_opennew = \Yii::$app->request->post('item_opennew');
     $item_type = \Yii::$app->request->post('item_type');
     $item_vieworder = (int) \Yii::$app->request->post('item_vieworder', 0);
     $row = Nav::find()->select(['ctype', 'cid', 'is_show', 'type'])->where($id)->one();
     $arr = Nav::analyse_uri($item_url);
     if ($arr) {
         if ($row['ctype'] == $arr['type'] && $row['cid'] == $arr['id']) {
             //如果没有修改分类
             if ($item_type != 'middle') {
                 //位置不在中部
                 Nav::setShowInNav($arr['type'], $arr['id'], 0);
             }
         } else {
             //修改了分类
             if ($row['is_show'] == 1 && $row['type'] == 'middle') {
                 Nav::setShowInNav($row['ctype'], $row['cid'], 0);
                 //设置成不显示
             }
         }
         //分类判断
         if ($item_ifshow != Nav::isShowInNav($arr['type'], $arr['id']) && $item_type == 'middle') {
             Nav::setShowInNav($arr['type'], $arr['id'], $item_ifshow);
         }
         Nav::updateAll(['name' => $item_name, 'ctype' => $arr['type'], 'cid' => $arr['id'], 'is_show' => $item_ifshow, 'view_order' => $item_vieworder, 'open_new' => $item_opennew, 'url' => $item_url, 'type' => $item_type], 'id=:id', [':id' => $id]);
     } else {
         if ($row['ctype'] && $row['cid']) {
             Nav::setShowInNav($row['ctype'], $row['cid'], 0);
         }
         Nav::updateAll(['name' => $item_name, 'ctype' => '', 'cid' => '', 'is_show' => $item_ifshow, 'view_order' => $item_vieworder, 'open_new' => $item_opennew, 'url' => $item_url, 'type' => $item_type], 'id=:id', [':id' => $id]);
     }
     exit(UtilD::handleResult(true, \Yii::t('common', 'edit_ok')));
 }
예제 #16
0
 public function run()
 {
     echo Html::tag($this->linkTag, '<i class="fa fa-question-circle"></i>', ['data-title' => $this->dataOptions['title'], 'data-content' => Html::decode($this->dataOptions['content']), 'data-toggle' => $this->dataOptions['toggle'], 'data-pjax' => 0, 'style' => $this->dataOptions['style']]);
 }
예제 #17
0
</h2>

                        <p>
                            Category: <?php 
    echo Html::a($post->category->name, '#');
    ?>
, by <?php 
    echo Html::a(ucfirst($post->user->username), '#');
    ?>
 on <?php 
    echo Yii::$app->formatter->asDate($post->created, 'long');
    ?>
                        </p>
                        <p>
                            <?php 
    echo Html::decode(nl2br(StringHelper::byteSubstr(Markdown::convert($post->content), 0, 400))) . '...';
    ?>
                            <br>
                            <?php 
    echo Html::a('Read more...', ['/post/view', 'id' => $post->id], ['class' => 'col-md-2 pull-right btn btn-primary']);
    ?>
                        </p>
                    </div>
                </div>
            </article>
        <?php 
}
?>
    </div>
    <div class="pagination">
        <?php 
 protected function _setButtons()
 {
     $button = [];
     foreach ($this->buttons as $key => $value) {
         $value['label'] = isset($value['label']) ? $value['label'] : 'Unknown Buttons ' . ($key + 1);
         if (isset($value['action'])) {
             $value['action'] = new JsExpression(Html::decode($value['action']));
         }
         $button[$key] = $value;
     }
     return $button;
 }
예제 #19
0
파일: view.php 프로젝트: rostiknaz/yii2blog
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Posts', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="post-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('Delete', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
?>
    </p>

      <div class="panel panel-default">
       
        <div class="panel-body">
            <?php 
echo Html::decode($model->text);
?>
        </div>
    </div>

</div>
예제 #20
0
<div style="background: #000080; min-height: 50px; margin: 0px; color: #FFF; padding: 7px 5px 1px 10px">
    <p>Cảm ơn bạn <?php 
echo $magazin->name;
?>
 đã đăng ký nhận bài tập với trình độ <?php 
echo $magazin->level;
?>
</p>
    <p>Dưới bài tập buổi <?php 
echo $contentmagazin->Day;
?>
 của bạn:</p>
</div>
<div style="border: #003eff solid 1px; padding: 5px">
    <?php 
echo Html::decode($contentmagazin->Content);
?>
</div>
<div style=" padding: 0px 0px 5px 10px; background: #ff6b7f; color: #fff; text-align: center">
    <br><i>Email được gửi tới từ trang web <a href='<?php 
echo Yii::$app->params['host'];
?>
' title='<?php 
echo Yii::$app->params['host'];
?>
'><?php 
echo Yii::$app->params['host'];
?>
</a></i>
</div>
예제 #21
0
 public function getArticleStatusSwitch()
 {
     switch ($this->status) {
         case 0:
             return Html::decode('<span class="label label-warning">' . $this->getArticleStatusName() . '</span>');
         case 1:
             return Html::decode('<span class="label label-success">' . $this->getArticleStatusName() . '</span>');
     }
 }
예제 #22
0
파일: index.php 프로젝트: C12D/advanced
<div class="mdlpermission-index">

    <p>
        <?php 
echo "Html::a('Create ERP Permission', ['create'], ['class' => 'btn btn-success'])";
//echo "<a data-toggle="modal" href="#myModal" class="btn btn-primary btn-lg">Launch demo modal</a>";
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'USER_ID', 'format' => 'html', 'value' => function ($model) {
    $username = Userlogin::find()->where(['id' => $model->USER_ID])->one();
    return Html::decode($username->username);
}, 'filter' => ArrayHelper::map(Userlogin::find()->asArray()->all(), 'id', 'username')], ['attribute' => 'MODUL_ID', 'format' => 'html', 'value' => function ($model) {
    $MODUL_NM = Modulerp::find()->where(['MODUL_ID' => $model->MODUL_ID])->one();
    return Html::decode($MODUL_NM->MODUL_NM);
}, 'filter' => ArrayHelper::map(Modulerp::find()->asArray()->all(), 'MODUL_ID', 'MODUL_NM')], ['attribute' => 'STATUS', 'format' => 'html', 'value' => function ($model) {
    if ($model->STATUS == 0) {
        return Html::a('<i class="fa fa-lock"></i>');
    } else {
        if ($model->STATUS == 1) {
            return Html::a('<i class="fa fa-unlock "></i>');
        }
    }
}], ['attribute' => 'BTN_CREATE', 'format' => 'html', 'value' => function ($model) {
    if ($model->BTN_CREATE == 0) {
        return Html::a('<i class="fa fa-lock"></i>');
    } else {
        if ($model->BTN_CREATE == 1) {
            return Html::a('<i class="fa fa-unlock "></i>');
        }
예제 #23
0
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Document */
$this->title = $model->title;
?>
<div class="document-view">

    <div class="box">
        <div class="box-header with-border">
            <h3 class="box-title">
                <span class="glyphicon glyphicon-file"></span> Просмотр документа
            </h3>
            <div class="box-tools pull-right">
                <button type="button" class="btn btn-box-tool" data-widget="collapse">
                    <i class="glyphicon glyphicon-minus"></i>
                </button>
            </div>
        </div>
        <div class="box-body">
            <h1><?php 
echo Html::decode($model->title);
?>
</h1>
            <?php 
echo Html::decode($model->content);
?>
        </div>
    </div>
</div>
예제 #24
0
            <div class="clearfix"></div>
        </div>
        <div style="margin-bottom: 5px;">
            <div class="col-sm-2" style="padding-left:0px;">
                <?php 
echo Html::activeTextInput($model, 'entrance', ['class' => 'form-control', 'placeholder' => '浏览入口']);
?>
            </div>
            <div class="col-sm-2" style="padding-left:0px;">
                <?php 
echo Html::activeTextInput($model, 'btime', ['class' => 'form-control', 'placeholder' => '开始', 'onfocus' => Html::decode('WdatePicker({dateFmt:&quot;yyyy-MM-dd HH:mm:ss&quot;,maxDate:&quot;#F{$dp.$D(\'commoditysearchform-etime\')}&quot;})')]);
?>
            </div>
            <div class="col-sm-2" style="padding-left:0px;">
                <?php 
echo Html::activeTextInput($model, 'etime', ['class' => 'form-control', 'placeholder' => '结束', 'onfocus' => Html::decode('WdatePicker({dateFmt:&quot;yyyy-MM-dd HH:mm:ss&quot;,minDate:&quot;#F{$dp.$D(\'commoditysearchform-btime\')}&quot;})')]);
?>
            </div>
            <div class="col-sm-1" style="padding-left:0px;">
                <?php 
echo Html::submitButton('查询', ['class' => 'btn-primary pull-left btn']);
?>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
<style>
    .gv-table{text-align:center;}
    .gv-table th{text-align:center;}
</style>
<?php 
예제 #25
0
            <div class="col-md-12">
                <div class="row">
        			<?php 
foreach (\backend\modules\news\models\News::find()->where('publish_at < ' . Yii::$app->formatter->asTimestamp('now'))->orderBy('id DESC', 'publish_at DESC')->limit(4)->all() as $data) {
    ?>
                        <div class="col-md-3">
                            <span><?php 
    echo Html::decode($data->publish_at);
    ?>
</span>
                            <h4 class="lighter"><?php 
    echo Html::decode($data->title);
    ?>
</h4>
                            <p><?php 
    echo Html::decode($data->summary);
    ?>
</p>
                            <p><?php 
    echo Html::a('Читать далее', ['/news/view', 'alias' => $data->alias], ['class' => 'btn btn-punch btn-link btn-black btn-sm']);
    ?>
</p>
                        </div>
                    <?php 
}
?>
                </div>
            </div><!--/.col-->
        </div><!-- /.row -->
    </div><!-- /.container -->
</section><!-- /.section -->
예제 #26
0
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use app\modules\admin\Module;
use yii\bootstrap\Tabs;
use yii\helpers\StringHelper;
use app\modules\admin\components\widgets\AdminBoxWidget;
/* @var $this yii\web\View */
/* @var $model app\modules\main\models\Article */
$this->title = StringHelper::truncate($model->title, 50);
$this->params['breadcrumbs'][] = ['label' => Module::t('app', 'ADMIN'), 'url' => ['default/index']];
$this->params['breadcrumbs'][] = ['label' => Module::t('app', 'ADMIN_ARTICLE'), 'url' => ['index']];
$this->params['breadcrumbs'][] = StringHelper::truncate($model->title, 20);
?>
<div class="article-view">

    <?php 
AdminBoxWidget::begin(['type' => AdminBoxWidget::TYPE_PRIMARY, 'title' => Html::a('<i class="fa fa-pencil-square-o"></i>' . ' ' . Module::t('app', 'BUTTON_UPDATE'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary btn-xs']) . ' ' . Html::a('<i class="fa fa-trash-o"></i>' . ' ' . Module::t('app', 'BUTTON_DELETE'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger btn-xs', 'data' => ['confirm' => Module::t('app', 'CONFIRM_DELETE'), 'method' => 'post']]), 'left_tools' => 'Количество просмотров статьи: <strong>' . $model->click . '</strong>', 'footer' => '<strong>Статья созана:</strong> ' . Yii::$app->formatter->asDatetime($model->created_at) . '<br/>' . '<strong>Статья обновлена:</strong> ' . Yii::$app->formatter->asDatetime($model->updated_at) . '<br/>' . '<i class="fa fa-link"></i>&nbsp;<code>' . Yii::$app->urlManager->createAbsoluteUrl(['main/default/view', 'alt_title' => $model->alt_title]) . '</code>']);
?>

    <?php 
echo Tabs::widget(['items' => [['label' => 'Основная информация', 'content' => DetailView::widget(['model' => $model, 'attributes' => [['attribute' => 'category_id', 'format' => 'html', 'value' => Html::a($model->category->title, ['category/view', 'id' => $model->category->id], ['target' => 'blank'])], 'title', ['attribute' => 'alt_title', 'format' => 'html', 'value' => Html::decode('<strong>' . $model->alt_title . '</strong>') . '<br/>' . $model->getArticleUrl()], ['attribute' => 'author_id', 'format' => 'html', 'value' => Html::a($model->author->username, ['user/view', 'id' => $model->author->id], ['target' => 'blank'])], ['attribute' => 'status', 'format' => 'html', 'value' => $model->getArticleStatusSwitch()], 'tags', ['attribute' => 'anons_img', 'format' => 'html', 'value' => Html::img(Yii::$app->request->baseUrl . $model->anons_img, ['class' => 'img-responsive'])], 'anons:ntext', 'post:ntext']]), 'active' => true], ['label' => 'Рендер статьи', 'content' => $this->render('_article', ['model' => $model])]]]);
?>

    <?php 
AdminBoxWidget::end();
?>

</div>
예제 #27
0
 public function testDecode()
 {
     $this->assertEquals("a<>&\"'", Html::decode("a&lt;&gt;&amp;&quot;&#039;"));
 }
예제 #28
0
        <?php 
// Html::a(Yii::t('app', 'Create Apps'), ['create'], ['class' => 'btn btn-success'])
?>
        <?php 
echo Html::a(Yii::t('app', 'Install Apps'), ['install'], ['class' => 'btn btn-success']);
?>
    </p>


    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', ['label' => 'Status', 'attribute' => 'active', 'format' => 'raw', 'value' => function ($data) {
    if ($data->active) {
        $label = '<span class="label label-success">Active</span>';
    } else {
        $label = '<span class="label label-danger">Inactive</span>';
    }
    return Html::a(Html::decode($label), Url::to(['admin/activate', 'id' => $data->id]), ['data-method' => 'post']);
}], ['attribute' => 'name', 'format' => 'raw', 'value' => function ($data) {
    return Html::a(Html::encode($data->name), Url::to(['admin/view', 'id' => $data->id]));
}], 'descr:ntext', 'type', 'alias', 'created_at:datetime', 'updated_at:datetime', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{uninstall}', 'buttons' => ['uninstall' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-remove"></span>', $url, ['title' => Yii::t('app', 'Uninstall'), 'data-method' => 'post', 'data-confirm' => 'Are you sure you want to uninstall application ?']);
}], 'urlCreator' => function ($action, $model, $key, $index) {
    if ($action === 'uninstall') {
        $url = Url::to(['admin/uninstall', 'id' => $model->id]);
        return $url;
    }
}]]]);
?>

</div>
예제 #29
0
파일: index.php 프로젝트: sergey-exu/myhome
<?php

use yii\helpers\Html;
$this->title = $model->page_title;
$this->registerMetaTag(['name' => 'description', 'content' => $model->meta_description]);
?>

<div class="page-main">
    <?php 
echo Html::decode($model->page_content);
?>
</div>
예제 #30
-1
    public function run()
    {
        if ($this->encode) {
            $this->text = Html::encode($this->text);
        }
        if (!$this->minimal) {
            $maxOembedCount = 3;
            // Maximum OEmbeds
            $oembedCount = 0;
            // OEmbeds used
            $that = $this;
            $pattern = <<<REGEXP
                    /(?(R) # in case of recursion match parentheses
\t\t\t\t \\(((?>[^\\s()]+)|(?R))*\\)
\t\t\t|      # else match a link with title
\t\t\t\t(https?|ftp):\\/\\/(([^\\s()]+)|(?R))+(?<![\\.,:;\\'"!\\?\\s])
\t\t\t)/x
REGEXP;
            $this->text = preg_replace_callback($pattern, function ($match) use(&$oembedCount, &$maxOembedCount, &$that) {
                // Try use oembed
                if ($maxOembedCount > $oembedCount) {
                    $oembed = UrlOembed::GetOembed($match[0]);
                    if ($oembed) {
                        $oembedCount++;
                        return $oembed;
                    }
                }
                return Html::a($match[0], Html::decode($match[0]), array('target' => '_blank'));
            }, $this->text);
            // mark emails
            $this->text = preg_replace_callback('/[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.[a-zA-Z]{2,3})/', function ($match) {
                return Html::mailto($match[0]);
            }, $this->text);
        }
        // get user and space details from guids
        $this->text = self::translateMentioning($this->text, $this->minimal ? false : true);
        // create image tag for emojis
        $this->text = self::translateEmojis($this->text, $this->minimal ? false : true);
        if ($this->maxLength != 0) {
            $this->text = \humhub\libs\Helpers::truncateText($this->text, $this->maxLength);
        }
        $this->text = trim($this->text);
        if (!$this->minimal) {
            $output = nl2br($this->text);
        } else {
            $output = $this->text;
        }
        // replace leading spaces with no break spaces to keep the text format
        $output = preg_replace_callback('/^( +)/m', function ($m) {
            return str_repeat("&nbsp;", strlen($m[1]));
        }, $output);
        $this->trigger(self::EVENT_BEFORE_OUTPUT, new ParameterEvent(['output' => &$output]));
        return trim($output);
    }