Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #7082: Clicking view response in tokens table opens response in…
… same window causing search to be lost dev: ported changes from 2.1 to master now using links instead of onclicks so user can choose where to open
- Loading branch information
1 parent
04f5b1f
commit cd06195
Showing
3 changed files
with
82 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | ||
/* | ||
* LimeSurvey | ||
* Copyright (C) 2007-2011 The LimeSurvey Project Team / Carsten Schmitz | ||
* All rights reserved. | ||
* License: GNU/GPL License v2 or later, see LICENSE.php | ||
* LimeSurvey is free software. This version may have been modified pursuant | ||
* to the GNU General Public License, and as distributed it includes or | ||
* is derivative of works licensed under the GNU General Public License or | ||
* other free or open source software licenses. | ||
* See COPYRIGHT.php for copyright notices and details. | ||
* | ||
* $Id$ | ||
*/ | ||
|
||
/** | ||
* General helper class for generating views. | ||
*/ | ||
class viewHelper | ||
{ | ||
/** | ||
* Returns HTML needed for a link that consists of only an image with alt text. | ||
* | ||
* Usage: getImageLink('test.png', 'controller/action/params', 'Your description', 'optionalClass', '_blank') | ||
* | ||
* @param string $imgName the name of the image to use, adminImageUrl will be added to it | ||
* @param string $linkUrl Url we want to go to, uses CController->createUrl() | ||
* @param string $linkTxt Text to show for the link | ||
* @param string $linkTarget Optional target to use for the link | ||
* @param string $linkclass Optional class to add to the link | ||
* @param array $attribs Optional array of attirbutes to set on the link | ||
*/ | ||
public static function getImageLink($imgName, $linkUrl, $linkTxt, $linkTarget = null, $linkClass = 'imagelink', $attribs = array()) | ||
{ | ||
if (!is_null($linkUrl) && $linkUrl != '#') { | ||
$linkUrl = Yii::app()->getController()->createUrl($linkUrl); | ||
} else { | ||
$linkUrl = "#"; | ||
} | ||
$output = '<a href="' . $linkUrl; | ||
if (!empty($linkClass)) { | ||
$output .= '" class="' . $linkClass . '"'; | ||
} | ||
if (!empty($linkTarget)) { | ||
$output .= ' target="' . $linkTarget . '"'; | ||
} | ||
if (!empty($attribs)) { | ||
foreach($attribs as $attrib => $value) { | ||
$output .= ' ' . $attrib . '="' . str_replace('"', '"', $value) . '"'; | ||
} | ||
} | ||
$output .= '><img src="' . Yii::app()->getConfig('adminimageurl') . $imgName . '" alt="' . $linkTxt. '" title="' . $linkTxt. '"></a>'; | ||
|
||
return $output; | ||
} | ||
} |
cd06195
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great,
Maybe using http://www.yiiframework.com/wiki/48/by-example-chtml/#hh0 ?