本文整理汇总了PHP中link_to_function函数的典型用法代码示例。如果您正苦于以下问题:PHP link_to_function函数的具体用法?PHP link_to_function怎么用?PHP link_to_function使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了link_to_function函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: input_asset_tag
function input_asset_tag($name, $value, $options = array())
{
use_helper('Javascript', 'I18N');
$type = 'all';
if (isset($options['images_only'])) {
$type = 'image';
unset($options['images_only']);
}
$form_name = 'this.previousSibling.previousSibling.form.name';
if (isset($options['form_name'])) {
$form_name = '\'' . $options['form_name'] . '\'';
unset($options['form_name']);
}
$html = '';
if (is_file(sfConfig::get('sf_web_dir') . $value)) {
$ext = substr($value, strpos($value, '.') - strlen($value) + 1);
if (in_array($ext, array('png', 'jpg', 'gif'))) {
$image_path = $value;
} else {
if (!is_file(sfConfig::get('sf_plugins_dir') . '/sfMediaLibraryPlugin/web/images/' . $ext . '.png')) {
$ext = 'unknown';
}
$image_path = '/sfMediaLibraryPlugin/images/' . $ext;
}
$html .= link_to_function(image_tag($image_path, array('alt' => 'File', 'height' => '64')), "window.open('{$value}')");
$html .= '<br />';
}
$html .= input_tag($name, $value, $options);
$html .= ' ' . image_tag('/sfMediaLibraryPlugin/images/folder_open', array('alt' => __('Insert Image'), 'style' => 'cursor: pointer; vertical-align: middle', 'onclick' => 'sfMediaLibrary.openWindow({ form_name: ' . $form_name . ', field_name: \'' . $name . '\', type: \'' . $type . '\', scrollbars: \'yes\' })'));
$html .= init_media_library();
return $html;
}
示例2: render
public function render()
{
$metaTitle = $this->metatag != null ? $this->metatag->getMetaTitle() : '';
$metaKeywords = $this->metatag != null ? $this->metatag->getMetaKeywords() : '';
$metaDescription = $this->metatag != null ? $this->metatag->getMetaDescription() : '';
return sprintf($this->skeleton, label_for('meta_title', __('Title:')), input_tag('w3s_meta_title', $metaTitle, 'size=34'), label_for('meta_meta_keywords', __('Keywords:')), textarea_tag('w3s_meta_keywords', $metaKeywords, 'size=31x10'), label_for('meta_meta_description', __('Description:')), textarea_tag('w3s_meta_description', $metaDescription, 'size=31x10'), link_to_function(__('Store metatags'), 'currentTab.save()', 'class="link_button"'));
}
示例3: render
public function render()
{
$result = '';
$page = DbFinder::from('W3sPage')->with('W3sTemplate', 'W3sProject')->leftJoin('W3sGroup')->leftJoin('W3sTemplate')->leftJoin('W3sProject')->findPK($this->idPage);
$slots = W3sSlotPeer::getTemplateSlots($page->getW3sGroup()->getTemplateId());
$i = 0;
foreach ($slots as $slot) {
$idSlot = $slot->getId();
$class = $i / 2 == intval($i / 2) ? "w3s_white_row" : "w3s_blue_row";
switch ($slot->getRepeatedContents()) {
case 0:
$repeatedColor = 'green';
$repeatedAlt = __('This contents is not repeated through pages');
break;
case 1:
$repeatedColor = 'orange';
$repeatedAlt = __('This contents is repeated at group level');
break;
case 2:
$repeatedColor = 'blue';
$repeatedAlt = __('This contents is repeated at site level');
break;
}
$result .= sprintf($this->rowSkeleton, $this->idLanguage . $idSlot, $class, $idSlot, link_to_function($slot->getSlotName(), 'W3sControlPanel.showRepeatedContentsForm(' . $idSlot . ');', 'onmouseover="W3sControlPanel.highlightSlot(\'' . $slot->getSlotName() . '\', ' . $slot->getRepeatedContents() . ')"'), image_tag(sfConfig::get('app_w3s_web_skin_images_dir') . '/control_panel/button_slot_' . $repeatedColor . '.jpg', 'title=' . $repeatedAlt . ' size=14x14'));
$i++;
}
return sprintf('<div id="w3s_slot_list">%s</div>', $result);
}
示例4: link_to_login
function link_to_login($name, $uri = null)
{
use_helper('Javascript');
if ($uri && sfContext::getInstance()->getUser()->isAuthenticated()) {
return link_to($name, $uri);
} else {
return link_to_function($name, visual_effect('blind_down', 'login', array('duration' => 0.5)));
}
}
示例5: google_analytics_link_to_function
/**
* Build a Javascript link that tracks a page view.
*
* Options can include:
*
* * track_as: an internal URI (required)
* * is_route: whether to send the URI through sfRouting
* * is_event: track as an event rather than a page view (for those trackers
* that support this option)
*
* @throws sfViewException if "track_as" option is absent
*
* @param string $name
* @param string $internalUri
* @param array $options
*
* @return string
*/
function google_analytics_link_to_function($name, $function, $options = array())
{
sfLoader::loadHelpers(array('Javascript'));
$tracker = sfContext::getInstance()->getRequest()->getTracker();
$options = _parse_attributes($options);
$trackerOptions = $tracker->extractViewOptions($options);
$link = link_to_function($name, $function, $options);
$link = _add_onclick_tracking($tracker, $link, $trackerOptions);
return $link;
}
示例6: getCollapseSnippet
public function getCollapseSnippet($name, $count)
{
if (is_null($this->getOption('collapse')) || !$this->getOption('collapse')) {
return null;
}
sfContext::getInstance()->getConfiguration()->loadHelpers(array('Javascript'));
$id = $this->generateId($name);
$snippet = link_to_function($this->getCollapseText($count), sprintf("document.getElementById('%s').style.display = (document.getElementById('%s').style.display == 'none' ? 'block' : 'none'); this.style.display = 'none';", $id, $id));
$snippet .= javascript_tag(sprintf("document.getElementById('%s').style.display = 'none'", $id));
return $snippet;
}
示例7: link_to_app_setting
function link_to_app_setting($text, $mid, $isReload = false)
{
$response = sfContext::getInstance()->getResponse();
$response->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/prototype');
$response->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/builder');
$response->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/effects');
$response->addJavascript('/opOpenSocialPlugin/js/opensocial-util');
$url = '@application_setting?id=' . $mid;
if ($isReload) {
$url = $url . '&is_reload=1';
}
return link_to_function($text, sprintf("iframeModalBox.open('%s')", url_for($url)));
}
示例8: render
public function render($name, $value = null, $attributes = array(), $errors = array())
{
$size = isset($attributes['size']) ? $attributes['size'] : (isset($this->attributes['size']) ? $this->attributes['size'] : 10);
$letters = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
$text = '<div class="dcFinder">';
$id = $this->generateId($name);
$id_left = $id . '_left';
$unassociated_name = 'unassociated_' . $id;
$double_list = new sfWidgetFormSelectDoubleList(array('choices' => $this->getOption('choices')));
$double_list->setOptions($this->getOptions());
$custom_handler = $this->getOption('custom_handler');
$widget_serialized = base64_encode(serialize($double_list));
$text .= '<ul class="finder">';
foreach ($letters as $letter) {
$text .= '<li>';
$text .= link_to_function($letter, remote_function(array('url' => '@dcWidgetFormSelectDoubleListFinderPropel', 'with' => "'?letter=" . $letter . "&size=" . $size . "&name=" . $unassociated_name . "&values=" . base64_encode(serialize($value)) . ($custom_handler ? "&custom_handler=" . base64_encode(serialize($custom_handler)) : '') . "&widget=" . $widget_serialized . "'", 'before' => "\$('{$id}_indicator').show(); dcFinder.setCurrent('{$id}', this);", 'complete' => "\$('{$id}_indicator').hide();", 'update' => $id_left)));
$text .= '</li>';
}
$text .= '<li class="current">';
$text .= link_to_function(__('All'), remote_function(array('url' => '@dcWidgetFormSelectDoubleListFinderPropel', 'with' => "'?letter=" . "&size=" . $size . "&values=" . base64_encode(serialize($value)) . ($custom_handler ? "&custom_handler=" . base64_encode(serialize($custom_handler)) : '') . "&name=" . $unassociated_name . "&widget=" . $widget_serialized . "'", 'update' => $id_left, 'before' => "\$('{$id}_indicator').show(); dcFinder.setCurrent('{$id}', this);", 'complete' => "\$('{$id}_indicator').hide();")));
$text .= '</li>';
$text .= '<li style="display: none;" id="' . $id . '_indicator">' . $this->getOption('loader') . '</li>';
$text .= '</ul>';
$this->addOption('template', <<<EOF
<div class="%class%">
<div style="float: left">
<div class="double_list_label">%label_unassociated%</div>
<div id="{$id_left}">%unassociated%</div>
</div>
<div style="float: left; margin-top: 2em">
%associate%
<br />
%unassociate%
</div>
<div style="float: left">
<div class="double_list_label">%label_associated%</div>
%associated%
</div>
<br style="clear: both" />
<script type="text/javascript">
sfDoubleList.init(document.getElementById('%id%'), '%class_select%');
</script>
</div>
EOF
);
$text .= parent::render($name, $value, $attributes, $errors);
$text .= '</div>';
return $text;
}
示例9: render
public function render($name, $value = null, $attributes = array(), $errors = array())
{
sfContext::getInstance()->getConfiguration()->loadHelpers('JavascriptBase');
$widget = $this->getRenderer()->render($name, $value, $attributes, $errors);
$space = " ";
$model = $this->getOption("model");
$widget_id = "#" . $name;
$widget_id = str_replace("[", "_", $widget_id);
$widget_id = str_replace("]", "", $widget_id);
$url = url_for($this->getOption("url"));
$ws_url = url_for($this->getOption("ws_url"), true);
$type = !$this->getOption('expanded') ? 'select' : ($this->getOption('multiple') ? 'checkbox' : 'radio');
$link = link_to_function($this->getOption("new_label"), "linkToNew('{$model}', '{$widget_id}', '{$url}', '{$ws_url}', '{$type}', '{$name}');");
return $widget . $space . $link;
}
示例10: trace
public static function trace($ignoreCount = 1)
{
$result = "";
self::$traceId++;
$traceId = "aTrace" . self::$traceId;
$traceIdShow = $traceId . "Show";
$traceIdHide = $traceId . "Hide";
sfContext::getInstance()->getConfiguration()->loadHelpers(array('Tag', 'JavascriptBase'));
$result .= "<div class='aTrace'>Trace " . link_to_function(">>>", "document.getElementById('{$traceId}').style.display = 'block'; " . "document.getElementById('{$traceIdShow}').style.display = 'none'; " . "document.getElementById('{$traceIdHide}').style.display = 'inline'", array("id" => $traceIdShow)) . link_to_function("<<<", "document.getElementById('{$traceId}').style.display = 'none'; " . "document.getElementById('{$traceIdHide}').style.display = 'none'; " . "document.getElementById('{$traceIdShow}').style.display = 'inline'", array("id" => $traceIdHide, "style" => 'display: none'));
$result .= "</div>";
$result .= "<pre id='{$traceId}' style='display: none'>\n";
$result .= self::traceText($ignoreCount + 1);
$result .= "</pre>\n";
return $result;
}
示例11: link_to_user_interested
function link_to_user_interested($user, $question)
{
if ($user->isAuthenticated()) {
$interested = InterestPeer::retrieveByPk($question->getId(), $user->getSubscriberId());
if ($interested) {
// already interested
return 'interested!';
} else {
// didn't declare interest yet
return link_to_remote('interested?', array('url' => 'user/interested?id=' . $question->getId(), 'update' => array('success' => 'block_' . $question->getId()), 'loading' => "Element.show('indicator')", 'complete' => "Element.hide('indicator');" . visual_effect('highlight', 'mark_' . $question->getId())));
}
} else {
return link_to_function('interested?', visual_effect('blind_down', 'login', array('duration' => 0.5)));
}
}
示例12: render
/**
* Renders the editor
*
* @return string
*
*/
public function render()
{
$idLanguage = 0;
$isMain = 0;
$languageName = '';
if ($this->language != null) {
$idLanguage = $this->language->getId();
$isMain = $this->language->getMainLanguage();
$languageName = $this->language->getLanguage();
}
$setEnabled = $idLanguage == 0 || $idLanguage != 0 && $isMain == 0 ? '' : 'DISABLED';
$function = $idLanguage == 0 ? link_to_function(__('Add Language'), 'W3sLanguage.add()', 'class="link_button"') : link_to_function(__('Edit Language'), 'W3sLanguage.edit()', 'class="link_button"');
$additionalInfo = $idLanguage == 0 ? '<div id="w3s_message"><p class="error_message">' . __('PAY ATTENTION: This operation will also insert all contents for the new language. These contents will be copied from the main language of your website.') . '</p></div>' : '';
$checked = $isMain == 1 ? 'CHECKED' : '';
return sprintf($this->editorSkeleton, label_for('language_name', __('Language name:')), input_tag('w3s_language_name', $languageName), label_for('main_language', __('Main language:')), sprintf('<input name="w3s_main_language" id="w3s_main_language" %s type="checkbox" %s />', $setEnabled, $checked), $function, $additionalInfo);
}
示例13: link_to_asset_action
function link_to_asset_action($text, $asset)
{
$user = sfContext::getInstance()->getUser();
if ($user->hasAttribute('popup', 'sf_admin/sf_asset/navigation')) {
switch ($user->getAttribute('popup', null, 'sf_admin/sf_asset/navigation')) {
case 1:
// popup called from a Rich Text Editor (ex: TinyMCE)
return link_to($text, "sfAsset/tinyConfigMedia?id=" . $asset->getId(), 'title=' . $asset->getFilename());
case 2:
// popup called from a simple form input (or via input_sf_asset_tag)
return link_to_function($text, "setImageField('" . $asset->getUrl() . "')");
}
} else {
// case : sf view (i.e. module sfAsset, view list)
return link_to($text, "sfAsset/edit?id=" . $asset->getId(), 'title=' . $asset->getFilename());
}
}
示例14: link_to_asset_action
/**
* @param string $text
* @param sfAsset $asset
* @return string
*/
function link_to_asset_action($text, $asset)
{
$user = sfContext::getInstance()->getUser();
if ($user->hasAttribute('popup', 'sf_admin/sf_asset/navigation')) {
switch ($user->getAttribute('popup', null, 'sf_admin/sf_asset/navigation')) {
case 1:
// popup called from a Rich Text Editor (ex: TinyMCE)
#return link_to($text, '@sf_asset_library_tiny_config?id=' . $asset->getId(), 'title=' . $asset->getFilename());
throw new sfAssetException('this option should be unused...');
case 2:
// popup called from a simple form input (or via input_sf_asset_tag)
return link_to_function($text, "setImageField('" . $asset->getUrl() . "','" . $asset->getUrl('small') . "'," . $asset->getId() . ')');
}
} else {
// case : sf view (i.e. module sfAsset, view list)
return link_to($text, '@sf_asset_library_edit?id=' . $asset->getId(), 'title=' . $asset->getFilename());
}
}
示例15: filters_switcher_link
function filters_switcher_link($mainFilterSwitchOn)
{
$options_on = $options_off = array();
$options_on['id'] = 'filter_switch_on';
$options_off['id'] = 'filter_switch_off';
if ($mainFilterSwitchOn) {
$options_off['style'] = 'display: none;';
} else {
$options_on['style'] = 'display: none;';
}
$html = picto_tag('action_on', __('some filters active'), $options_on);
$html .= picto_tag('action_off', __('some filters have been defined but are not activated'), $options_off);
if (defined('PUN_ROOT')) {
// we are in the forum
// it is not possible to activate/disactivate filter because the FiltersSwitchFilter will not get executed.
// moreover, forums are not filtered on activities, regions, langs.
return $html;
} else {
return link_to_function($html, "\$('#indicator').show();" . "\$.ajax('" . url_for('@default?module=common&action=switchallfilters') . "')" . ".done(function() { \$('#filter_switch_on, #filter_switch_off').toggle(); window.location.reload(); })" . ".always(function() { \$('#indicator').hide(); })");
}
}