Skip to content

Commit

Permalink
Add url parameter in AdminController::error().
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11966 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
GautamGupta committed Jan 10, 2012
1 parent 2a47016 commit 21e82f5
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions application/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,38 @@ protected function _init()
*
* @access public
* @param string $message The error message
* @param string|array $url URL. Either a string. Or array with keys url and title
* @return void
*/
public function error($message)
public function error($message, $url = array())
{
$clang = $this->lang;

$this->_getAdminHeader();
$output = '<div class="warningheader">'.$clang->gT('Error').'</div><br />'."\n";
$output .= $message . '<br /><br />'."\n";
$output .= '<input type="submit" value="'.$clang->gT('Main Admin Screen').'" onclick="window.open("'.Yii::app()->baseUrl.'", "_top")" /><br /><br />'."\n";
if (!empty($url) && !is_array($url))
{
$title = $clang->gT('Back');
}
elseif (!empty($url['url']))
{
if (!empty($url['title']))
{
$title = $url['title'];
}
else
{
$title = $clang->gT('Back');
}
$url = $url['url'];
}
else
{
$title = $clang->gT('Main Admin Screen');
$url = $this->createUrl('/admin');
}
$output .= '<input type="submit" value="'.$title.'" onclick=\'window.open("'.$url.'", "_top")\' /><br /><br />'."\n";
$output .= '</div>'."\n";

echo $output;
Expand Down

0 comments on commit 21e82f5

Please sign in to comment.