Example #1
0
 /**
  * Initialize the widget
  * @throws InvalidConfigException
  */
 public function init()
 {
     parent::init();
     if (empty(Yii::$app->recaptcha->siteKey)) {
         throw new InvalidConfigException('The site key has not been set.');
     }
     if (empty(Yii::$app->recaptcha->secretKey)) {
         throw new InvalidConfigException('The secret key has not been set.');
     }
     if (!empty(Yii::$app->recaptcha->errorMessage)) {
         $this->errorMessage = Yii::$app->recaptcha->errorMessage;
     }
     if (empty($this->theme)) {
         $this->theme = 'light';
     } else {
         if ($this->theme != 'light' && $this->theme != 'dark') {
             throw new InvalidConfigException('The theme has not been set.');
         }
     }
     if ($this->lang) {
         echo Html::jsFile('https://www.google.com/recaptcha/api.js?hl=' . $this->lang);
     } else {
         echo Html::jsFile('https://www.google.com/recaptcha/api.js');
     }
     if (Yii::$app->recaptcha->hasError) {
         echo Html::tag('p', $this->errorMessage, ['class' => 'text-danger']);
     }
     echo Html::tag('div', '', ['class' => 'g-recaptcha', 'data-sitekey' => Yii::$app->recaptcha->siteKey, 'data-theme' => $this->theme]);
 }
Example #2
0
 /**
  * @param integer $position
  * @param array $files
  */
 protected function process($position, $files)
 {
     $resultFile = sprintf('%s/%s.js', $this->view->minify_path, $this->_getSummaryFilesHash($files));
     if (!file_exists($resultFile)) {
         $js = '';
         foreach ($files as $file => $html) {
             $file = $this->getAbsoluteFilePath($file);
             $content = '';
             if (!file_exists($file)) {
                 \Yii::warning(sprintf('Asset file not found `%s`', $file), __METHOD__);
             } elseif (!is_readable($file)) {
                 \Yii::warning(sprintf('Asset file not readable `%s`', $file), __METHOD__);
             } else {
                 $content .= file_get_contents($file) . ';' . "\n";
             }
             $js .= $content;
         }
         $this->removeJsComments($js);
         if ($this->view->minifyJs) {
             $js = (new \JSMin($js))->min();
         }
         file_put_contents($resultFile, $js);
         if (false !== $this->view->file_mode) {
             @chmod($resultFile, $this->view->file_mode);
         }
     }
     $file = $this->prepareResultFile($resultFile);
     $this->view->jsFiles[$position][$file] = Html::jsFile($file);
 }
 /**
  * Registers Js
  */
 public function addJsFiles($jsFiles, $options = [])
 {
     $url = $this->getUrlByFiles($jsFiles);
     if (Yii::$app->controller->layout) {
         Yii::$app->getView()->registerJsFile($url, $options);
     } else {
         echo Html::jsFile($url, $options);
     }
 }
 /**
  * This method should be used if you need to embed iframeResizer.contentWindow.min.js
  * into an existing iFrame HTML content generated elsewhere.
  * @param $html string iFrame HTML code where script needs to be embedded
  * @return string iFrame HTML code with embedded script
  * @throws InvalidConfigException
  */
 public static function embed($html)
 {
     $config['class'] = IFrameResizer::className();
     $widget = Yii::createObject($config);
     /* @var $widget IFrameResizer */
     $url = $widget->getScriptUrl();
     $scriptTag = Html::jsFile($url);
     // Using regular expression rather than DOMDocument approach, as the latter may end up messing the code.
     // Split the string contained in $html in three parts:
     // - everything before the </body> tag
     // - the </body> tag with any attributes in it
     // - everything following the </body> tag
     $matches = preg_split('/(<\\/body.*?>)/i', $html, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
     // assemble HTML code back with the script code embedded before </body>
     $embeddedHTML = $matches[0] . $scriptTag . $matches[1] . $matches[2];
     return $embeddedHTML;
 }
Example #5
0
 /**
  * render js in page
  * @return string
  */
 public function renderJs()
 {
     $jsLines = "\n";
     if ($this->getView()->assetBundles) {
         foreach ($this->getView()->assetBundles as $assetBundle) {
             if (!$assetBundle->sourcePath) {
                 foreach ($assetBundle->js as $jsFile) {
                     $jsLines .= "\n" . Html::jsFile($jsFile, $assetBundle->jsOptions);
                 }
             }
         }
     }
     if ($this->getView()->jsFiles) {
         foreach ($this->getView()->jsFiles as $jsFiles) {
             $jsLines .= implode("\n", $jsFiles);
         }
     }
     if ($this->getView()->js) {
         foreach ($this->getView()->js as $js) {
             $jsLines .= implode("\n", $js);
         }
     }
     return $jsLines;
 }
Example #6
0
            </div>
            <br>
            <button type="submit" id="submit" class="border0 bgd-787878 c-ffffff p-bottom-10 p-top-10 m-bottom-10" style="width: 100%;">开启免登录</button>

            </form>

        </div>
        <br><br><br><br><br><br><br><br><br>
    </div>
    <!--content end-->

</div>
<?php 
$this->beginBlock('inline_scripts');
echo Html::jsFile('@web/js/bootstrap.js');
echo Html::jsFile('@web/js/bootbox.js');
?>
<script>
$(document).ready(function(){
    $(".wapper").css("min-height",$(window).height());
    setTimeout(function(){$('#flash').fadeOut(500);},2600);
})
    var flag=[0,0];
    $('#username').blur(function(){
        var username = $('#username').val();
        if(username) {
            flag[0] = 1;
            $('#submit').attr('class','border0 bgd-e44949 c-ffffff p-bottom-10 p-top-10 m-bottom-10');
            $('#spanti').hide();
        }else{
            $('#spanti').html('用户名不能为空');
Example #7
0
 /**
  * Renders the content to be inserted within the default js block
  * The content is rendered using the registered JS code blocks and files.
  * @param boolean $ajaxMode whether the view is rendering in AJAX mode.
  * @return string the rendered content
  */
 protected function renderJsBlockHtml($ajaxMode = false)
 {
     $lines = [];
     if (true) {
         if (!empty($this->jsFiles[self::POS_JS_BLOCK])) {
             $lines[] = implode("\n\t", $this->jsFiles[self::POS_JS_BLOCK]);
             $this->jsFiles[self::POS_JS_BLOCK] = [];
         }
         if ($this->pagePlugin) {
             $this->addPagePlugin($this->pagePlugin, true);
             $this->pagePlugin = '';
         }
         if ($this->pagePlugins) {
             foreach ($this->pagePlugins as $pagePlugin) {
                 $lines[] = Html::jsFile($pagePlugin);
             }
             $this->pagePlugins = [];
         }
         if (!empty($this->jsFiles[self::POS_END])) {
             $lines[] = implode("\n\t", $this->jsFiles[self::POS_END]);
             $this->jsFiles[self::POS_END] = [];
         }
         if (empty($this->js[self::POS_READY])) {
             $this->js[self::POS_READY] = [];
         }
         if ($this->pageReadyJS) {
             array_unshift($this->js[self::POS_READY], $this->pageReadyJS);
             $this->pageReadyJS = '';
         }
         if ($this->pageReadyJSs) {
             $this->js[self::POS_READY] = array_merge($this->pageReadyJSs, $this->js[self::POS_READY]);
             $this->pageReadyJSs = [];
         }
         if ($this->pageReadyPriorityJSs) {
             $this->js[self::POS_READY] = array_merge($this->pageReadyPriorityJSs, $this->js[self::POS_READY]);
             $this->pageReadyPriorityJSs = [];
         }
         if ($this->pageReadyFinalJSs) {
             $this->js[self::POS_READY] = array_merge($this->js[self::POS_READY], $this->pageReadyFinalJSs);
             $this->pageReadyFinalJSs = [];
         }
         if (!empty($this->js[self::POS_READY])) {
             if ($ajaxMode) {
                 $js = "\n\t\t" . implode("\n\t\t", $this->js[self::POS_READY]) . "\n\t";
             } else {
                 $js = "\n\t\tjQuery(document).ready(function () {\n\t\t\t" . implode("\n\t\t\t", $this->js[self::POS_READY]) . "\n\t\t});\n\t";
             }
             $this->js[self::POS_READY] = [];
             $lines[] = Html::script($js, ['type' => 'text/javascript']);
         }
         if (empty($this->js[self::POS_LOAD])) {
             $this->js[self::POS_LOAD] = [];
         }
         if ($this->pageLoadJS) {
             array_unshift($this->js[self::POS_LOAD], $this->pageLoadJS);
             $this->pageLoadJS = '';
         }
         if ($this->pageLoadJSs) {
             $this->js[self::POS_LOAD] = array_merge($this->pageLoadJSs, $this->js[self::POS_READY]);
             $this->pageLoadJSs = [];
         }
         if ($this->pageLoadPriorityJSs) {
             $this->js[self::POS_LOAD] = array_merge($this->pageLoadPriorityJSs, $this->js[self::POS_LOAD]);
             $this->pageLoadPriorityJSs = [];
         }
         if ($this->pageLoadFinalJSs) {
             $this->js[self::POS_LOAD] = array_merge($this->js[self::POS_LOAD], $this->pageLoadFinalJSs);
             $this->pageLoadFinalJSs = [];
         }
         if (!empty($this->js[self::POS_LOAD])) {
             if ($ajaxMode) {
                 $js = "\n\t\t" . implode("\n\t\t", $this->js[self::POS_LOAD]) . "\n\t";
             } else {
                 $js = "\n\t\tjQuery(window).load(function () {\n\t\t\t" . implode("\n\t\t\t", $this->js[self::POS_LOAD]) . "\n\t\t});\n\t";
             }
             $this->js[self::POS_LOAD] = [];
             $lines[] = Html::script($js, ['type' => 'text/javascript']);
         }
     }
     return empty($lines) ? '' : "\t" . implode("\n\t", $lines) . "\n";
 }
Example #8
0
 /**
  * Registers a JS file.
  * @param string $url the JS file to be registered.
  * @param array $options the HTML attributes for the script tag. The following options are specially handled
  * and are not treated as HTML attributes:
  *
  * - `depends`: array, specifies the names of the asset bundles that this JS file depends on.
  * - `position`: specifies where the JS script tag should be inserted in a page. The possible values are:
  *     * [[POS_HEAD]]: in the head section
  *     * [[POS_BEGIN]]: at the beginning of the body section
  *     * [[POS_END]]: at the end of the body section. This is the default value.
  *
  * Please refer to [[Html::jsFile()]] for other supported options.
  *
  * @param string $key the key that identifies the JS script file. If null, it will use
  * $url as the key. If two JS files are registered with the same key at the same position, the latter
  * will overwrite the former. Note that position option takes precedence, thus files registered with the same key,
  * but different position option will not override each other.
  */
 public function registerJsFile($url, $options = [], $key = null)
 {
     $url = Yii::getAlias($url);
     $key = $key ?: $url;
     $depends = ArrayHelper::remove($options, 'depends', []);
     if (empty($depends)) {
         $position = ArrayHelper::remove($options, 'position', self::POS_END);
         $this->jsFiles[$position][$key] = Html::jsFile($url, $options);
     } else {
         $this->getAssetManager()->bundles[$key] = Yii::createObject(['class' => AssetBundle::className(), 'baseUrl' => '', 'js' => [strncmp($url, '//', 2) === 0 ? $url : ltrim($url, '/')], 'jsOptions' => $options, 'depends' => (array) $depends]);
         $this->registerAssetBundle($key);
     }
 }
Example #9
0
	
	<tr>
		<?php 
echo $form->field($preferential, 'preferential_type')->radioList(['1' => '满减', '2' => '折扣']);
?>
	</tr>
	<tr>
		<?php 
echo $form->field($preferential, 'preferential_content')->textInput();
?>
满减内容用,隔开(例:满100减80 100,80)
	</tr>
	<tr>
		<?php 
echo $form->field($preferential, 'preferential_start', ['inputOptions' => ['placeholder' => '开始日期']])->textInput(['id' => "d11", "onClick" => "WdatePicker()"]);
?>
	</tr>
	<tr>
		<?php 
echo $form->field($preferential, 'preferential_end', ['inputOptions' => ['placeholder' => '结束日期']])->textInput(['id' => "d11", "onClick" => "WdatePicker()"]);
?>
	</tr>
	<tr>
		 <?php 
echo Html::submitButton('添加', ['class' => 'btn btn-micv5 btn-block', 'id' => 'preferential_save', 'style' => 'margin:0px auto;']);
?>
	</tr>
</table>
<?php 
echo Html::jsFile('public/date/My97DatePicker/WdatePicker.js');
Example #10
0
?>
">
<head>
    <meta charset="<?php 
echo Yii::$app->charset;
?>
">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php 
echo Html::csrfMetaTags();
?>
    <?php 
echo Html::cssFile('frontend/web/css/layout.css');
?>
    <?php 
echo Html::jsFile('frontend/web/js/jquery-1.8.1.min.js');
?>
    <title><?php 
echo Html::encode('YII2');
?>
</title>
    <?php 
$this->head();
?>
</head>
<body>
    <?php 
$this->beginBody();
?>
   <div class="container-fluid" id="header">
   		<div class="row">
Example #11
0
                <p><a class="btn btn-default" href="http://www.yiiframework.com/doc/">Yii Documentation &raquo;</a></p>
            </div>
            <div class="col-lg-4">
                <h2>Heading</h2>

                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
                    dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
                    ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
                    fugiat nulla pariatur.</p>

                <p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum &raquo;</a></p>
            </div>
            <div class="col-lg-4">
                <h2>Heading</h2>

                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
                    dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
                    ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
                    fugiat nulla pariatur.</p>

                <p><a class="btn btn-default" href="http://www.yiiframework.com/extensions/">Yii Extensions &raquo;</a></p>
            </div>
        </div>

    </div>
</div>

<?php 
echo Html::jsFile('@web/js/icomp.js');
Example #12
0
<?php 
echo $form->field($model, 'stage_number')->textInput();
?>

<?php 
echo $form->field($model, 'fee_per_stage')->textInput();
?>

<?php 
echo $form->field($model, 'start_month')->radioButtonGroup([0 => '当日起', 1 => '下月起']);
?>

<?php 
echo $form->field($model, 'description')->textInput();
?>

<?php 
echo Html::submitButton('Create', ['class' => 'btn btn-success']);
?>

<?php 
$form = ActiveForm::end();
?>

<?php 
echo Html::jsFile('/js/fund.js');
?>

<?php 
echo Html::a('返回', '/index.php?r=fund/currency/index');
Example #13
0
<?php

use yii\helpers\Html;
?>
<!doctype html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>消息中心</title>
        <?php 
echo Html::cssFile('@web/css/bootstrap.min.css');
?>
        <?php 
echo Html::cssFile('@web/css/style.css');
?>
        <?php 
echo Html::jsFile('@web/Js/jquery.js');
?>
    </head>

    <body>
        <?php 
echo $this->render('_form', ['model' => $model]);
?>
    </body>
</html>
Example #14
0
 private function yandexMap($model, $field_name, $options)
 {
     $txt = Html::beginTag("div");
     $id_map = 'map' . $this->id;
     $id_field = 'field' . $this->id;
     $txt .= Html::beginTag('div', ['id' => $id_map, 'style' => 'height: 400px;']);
     $txt .= Html::endTag("div");
     $options["id"] = $id_field;
     $txt .= Html::activeHiddenInput($model, $field_name, $options);
     $txt .= Html::endTag("div");
     $script = "\n            ymaps.ready(init);\n            var myMap;\n\n            function init(){     \n                \n                var coord = \$('#" . $id_field . "').val();\n                coord = coord.split(',');\n                \n\n                if (coord.length == 1)\n                {\n                    \n                    coord = [55.76, 37.64];\n                }\n                else\n                    var dPlacemark = new ymaps.Placemark(coord);\n                \n\n                myMap = new ymaps.Map('" . $id_map . "', {\n                    center: coord,\n                    zoom: 7\n                });\n\n                if (dPlacemark)\n                    myMap.geoObjects.add(dPlacemark);\n\n                myMap.events.add('click', function (e) {\n                    var coords = e.get('coords');\n                    \n\n                    var eMap = e.get('target');\n\n                    x = coords[0].toPrecision(8);\n                    y = coords[1].toPrecision(8);\n\n                    \$('#" . $id_field . "').val(x+', '+y);\n\n                    var myPlacemark = new ymaps.Placemark([x, y]);\n                    eMap.geoObjects.removeAll();\n                    eMap.geoObjects.add(myPlacemark);\n                });\n            };\n        ";
     $txt .= Html::script($script);
     $txt .= Html::jsFile(Url::to('@web/js/yandex_map.js'));
     return $txt;
 }
Example #15
0
 /**
  * Registers a JS file.
  * @param string $url the JS file to be registered.
  * @param array $options the HTML attributes for the script tag. The following options are specially handled
  * and are not treated as HTML attributes:
  *
  * - `depends`: array, specifies the names of the asset bundles that this JS file depends on.
  * - `position`: specifies where the JS script tag should be inserted in a page. The possible values are:
  *     * [[POS_HEAD]]: in the head section
  *     * [[POS_BEGIN]]: at the beginning of the body section
  *     * [[POS_END]]: at the end of the body section. This is the default value.
  *
  * Please refer to [[Html::jsFile()]] for other supported options.
  *
  * @param string $key the key that identifies the JS script file. If null, it will use
  * $url as the key. If two JS files are registered with the same key, the latter
  * will overwrite the former.
  */
 public function registerJsFile($url, $options = [], $key = null)
 {
     $url = Yii::getAlias($url);
     $key = $key ?: $url;
     $depends = ArrayHelper::remove($options, 'depends', []);
     if (empty($depends)) {
         // получим позицию расположения файла
         $position = ArrayHelper::remove($options, 'position', self::POS_END);
         $this->jsFiles[$position][$key] = Html::jsFile($url, $options);
     } else {
         $this->getAssetManager()->bundles[$key] = new AssetBundle(['baseUrl' => '', 'js' => [strncmp($url, '//', 2) === 0 ? $url : ltrim($url, '/')], 'jsOptions' => $options, 'depends' => (array) $depends]);
         $this->registerAssetBundle($key);
     }
 }
Example #16
0
        <meta charset="UTF-8">
        <title>预算利润表</title>
        <?php 
echo Html::cssFile('@web/css/style.css');
?>
        <?php 
echo Html::cssFile('@web/css/bootstrap.min.css');
?>
        <?php 
echo Html::jsFile('@web/Js/jquery.js');
?>
        <?php 
echo Html::jsFile('@web/Js/bootstrap.js');
?>
        <?php 
echo Html::jsFile('@web/Js/WdatePicker/WdatePicker.js');
?>
    </head>
    <body>
        <div class="handsontable">
            <div class="div-top">
                <label class="lab-date">日 期:<input type="text" name="date" onfocus="datepicker()"  value="<?php 
echo $date;
?>
"></label>
            </div>
            <table class="htCore">
                <tr><th style="height: 25px;width: 3.5%;">行次</th><th>资 产</th><th>年初数</th><th>利润分配率为<?php 
echo $measure[0][1];
?>
%</th><th>利润分配率为<?php 
Example #17
0
 protected function saveOptimizedJsFile($content, $jsPosition)
 {
     $finalPath = $this->saveFile($content, $this->publishPath, 'js');
     $finalUrl = $this->publishUrl . DIRECTORY_SEPARATOR . basename($finalPath);
     $this->jsFiles[$jsPosition][$finalPath] = Html::jsFile($finalUrl);
 }
Example #18
0
<?php

use yii\base\View;
use yii\helpers\Html;
$directoryAsset = Yii::$app->assetManager->getPublishedUrl('@almasaeed/');
$this->title = '提现';
echo Html::cssFile('@web/myAssetsLib/css/bootstrap.css');
echo Html::jsFile('@web/myAssetsLib/js/jquery-1.9.1.min.js');
echo Html::jsFile('@web/myAssetsLib/js/bootstrap.js');
echo Html::jsFile('@web/myAssetsLib/js/bootbox.js');
?>
<div class="main aqbz">
    	<div class="left" id="left">
            <div class="page-con4">
                <p class="page-con41"><a href="<?php 
echo yii\helpers\Url::to(['setting/setting']);
?>
"><img width="100px" height="100px" src="<?php 
echo yii::$app->homeUrl;
?>
upload/<?php 
echo $model["person_face"];
?>
" alt="头像" /></a></p>
                
                <?php 
if (yii::$app->user->identity->real_name) {
    ?>
                <p><?php 
    echo yii::$app->user->identity->real_name;
    ?>
Example #19
0
    <ul id="J_NavContent" class="dl-tab-conten">

    </ul>
</div>



<?php 
echo Html::cssFile('@web/assets/css/dpl-min.css');
echo Html::cssFile('@web/assets/css/bui-min.css');
echo Html::cssFile('@web/assets/css/main-min.css');
echo Html::cssFile('@web/css/site.css');
echo Html::jsFile('@web/assets/js/jquery-1.8.1.min.js');
echo Html::jsFile('@web/assets/js/bui-min.js');
echo Html::jsFile('@web/assets/js/common/main-min.js');
echo Html::jsFile('@web/assets/js/config-min.js');
?>


<script>
    BUI.use('common/main', function () {
        var config = [{
            id: 'menu',
            menu: [{
                text: '用户信息修改',
                items: [
                    {
                        id: 'aboutuser',
                        text: '修改密码',
                        href: '<?php 
echo \Yii::$app->urlManager->createUrl('/admin/user/changepassword');
Example #20
0
 /**
  * Registers a JS file.
  * @param string $url the JS file to be registered.
  * @param array $depends the names of the asset bundles that this JS file depends on
  * @param array $options the HTML attributes for the script tag. A special option
  * named "position" is supported which specifies where the JS script tag should be inserted
  * in a page. The possible values of "position" are:
  *
  * - [[POS_HEAD]]: in the head section
  * - [[POS_BEGIN]]: at the beginning of the body section
  * - [[POS_END]]: at the end of the body section. This is the default value.
  *
  * @param string $key the key that identifies the JS script file. If null, it will use
  * $url as the key. If two JS files are registered with the same key, the latter
  * will overwrite the former.
  */
 public function registerJsFile($url, $depends = [], $options = [], $key = null)
 {
     $key = $key ?: $url;
     if (empty($depends)) {
         $position = isset($options['position']) ? $options['position'] : self::POS_END;
         unset($options['position']);
         $this->jsFiles[$position][$key] = Html::jsFile($url, $options);
     } else {
         $am = Yii::$app->getAssetManager();
         $am->bundles[$key] = new AssetBundle(['js' => [$url], 'jsOptions' => $options, 'depends' => (array) $depends]);
         $this->registerAssetBundle($key);
     }
 }
Example #21
0
echo Url::toRoute('/member/index/index');
?>
" class="button button-w button-white">会员中心</a>
                    </div>
                    <div class="decoration"></div>
                </div>                
            </div>  
        </div>
    </body>
    <?php 
yii\bootstrap\Modal::begin(['headerOptions' => ['id' => 'modalHeader'], 'id' => 'modal', 'size' => 'modal-lg', 'clientOptions' => ['backdrop' => 'static', 'keyboard' => FALSE]]);
echo '<div id="modalContent"><div style="text-align:center">加载中...请稍侯</div></div>';
yii\bootstrap\Modal::end();
?>
    <?php 
echo Html::jsFile('@web/js/framework.js');
?>
    <?php 
$this->endBody();
?>
</html>
<?php 
$this->endPage();
?>






Example #22
0
?>
    <?php 
echo Html::cssFile('@web/css/jquery.Jcrop.css');
?>

    <?php 
echo Html::jsFile('@web/Js/jquery.js');
?>
    <?php 
echo Html::jsFile('@web/Js/ajaxupload.js');
?>
    <?php 
echo Html::jsFile('@web/Js/jquery.Jcrop.min.js');
?>
    <?php 
echo Html::jsFile('@web/Js/bootstrap.js');
?>
    <title>用户管理</title>
    <script>
        $(function(){



        })
    </script>
</head>
<style type="text/css">
    .form{padding: 15px;}
    .jcorp-holder{position: relative;}
    #frm{margin-bottom:0px; }
    #frm input{margin:15px 0; }
    /**
     * * Eg.: <ViewTag:upload action="/upload.php" filetype="*.jpg;*.png;*.gif" filetypedesc="图片(.jpg,.png,.gif)" width="120" height="30" multi="false" for="" />
     * @param $attr
     * @return string|void
     */
    public function _ajaxUpload($objClass)
    {
        \Yii::$app->view->on(View::EVENT_END_PAGE, function () {
            echo Html::jsFile("@web/js/ext/ajaxFileUpload.js");
            $objClass = $this->objClass;
            $str = <<<STD

            <script type="text/javascript">
            //data {id:id, url:url, otherData:otherData}
            function ajaxFileUpload(data)
            {

                var id = data.id;
                var url = data.url;
                var otherData = data.otherData?data.otherData:{};
                \$.ajaxFileUpload ({
                    url: url,
                    secureuri:false,
                    fileElementId:id,
                    dataType: 'json',
                    data:{name:'logan', id:otherData},
                    success: function (data)
                    {

                        var file_name = data.data.file_name;
                        var objClass = \$('#'+id).attr('point-class');
                        var showImageId = \$('#'+id).attr('point-img');

                        \$('.'+objClass).val(file_name);
                        \$('#'+showImageId).attr('src', data.data.img_src).show();

                        return false;

                    },
                    error: function (data, status, e)
                    {
                       alert(e);
                    }
                });

                return false;
            }

            </script>
STD;
            $strBindEvent = <<<STD

            <script type="text/javascript">

            function onFileChange(obj){

                var id = obj.attr('id');
                var url = obj.attr('data-url');
                var otherData = {name:id}
                var data = {id:id, url:url, otherData:otherData};

                ajaxFileUpload(data, otherData);
            }

            function bindUploadAction() {

               var objClass = '{$objClass}';

                \$(document).on("change",objClass,function(){//修改成这样的写法

                    onFileChange(\$(this))

                });

            }


            \$(function(){

                bindUploadAction();
            })

            </script>
STD;
            echo $str . $strBindEvent;
        });
    }
Example #24
0
use kartik\widgets\Select2;
use kartik\sortinput\SortableInput;
use yii\helpers\BaseHtml;
/**
 * @var yii\web\View $this
 * @var yii\widgets\ActiveForm $form
 * @var amnah\yii2\user\Module $module
 * @var amnah\yii2\user\models\User $user
 * @var amnah\yii2\user\models\User $profile
 * @var string $userDisplayName
 */
$module = $this->context->module;
$this->title = Yii::t('user', 'Register');
$this->params['breadcrumbs'][] = $this->title;
echo Html::jsFile("/applanchonete/web/admin/js/jquery.js");
echo Html::jsFile("/applanchonete/web/admin/js/bootstrap.js");
?>


<div class="user-default-register">

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

    <?php 
if ($flash = Yii::$app->session->getFlash("Register-success")) {
    ?>

        <div class="alert alert-success">
Example #25
0
 public function testJsFile()
 {
     $this->assertEquals('<script src="http://example.com"></script>', Html::jsFile('http://example.com'));
     $this->assertEquals('<script src="/test"></script>', Html::jsFile(''));
 }
 /**
  * @param array $files
  * @return array
  */
 protected function _processingJsFiles($files = [])
 {
     $fileName = md5(implode(array_keys($files)) . $this->getSettingsHash()) . '.js';
     $publicUrl = \Yii::getAlias('@web/assets/js-compress/' . $fileName);
     $rootDir = \Yii::getAlias('@webroot/assets/js-compress');
     $rootUrl = $rootDir . '/' . $fileName;
     if (file_exists($rootUrl)) {
         $resultFiles = [];
         foreach ($files as $fileCode => $fileTag) {
             if (!Url::isRelative($fileCode)) {
                 $resultFiles[$fileCode] = $fileTag;
             } else {
                 if ($this->jsFileRemouteCompile) {
                     $resultFiles[$fileCode] = $fileTag;
                 }
             }
         }
         $publicUrl = $publicUrl . "?v=" . filemtime($rootUrl);
         $resultFiles[$publicUrl] = Html::jsFile($publicUrl);
         return $resultFiles;
     }
     //Reading the contents of the files
     try {
         $resultContent = [];
         $resultFiles = [];
         foreach ($files as $fileCode => $fileTag) {
             if (Url::isRelative($fileCode)) {
                 $contentFile = $this->fileGetContents(Url::to(\Yii::getAlias($fileCode), true));
                 $resultContent[] = trim($contentFile) . "\n;";
             } else {
                 if ($this->jsFileRemouteCompile) {
                     //Пытаемся скачать удаленный файл
                     $contentFile = $this->fileGetContents($fileCode);
                     $resultContent[] = trim($contentFile);
                 } else {
                     $resultFiles[$fileCode] = $fileTag;
                 }
             }
         }
     } catch (\Exception $e) {
         \Yii::error($e->getMessage(), static::className());
         return $files;
     }
     if ($resultContent) {
         $content = implode($resultContent, ";\n");
         if (!is_dir($rootDir)) {
             if (!FileHelper::createDirectory($rootDir, 0777)) {
                 return $files;
             }
         }
         if ($this->jsFileCompress) {
             $content = \JShrink\Minifier::minify($content, ['flaggedComments' => $this->jsFileCompressFlaggedComments]);
         }
         $page = \Yii::$app->request->absoluteUrl;
         $useFunction = function_exists('curl_init') ? 'curl extension' : 'php file_get_contents';
         $filesString = implode(', ', array_keys($files));
         \Yii::info("Create js file: {$publicUrl} from files: {$filesString} to use {$useFunction} on page '{$page}'", static::className());
         $file = fopen($rootUrl, "w");
         fwrite($file, $content);
         fclose($file);
     }
     if (file_exists($rootUrl)) {
         $publicUrl = $publicUrl . "?v=" . filemtime($rootUrl);
         $resultFiles[$publicUrl] = Html::jsFile($publicUrl);
         return $resultFiles;
     } else {
         return $files;
     }
 }
Example #27
0
use yii\helpers\Url;
use kartik\file\FileInput;
use common\models\base\fund\Thirdproduct;
use common\models\base\ucenter\Catmiddle;
/* @var $this yii\web\View */
/* @var $model common\models\base\fund\Thirdproduct */
/* @var $form yii\widgets\ActiveForm */
$octor = Catmiddle::find()->select('ucenter_member.id,uid,ucenter_member.username,ucenter_member.real_name')->joinWith(['user'])->andWhere(['cid' => \common\models\UcenterMember::CUS_CRE])->asArray()->all();
foreach ($octor as &$v) {
    $v['newname'] = '(' . $v['real_name'] . ')' . $v['username'];
}
$maxtor = Catmiddle::find()->select('ucenter_member.id,uid,ucenter_member.username,ucenter_member.real_name')->joinWith(['user'])->andWhere(['cid' => \common\models\UcenterMember::CUS_MAXCRE])->asArray()->all();
foreach ($maxtor as &$v) {
    $v['newname'] = '(' . $v['real_name'] . ')' . $v['username'];
}
echo Html::jsFile('@web/adminlte/js/jquery.min.js');
?>

<div class="thirdproduct-form">

    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>
    <input type="hidden" name="intent" value="<?php 
echo Thirdproduct::INTENT_CHECK;
?>
" />


    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
Example #28
0
    <?php 
echo $content;
?>

</div>





<?php 
echo Yii::$app->view->renderFile(Yii::$aliases['@moduleViewPath'] . "/public/footer.php");
?>

<?php 
echo Html::jsFile("@web/ecshop/js/admin/validator.js");
$this->endBody();
?>


</body>
</html>
<?php 
$this->endPage();
?>
<script>
    jQuery(document).ready(function () {
        Metronic.init(); // init metronic core componets
        Layout.init(); // init layout
        QuickSidebar.init(); // init quick sidebar
        //Demo.init(); // init demo features
Example #29
0
                            	<div class="input-group">
                                    <input type="email" class="form-control" id="email" placeholder="Put your email" required>
                                    <span class="input-group-btn"><button class="btn btn-primary" type="button">Submit</button></span>
                                </div>
                            </div>
                        </fieldset>
                    </form>
                </div>
            </div>
            <div class="footer-bottom">
                <div class="footer-copyright">
                    <p>&copy; 2015 Yii Software LLC | <?php 
echo Html::a('Terms of service', ['/site/tos']);
?>
</p>
                </div>
            </div>
        </div>
    </footer>
    </div>
   	<!-- ==========================
    	JS
    =========================== -->
    <?php 
echo Html::jsFile(YII_DEBUG ? '@web/js/all.js' : '@web/js/all.min.js?v=' . filemtime(Yii::getAlias('@webroot/js/all.min.js')));
$this->endBody();
?>
</body>
</html>
<?php 
$this->endPage();
Example #30
0
 /**
  * @param integer $position
  * @param array $files
  */
 protected function processMinifyJs($position, $files)
 {
     $resultFile = sprintf('%s/%s.js', $this->minify_path, $this->_getSummaryFilesHash($files));
     if (!file_exists($resultFile)) {
         $js = '';
         foreach ($files as $file => $html) {
             $file = $this->getAbsoluteFilePath($file);
             $js .= file_get_contents($file) . ';' . PHP_EOL;
         }
         $this->removeJsComments($js);
         $compressedJs = (new \JSMin($js))->min();
         file_put_contents($resultFile, $compressedJs);
         if (false !== $this->file_mode) {
             @chmod($resultFile, $this->file_mode);
         }
     }
     $file = sprintf('%s%s', \Yii::getAlias($this->web_path), str_replace(\Yii::getAlias($this->base_path), '', $resultFile));
     $this->jsFiles[$position][$file] = helpers\Html::jsFile($file);
 }