public function init($category_id = null, $current_tuid = null) { parent::init(); global $js_file; $js_file['tservices/tservices_catalog'] = 'tservices/tservices_catalog.js'; if (isset($this->options['limit'])) { $this->limit = $this->options['limit']; } if (isset($this->options['prof_group_id'], $this->options['prof_id']) && !$category_id) { require_once ABS_PATH . '/classes/tservices/tservices_categories.php'; $tservices_categories = new tservices_categories(); $category_data = $tservices_categories->getCategoryByFreelancersCatalog($this->options['prof_group_id'], $this->options['prof_id']); if ($category_data) { $category_id = $category_data['id']; $this->options['category_title'] = $category_data['title']; $this->options['category_stitle'] = $category_data['link']; } } $tservicesCatalogModel = new tservices_catalog(); $tservicesCatalogModel->setPage($this->limit, 1); if (isset($this->options['user_id']) && $this->options['user_id'] > 0) { $tservicesCatalogModel->user_id = $this->options['user_id']; } elseif ($category_id) { $tservicesCatalogModel->category_id = $category_id; } $exclude_ids = $current_tuid ? array($current_tuid) : array(); $list = $tservicesCatalogModel->cache($this->ttl_cache)->getList($exclude_ids); $this->tservices = $list['list']; if ($this->tservices) { //расширение сведений о типовых услугах $tserviceModel = new TServiceModel(); $tserviceModel->addOwnerInfo()->extend($this->tservices, 'id'); } }
function init() { parent::init(); if (trim($this->id) == '' || trim($this->name) == '') { throw new CException('必须设置容器id和name值'); } //发布资源 $this->_assetUrl = Yii::app()->assetManager->publish(Yii::getPathOfAlias('ext.baiduUeditor.resource')); $clientScript = Yii::app()->clientScript; //注册常量 $jsConstant = 'window.UEDITOR_HOME_URL = "' . $this->_assetUrl . '/"'; $clientScript->registerScript('ueditor_constant', $jsConstant, CClientScript::POS_BEGIN); //注册js文件 foreach ($this->jsFiles as $jsFile) { $clientScript->registerScriptFile($this->_assetUrl . $jsFile, CClientScript::POS_END); } //注册css文件 foreach ($this->cssFiles as $cssFile) { $clientScript->registerCssFile($this->_assetUrl . $cssFile); } //判断是否存在module if ($this->owner->module != null) { $moduleId = $this->owner->module->id; $this->serverUrl = Yii::app()->createUrl($moduleId . '/ueditor'); } else { $this->serverUrl = Yii::app()->createUrl('ueditor'); } //config $this->config['serverUrl'] = $this->serverUrl; $this->render('ueditor'); }
/** * Initializes the widget. * This method is called by {@link CBaseController::createWidget} * and {@link CBaseController::beginWidget} after the widget's * properties have been initialized. */ public function init() { parent::init(); // EAuth component $component = Yii::app()->getComponent($this->component); // Some default properties from component configuration if (!isset($this->services)) { $this->services = $component->getServices(); } if (is_array($this->predefinedServices)) { $_services = array(); foreach ($this->predefinedServices as $_serviceName) { if (isset($this->services[$_serviceName])) { $_services[$_serviceName] = $this->services[$_serviceName]; } } $this->services = $_services; } if (!isset($this->popup)) { $this->popup = $component->popup; } // Set the current route, if it is not set. if (!isset($this->action)) { $this->action = Yii::app()->urlManager->parseUrl(Yii::app()->request); } }
public function init() { $this->registerScripts(); $this->options = (require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'tooltip.options.php'); $this->initTooltip(); parent::init(); }
public function init() { $this->initDefaultButtons(); parent::init(); $locale = Yii::app()->getLocale(); $this->defaultOptions = array('header' => array('left' => 'prev,next today', 'center' => 'title', 'right' => 'agendaDay, agendaWeek, month'), 'defaultView' => 'month', 'axisFormat' => 'HH:mm', 'timeFormat' => 'H:mm{ - H:mm}', 'slotMinutes' => 15, 'snapMinutes' => 5, 'selectable' => true, 'selectHelper' => true, 'allDaySlot' => false, 'editable' => true, 'firstHour' => 11, 'firstDay' => 1, 'uneditableOnLeft' => true, 'droppable' => true, 'monthNames' => array_values($locale->getMonthNames('wide')), 'monthNamesShort' => array_values($locale->getMonthNames('abbreviated')), 'dayNames' => $locale->getWeekDayNames('wide'), 'dayNamesShort' => $locale->getWeekDayNames('abbreviated'), 'buttonText' => array('today' => Yii::t('FullCalendar.fc', 'Today'), 'agendaDay' => Yii::t('FullCalendar.fc', 'Day'), 'agendaWeek' => Yii::t('FullCalendar.fc', 'Week'), 'month' => Yii::t('FullCalendar.fc', 'Month')), 'eventRender' => 'js:function(event, element){if (!event.editable) element.css({opacity: 0.8})}', 'indentationMultiplier' => 0.2); }
public function init() { parent::init(); // TODO: Change the autogenerated stub $this->filter = new TServiceFilterForm(); $this->setFilterAttributes(); }
public function init() { parent::init(); Yii::app()->counter->refresh(); $this->_session = new CHttpSession(); $this->_session->open(); }
public function init() { $dateInfo = CTimestamp::getDate(time()); $month = $dateInfo['mon']; $day = $dateInfo['mday']; $yDay = $dateInfo['yday']; foreach ($this->signsOrder as $key => $val) { $arr = explode('-', $val); $start = explode('.', $arr[0]); $end = explode('.', $arr[1]); settype($start[0], 'integer'); settype($start[1], 'integer'); settype($end[0], 'integer'); settype($end[1], 'integer'); if ($month >= $start[1] && $month <= $end[1]) { if ($day >= $start[0] || $day <= $end[0]) { $signMonth = $key; break; } } } $this->_data = Yii::app()->db->createCommand('SELECT p.`post_id`, p.`gallery_id`, h.`content`, h.`publication_date`, p.`title`, p.`created_date`, ph.`filename` FROM horoscope AS h LEFT JOIN posting AS p ON h.`post_id` = p.`post_id` LEFT JOIN gallery AS g ON p.`gallery_id` = g.`gallery_id` LEFT JOIN photo AS ph ON ph.`gallery_id` = g.`gallery_id` WHERE p.`title` LIKE :sign')->queryRow(true, array(':sign' => $this->signs[$signMonth])); // этот метод будет вызван внутри CBaseController::beginWidget() parent::init(); }
public function init() { parent::init(); // prepare the list of input elements foreach ($this->params as $param) { $elm = new ParamFormElement($param); if (isset($this->config[$param->name])) { $pCfg = $this->config[$param->name]; if (!isset($pCfg['visible']) || $pCfg['visible'] == false) { continue; } if (isset($pCfg['type'])) { $elm->type = $pCfg['type']; } if (isset($pCfg['rules']) && is_array($pCfg['rules'])) { $elm->param->rules = array(); foreach ($pCfg['rules'] as $rule => $options) { $elm->param->rules[] = array_merge(array('value', $rule), $options); } // $pCfg['rules']; } if (isset($pCfg['items'])) { $elm->items = $pCfg['items']; } if (isset($pCfg['htmlOptions'])) { $elm->htmlOptions = $pCfg['htmlOptions']; } } $this->elements[$param->name] = $elm; } }
public function init() { $assetsPath = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets'; $this->htmlOptions = isset($this->htmlOptions) ? $this->htmlOptions : array(); $this->selectSepartor = isset($this->selectSepartor) ? $this->selectSepartor : ''; $this->assetsPath = Yii::app()->getAssetManager()->publish($assetsPath); $nameList = array(); $attributeList = array(); $dropListInit = 'new PCAS('; $attrCity = $this->attributeCity; $attrArea = $this->attributeArea; $attrProvince = $this->attributeProvince; $modelName = get_class($this->model); if (isset($this->attributeProvince)) { $nameList[] = '"' . $modelName . '[' . $this->attributeProvince . ']' . '"'; $attributeList[] = '"' . $this->model->{$attrProvince} . '"'; } if (isset($this->attributeCity)) { $nameList[] = '"' . $modelName . '[' . $this->attributeCity . ']' . '"'; $attributeList[] = '"' . $this->model->{$attrCity} . '"'; } if (isset($this->attributeArea)) { $nameList[] = '"' . $modelName . '[' . $this->attributeArea . ']' . '"'; $attributeList[] = '"' . $this->model->{$attrArea} . '"'; } $initArray = array_merge($nameList, $attributeList); $dropListInit .= implode(', ', $initArray) . ');'; Yii::app()->clientScript->registerScriptFile($this->assetsPath . '/PCAS.js'); Yii::app()->clientScript->registerScript(__CLASS__ . '#' . uniQId(), $dropListInit); parent::init(); }
public function init() { parent::init(); if (!$this->email || !(new CEmailValidator())->validateValue($this->email)) { throw new HttpException(500, 'The email you specified is not valid.'); } }
public function init() { parent::init(); Yii::app()->clientScript->registerScriptFile('https://apis.google.com/js/plusone.js', CClientScript::POS_END); Yii::app()->clientScript->registerScriptFile('http://platform.twitter.com/widgets.js', CClientScript::POS_END); Yii::app()->clientScript->registerScriptFile('http://connect.facebook.net/en_US/all.js#appId=362597297166414&xfbml=1', CClientScript::POS_END); }
public function init() { $default = array('skin' => 'default', 'preview' => null, 'allowDelete' => true, 'deleteField' => $this->name . '_delete', 'fileField' => $this->name . '_file', 'url' => '', 'secureuri' => false, 'loader' => $this->id . 'Loader', 'field' => $this->id, 'result' => $this->id . 'Result', 'button' => $this->id . 'ButtonUpload', 'container' => $this->id . 'Container', 'onBeforeSerialize' => '', 'onBeforeSubmit' => '', 'onSuccess' => '', 'url' => '', 'data' => null, 'form' => $this->id . 'Form'); $this->options = array_merge($default, $this->options); $options = CJavaScript::encode($this->options); switch ($this->options['skin']) { case 'ajax': $this->assets = Yii::app()->assetManager->publish(Yii::getPathOfAlias('ext.image.assets'), false, -1, true); $cs = Yii::app()->clientScript; $cs->registerCoreScript('jquery'); $cs->registerScriptFile($this->assets . '/ajaxfileupload.js'); $cs->registerScriptFile($this->assets . '/ajaxfunction.js'); $cs->registerScript(__CLASS__ . '#' . $this->id, "\$.ajaxFunction({$options});"); break; case 'ajax2': $this->assets = Yii::app()->assetManager->publish(Yii::getPathOfAlias('ext.image.assets'), false, -1, true); $cs = Yii::app()->clientScript; $cs->registerCoreScript('jquery'); $cs->registerScriptFile($this->assets . '/jquery.form.js'); // заплатка, не могу понять почему исчезает форма обрамляющая поле файла $cs->registerScript(__CLASS__ . '#' . $this->id . 'WrapInner', "\$('#{$this->options['container']}').wrapInner('<form id=\\'{$this->options['form']}\\' enctype=\\'multipart/form-data\\' method=\\'post\\' action=\\'{$this->options['url']}\\'></form>');"); $cs->registerScript(__CLASS__ . '#' . $this->id, "\$('#{$this->options['form']}').ajaxForm({\n\t\t\t\t\turl: '{$this->options['url']}',\n\t\t\t\t\tdata: " . CJavaScript::encode($this->options['data']) . ",\n\t\t\t\t\tdataType: 'json',\n\t\t\t\t\tbeforeSubmit: function(arr, form, options){\n\t\t\t\t\t\t\$('#" . $this->options['loader'] . "').show();\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function(data){\n\t\t\t\t\t\t\$('#" . $this->options['loader'] . "').hide();\n\t\t\t\t\t\t\$('#" . $this->options['field'] . "').val('');\n\t\t\t\t\t\tif(typeof(data.error) != 'undefined'){\n\t\t\t\t\t\t\talert(data.error);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t" . ($this->options['onSuccess'] ? CJavaScript::encode($this->options['onSuccess']) : '') . ";\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror:function(data){\n\t\t\t\t\t\talert(data);\n\t\t\t\t\t}\n\t\t\t\t});"); break; } return parent::init(); }
public function init() { if (empty($this->assetsUrl)) { $this->assetsUrl = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'prettyPhoto'); } $this->registerClientScript(); parent::init(); $id = $this->getId(); if (isset($this->htmlOptions['id'])) { $id = $this->htmlOptions['id']; } else { $this->htmlOptions['id'] = $id; } echo CHtml::openTag($this->tag, $this->htmlOptions) . "\n"; if (empty($this->options['theme'])) { $this->options['theme'] = $this->theme; } $options = empty($this->options) ? '' : CJavaScript::encode($this->options); /* Yii::app()->clientScript->registerScript(__CLASS__," jQuery('#$id a').attr('data-lightbox','prettyPhoto".($this->gallery?'[]':'')."'); jQuery('a[data-lightbox^=\"prettyPhoto\"]').prettyPhoto(".$options.'); ',CClientScript::POS_END); */ // Fix multiple widgets on same page. Yii::app()->clientScript->registerScript('prettyPhoto_' . $id, "\n jQuery('#" . $id . " a').attr('data-lightbox','prettyPhoto_" . $id . "" . ($this->gallery ? '[]' : '') . "');\n jQuery('a[data-lightbox^=\"prettyPhoto_" . $id . "\"]').prettyPhoto(" . $options . '); ', CClientScript::POS_END); }
/** * Initializes the widget. */ public function init() { parent::init(); if (!isset($this->htmlOptions['id'])) { $this->htmlOptions['id'] = $this->getId(); } }
public function init() { if (isset($this->htmlOptions['id'])) { $this->_id = $this->htmlOptions['id']; unset($this->htmlOptions['id']); } else { $this->_id = $this->getId(); } if ($this->listOptions['ajaxUpdate'] === true) { $this->listOptions['beforeAjaxUpdate'] = 'function(id, options){ var activeLanguage = $(".ts-translate.active").attr("data-language"); $("#currentActiveLanguage").val(activeLanguage); }'; $this->listOptions['afterAjaxUpdate'] = 'function(id, data){ var activeLanguage = $("#currentActiveLanguage").val(); $(".ts-translate[data-language="+activeLanguage+"]").addClass("active"); $(".ts-translate[data-language="+activeLanguage+"] i").addClass("glyphicon-check"); $(".tstranslation-list table tbody").sortable(); $(".tstranslation-list table tbody").disableSelection(); orderCount = 0; }'; } if ($this->minifyScripts) { $this->_minifySuffix = '.min'; } parent::init(); }
public function init($data = array()) { parent::init(); if (!empty($data)) { $this->data = $data; } }
public function init() { parent::init(); $this->maxDistKm = $this->maxDistance / 1000; $this->newLat = deg2rad($this->lat); $this->newLng = deg2rad($this->lng); }
/** * */ public function init() { $baseUrl = Yii::app()->assetManager->publish(Yii::getPathOfAlias('vendor.fortawesome.font-awesome'), false, -1, YII_DEBUG); $clientScript = Yii::app()->clientScript; $clientScript->registerCssFile($baseUrl . '/css/font-awesome.min.css'); parent::init(); }
/** * @return void Make sure that the JS SDK is enabled */ public function init() { parent::init(); if (!Yii::app()->facebook->jsSdk) { throw new CException('Facebook JS SDK not enabled.'); } }
/** * Widget's initialization */ public function init() { $this->htmlOptions['id'] = TbArray::getValue('id', $this->htmlOptions, $this->getId()); $this->pluginOptions['container'] = '#' . $this->htmlOptions['id'] . '-gallery'; $this->attachBehavior('ywplugin', array('class' => 'yiiwheels.behaviors.WhPlugin')); parent::init(); }
public function init() { $assetFolder = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets'; $publishedAssetsPath = Yii::app()->assetManager->publish($assetFolder); if ($this->position == 'left') { Yii::app()->clientScript->registerCssFile($publishedAssetsPath . '/css/leftsidebar.css'); Yii::app()->clientScript->registerScriptFile($publishedAssetsPath . '/js/leftsidebar.js'); $js = $this->collapsed ? 'left_menu.setStartStatus(false);' : 'left_menu.setStartStatus(true);'; Yii::app()->clientScript->registerScript('leftMenu', $js, CClientScript::POS_LOAD); echo '<div class="left_menu" id="leftmenu">'; echo '<div class="title">'; echo CHtml::encode($this->title); echo '</div>'; } else { Yii::app()->clientScript->registerCssFile($publishedAssetsPath . '/css/rightsidebar.css'); Yii::app()->clientScript->registerScriptFile($publishedAssetsPath . '/js/rightsidebar.js'); $js = $this->collapsed ? 'right_menu.setStartStatus(false);' : 'right_menu.setStartStatus(true);'; Yii::app()->clientScript->registerScript('rightMenu', $js, CClientScript::POS_LOAD); echo '<div class="right_menu" id="rightmenu">'; echo '<div class="title">'; echo CHtml::encode($this->title); echo '</div>'; } parent::init(); }
/** * Widget init function * @see CActiveForm init() */ public function init() { // Use Reflection::getProperties(PROTECTED) to get protected properties from the passed model $reflection = new ReflectionClass($this->model); $this->properties = $reflection->getProperties(ReflectionProperty::IS_PROTECTED); return parent::init(); }
public function init() { if (isset($_POST)) { $startHidden = false; } if ($this->startHidden) { // register css Yii::app()->clientScript->registerCssFile(Yii::app()->theme->getBaseUrl() . '/css/inlinequotes.css'); // register (lots of) javascript Yii::app()->clientScript->registerScript('toggleQuotes', ($this->startHidden ? "\$(document).ready(function() { \$('#quotes-form').hide();\n\t\t\t });\n" : '') . "function toggleQuotes() {\n\t\t\t\t\n\t\t\t\tif(\$('#quotes-form').is(':hidden')) {\n\t\t\t\t\t\$('.focus-mini-module').removeClass('focus-mini-module');\n\t\t\t\t\t\$('#quotes-form').find('.wide.form').addClass('focus-mini-module');\n\t\t\t\t\t\$('html,body').animate({\n\t\t\t\t\t\tscrollTop: (\$('#action-form').offset().top - 200)\n\t\t\t\t\t}, 300);\n\t\t\t\t}\n\t\t\t\t\$('#quotes-form').toggle('blind',300,function() {\n\t\t\t\t\t\$('#quotes-form').focus();\n\t\t\t\t});\n\t\t\t}\n\t\t\t\n\t\t\t\$(function() {\n\t\t\t\t\$('#quotes-form').click(function() {\n\t\t\t\t\tif(sendingQuote) {\n\t\t\t\t\t\tsendingQuote = false;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif(!\$('#quotes-form').find('.wide.form').hasClass('focus-mini-module')) {\n\t\t\t\t\t\t\t\$('.focus-mini-module').removeClass('focus-mini-module');\n\t\t\t\t\t\t\t\$('#quotes-form').find('.wide.form').addClass('focus-mini-module');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t});\n\t\t\t});\n\t\t\t", CClientScript::POS_HEAD); Yii::app()->clientScript->registerScript('emailQuote', "\n\t\tfunction appendEmail(line) {\n\t\t\tvar email = \$('#email-message');\n\t\t\temail.val(email.val() + line + " . '""' . ");\n\t\t}\n\t\t\n\t\tvar sendingQuote = false;\n\t\tfunction sendQuoteEmail(quote) {\n\t\t\tvar notes = " . '"\\n"' . " + quote['notes']['label'] + " . '"\\n"' . " + quote['notes']['notes'] + " . '"\\n"' . ";\n\t\t\ttoggleEmailForm();\n\t\t\tteditor.e.body.innerHTML = '' + quote['name'] + quote['products'] + notes;\n\t\t\tvar value = \$('#email-template option:contains(\"Quote\")').val();\n\t\t\t\$('#email-template').val(value);\n\t\t\t\$('#InlineEmail_subject').val('Quote');\n\t\t\t\$('#email-template').change();\n\t\t sendingQuote = true; // stop quote mini-module from stealing focus away from email\n\t\t}\n\t\t", CClientScript::POS_HEAD); $products = Product::model()->findAll(array('select' => 'id, name, price')); $jsProductList = "\$(productList).append(\$('<option>', {value: 0}).append(''));\n"; $jsProductPrices = "var prices = [];\n"; $jsProductPrices .= "prices[0] = 0;\n"; foreach ($products as $product) { $jsProductList .= "\$(productList).append(\$('<option>', {value: {$product->id}}).append('{$product->name}'));\n"; $jsProductPrices .= "prices[{$product->id}] = {$product->price};\n"; } $productNames = Product::productNames(); $jsonProductList = json_encode($productNames); $region = Yii::app()->getLocale()->getId(); Yii::app()->clientScript->registerScript('productTable', "\n\n// translate ISO 4217 currency into i18n\nvar currencyTable = {\n\t'USD': 'en-US',\n\t'EUR': 'hsb-DE',\n\t'GBP': 'en-GB',\n\t'CAD': 'en-CA',\n\t'JPY': 'ja-JP',\n\t'CNY': 'zh-CN',\n\t'CHF': 'de-CH',\n\t'INR': 'hi-IN',\n\t'BRL': 'pt-BR',\n};\n\nfunction removeProduct(object) {\n\t\$(object).closest('tr').remove();\n\tupdateProductTotal();\n}\n\nfunction updateProduct(id, price, quantity, adjustments, label, currency) {\n\tprice = parseFloat(price);\n\tquantity = parseFloat(quantity);\n\tvar total = price * quantity;\n\tvar index = adjustments.indexOf('%');\n\tif(index == -1) { // adjustment\n\t total += parseFloat(adjustments);\n\t} else { // percent adjustment\n\t adjustments = adjustments.substring(0, index);\n\t adjustments = parseFloat(adjustments) / 100;\n\t total += total * adjustments;\n\t}\n\t\$(label).html('' + total);\n\t\$(label).formatCurrency({'region': currencyTable[currency]});\n\tupdateProductTotal(id, currency);\n}\n\nfunction updateProductTotal(id, currency) {\n\tvar total = 0;\n\t\$('#product-table-' + id + ' .product-list-price').each(function () {\n\t\t\$(this).toNumber({'region': currencyTable[currency]});\n\t total += parseFloat(\$(this).html());\n\t \$(this).formatCurrency({'region': currencyTable[currency]});\n\t});\n\t\$('#product-list-total-' + id).html('' + total);\n\t\$('#product-list-total-' + id).formatCurrency({'region': currencyTable[currency]});\n}\n\n\n\nfunction addProduct(id, currency, productNames, prices) {\n\tvar row = \$('<tr></tr>');\n\t\$('#product-table-' + id + ' tbody').append(row);\n\n\tvar td = \$('<td></td>');\n\tvar tdRemove = \$('<td></td>', {\n\t\t'style': 'padding: 0;'\n\t});\n\t\n\tvar remove = \$('<a>', {\n\t\thref: 'javascript:void(0)',\n\t\t'onClick': 'removeProduct(this);'\n\t});\n\tvar removeImage = \$('<img>', {\n\t\tsrc: '" . Yii::app()->request->baseUrl . '/themes/x2engine/css/gridview/delete.png' . "',\n\t\talt: '[" . Yii::t('quotes', 'Delete Quote') . "]'\n\t});\n\t\$(row).append(tdRemove.clone().append(remove));\n\t\$(remove).append(removeImage);\n\t\n\tvar productList = \$('<select>', {\n\t\tname: 'ExistingProducts[id][]'\n\t});\n\t\$(row).append(td.clone().append(productList));\n\tfor(var i in productNames) {\n\t\t\$(productList).append(\$('<option>', {value: i}).append(productNames[i]));\n\t}\n\t\n\tvar price = \$('<input>', {\n\t\ttype: 'text',\n\t\tsize: 10,\n\t\t'onFocus': 'toggleText(this);',\n\t\t'onBlur': 'toggleText(this);',\n\t\t'style': 'color:#aaa;',\n\t\tname: 'ExistingProducts[price][]',\n\t\tvalue: 0\n\t});\n\t\$(row).append(td.clone().append(price));\n\t\n\tvar quantity = \$('<input>', {\n\t\ttype: 'text',\n\t\tsize: 10,\n\t\t'onFocus': 'toggleText(this);',\n\t\t'onBlur': 'toggleText(this);',\n\t\t'style': 'color:#aaa;',\n\t\tname: 'ExistingProducts[quantity][]',\n\t\tvalue: 0\n\t});\n\t\$(row).append(td.clone().append(quantity));\n\t\n\tvar adjustments = \$('<input>', {\n\t\ttype: 'text',\n\t\tsize: 10,\n\t\t'onFocus': 'toggleText(this);',\n\t\t'onBlur': 'toggleText(this);',\n\t\t'style': 'color:#aaa;',\n\t\tname: 'ExistingProducts[adjustment][]',\n\t\tvalue: 0\n\t});\n\t\$(row).append(td.clone().append(adjustments));\n\t\n\tvar label = \$('<label>', {\n\t\t'class': 'product-list-price',\n\t\t'style': 'width: auto;',\n\t});\n\t\$(row).append(td.clone().append(label));\n\t\$(label).append('0');\n\t\n\t\$(productList).change(function() {\n\t\t\$(price).val('' + prices[\$(this).attr('value')]);\n\t\t\$(price).css('color', 'black');\n\t\tupdateProduct(id, \$(price).val(), \$(quantity).val(), \$(adjustments).val(), label, currency);\n\t});\n\t\n\t\$('#update-quote-button-' + id).css('background', 'yellow');\n\t\n\t\$(price).change(function() {\n\t\tupdateProduct(id, \$(price).val(), \$(quantity).val(), \$(adjustments).val(), label, currency);\n\t});\n\t\n\t\$(quantity).change(function() {\n\t\tupdateProduct(id, \$(price).val(), \$(quantity).val(), \$(adjustments).val(), label, currency);\n\t});\n\t\n\t\$(adjustments).change(function() {\n\t\tupdateProduct(id, \$(price).val(), \$(quantity).val(), \$(adjustments).val(), label, currency);\n\t});\n} \n\n\nfunction addFilledProduct(id, fillId, fillPrice, fillQuantity, fillAdjustment, currency, productNames, prices) {\n\tvar row = \$('<tr></tr>');\n\t\$('#product-table-' + id + ' tbody').append(row);\n\n\tvar td = \$('<td></td>');\n\tvar tdRemove = \$('<td></td>', {\n\t\t'style': 'padding: 0;'\n\t});\n\t\n\tvar remove = \$('<a>', {\n\t\thref: 'javascript:void(0)',\n\t\t'onClick': 'removeProduct(this);'\n\t});\n\tvar removeImage = \$('<img>', {\n\t\tsrc: '" . Yii::app()->request->baseUrl . '/themes/x2engine/css/gridview/delete.png' . "',\n\t\talt: '[" . Yii::t('quotes', 'Delete Quote') . "]'\n\t});\n\t\$(row).append(tdRemove.clone().append(remove));\n\t\$(remove).append(removeImage);\n\t\n\tvar productList = \$('<select>', {\n\t\tname: 'ExistingProducts[id][]',\n\t});\n\t\$(row).append(td.clone().append(productList));\n\tfor(var i in productNames) {\n\t\t\$(productList).append(\$('<option>', {value: i}).append(productNames[i]));\n\t}\n\t\$(productList).val(fillId);\n\t\n\tvar price = \$('<input>', {\n\t\ttype: 'text',\n\t\tsize: 10,\n\t\t'onFocus': 'toggleText(this);',\n\t\t'onBlur': 'toggleText(this);',\n\t\tname: 'ExistingProducts[price][]',\n\t\tvalue: 0,\n\t\tdefaultValue: 0,\n\t});\n\t\$(row).append(td.clone().append(price));\n\t\$(price).val(fillPrice);\n\t\n\tvar quantity = \$('<input>', {\n\t\ttype: 'text',\n\t\tsize: 10,\n\t\t'onFocus': 'toggleText(this);',\n\t\t'onBlur': 'toggleText(this);',\n\t\tname: 'ExistingProducts[quantity][]',\n\t\tvalue: 0,\n\t\tdefaultValue: 0,\n\t});\n\t\$(row).append(td.clone().append(quantity));\n\t\$(quantity).val(fillQuantity);\n\t\n\tvar adjustments = \$('<input>', {\n\t\ttype: 'text',\n\t\tsize: 10,\n\t\t'onFocus': 'toggleText(this);',\n\t\t'onBlur': 'toggleText(this);',\n\t\tname: 'ExistingProducts[adjustment][]',\n\t\tvalue: 0,\n\t\tdefaultValue: 0,\n\t});\n\t\$(row).append(td.clone().append(adjustments));\n\t\$(adjustments).val(fillAdjustment);\n\t\n\tvar label = \$('<label>', {\n\t\t'class': 'product-list-price',\n\t\t'style': 'width: auto;',\n\t});\n\t\$(row).append(td.clone().append(label));\n\t\$(label).append('0');\n\t\n\tupdateProduct(id, \$(price).val(), \$(quantity).val(), \$(adjustments).val(), label, currency);\n\n\t\$(productList).change(function() {\n\t\t\$(price).val('' + prices[\$(this).attr('value')]);\n\t\t\$(price).css('color', 'black');\n\t\t\$('#update-quote-button-' + id).css('background', 'yellow');\n\t\tupdateProduct(id, \$(price).val(), \$(quantity).val(), \$(adjustments).val(), label, currency);\n\t});\n\t\n\t\$(price).change(function() {\n\t\t\$('#update-quote-button-' + id).css('background', 'yellow');\n\t\tupdateProduct(id, \$(price).val(), \$(quantity).val(), \$(adjustments).val(), label, currency);\n\t});\n\t\n\t\$(quantity).change(function() {\n\t\t\$('#update-quote-button-' + id).css('background', 'yellow');\n\t\tupdateProduct(id, \$(price).val(), \$(quantity).val(), \$(adjustments).val(), label, currency);\n\t});\n\t\n\t\$(adjustments).change(function() {\n\t\t\$('#update-quote-button-' + id).css('background', 'yellow');\n\t\tupdateProduct(id, \$(price).val(), \$(quantity).val(), \$(adjustments).val(), label, currency);\n\t});\n}\n\nfunction toggleUpdateQuote(id, locked, strict) {\n\tvar confirmBox = \$('<div></div>')\n\t\t.html('This quote is locked. Are you sure you want to update this quote?')\n\t\t.dialog({\n\t\t\ttitle: 'Locked', \n\t\t\tautoOpen: false,\n\t\t\tresizable: false,\n\t\t\tbuttons: {\n\t\t\t\t'Yes': function() {\n\t\t\t\t\t\$('#quote-detail-' + id).hide('blind', 'slow');\n\t\t\t\t\t\$('#quote-update-' + id).show('slow');\n\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t},\n\t\t\t\t'No': function() {\n\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\tvar denyBox = \$('<div></div>')\n\t\t.html('This quote is locked.')\n\t\t.dialog({\n\t\t\ttitle: 'Locked', \n\t\t\tautoOpen: false,\n\t\t\tresizable: false,\n\t\t\tbuttons: {\n\t\t\t\t'OK': function() {\n\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t\t\n\tif(locked)\n\t\tif(strict)\n\t\t\tdenyBox.dialog('open');\n\t\telse\n\t\t\tconfirmBox.dialog('open');\n\telse {\n\t\t\$('#quote-detail-' + id).hide('blind', 'slow');\n\t\t\$('#quote-update-' + id).show('slow');\n\t}\n}\n\nfunction toggleNewQuote() {\n\t\$('#show-new-quote-button').hide('blind', 'slow');\n\t\$('#new-quote').show('slow');\n}\n\nfunction duplicateQuote(quote) {\n\t\$('#new-quote [name=\"Quote[status]\"]').val(quote['status']);\n\t\$('#new-quote [name=\"Quote[expirationDate]\"]').val(quote['expirationDate']);\n\t\n\t\$('#product-table-create tbody tr').remove();\n\tfor(var i in quote['products']) {\n\t\taddFilledProduct('create', quote['products'][i]['id'], quote['products'][i]['price'], quote['products'][i]['quantity'], '' + quote['products'][i]['adjustment'], quote['currency'], quote['productNames'], quote['prices']);\n\t}\n\t\n\t\$('#new-quote').show('slow');\n}\n\n", CClientScript::POS_HEAD); } parent::init(); }
/** * @return void */ public function init() { parent::init(); // start buffering ob_start(); }
/** * register the required scripts and style */ function init() { // $this->flashvars['f'] = "js:escape('".$this->flashvars['f']."')"; Yii::app()->getClientScript()->registerScriptFile($this->baseUrl . '/offlights.js')->registerScriptFile($this->baseUrl . '/ckplayer.js'); echo '<div id="video" style="position:relative;z-index: 100;width:100%;float: left;"><div id="a1"></div></div>'; return parent::init(); }
public function init() { if (!$this->getId(false)) { $this->setId('chart'); } $this->data = CHtml::openTag('graph', $this->chartOptions); if (count($this->chartData['sets']) > 1 || strstr($this->chartName, 'Scroll')) { $this->data .= "<categories>"; foreach ($this->chartData['categories'] as $category) { $this->data .= "<category name='" . $category . "' />"; } $this->data .= "</categories>"; } $i = 0; foreach ($this->chartData['sets'] as $setlabel => $setdata) { if (count($this->chartData['sets']) > 1 || strstr($this->chartName, 'Scroll')) { $this->data .= "<dataset seriesName='" . $setlabel . "' color='" . $this->colors[$i++] . "'>"; } foreach ($setdata as $key => $value) { $this->data .= "<set" . (count($this->chartData['sets']) > 1 ? "" : " label='" . $this->chartData['categories'][$key] . "'") . " value='" . $value . "' />"; } if (count($this->chartData['sets']) > 1 || strstr($this->chartName, 'Scroll')) { $this->data .= "</dataset>"; } } $this->data .= CHtml::closeTag('graph'); parent::init(); }
public function init() { assert('($this->model instanceof CModel && $this->form instanceof ZurmoActiveForm) || ( $this->model == null && $this->form == null)'); assert('is_bool($this->allowSorting)'); if ($this->rightSideId == null) { $this->rightSideId = $this->form->id . '_' . $this->rightSideAttributeName; } if ($this->rightSideName == null) { $this->rightSideName = $this->rightSideAttributeName; } if ($this->rightSideValue === null) { $this->rightSideValue = $this->model->{$this->rightSideAttributeName}; } if ($this->leftSideId == null) { $this->leftSideId = $this->form->id . '_' . $this->leftSideAttributeName; } if ($this->leftSideName == null) { $this->leftSideName = $this->leftSideAttributeName; } if ($this->leftSideValue === null) { $this->leftSideValue = $this->model->{$this->leftSideAttributeName}; } if ($this->formId === null) { $this->formId = $this->form->id; } $this->registerCoreScripts(); parent::init(); }
public function init() { $this->resolvePackagePath(); $this->registerCoreScripts(); $this->useCache = !is_null(Yii::app()->cache); parent::init(); }
public function init() { Yii::import('album.AlbumModule'); Yii::import('album.actions.*'); Yii::import('album.models.*'); parent::init(); }