本文整理汇总了PHP中ZurmoHtml::encode方法的典型用法代码示例。如果您正苦于以下问题:PHP ZurmoHtml::encode方法的具体用法?PHP ZurmoHtml::encode怎么用?PHP ZurmoHtml::encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZurmoHtml
的用法示例。
在下文中一共展示了ZurmoHtml::encode方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderControlNonEditable
/**
* Renders the attribute from the model.
* @return The element's content.
*/
protected function renderControlNonEditable()
{
if ($this->model->{$this->attribute} != null) {
$content = DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($this->model->{$this->attribute});
return ZurmoHtml::encode($content);
}
}
示例2: formatUrl
/**
* Formats the value as a hyperlink.
* @param mixed $value the value to be formatted
* @return string the formatted result
*/
public function formatUrl($value, $htmlOptions = array())
{
$url = $value;
if (strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) {
$url = 'http://' . $url;
}
return ZurmoHtml::link(ZurmoHtml::encode($value), $url, $htmlOptions);
}
示例3: renderContent
protected function renderContent()
{
$content = '<div id="FlashMessageBar"></div>';
if (Yii::app()->user->hasFlash('notification')) {
$script = "\n \$('#FlashMessageBar').jnotifyAddMessage(\n {\n text: '" . ZurmoHtml::encode(Yii::app()->user->getFlash('notification')) . "',\n permanent: true,\n showIcon: true,\n }\n );\n ";
Yii::app()->clientScript->registerScript('FlashMessage', $script);
}
$this->controller->beginClip("FlashMessage");
$this->controller->widget('application.core.widgets.JNotify', array('statusBarId' => 'FlashMessageBar'));
$this->controller->endClip();
$content .= $this->controller->clips['FlashMessage'];
return $content;
}
示例4: renderNonEditableContent
/**
* Combines the 'user' with the 'datetime stamp'
* into a single string
* @return The element's content.
*/
protected function renderNonEditableContent($attributeName)
{
assert('$attributeName == "created" || $attributeName == "modified"');
$userModelName = $attributeName . 'ByUser';
$dateTimeAttributeName = $attributeName . 'DateTime';
assert('$this->model->isAttribute($dateTimeAttributeName)');
if (empty($this->model->{$dateTimeAttributeName})) {
return Zurmo::t('Core', 'Unknown');
}
$content = ZurmoHtml::encode(DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($this->model->{$dateTimeAttributeName}));
if ($this->model->{$userModelName}->id > 0) {
$content .= ' ' . Zurmo::t('Core', 'by') . ' ' . Yii::app()->format->text($this->model->{$userModelName});
}
return $content;
}
示例5: renderStatusAndMessageListContent
/**
* @param JobLog $jobLog
* @return string
* @throws NotSupportedException
*/
public static function renderStatusAndMessageListContent(JobLog $jobLog)
{
if ($jobLog->status == JobLog::STATUS_COMPLETE_WITH_ERROR) {
$content = '<span class="job-label">' . Zurmo::t('JobsManagerModule', 'Completed with Errors') . '</span>';
$content .= '<span id="active-nonmonitor-job-tooltip-' . $jobLog->id . '" class="tooltip" title="' . ZurmoHtml::encode($jobLog->message) . '">?</span>';
$options = array('content' => array('title' => array('text' => Zurmo::t('JobsManagerModule', 'Error Log'), 'button' => Zurmo::t('Core', 'Close'))), 'hide' => array('event' => 'click'), 'show' => array('event' => 'click mouseenter', 'solo' => true), 'adjust' => array('screen' => true), 'position' => array('corner' => array('target' => 'bottomRight', 'tooltip' => 'topRight')), 'style' => array('width' => array('max' => 600)), 'api' => array('beforeHide' => 'js:function (event, api)
{ if (event.originalEvent.type !== "click")
{ return false;}}'));
// Not Coding Standard
$qtip = new ZurmoTip();
$qtip->addQTip("#active-nonmonitor-job-tooltip-" . $jobLog->id, $options);
return $content;
} elseif ($jobLog->status == JobLog::STATUS_COMPLETE_WITHOUT_ERROR) {
return Zurmo::t('Core', 'Completed');
} else {
throw new NotSupportedException();
}
}
示例6: registerJavaScript
protected function registerJavaScript()
{
$commonErrorMessage = ZurmoHtml::encode(Zurmo::t('ZurmoModule', 'Unexpected error during the AJAX call'));
// Begin Not Coding Standard
$script = <<<EOD
\$(document).on('click', ".action-button", function(event) {
var _parent = \$(this).parent();
var _ajaxUrl = \$(this).attr('ajaxurl');
if (_parent.hasClass('loading-ajax'))
{
return false;
}
_parent.addClass('loading-ajax');
\$(this).addClass('loading');
\$(this).attachLoadingSpinnerForLanguageActivation(this, true);
\$.ajax({
'url':_ajaxUrl,
'cache':false,
'success':function(html) {
_parent.replaceWith(html);
},
'error':function(jqXHR, textStatus, errorThrown) {
\$('#FlashMessageBar').jnotifyAddMessage({
text: '{$commonErrorMessage}',
permanent: false,
showIcon: true,
});
\$(this).attachLoadingSpinnerForLanguageActivation(this);
\$(this).removeClass('loading');
_parent.removeClass('loading-ajax');
}
});
return false;
});
EOD;
// End Not Coding Standard
$cs = Yii::app()->getClientScript();
$cs->registerScript('my-hello-world-1', $script, CClientScript::POS_END);
}
示例7: formatNtext
/**
* Override CHtml::formatText() method, so we can use ZurmoHtml::encode() function
* @see CHtml::formatNtext()
*/
public function formatNtext($value)
{
return nl2br(ZurmoHtml::encode($value));
}
示例8: testAccentsAreEncodingProperly
/**
* This test shows that accents are maybe not in the right encoding in the message file. This is just an example
* of something that was not working in windows correctly. The result was the label would not display in the
* input box in the browser in the module general in designer.
*/
public function testAccentsAreEncodingProperly()
{
$this->assertEquals('Opportunité', ZurmoHtml::encode('Opportunité'));
//First we need to activate French, to import the message
Yii::app()->languageHelper->load();
Yii::app()->languageHelper->activateLanguagesForTesting();
Yii::app()->languageHelper->importMessagesForTesting();
$label = OpportunitiesModule::getModuleLabelByTypeAndLanguage('SingularLowerCase', 'fr');
$this->assertEquals('opportunité', $label);
$this->assertEquals('opportunité', ZurmoHtml::encode($label));
}
示例9: registerScriptForEditAndDetailsView
/**
* Register the script that will make the ajax call to search for a dedupe and update the DedupeViewClassName
* with the content returned. It also display a clickable flash message with the number of results found
* @see ZurmoModuleController::actionSearchForDuplicateModels
* @param Element $element
* @return null
*/
public function registerScriptForEditAndDetailsView(Element $element)
{
if (!$this->shouldCreateScriptForElement($element)) {
return null;
}
$id = $this->getInputIdForDedupe($element);
$dedupeViewId = $this->getDedupeViewClassName();
$link = ZurmoHtml::link(Zurmo::t('Core', 'click here'), '#', array('onclick' => 'js:$("#' . $dedupeViewId . '").closest("form")[0].submit();'));
$spanUnderline = ZurmoHtml::tag('span', array('class' => 'underline'), $link);
$textMessage = '<br>' . ZurmoHtml::encode(Zurmo::t('ZurmoModule', 'If you still want to save '));
$textMessage .= $spanUnderline . '.';
$spinnerId = 'dedupe-spinner';
// Begin Not Coding Standard
$ajaxScript = ZurmoHtml::ajax(array('type' => 'GET', 'data' => array('attribute' => $this->getAttributeForDedupe($element), 'value' => "js:\$('#{$id}').val()"), 'url' => 'searchForDuplicateModels', 'beforeSend' => "js:function(){\n \$('#" . $id . "').after('<div id=\"" . $spinnerId . "\"><span class=\"z-spinner\"></span></div>');\n \$(this).makeOrRemoveLoadingSpinner(true, '#" . $spinnerId . "', 'dark');\n }", 'success' => "js:function(data, textStatus, jqXHR){\n var returnObj = jQuery.parseJSON(data);\n \$('#" . $dedupeViewId . "').closest('form').off('submit.dedupe');\n if (returnObj != null)\n {\n var textMessage = '<a href=\"#\" onclick=\"\$(\\'#" . $dedupeViewId . "\\').show();dedupeShouldSubmitFormAfterMessage = false;\$(\\'.jnotify-item-close\\').click(); return false;\">' + returnObj.message + '</a>';\n if (shouldSubmitForm)\n {\n \$('#" . $dedupeViewId . "').closest('form').find('a[name=\\'save\\']').removeClass('loading');\n textMessage += '" . $textMessage . "';\n }\n \$('#" . $dedupeViewId . "').replaceWith(returnObj.content);\n \$('#FlashMessageBar').jnotifyAddMessage({\n text: textMessage,\n permanent: true,\n clickOverlay : true,\n showIcon: false,\n });\n\n }\n else if (shouldSubmitForm)\n {\n \$('#" . $dedupeViewId . "').closest('form')[0].submit();\n }\n }", 'complete' => "js:function(){ \$('#" . $id . "').next('#" . $spinnerId . "').remove(); }"));
$js = "var shouldSubmitForm = false;\n \$('#{$id}' ).change(function() {\n if (\$('#{$id}').val() != '')\n {\n {$ajaxScript}\n \$(this).closest('form').on('submit.dedupe', function(e)\n {\n shouldSubmitForm = true;\n return false;\n });\n }\n\n });\n ";
Yii::app()->getClientScript()->registerScript(__CLASS__ . $id . '#dedupe-for-edit-and-details-view', $js);
// End Not Coding Standard
}
示例10: renderSuggestedFrequencyContent
protected function renderSuggestedFrequencyContent()
{
$content = '<h3>' . Zurmo::t('JobsManagerModule', 'How often should I run each Job?') . '</h3>';
$content .= '<table id="jobs-frequency">';
$content .= '<colgroup>';
$content .= '<col style="width:40%" /><col style="width:60%" />';
$content .= '</colgroup>';
$content .= '<tbody>';
$content .= '<tr><th>' . Zurmo::t('JobsManagerModule', 'Job Name') . '</th>';
$content .= '<th>' . Zurmo::t('JobsManagerModule', 'Recommended Frequency') . '</th>';
$content .= '</tr>';
$content .= '<tr>';
$content .= '<td>' . ZurmoHtml::encode($this->monitorJobData['label']) . '</td>';
$content .= '<td>' . ZurmoHtml::encode($this->monitorJobData['recommendedFrequencyContent']) . '</td>';
$content .= '</tr>';
foreach ($this->jobsData as $type => $jobData) {
$title = Zurmo::t('JobsManagerModule', 'Cron or scheduled job name: {type}', array('{type}' => $type));
$content .= '<tr>';
$content .= '<td>';
$content .= '<span class="job-label">' . ZurmoHtml::encode($jobData['label']) . '</span>';
$content .= '<span id="suggested-frequency-job-tooltip-' . $type . '" class="tooltip" title="' . $title . '">?</span>';
$content .= '</td>';
$content .= '<td>' . ZurmoHtml::encode($jobData['recommendedFrequencyContent']) . '</td>';
$content .= '</tr>';
$qtip = new ZurmoTip();
$qtip->addQTip("#suggested-frequency-job-tooltip-{$type}");
}
$content .= '</tbody>';
$content .= '</table>';
return $content;
}
示例11: renderMapAndPoint
protected static function renderMapAndPoint($containerId, $apiKey, $address, $latitude, $longitude)
{
assert('is_string($containerId)');
assert('is_string($apiKey) || $apiKey == null');
assert('$address instanceof Address || is_string($address) || $address == null');
assert('is_numeric($latitude) || $latitude == null');
assert('is_numeric($longitude) || $longitude == null');
$marker_text = ZurmoHtml::encode("{$address}");
$mapScript = "\n function plotMap()\n {\n var latlng = new google.maps.LatLng({$latitude}, {$longitude});\n var myOptions =\n {\n zoom: 14,\n center: latlng,\n mapTypeId: google.maps.MapTypeId.ROADMAP\n }\n var map = new google.maps.Map(document.getElementById('{$containerId}'), myOptions);\n\n var marker = new google.maps.Marker(\n {\n position: latlng,\n map: map\n });\n var infowindow = new google.maps.InfoWindow(\n {\n content: '{$marker_text}'\n });\n\n google.maps.event.addListener(marker, 'click', function()\n {\n infowindow.open(map, marker);\n });\n }\n function loadGoogleMap()\n {\n var script = document.createElement('script');\n script.type = 'text/javascript';\n if ('{$apiKey}' !== null)\n {\n script.src = '//maps.googleapis.com/maps/api/js?key=" . $apiKey . "&sensor=false&callback=plotMap';" . "document.body.appendChild(script);\n }\n else\n {\n script.src = '//maps.googleapis.com/maps/api/js?sensor=false&callback=plotMap';" . "document.body.appendChild(script);\n }\n }\n \$(document).ready(loadGoogleMap);\n ";
// Register the javascripts
Yii::app()->getClientScript()->registerScript("GoogleMapScript" . $containerId, $mapScript, CClientScript::POS_END);
}
示例12: resolveDependencyData
protected static function resolveDependencyData($inputId, $parentInputId, $mappingData, $position, $existingValue, $parentAttributeLabel)
{
assert('is_string($inputId)');
assert('$parentInputId == null || is_string($parentInputId)');
assert('is_array($mappingData)');
assert('is_int($position)');
assert('$existingValue == null || is_string($existingValue)');
assert('is_string($parentAttributeLabel) || $parentAttributeLabel == null');
$dependencyData = array();
$dependencyData['inputId'] = $inputId;
$dependencyData['parentInputId'] = $parentInputId;
$dependencyData['valueToAlwaysShow'] = $existingValue;
if ($parentAttributeLabel != null) {
$dependencyData['notReadyToSelectText'] = ZurmoHtml::encode(Zurmo::t('Core', 'First select the {attributeLabel}', array('{attributeLabel}' => $parentAttributeLabel)));
} else {
$dependencyData['notReadyToSelectText'] = null;
}
if (isset($mappingData[$position]['valuesToParentValues'])) {
$dependencyData['valuesToParentValues'] = $mappingData[$position]['valuesToParentValues'];
} else {
$dependencyData['valuesToParentValues'] = null;
}
return $dependencyData;
}
示例13: registerKanbanColumnFinishActionScript
/**
* Registers kanban column finish action script
* @param string $label
* @param int $targetStatus
* @param string $url
*/
protected function registerKanbanColumnFinishActionScript($labelAccept, $labelReject, $targetStatus, $url)
{
$acceptanceStatusLabel = ZurmoHtml::encode(Task::getStatusDisplayName(Task::STATUS_AWAITING_ACCEPTANCE));
$acceptanceStatus = Task::STATUS_AWAITING_ACCEPTANCE;
$inProgressKanbanType = KanbanItem::TYPE_IN_PROGRESS;
// Begin Not Coding Standard
$script = "\$(document).on('click','.action-type-finish',function()\n {\n var element = \$(this).parent().parent().parent().parent();\n var ulelement = \$(element).parent();\n var id = \$(element).attr('id');\n var idParts = id.split('_');\n var taskId = parseInt(idParts[1]);\n var rejectLinkElement = \$(this).clone();\n var parent = \$(this).parent();\n \$(this).find('.button-label').html('" . $labelAccept . "');\n \$(this).removeClass('action-type-finish').addClass('action-type-accept');\n \$(rejectLinkElement).appendTo(\$(parent));\n \$(rejectLinkElement).find('.button-label').html('" . $labelReject . "');\n \$(rejectLinkElement).removeClass('action-type-finish').addClass('action-type-reject');\n \$(element).find('.task-status').html('{$acceptanceStatusLabel}');\n \$.ajax(\n {\n type : 'GET',\n data : {'targetStatus':'{$acceptanceStatus}', 'taskId':taskId, 'sourceKanbanType':'{$inProgressKanbanType}'},\n url : '" . $url . "',\n beforeSend : function(){\n \$('.ui-overlay-block').fadeIn(50);\n \$(this).makeLargeLoadingSpinner(true, '.ui-overlay-block'); //- add spinner to block anything else\n },\n success: function(data){\n \$(this).makeLargeLoadingSpinner(false, '.ui-overlay-block');\n \$('.ui-overlay-block').fadeOut(50);\n }\n }\n );\n }\n );";
// End Not Coding Standard
Yii::app()->clientScript->registerScript('finish-action-script', $script);
}