public static function addMarker($model, $inMarker, $draggable = 'false') { if (!$model) { return false; } if ($model->lat && $model->lng) { self::$jsCode .= ' var latLng' . $model->id . ' = new google.maps.LatLng(' . $model->lat . ', ' . $model->lng . '); latLngList.push(latLng' . $model->id . '); markersGMap[' . $model->id . '] = new google.maps.Marker({ position: latLng' . $model->id . ', title: "' . CJavaScript::quote($model->getStrByLang('title')) . '", icon: "' . $model->getMapIconUrl() . '", map: mapGMap, draggable: ' . $draggable . ' }); markersForClasterGMap.push(markersGMap[' . $model->id . ']); infoWindowsGMap[' . $model->id . '] = new google.maps.InfoWindow({ content: "' . CJavaScript::quote($inMarker) . '" }); google.maps.event.addListener(markersGMap[' . $model->id . '], "click", function() { infoWindowsGMap[' . $model->id . '].open(mapGMap, markersGMap[' . $model->id . ']); }); '; } }
/** * @param string $attributeString * @return string */ public function getLinkString($attributeString) { $url = Yii::app()->createUrl("calendars/default/addSubsriptionForCalendar"); $errorInProcess = CJavaScript::quote(Zurmo::t('Core', 'There was an error processing your request')); $string = 'ZurmoHtml::link('; $string .= $attributeString . ', '; $string .= '"javascript:addCalendarRowToSharedCalendarListView(\'$data->id\', \'' . $url . '\', \'' . $this->uniqueLayoutId . '\', \'' . $errorInProcess . '\')"'; $string .= ')'; return $string; }
/** * @param string $attributeString * @return string */ public function getLinkString($attributeString) { $url = Yii::app()->createUrl("opportunityProducts/default/addOpportunityRelation", array('relationModuleId' => $this->relationModuleId, 'portletId' => $this->portletId, 'uniqueLayoutId' => $this->uniqueLayoutId)); $errorInProcess = CJavaScript::quote(Zurmo::t('Core', 'There was an error processing your request')); $string = 'ZurmoHtml::link('; $string .= $attributeString . ', '; $string .= '"javascript:addProductRowToPortletGridView(\'$data->id\', \'' . $url . '\', \'' . $this->relationAttributeName . '\', \'' . $this->relationModelId . '\' , \'' . $this->uniqueLayoutId . '\', \'' . $errorInProcess . '\')"'; $string .= ')'; return $string; }
public static function addMarker($model, $inMarker, $draggable = 'false') { if (!$model) { return false; } if ($model->lat && $model->lng) { self::$jsCode .= ' var latLng' . $model->id . ' = new google.maps.LatLng(' . $model->lat . ', ' . $model->lng . '); //final position for marker, could be updated if another marker already exists in same position var finalLatLng' . $model->id . ' = latLng' . $model->id . '; //check to see if any of the existing markers match the latlng of the new marker if (markersForClasterGMap.length != 0) { for (i=0; i < markersForClasterGMap.length; i++) { var existingMarker = markersForClasterGMap[i]; var pos = existingMarker.getPosition(); //if a marker already exists in the same position as this marker if (latLng' . $model->id . '.equals(pos)) { //update the position of the coincident marker by applying a small multipler to its coordinates var newLat = latLng' . $model->id . '.lat() + ((Math.random() -.4) / 6500); var newLng = latLng' . $model->id . '.lng() + ((Math.random() -.4) / 6500); finalLatLng' . $model->id . ' = new google.maps.LatLng(newLat, newLng); } } } latLngList.push(finalLatLng' . $model->id . '); markersGMap[' . $model->id . '] = new google.maps.Marker({ position: finalLatLng' . $model->id . ', title: "' . CJavaScript::quote($model->getStrByLang('title')) . '", icon: "' . $model->getMapIconUrl() . '", map: mapGMap, draggable: ' . $draggable . ' }); markersForClasterGMap.push(markersGMap[' . $model->id . ']); infoWindowsGMap[' . $model->id . '] = new google.maps.InfoWindow({ content: "' . CJavaScript::quote($inMarker) . '" }); google.maps.event.addListener(markersGMap[' . $model->id . '], "click", function() { infoWindowsGMap[' . $model->id . '].open(mapGMap, markersGMap[' . $model->id . ']); }); '; } }
protected function renderBeforeTableContent() { $dropDownContent = ZurmoHtml::dropDownList('attributeTypeName', null, $this->getValueTypeDropDownArray()); $linkContent = static::renderConfigureLinkContent(null, 'attributeTypeNameButton'); $url = Yii::app()->createUrl($this->moduleId . '/' . $this->controllerId . '/attributeEdit/', array('moduleClassName' => $this->moduleClassName)); Yii::app()->clientScript->registerScript('attributeTypeCreateLink', "\n \$('#attributeTypeNameButton').click( function()\n {\n if (\$('#attributeTypeName').val() == '')\n {\n alert('" . CJavaScript::quote(Zurmo::t('DesignerModule', 'You must first select a field type')) . "');\n }\n else\n {\n window.location = '" . $url . "&attributeTypeName=' + \$('#attributeTypeName').val();\n }\n }\n );"); DropDownUtil::registerScripts(); $content = null; $content .= '<div class="add-custom-field">'; $content .= '<h1>' . Zurmo::t('DesignerModule', 'Create Field') . '</h1>'; $content .= '<div class="panel-buffer"><div>' . $dropDownContent . '</div>' . $linkContent . '</div>'; $content .= '</div>'; return $content; }
protected function registerUnifiedEventHander() { if (Yii::app()->clientScript->isScriptRegistered(static::JS_HANDLER_ID)) { return; } else { $unlinkConfirmMessage = CJavaScript::quote($this->getUnlinkTranslatedMessage()); $errorMessage = CJavaScript::quote(Zurmo::t('Core', 'There was an error processing your request')); // Begin Not Coding Standard Yii::app()->clientScript->registerScript(static::JS_HANDLER_ID, ' $("a.' . static::LINK_ACTION_ELEMENT_CLASS . '").unbind("click.action").bind("click.action", function(event) { linkUrl = $(this).attr("href"); linkId = $(this).attr("id"); refreshGrid = false; if (linkId.indexOf("delete") !== -1 && !$(this).onAjaxSubmitRelatedListAction("' . $unlinkConfirmMessage . '", "' . $this->getGridId() . '")) { refreshMembersListGridView("' . $this->getGridId() . '"); } else { $.ajax({ "error" : function(xhr, textStatus, errorThrown) { alert("' . $errorMessage . '"); }, "success" : function() { refreshMembersListGridView("' . $this->getGridId() . '"); }, "url" : linkUrl, "cache" : false }); } event.preventDefault(); return false; } ); '); // End Not Coding Standard } }
/** * @param $level * @param $time * @param $category * @param $content * @param null $groupName * @param bool $forced * * @return null */ public static function processFireBugLogEntry($level, $time, $category, $content, $groupName = null, $forced = false) { $time = date('H:i:s.', $time) . sprintf('%03d', (int) (($time - (int) $time) * 1000)); if ($level === LogLevel::Warning) { $func = 'warn'; } else { if ($level === LogLevel::Error) { $func = 'error'; } else { $func = 'log'; } } if ($groupName !== null) { echo "\tconsole.groupCollapsed(\"{$groupName}\");\n"; } $content = \CJavaScript::quote("[{$time}][{$level}][{$category}]" . ($forced ? "[Forced]" : "") . "\n{$content}"); echo "\tconsole.{$func}(\"{$content}\");\n"; if ($groupName !== null) { echo "\tconsole.groupEnd();\n"; } }
public static function addMarker($model, $inMarker, $draggable = 'false') { if (!$model) { return false; } if ($model->lat && $model->lng) { self::setIconType($model); self::$jsCode .= ' var markerIcon = L.icon({ iconUrl: "' . self::$icon['href'] . '", iconSize: [' . self::$icon['size']['x'] . ', ' . self::$icon['size']['y'] . '], className : "marker-icon-class" }); markersOSMap[' . $model->id . '] = L.marker([' . $model->lat . ', ' . $model->lng . '], {icon: markerIcon, draggable : ' . $draggable . '}) .addTo(mapOSMap) .bindPopup("' . CJavaScript::quote($inMarker) . '"); latLngList.push([' . $model->lat . ', ' . $model->lng . ']); markersForClasterOSMap.push(markersOSMap[' . $model->id . ']); '; } }
protected function registerUnifiedEventHander() { if (Yii::app()->clientScript->isScriptRegistered('marketingListMemberLinkActionElementEventHandler')) { return; } else { $unlinkConfirmMessage = CJavaScript::quote(Zurmo::t('MarketingListsModule', 'Are you sure you want to unlink this record?')); $errorMessage = CJavaScript::quote(Zurmo::t('Core', 'There was an error processing your request')); // Begin Not Coding Standard Yii::app()->clientScript->registerScript('marketingListMemberLinkActionElementEventHandler', ' $("a.' . static::LINK_ACTION_ELEMENT_CLASS . '").unbind("click.action").bind("click.action", function(event) { linkUrl = $(this).attr("href"); linkId = $(this).attr("id"); if (linkId.indexOf("delete") !== -1 && !onAjaxSubmitRelatedListAction("' . $unlinkConfirmMessage . '", "' . $this->getGridId() . '")) { event.preventDefault(); } $.ajax({ "error" : function(xhr, textStatus, errorThrown) { alert("' . $errorMessage . '"); }, "success" : function() { $("#" + linkId).closest(".items").parent().find(".pager").find(".refresh").find("a").click(); }, "url" : linkUrl, "cache" : false }); event.preventDefault(); } ); '); // End Not Coding Standard } }
?> ", "allowScriptAccess","<?php echo $this->allowScriptAccess; ?> ", "allowFullScreen","<?php echo $this->allowFullScreen; ?> ", "type", "application/x-shockwave-flash", "pluginspage", "http://www.adobe.com/go/getflashplayer" ); } else { // flash is too old or we can't detect the plugin var alternateContent = '<?php echo CJavaScript::quote($this->altHtmlContent); ?> '; document.write(alternateContent); // insert non-flash content } /*]]>*/ </script> <noscript> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="<?php echo $this->name; ?> " width="<?php echo $this->width; ?>
/** * Generates the properly quoted flash parameter string. * @return string the flash parameter string. */ public function getFlashVarsAsString() { $params = array(); foreach ($this->flashVars as $k => $v) { $params[] = urlencode($k) . '=' . urlencode($v); } return CJavaScript::quote(implode('&', $params)); }
private static function encode($value) { if (is_string($value)) { if (strpos($value, 'js:') === 0) { return substr($value, 3); } if (strpos($value, '{') === 0) { return $value; } else { return "'" . CJavaScript::quote($value) . "'"; } } else { if ($value === null) { return 'null'; } else { if (is_bool($value)) { return $value ? 'true' : 'false'; } else { if (is_integer($value)) { return "{$value}"; } else { if (is_float($value)) { if ($value === -INF) { return 'Number.NEGATIVE_INFINITY'; } else { if ($value === INF) { return 'Number.POSITIVE_INFINITY'; } else { return rtrim(sprintf('%.16F', $value), '0'); } } // locale-independent representation } else { if (is_object($value)) { return self::encode(get_object_vars($value)); } else { if (is_array($value)) { $es = array(); if (($n = count($value)) > 0 && array_keys($value) !== range(0, $n - 1)) { foreach ($value as $k => $v) { $es[] = "'" . CJavaScript::quote($k) . "':" . self::encode($v); } return '{' . implode(',', $es) . '}'; } else { foreach ($value as $v) { $es[] = self::encode($v); } return '[' . implode(',', $es) . ']'; } } else { return ''; } } } } } } } }
public static function getAjaxBeforeSendOptionForModalLinkContent($title, $containerId = 'modalContainer', $height = 'auto', $width = 600, $position = 'center top+25', $class = "''", $extraCloseScript = null) { assert('is_string($containerId)'); assert('is_string($title)'); assert('$height == "auto" || is_int($height)'); assert('is_int($width)'); assert('is_string($position) || is_array($position)'); assert('is_string($class) || $class == null'); assert('is_string($extraCloseScript) || $extraCloseScript == null'); if ($height == 'auto') { $heightContent = "'auto'"; } else { $heightContent = $height; } if (is_array($position)) { $position = CJSON::encode($position); } else { $position = "'" . $position . "'"; } $modalTitle = CJavaScript::quote($title); // Begin Not Coding Standard return "js:function(){\n jQuery('#{$containerId}').html('');\n \$(this).makeLargeLoadingSpinner(true, '#{$containerId}');\n //window.scrollTo(0, 0);\n jQuery('#{$containerId}').dialog({\n 'title' : '{$modalTitle}',\n 'autoOpen' : true,\n 'modal' : true,\n 'position' : {$position},\n 'dialogClass' : {$class},\n 'height' : {$heightContent},\n 'open': function( event, ui ) { jQuery('#{$containerId}').parent().addClass('openingModal'); },\n 'close': function( event, ui ) { jQuery('#{$containerId}').parent().removeClass('openingModal');\n \$('#{$containerId}').dialog('destroy');\n " . $extraCloseScript . "\n }\n });\n return true;\n }"; // End Not Coding Standard }
protected static function resolveSuccessMessage() { return CJavaScript::quote(Zurmo::t('CampaignsModule', 'Campaign status was changed.')); }
protected function getAjaxLinkOptions() { return array('error' => 'function(xhr, textStatus, errorThrown) {alert("' . CJavaScript::quote(Zurmo::t('Core', 'There was an error processing your request')) . '");}', 'success' => "js:function(){\$('#" . $this->getLinkId() . "').closest('.items').parent()\n .find('.pager').find('.refresh').find('a').click();}"); }
/** * Add a message to an existing initialized jnotify div. Registers the addMessage script. * @param string $statusBarId * @param string $text * @param string $scriptId */ public static function addMessage($statusBarId, $text, $scriptId, $type = 'message') { assert('is_string($statusBarId)'); assert('is_string($text)'); assert('is_string($scriptId)'); assert('$type == "message" || $type == "error"'); $script = "\n \$('#" . $statusBarId . "').jnotifyAddMessage(\n {\n text: '" . CJavaScript::quote($text) . "',\n permanent: false,\n showIcon: true,\n type: '" . $type . "'\n }\n );\n "; Yii::app()->clientScript->registerScript($scriptId, $script); }
<br/> <div class="rowold" id="description"> <?php echo reset($paySystems)->getDescription(); ?> </div> <div class="rowold submit"> <?php echo CHtml::hiddenField('paid_id', $paidService->id); echo CHtml::hiddenField('id', $ad_id); echo CHtml::submitButton(tc('Proceed'), array('class' => 'button-blue')); ?> </div> <?php echo CHtml::endForm(); $descriptions = ''; foreach ($paySystems as $model) { $descriptions .= 'descr[' . $model->id . '] = "' . CJavaScript::quote($model->getDescription()) . '";' . "\n"; } Yii::app()->clientScript->registerScript('showDescription', ' var descr = new Array(); ' . $descriptions . ' function showDescription(id){ $("#description").html(""); if(descr[id]){ $("#description").html(descr[id]); } } ', CClientScript::POS_END); ?> </div>
if ($video->isHtml()) { echo '<div class="video-html-block" id="video-block-html-' . $count . '"></div>'; echo '<div>'; $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'button', 'type' => 'danger', 'icon' => 'remove white', 'label' => tc('Delete'), 'htmlOptions' => array('onclick' => 'document.location.href="' . Yii::app()->controller->createUrl('deletevideo', array('id' => $video->id, 'apId' => $model->id)) . '";'))); echo '</div><br/>'; $videoHtml[$count] = CHtml::decode($video->video_html); $count++; } } if ($videoFileExists) { Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/flowplayer/flowplayer-3.2.12.min.js', CClientScript::POS_END); } $script = ''; if ($videoHtml) { foreach ($videoHtml as $key => $value) { $script .= '$("#video-block-html-' . $key . '").html("' . CJavaScript::quote($value) . '");'; } } if ($script) { Yii::app()->clientScript->registerScript('chrome-xss-alert-preventer', $script, CClientScript::POS_READY); } } ?> <?php if ($model->video) { /*echo '<div>'.CHtml::button(tc('Add'), array( 'onclick' => '$(".add-video").toggle();', )).'</div><br/>';*/ echo '<div>'; $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'button', 'type' => 'success', 'icon' => 'plus white', 'label' => tc('Add'), 'htmlOptions' => array('onclick' => '$(".add-video").toggle();')));
/** * Generates a POST Link using a Form * * @param type $text * @param type $url * @param array $htmlOptions * @return string */ public static function postLink($text, $url = '#', $htmlOptions = array()) { $id = ""; if (!isset($htmlOptions['id'])) { $id = Helpers::GetUniqeId(); $htmlOptions['id'] = $id; } else { $id = $htmlOptions['id']; } // Build Click JS $clickJS = '$("#postLink_' . $id . '").submit(); return true;'; if (isset($htmlOptions['confirm'])) { $confirm = 'confirm(\'' . CJavaScript::quote($htmlOptions['confirm']) . '\')'; $clickJS = "if(!{$confirm}) return false;" . $clickJS; unset($htmlOptions['confirm']); } $output = self::link($text, "#", $htmlOptions); // Generate this at the end of the page $hiddenFormHtml = "<div style='display:none'>"; $hiddenFormHtml .= self::beginForm($url, 'POST', array('id' => 'postLink_' . $id)); $hiddenFormHtml .= self::endForm(); $hiddenFormHtml .= "</div>"; $cs = Yii::app()->getClientScript(); $cs->registerCoreScript('jquery'); $cs->registerScript($id, '$("#' . $id . '").on("click", function(){ ' . $clickJS . ' });'); $cs->registerHtml($id, $hiddenFormHtml); return $output; }
/** * Registers the needed client scripts. * @since 1.0.2 */ public function registerClientScript() { $cs = Yii::app()->clientScript; $id = $this->imageOptions['id']; $url = $this->getController()->createUrl($this->captchaAction, array(CCaptchaAction::REFRESH_GET_VAR => true)); if ($this->showRefreshButton) { $cs->registerScript('Yii.CCaptcha#' . $id, 'dummy'); $label = $this->buttonLabel === null ? Yii::t('yii', 'Get a new code') : $this->buttonLabel; $button = $this->buttonType === 'button' ? 'ajaxButton' : 'ajaxLink'; $html = CHtml::$button($label, $url, array('success' => 'js:function(html){jQuery("#' . $id . '").attr("src",html)}'), $this->buttonOptions); $js = "jQuery('#{$id}').after(\"" . CJavaScript::quote($html) . '");'; $cs->registerScript('Yii.CCaptcha#' . $id, $js); } if ($this->clickableImage) { $js = "jQuery('#{$id}').click(function(){" . CHtml::ajax(array('url' => $url, 'success' => "js:function(html){jQuery('#{$id}').attr('src',html)}")) . '});'; $cs->registerScript('Yii.CCaptcha#2' . $id, $js); } }
/** * Assumes the modalContainer id is 'modalContainer'. * (non-PHPdoc) * @see ModalListLinkProvider::getLinkString() */ public function getLinkString($attributeString) { $string = 'ZurmoHtml::link('; $string .= $attributeString . ', '; $string .= '"#", '; $string .= 'array("onclick" => ZurmoHtml::ajax(array('; $string .= '"url" => Yii::app()->createUrl("' . $this->moduleId . '/defaultPortlet/selectFromRelatedListSave", $_GET),'; // Not Coding Standard $string .= '"beforeSend" => "function ( xhr ) {jQuery(\'#modalContainer\').html(\'\');\\$(this).makeLargeLoadingSpinner(true, \'#modalContainer\');}",'; // Not Coding Standard $string .= '"complete" => "function(XMLHttpRequest, textStatus){\\$(\\"#modalContainer\\").dialog(\\"close\\");}",'; // Not Coding Standard $string .= '"success" => "function(dataOrHtml, textStatus, xmlReq){'; $string .= '\\$(this).processAjaxSuccessUpdateHtmlOrShowDataOnFailure(dataOrHtml, \\"' . $this->uniquePortletPageId . '\\")}",'; // Not Coding Standard $string .= '"error" => "function(xhr, textStatus, errorThrown) {alert(\'' . CJavaScript::quote(Zurmo::t('Core', 'There was an error processing your request')) . '\');}",'; // Not Coding Standard $string .= '"data" => array(\'modelId\' => $data->id)'; $string .= ')),'; // Not Coding Standard $string .= '"id" => "modalLink' . $this->portletId . '_$data->id")'; $string .= ')'; return $string; }
public function addMarker($lat, $lng, $content, $multyMarker = 0, $model = null) { $content = $this->filterContent($content); $clusterCaption = ''; if ($model) { $clusterCaption = CJavaScript::quote($model->getTitle()); } $draggable = (Yii::app()->user->getState('isAdmin') || param('useUserads', 1) && (!Yii::app()->user->isGuest && Yii::app()->user->id == $model->owner_id)) && !$multyMarker ? ", draggable: true" : ""; $this->setIconType($model); $this->scripts[] = ' placemark = new ymaps.Placemark( [' . $lng . ', ' . $lat . '], { balloonContent: "' . $content . '", clusterCaption: "' . $clusterCaption . '" }, { iconImageHref: "' . self::$icon['href'] . '", iconImageSize: [' . self::$icon['size']['x'] . ', ' . self::$icon['size']['y'] . '], iconImageOffset: [' . self::$icon['offset']['x'] . ', ' . self::$icon['offset']['y'] . '], hideIconOnBalloonOpen: false, balloonShadow: true, balloonCloseButton: true, iconMaxWidth: 300 ' . $draggable . ' } ); ' . ($multyMarker ? '' : 'map.geoObjects.add(placemark); placemark.balloon.open(); ') . 'markers.push(placemark); placemarksAll[' . $model->id . '] = placemark; '; }
<script type="text/javascript"> /*<![CDATA[*/ if(typeof(console)=='object') { console.group("Общий отчет"); console.log(" номер всего среднее мин макс "); <?php foreach ($data as $index => $entry) { $proc = CJavaScript::quote($entry[0]); $count = sprintf('%5d', $entry[1]); $min = sprintf('%0.5f', $entry[2]); $max = sprintf('%0.5f', $entry[3]); $total = sprintf('%0.5f', $entry[4]); $average = sprintf('%0.5f', $entry[4] / $entry[1]); echo "\tconsole.log(\" {$count} {$total} {$average} {$min} {$max} {$proc}\");\n"; } ?> console.groupEnd(); } /*]]>*/ </script>
success: function(data){ $(".setAsMain", ".images-area").html("<a class=\\"setAsMainLink\\" href=\\"#\\">' . tc('Set as main photo') . '</a>"); $(".setAsMain[link-id=\'" + id + "\']").html("' . CJavaScript::quote(tc('Main photo')) . '"); } }); return false; }); $(".deleteImageLink").live("click", function(){ var id = $(this).attr("link-id"); $.ajax({ url: "' . Yii::app()->controller->createUrl('/images/main/deleteImage') . '?id="+id, success: function(result){ $("#image_"+id).remove(); if(result){ $(".setAsMain[link-id=\'" + result + "\']").html("' . CJavaScript::quote(tc('Main photo')) . '"); } reInitJs(); } }); return false; }); function reloadImagesArea(){ $.ajax({ url: "' . Yii::app()->controller->createUrl('/images/main/getImagesForAdmin', array('id' => $this->objectId)) . '", success: function(data){ $(".image-comment-input > textarea", data).each(function(){ var name; name = $(this).attr("name");
<script type="text/javascript"> /*<![CDATA[*/ if (typeof(console) == 'object') { console.group("Anwendungsprotokoll"); <?php foreach ($data as $index => $log) { $time = date('H:i:s.', $log[3]) . (int) (($log[3] - (int) $log[3]) * 1000); if ($log[1] === CLogger::LEVEL_WARNING) { $func = 'warn'; } else { if ($log[1] === CLogger::LEVEL_ERROR) { $func = 'error'; } else { $func = 'log'; } } $content = CJavaScript::quote("[{$time}][{$log['1']}][{$log['2']}] {$log['0']}"); echo "\tconsole.{$func}(\"{$content}\");\n"; } ?> console.groupEnd(); } /*]]>*/ </script>
protected static function resolveOnSuccessScript() { // Begin Not Coding Standard $script = "\n function(data)\n {\n \$('#FlashMessageBar').jnotifyAddMessage(\n {\n text: '" . CJavaScript::quote(Zurmo::t('ConversationsModule', 'Conversation status was changed.')) . "',\n permanent: false,\n showIcon: true,\n type: 'ConversationsChangeStatusMessage'\n }\n );\n \$('#CommentInlineEditForModelView').toggle();\n }"; // End Not Coding Standard return $script; }
protected static function clientChange($event, &$htmlOptions) { if (!isset($htmlOptions['submit']) && !isset($htmlOptions['confirm']) && !isset($htmlOptions['ajax'])) { return; } if (isset($htmlOptions['live'])) { $live = $htmlOptions['live']; unset($htmlOptions['live']); } else { $live = self::$liveEvents; } if (isset($htmlOptions['return']) && $htmlOptions['return']) { $return = 'return true'; } else { $return = 'return false'; } if (isset($htmlOptions['on' . $event])) { $handler = trim($htmlOptions['on' . $event], ';') . ';'; unset($htmlOptions['on' . $event]); } else { $handler = ''; } if (isset($htmlOptions['id'])) { $id = $htmlOptions['id']; } else { $id = $htmlOptions['id'] = isset($htmlOptions['name']) ? $htmlOptions['name'] : self::ID_PREFIX . self::$count++; } $cs = Yii::app()->getClientScript(); $cs->registerCoreScript('jquery'); if (isset($htmlOptions['submit'])) { $cs->registerCoreScript('yii'); $request = Yii::app()->getRequest(); if ($request->enableCsrfValidation && isset($htmlOptions['csrf']) && $htmlOptions['csrf']) { $htmlOptions['params'][$request->csrfTokenName] = $request->getCsrfToken(); } if (isset($htmlOptions['params'])) { $params = CJavaScript::encode($htmlOptions['params']); } else { $params = '{}'; } if ($htmlOptions['submit'] !== '') { $url = CJavaScript::quote(self::normalizeUrl($htmlOptions['submit'])); } else { $url = ''; } $handler .= "jQuery.yii.submitForm(this,'{$url}',{$params});{$return};"; } if (isset($htmlOptions['ajax'])) { $handler .= self::ajax($htmlOptions['ajax']) . "{$return};"; } if (isset($htmlOptions['confirm'])) { $confirm = 'confirm(\'' . CJavaScript::quote($htmlOptions['confirm']) . '\')'; if ($handler !== '') { $handler = "if({$confirm}) {" . $handler . "} else return false;"; } else { $handler = "return {$confirm};"; } } if ($live) { $cs->registerScript('Yii.CHtml.#' . $id, "jQuery('body').on('{$event}','#{$id}',function(){{$handler}});"); } else { $cs->registerScript('Yii.CHtml.#' . $id, "jQuery('#{$id}').on('{$event}', function(){{$handler}});"); } unset($htmlOptions['params'], $htmlOptions['submit'], $htmlOptions['ajax'], $htmlOptions['confirm'], $htmlOptions['return'], $htmlOptions['csrf']); }
if ($cart_is_empty) { } else { $cs = Yii::app()->clientScript; $themePath = Yii::app()->theme->baseUrl; $login_url = $this->createUrl('site/login'); $update_url = $this->createUrl('cart/update'); $remove_url = $this->createUrl('cart/remove'); $estimate_url = $this->createUrl('cart/estimate'); $details_url = $this->createUrl('cart/details'); $redeem_url = $this->createUrl('cart/redeem'); $paypaltoken_url = $this->createUrl("cart/getPaypalToken"); Yii::app()->user->returnUrl = $this->createUrl('index'); $cs->registerScriptFile('/js/chosen.jquery.min.js', CClientScript::POS_END)->registerScript('estimate', "\n\t\t\t\t\t\t\t\tvar update_url = '{$update_url}';\n\t\t\t\t\t\t\t\tvar remove_url = '{$remove_url}';\n\t\t\t\t\t\t\t\tvar estimate_url = '{$estimate_url}';\n\t\t\t\t\t\t\t\tvar details_url = '{$details_url}';\n\t\t\t\t\t\t\t\tvar login_url = '{$login_url}';\n\t\t\t\t\t\t\t\tvar redeem_url = '{$redeem_url}';\n\t\t\t\t\t\t\t\tvar paypaltoken_url = '{$paypaltoken_url}';\n\t\t\t\t\t\t\t", CClientScript::POS_HEAD)->registerScriptFile('/js/boukem_cart.js', CClientScript::POS_END); if (Yii::app()->session['cart_country']) { $cart_country = CJavaScript::quote(Yii::app()->session['cart_country']); $cart_province = CJavaScript::quote(Yii::app()->session['cart_province']); // A country was specified for the session, select if in the list with javascript $cs->registerScript('auto_fill_country', "\$('#country').val('{$cart_country}'); \$('#country').trigger('chosen:updated'); updateChosenSelects();", CClientScript::POS_READY); if (($cart_country === "CA" || $cart_country === "US" || $cart_country === "MX") && $cart_province) { $cs->registerScript('auto_fill_province', "\$('#province').val('{$cart_province}'); \$('#province').trigger('chosen:updated');", CClientScript::POS_READY); } if (Yii::app()->user->user->postcode && Yii::app()->user->user->postcode !== "" && $dataProvider->totalItemCount > 0) { $cs->registerScript('auto_fetch_estimate', "fetchEstimate();", CClientScript::POS_READY); } } $cs->registerCssFile('/css/chosen.min.css'); } // end of $cart_is_empty ?> <?php
<script type="text/javascript"> /*<![CDATA[*/ if(typeof(console)=='object') { console.group("Profiliavimo kreipinių dėklas"); <?php foreach ($data as $index => $entry) { list($proc, $time, $level) = $entry; $proc = CJavaScript::quote($proc); $time = sprintf('%0.5f', $time); $spaces = str_repeat(' ', $level * 8); echo "\tconsole.log(\"[{$time}]{$spaces}{$proc}\");\n"; } ?> console.groupEnd(); } /*]]>*/ </script>
/** * @return string */ protected function renderChartContent() { $reportDataProviderToAmChartMakerAdapter = $this->dataProvider->makeReportDataProviderToAmChartMakerAdapter(); Yii::import('ext.amcharts.AmChartMaker'); $amChart = new AmChartMaker(); $amChart->categoryField = ReportDataProviderToAmChartMakerAdapter::resolveFirstSeriesDisplayLabelName(1); $amChart->data = $reportDataProviderToAmChartMakerAdapter->getData(); $amChart->id = $this->uniqueLayoutId; $amChart->type = $reportDataProviderToAmChartMakerAdapter->getType(); $amChart->xAxisName = $this->dataProvider->resolveFirstSeriesLabel(); $amChart->yAxisName = $this->dataProvider->resolveFirstRangeLabel(); $amChart->yAxisUnitContent = $this->resolveYAxisUnitContent(); if ($reportDataProviderToAmChartMakerAdapter->isStacked()) { for ($i = 1; $i < $reportDataProviderToAmChartMakerAdapter->getSecondSeriesValueCount() + 1; $i++) { $title = $reportDataProviderToAmChartMakerAdapter->getSecondSeriesDisplayLabelByKey($i); $balloonText = '"[[' . ReportDataProviderToAmChartMakerAdapter::resolveSecondSeriesDisplayLabelName($i) . ']] - [[' . ReportDataProviderToAmChartMakerAdapter::resolveFirstRangeDisplayLabelName($i) . ']] : [[' . ReportDataProviderToAmChartMakerAdapter::resolveFirstSeriesFormattedValueName($i) . ']] - [[' . ReportDataProviderToAmChartMakerAdapter::resolveSecondSeriesDisplayLabelName($i) . ']] : [[' . ReportDataProviderToAmChartMakerAdapter::resolveSecondSeriesFormattedValueName($i) . ']] "'; $amChart->addSerialGraph(ReportDataProviderToAmChartMakerAdapter::resolveFirstSeriesValueName($i), 'column', array('title' => '"' . CJavaScript::quote($title) . '"', 'balloonText' => $balloonText)); } } else { $amChart->addSerialGraph(ReportDataProviderToAmChartMakerAdapter::resolveFirstSeriesValueName(1), 'column'); } $scriptContent = $amChart->javascriptChart(); Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->uniqueLayoutId, $scriptContent); $cClipWidget = new CClipWidget(); $cClipWidget->beginClip("Chart" . $this->uniqueLayoutId); $cClipWidget->widget('application.core.widgets.AmChart', array('id' => $this->uniqueLayoutId)); $cClipWidget->endClip(); return $cClipWidget->getController()->clips['Chart' . $this->uniqueLayoutId]; }