public function run() { parent::run(); // Saves $id will be the id of the element that ckeditor will target list($name, $id) = $this->resolveNameID(); // Publish assets to public directory $baseDir = dirname(__FILE__); $assets = Yii::app()->getAssetManager()->publish($baseDir . DIRECTORY_SEPARATOR . 'assets'); $cs = Yii::app()->getClientScript(); $cs->registerScriptFile($assets . '/ckeditor.js'); echo CHtml::activeTextArea($this->model, $this->attribute, array('rows' => 10, 'cols' => 70)); $this->options = array_merge(array('filebrowserBrowseUrl' => array('/backend/elfinderBrowse'), 'height' => '250px', 'allowedContent' => true), $this->options); $this->setConfig($this->options); $this->ECKE->replace($id, $this->_config); }
/** * Initializes the widget. */ public function init() { parent::init(); Yii::import('bootstrap.behaviors.TbWidget'); $this->attachBehavior('tbWidget', new TbWidget()); if (!isset($this->assetPath)) { $this->assetPath = realpath(dirname(__FILE__) . '/../assets'); } if (!$this->asDropDownList && !isset($this->pluginOptions['data'])) { $this->pluginOptions['data'] = $this->normalizeData($this->data); } if (isset($this->htmlOptions['placeholder'])) { if ($this->asDropDownList) { $this->htmlOptions['prompt'] = $this->htmlOptions['placeholder']; } else { $this->pluginOptions['placeholder'] = $this->htmlOptions['placeholder']; } unset($this->htmlOptions['placeholder']); } if (!$this->bindPlugin) { $this->htmlOptions['data-plugin'] = 'select2'; $this->htmlOptions['data-plugin-options'] = CJSON::encode($this->pluginOptions); } if (TbArray::popValue('block', $this->htmlOptions, false)) { TbHtml::addCssClass('input-block-level', $this->htmlOptions); } }
public function init() { $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'source'; $this->baseurl = Yii::app()->getAssetManager()->publish($dir); $this->kcFinderPath = $this->baseurl . "/kcfinder/"; parent::init(); }
public function run() { parent::run(); list($name, $id) = $this->resolveNameID(); $baseDir = dirname(__FILE__); $assets = Yii::app()->getAssetManager()->publish($baseDir . DIRECTORY_SEPARATOR . 'assets'); $cs = Yii::app()->getClientScript(); $cs->registerScriptFile($assets . '/ckeditor.js'); $this->htmlOptions['id'] = $id; // $this->htmlOptions['class'] = 'ckeditor'; if (!array_key_exists('style', $this->htmlOptions)) { $this->htmlOptions['style'] = "width:{$this->width};height:{$this->height};"; } if (!array_key_exists('cols', $this->htmlOptions)) { $this->htmlOptions['cols'] = self::COLS; } if (!array_key_exists('rows', $this->htmlOptions)) { $this->htmlOptions['rows'] = self::ROWS; } $options = $this->makeOptions(); $js = <<<EOP CKEDITOR.replace('{$name}',{$options}); EOP; $cs->registerScript('Yii.' . get_class($this) . '#' . $id, $js, CClientScript::POS_LOAD); if ($this->hasModel()) { $html = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions); } else { $html = CHtml::textArea($name, $this->value, $this->htmlOptions); } echo $html; }
public function init() { parent::init(); if (empty($this->model) || empty($this->attribute)) { throw new Exception("Model and Attribute must be declared"); } }
public function init() { list($this->name, $this->id) = $this->resolveNameID(); //не стал делать сеттер, если хочешь допиши $this->attachBehaviors($this->behaviors()); parent::init(); }
public function init() { parent::init(); list($name, $id) = $this->resolveNameID(); $config = array("id" => $id, "height" => $this->height, "autogrow" => $this->autogrow); $js = 'window.setTimeout(function() { chive.initAce(' . json_encode($config) . '); }, 1000);'; Yii::app()->clientScript->registerScript('Yii.AceEditor.' . $this->id, $js, CClientScript::POS_END); }
/** * @throws \yii\base\InvalidConfigException */ public function init() { parent::init(); $this->options['class'] = $this->el; Yii::setAlias('@sirtrevorjs', dirname(__FILE__) . DIRECTORY_SEPARATOR . '..'); $this->registerAsset(); echo $this->renderInput(); }
public function init() { parent::init(); Yii::import('bootstrap.behaviors.TbWidget'); $this->attachBehavior('tbWidget', new TbWidget()); if (!isset($this->assetPath)) { $this->assetPath = realpath(dirname(__FILE__) . '/../assets'); } }
/** * 运行 */ public function run() { parent::run(); $assets = $this->getAssetsPath(); $clientScript = Yii::app()->getClientScript(); $clientScript->registerScriptFile($assets . '/ueditor.config.js', CClientScript::POS_END); $clientScript->registerScriptFile($assets . '/ueditor.all.min.js', CClientScript::POS_END); $clientScript->registerScriptFile($assets . '/lang/' . $this->language . '.js', CClientScript::POS_END); $clientScript->registerScript('content', $this->makeOptions(), CClientScript::POS_END); }
public function init() { $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'source'; $this->baseurl = Yii::app()->getAssetManager()->publish($dir); $this->kcFinderPath = $this->baseurl; $cs = Yii::app()->clientScript; $cs->registerCssFile($this->baseurl . "/run/kcfinder.css", "screen"); $cs->registerScriptFile($this->baseurl . "/run/kcfinder.js"); parent::init(); }
/** * 运行 */ public function run() { parent::run(); $this->assets = $assets = $this->getAssetsPath(); $this->displayHtml(); $clientScript = Yii::app()->getClientScript(); $clientScript->registerCssFile($assets . '/default.css'); $clientScript->registerScriptFile($assets . '/resumable.js', CClientScript::POS_END); $clientScript->registerScriptFile($assets . '/upload.js', CClientScript::POS_END); }
public function run() { parent::run(); $assets = $this->getAssetsPath(); $cs = Yii::app()->getClientScript(); $cs->registerCssFile($assets . '/themes/default/default.css'); $cs->registerCssFile($assets . '/plugins/code/prettify.css'); $cs->registerScriptFile($assets . '/kindeditor.js', CClientScript::POS_HEAD); $cs->registerScriptFile($assets . '/lang/zh_CN.js', CClientScript::POS_HEAD); $cs->registerScriptFile($assets . '/plugins/code/prettify.js', CClientScript::POS_HEAD); $cs->registerScript('content', $this->makeOptions(), CClientScript::POS_HEAD); }
public function init() { parent::init(); Yii::import('bootstrap.behaviors.TbWidget'); $this->attachBehavior('tbWidget', new TbWidget()); if (!isset($this->assetPath)) { $this->assetPath = realpath(dirname(__FILE__) . '/../assets'); } if (!$this->bindPlugin) { $this->htmlOptions['data-plugin'] = 'datetimepicker'; $this->htmlOptions['data-plugin-options'] = CJSON::encode($this->pluginOptions); } }
public function init() { if (!isset($this->options['allowTimes'])) { $this->options['allowTimes'] = array(); for ($i = 0; $i < 24; $i++) { $hour = str_pad($i, 2, 0, STR_PAD_LEFT); $minutes = str_pad($i, 2, 0, STR_PAD_LEFT); $this->options['allowTimes'][] = $hour . ':00'; $this->options['allowTimes'][] = $hour . ':30'; } } return parent::init(); }
/** * Initializes the widget. */ public function init() { parent::init(); Yii::import('bootstrap.behaviors.TbWidget'); $this->attachBehavior('tbWidget', new TbWidget()); if (!isset($this->assetPath)) { $this->assetPath = Yii::getPathOfAlias('lib.bootstrap-wysihtml5'); } if (!$this->bindPlugin) { $this->htmlOptions['data-plugin'] = 'wysihtml5'; $this->htmlOptions['data-plugin-options'] = CJSON::encode($this->pluginOptions); } TbHtml::addCssStyle('width: ' . $this->width . 'px; height: ' . $this->height . 'px;', $this->htmlOptions); }
/** * Init widget */ public function init() { parent::init(); if ($this->assetsPath === null) { $this->assetsPath = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets'; } if ($this->assetsUrl === null) { $this->assetsUrl = Yii::app()->assetManager->publish($this->assetsPath); } if ($this->selector === null) { list($this->name, $this->id) = $this->resolveNameId(); $this->selector = '#' . $this->id; } $this->registerClientScript(); }
/** * Init widget. */ public function init() { parent::init(); if ($this->selector === null) { list($this->name, $this->id) = $this->resolveNameID(); $this->htmlOptions['id'] = $this->getId(); $this->selector = '#' . $this->getId(); if ($this->hasModel()) { echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions); } else { echo CHtml::textArea($this->name, $this->value, $this->htmlOptions); } } $this->registerClientScript(); }
public function init() { // Please change the config below to suit your needs $this->uploadPath = dirname(Yii::app()->request->scriptFile) . '/uploads/'; $this->uploadUrl = Yii::app()->getRequest()->hostInfo . Yii::app()->baseUrl . '/uploads/'; // We need to make the CKFinder accessible, let's publish it to the assets folder $lo_am = new CAssetManager(); $this->path = Yii::app()->getAssetManager()->publish(Yii::app()->basePath . '/extensions/finder/ckfinder2.1', true); // And save the upload path to use with ckfinder's config file. Passing as js param did not work... $lo_session = new CHttpSession(); $lo_session->open(); $lo_session['auth'] = true; $lo_session['upload_path'] = $this->uploadPath; $lo_session['upload_url'] = $this->uploadUrl; parent::init(); }
public function init() { parent::init(); if ($this->selector === null) { list($this->name, $this->id) = $this->resolveNameID(); $this->htmlOptions['id'] = $this->getId(); $this->selector = '#' . $this->getId(); if ($this->hasModel()) { echo CHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions); } else { echo CHtml::textField($this->name, $this->value, $this->htmlOptions); } } $this->registerMoment(); $this->registerBootstrapDateRangePicker(); }
/** * Initializes the widget. */ public function init() { parent::init(); Yii::import('bootstrap.behaviors.TbWidget'); $this->attachBehavior('tbWidget', new TbWidget()); if (isset($this->locale)) { $this->pluginOptions['language'] = $this->locale; } if (!isset($this->assetPath)) { $this->assetPath = Yii::getPathOfAlias('lib.smalot-bootstrap-datetimepicker'); } if (!$this->bindPlugin) { $this->htmlOptions['data-plugin'] = 'datetimepicker'; $this->htmlOptions['data-plugin-options'] = CJSON::encode($this->pluginOptions); } }
public function init() { $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'source'; $this->baseurl = Yii::app()->getAssetManager()->publish($dir); $cs = Yii::app()->clientScript; $cs->registerCoreScript('jquery'); $cs->registerCoreScript('jquery.ui'); $cs->registerScriptFile($this->baseurl . "/jquery.tmpl.min.js"); $cs->registerScriptFile($this->baseurl . "/jquery.iframe-transport.js"); $cs->registerScriptFile($this->baseurl . "/jquery.fileupload.js"); $cs->registerScriptFile($this->baseurl . "/jquery.fileupload-ui.js"); $cs->registerScriptFile($this->baseurl . "/application.js"); $cs->registerCssFile("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css", "screen"); $cs->registerCssFile($this->baseurl . "/jquery.fileupload-ui.css", "screen"); parent::init(); }
/** * Init widget. */ public function init() { parent::init(); if ($this->selector === null) { list($this->name, $this->id) = $this->resolveNameID(); $this->htmlOptions['id'] = $this->getId(); $this->selector = '#' . $this->getId(); if ($this->hasModel()) { echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions); } else { echo CHtml::textArea($this->name, $this->value, $this->htmlOptions); } } $package = array_merge(array('baseUrl' => $this->getAssetsUrl()), $this->package); self::initClientScript($package, isset($this->options['lang']) && $this->options['lang'] !== 'en' ? $this->options['lang'] : null); $this->registerClientScript(); }
/** * Initialize component */ public function init() { if (self::$initialized === false) { self::$initialized = true; $assetsUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('ext.elrte.lib'), false, -1, YII_DEBUG); $cs = Yii::app()->clientScript; // Elrte $cs->registerCssFile($assetsUrl . '/elrte/css/elrte.min.css'); $cs->registerScriptFile($assetsUrl . '/elrte/js/elrte.min.js'); $cs->registerScriptFile($assetsUrl . '/elrte/js/i18n/elrte.ru.js'); // Elfinder $cs->registerCssFile($assetsUrl . '/elfinder/css/elfinder.min.css'); $cs->registerCssFile($assetsUrl . '/elfinder/css/theme.css'); $cs->registerScriptFile($assetsUrl . '/elfinder/js/elfinder.min.js'); $cs->registerScriptFile($assetsUrl . '/elfinder/js/i18n/elfinder.ru.js'); $cs->registerScriptFile($assetsUrl . '/helper.js'); } parent::init(); }
/** * Initializes the widget. */ public function init() { parent::init(); Yii::import('bootstrap.behaviors.TbWidget'); $this->attachBehavior('tbWidget', new TbWidget()); if (!isset($this->assetPath)) { $this->assetPath = Yii::getPathOfAlias('lib.select2'); } if (!$this->asDropDownList && !isset($this->pluginOptions['data'])) { $this->pluginOptions['data'] = $data = $this->normalizeData($this->data); } if (!$this->bindPlugin) { $this->htmlOptions['data-plugin'] = 'select2'; $this->htmlOptions['data-plugin-options'] = CJSON::encode($this->pluginOptions); } if (TbArray::popValue('block', $this->htmlOptions, false)) { TbHtml::addCssClass('input-block-level', $this->htmlOptions); } }
/** * */ public function init() { $this->directory || ($this->directory = app()->getRuntimePath() . '/ck_uploads/'); if (!file_exists($this->directory)) { mkdir($this->directory, 0755, true); } $ckFinderPath = Yii::getPathOfAlias('vendor') . '/cornernote/ckfinder-assets/ckfinder'; $this->path = app()->assetManager->publish($ckFinderPath, false, -1, YII_DEBUG); if (!$this->resourceTypes) { $this->resourceTypes[] = array('name' => t('CK Uploads'), 'url' => $this->url, 'directory' => $this->directory, 'maxSize' => $this->maxSize, 'allowedExtensions' => is_array($this->allowedExtensions) ? implode(',', $this->allowedExtensions) : $this->allowedExtensions, 'deniedExtensions' => is_array($this->deniedExtensions) ? implode(',', $this->deniedExtensions) : $this->deniedExtensions); } $lo_session = new CHttpSession(); $lo_session->open(); $lo_session['ck_auth'] = true; $lo_session['ck_upload_path'] = $this->directory . '/'; $lo_session['ck_upload_url'] = $this->url . '/'; $lo_session['ck_resource'] = $this->resourceTypes; parent::init(); }
/** * @inheritdoc */ public function init() { parent::init(); if (!$this->hasModel() && $this->name === null) { throw new CException("Either 'name', or 'model' and 'attribute' properties must be specified."); } if (!isset($this->htmlOptions['id'])) { $this->htmlOptions['id'] = $this->hasModel() ? CHtml::activeId($this->model, $this->attribute) : $this->getId(); } $this->attachBehavior('ywplugin', array('class' => 'yiiwheels.behaviors.WhPlugin')); $this->htmlOptions = TbArray::merge($this->asDataAttributes($this->pluginOptions), $this->htmlOptions); $this->pluginOptions = false; if ($this->hasModel()) { $this->htmlOptions['data-name'] = CHtml::activeId($this->model, $this->attribute); $this->htmlOptions['data-value'] = CHtml::value($this->model, $this->attribute); } else { $this->htmlOptions['data-name'] = $this->name; $this->htmlOptions['data-value'] = $this->value; } }
public function run() { parent::run(); list($name, $id) = $this->resolveNameID(); $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets'); $options = $this->makeOptions(); $cs = Yii::app()->getClientScript(); $cs->registerScriptFile($assets . '/ckeditor.js'); $this->htmlOptions['id'] = $id; $js = <<<EOP CKEDITOR.replace('{$name}',{$options}); EOP; $cs->registerScript('Yii.' . get_class($this) . '#' . $id, $js, CClientScript::POS_LOAD); if ($this->hasModel()) { $html = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions); } else { $html = CHtml::textArea($name, $this->value, $this->htmlOptions); } echo $html; }
public function init() { parent::init(); $checkboxClass = class_exists(\Befound\Widgets\CheckBoxColumn::CLASS) ? \Befound\Widgets\CheckBoxColumn::CLASS : \CCheckBoxColumn::CLASS; $this->checkBoxColumn = array_merge(array('class' => $checkboxClass, 'headerTemplate' => '{item}', 'checked' => function ($model, $row, $source) { if (is_array($this->model->{$this->attribute})) { return in_array($model->{$source->name}, $this->model->{$this->attribute}); } else { return $model->{$source->name} == $this->model->{$this->attribute}; } }), $this->checkBoxColumn); if (isset($this->checkBoxColumn['header'])) { $this->checkBoxColumn['headerTemplate'] = $this->checkBoxColumn['header'] . ' ' . $this->checkBoxColumn['headerTemplate']; } if ($this->multiple) { $this->options['selectableRows'] = 2; } else { $this->options['selectableRows'] = 1; } CHtml::resolveNameID($this->model, $this->attribute, $this->htmlOptions); if (substr($this->htmlOptions['name'], -2) !== '[]') { $this->htmlOptions['name'] .= '[]'; } $this->checkBoxColumn['checkBoxHtmlOptions']['name'] = $this->htmlOptions['name']; //search for placeholder const in the columns $foundplaceholder = false; foreach ($this->options['columns'] as $key => $column) { if ($column == static::CHECKBOX_COLUMN) { $this->options['columns'][$key] = $this->checkBoxColumn; $foundplaceholder = true; break; } } //if not found, choose the last column if (!$foundplaceholder) { $this->options['columns'][] = $this->checkBoxColumn; } if (!isset($this->options['id'])) { $this->options['id'] = $this->resolveNameID()[1]; } }
public function run() { parent::run(); // Saves $id will be the id of the element that ckeditor will target list($name, $id) = $this->resolveNameID(); // Publish assets to public directory $baseDir = dirname(__FILE__); $assets = Yii::app()->getAssetManager()->publish($baseDir . DIRECTORY_SEPARATOR . 'assets'); $cs = Yii::app()->getClientScript(); $cs->registerScriptFile($assets . '/ckeditor.js'); echo CHtml::activeTextArea($this->model, $this->attribute, array('rows' => 10, 'cols' => 70)); $this->ECKE->replace($id, $this->_config); }