Ejemplo n.º 1
0
 public function init()
 {
     Yii::import('album.AlbumModule');
     Yii::import('album.actions.*');
     Yii::import('album.models.*');
     parent::init();
 }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 4
0
 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);
 }
 /**
  * @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.');
     }
 }
Ejemplo n.º 6
0
 /**
  *
  */
 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();
 }
Ejemplo n.º 7
0
 public function init()
 {
     $this->registerScripts();
     $this->options = (require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'tooltip.options.php');
     $this->initTooltip();
     parent::init();
 }
Ejemplo n.º 8
0
 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();
 }
Ejemplo n.º 9
0
 public function init()
 {
     parent::init();
     if (!$this->email || !(new CEmailValidator())->validateValue($this->email)) {
         throw new HttpException(500, 'The email you specified is not valid.');
     }
 }
Ejemplo n.º 10
0
 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();
 }
Ejemplo n.º 11
0
 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);
 }
Ejemplo n.º 12
0
	/**
	 * Run widget.
	 */
	public function run()
	{
		parent::run();
		$this->htmlOptions['id'] = $this->map->id;
		echo Html::tag($this->tagName, $this->htmlOptions, '');
		$this->onAfterRender(new \CEvent($this));
	}
Ejemplo n.º 13
0
 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);
 }
Ejemplo n.º 14
0
 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');
     }
 }
 public function init($data = array())
 {
     parent::init();
     if (!empty($data)) {
         $this->data = $data;
     }
 }
Ejemplo n.º 16
0
 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();
 }
Ejemplo n.º 17
0
 public function init()
 {
     parent::init();
     // TODO: Change the autogenerated stub
     $this->filter = new TServiceFilterForm();
     $this->setFilterAttributes();
 }
Ejemplo n.º 18
0
 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;
     }
 }
Ejemplo n.º 19
0
 /**
  * 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();
 }
Ejemplo n.º 20
0
 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();
 }
Ejemplo n.º 21
0
 /**
  * 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();
 }
Ejemplo n.º 22
0
 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     if (!isset($this->htmlOptions['id'])) {
         $this->htmlOptions['id'] = $this->getId();
     }
 }
Ejemplo n.º 23
0
 public function init()
 {
     $this->resolvePackagePath();
     $this->registerCoreScripts();
     $this->useCache = !is_null(Yii::app()->cache);
     parent::init();
 }
Ejemplo n.º 24
0
 public function endCache()
 {
     if (YII_DEBUG) {
         return;
     }
     parent::endCache();
 }
Ejemplo n.º 25
0
 public function init()
 {
     $assets = dirname(__FILE__) . '/assets';
     $this->assetsPath = Yii::app()->assetManager->publish($assets, false, 1, YII_DEBUG);
     if (empty($this->data)) {
         $data[] = array('file' => $this->assetsPath . '/default.mp3', 'label' => '128K');
         $data[] = array('file' => $this->assetsPath . '/default.mp3', 'label' => '320K VIP');
         //$source = json_encode($data);
     }
     $song = SongModel::model()->findByPk($this->songId);
     $source = SongModel::model()->builDataPlayerSong($this->songId, $song);
     $cs = Yii::app()->clientScript;
     $cs->registerScriptFile($this->assetsPath . '/jwplayer.js', CClientScript::POS_END);
     $cs->registerScript('play_audio_mobile' . $this->id, "\n            jwplayer('" . $this->id . "').setup({\n                width: '" . $this->width . "',\n                height: '" . $this->height . "',\n                stretching: 'none',\n                sources: {$source},\n                skin:'" . $this->assetsPath . "/vega-skin-audio-min-2.xml',\n                autostart: " . $this->autostart . ",\n                primary: '" . $this->primary . "'\n            });", CClientScript::POS_END);
     //log and track
     $deviceType = 'mobile';
     $cs->registerScript('play_audio_mobile_current' . $this->id, "\n            var device_type = '" . $deviceType . "';\n            var listPlayed =Array();\n            var logPlayAudioFlag = true;\n\t\t\tjwplayer().onBeforePlay(function() {\n\t\t\t\tlogPlayAudioFlag = true;\n\t\t\t\tconsole.log('set flag again|'+logPlayAudioFlag);\n\t\t\t});\n\t\t\tjwplayer().onTime(function(event) {\n\t\t\t\tif(Math.round(event.position) >=5){\n\t\t\t\t\tif(logPlayAudioFlag) {\n\t\t\t\t\t\tlogPlayAudioFlag = false;\n                        var action = 'Play Song';\n\t\t\t\t\t\tif(in_array_item(listPlayed,'song_'+" . $song->id . ")){\n\t\t\t\t\t\t\tvar action = 'Replay Song';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar item = 'song_" . $song->id . "';\n                        if(!in_array_item(listPlayed,item)){\n                            listPlayed.push(item);\n                        }\n                        console.log(device_type+'-'+action);\n\t\t\t\t\t\tga('send', 'event', device_type, action,'" . CHtml::encode($song->name . "-" . $song->artist_name . "-" . $song->id) . "');\n\t\t\t\t\t\tajax_load('/player/logSong',{'id':" . $song->id . "});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});", CClientScript::POS_END);
     /*$cs->registerScript('play_audio_cookie'.$this->id,"
           var primaryCookie = 'html5';
           var cookies = document.cookie.split(';');
           for (i=0; i < cookies.length; i++) {
               var x = cookies[i].substr(0, cookies[i].indexOf('='));
               var y = cookies[i].substr(cookies[i].indexOf('=') + 1);
               x = x.replace(/^\s+|\s+$/g,'');
               if (x == 'primaryCookie') {
                   primaryCookie = y;
               }
           }
       ",CClientScript::POS_END);*/
     parent::init();
 }
Ejemplo n.º 26
0
 public function __set($name, $value)
 {
     if (array_key_exists($name, $this->_options)) {
         return $this->_options[$name] = $value;
     }
     return parent::__set($name, $value);
 }
Ejemplo n.º 27
0
 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');
 }
Ejemplo n.º 28
0
 /**
  * override defaults __set method to allow set options easier
  * 
  * @param mixed $name
  * @param mixed $value
  * @return mixed
  */
 function __set($name, $value)
 {
     try {
         return parent::__set($name, $value);
     } catch (exception $e) {
         return $this->_options[$name] = $value;
     }
 }
Ejemplo n.º 29
0
 public function __get($name)
 {
     if (!$this->canGetProperty($name)) {
         return $this->options[$name];
     } else {
         return parent::__get($name);
     }
 }
Ejemplo n.º 30
0
 public function __set($name, $value)
 {
     if (isset($this->params[$name])) {
         $this->params[$name] = $value;
     } else {
         return parent::__set($name, $value);
     }
 }