SetInterface($_SWIFT_UserInterfaceObject))
{
$this->SetIsClassLoaded(false);
return false;
}
$this->SetID($_toolbarID);
return true;
}
/**
* Destructor
*
* @author Varun Shoor
* @return bool "true" on Success, "false" otherwise
*/
public function __destruct()
{
parent::__destruct();
return true;
}
/**
* Set the User Interface
*
* @author Varun Shoor
* @param object $_SWIFT_UserInterfaceObject The User Interface Object
* @return bool "true" on Success, "false" otherwise
*/
public function SetInterface(SWIFT_UserInterface $_SWIFT_UserInterfaceObject)
{
if (!$_SWIFT_UserInterfaceObject->GetIsClassLoaded())
{
return false;
}
$this->_SWIFT_UserInterfaceObject = $_SWIFT_UserInterfaceObject;
return true;
}
/**
* Retrieve the Currently Set User Interface
*
* @author Varun Shoor
* @return mixed "_SWIFT_UserInterfaceObject" (OBJECT) on Success, "false" otherwise
*/
public function GetInterface()
{
return $this->_SWIFT_UserInterfaceObject;
}
/**
* Set The Toolbar ID
*
* @author Varun Shoor
* @param string $_toolbarID The Toolbar DOM ID
* @return bool "true" on Success, "false" otherwise
*/
public function SetID($_toolbarID)
{
if (empty($_toolbarID))
{
return false;
}
$this->_toolbarID = $_toolbarID;
return true;
}
/**
* Add a Toolbar Buton
*
* @author Varun Shoor
*
* @param string $_buttonTitle The Button Title
* @param string $_buttonIcon The Button Icon
* @param string $_buttonLink The Button Link
* @param string $_buttonLinkType The Button Link Type
* @param string $_buttonID The Button DOM ID
* @param bool $_disableMultipleClicking
*
* @return bool "true" on Success, "false" otherwise
*/
public function AddButton($_buttonTitle, $_buttonIcon = '', $_buttonLink = '', $_buttonLinkType = '', $_buttonID = '', $_anchorLink = '', $_disableMultipleClicking = true)
{
if (empty($_buttonLinkType))
{
$_buttonLinkType = self::LINK_SUBMIT;
}
if (empty($_buttonTitle) && empty($_buttonIcon) && empty($_buttonLink))
{
$this->_outputContainer .= '
';
return false;
}
if (empty($_buttonTitle))
{
$_buttonTitle = $this->Language->Get('nolocale');
}
$_extendedJavaScript = $_linkID = '';
switch ($_buttonLinkType)
{
case self::LINK_DEFAULT:
break;
case self::LINK_CONFIRM:
$_extendedJavaScript = 'doConfirm(\''. addslashes($this->Language->Get('actionconfirm')) .'\', \''. SWIFT::Get('basename') . $_buttonLink .'\');';
break;
case self::LINK_SUBMITCONFIRM:
$_extendedJavaScript = 'TabLoading(\''. $this->GetInterface()->_formName .'\', \''. '%TABID' .'\'); doConfirmForm(\''. addslashes($this->Language->Get('actionconfirm')) .'\', \''. $this->GetInterface()->_formName . SWIFT_UserInterface::FORM_SUFFIX .'\');';
//$_linkID = $this->GetInterface()->_formName . SWIFT_UserInterface::FORM_SUFFIX . '_submit';
break;
case self::LINK_SUBMITCONFIRMCUSTOM:
$_extendedJavaScript = 'TabLoading(\''. $this->GetInterface()->_formName .'\', \''. '%TABID' .'\'); doConfirmForm(\''. $_buttonLink .'\', \''. $this->GetInterface()->_formName . SWIFT_UserInterface::FORM_SUFFIX .'\');';
//$_linkID = $this->GetInterface()->_formName . SWIFT_UserInterface::FORM_SUFFIX . '_submit';
break;
case self::LINK_VIEWPORT:
$_extendedJavaScript = 'loadViewportData(\''. SWIFT::Get('basename') . $_buttonLink .'\');';
break;
case self::LINK_SUBMIT:
$_extendedJavaScript = 'TabLoading(\''. $this->GetInterface()->_formName .'\', \''. '%TABID' .'\'); $(\'#'. $this->GetInterface()->_formName . SWIFT_UserInterface::FORM_SUFFIX .'\').submit();';
$_linkID = $this->GetInterface()->_formName . SWIFT_UserInterface::FORM_SUFFIX . '_submit_' . '%d';
break;
case self::LINK_SUBMITTARGET:
$_extendedJavaScript = '$(\'#'. $this->GetInterface()->_formName . SWIFT_UserInterface::FORM_SUFFIX .'\').submit();';
$_linkID = $this->GetInterface()->_formName . SWIFT_UserInterface::FORM_SUFFIX . '_submit_' . '%d';
break;
case self::LINK_FORM:
$_extendedJavaScript = 'TabLoading(\''. $this->GetInterface()->_formName .'\', \''. '%TABID' .'\'); $(\'#'. $this->GetInterface()->_formName . SWIFT_UserInterface::FORM_SUFFIX .'\').attr(\'action\', \'' . SWIFT::Get('basename') . addslashes($_buttonLink) . '\'); $(\'#'. $this->GetInterface()->_formName . SWIFT_UserInterface::FORM_SUFFIX .'\').submit();';
$_linkID = $this->GetInterface()->_formName . SWIFT_UserInterface::FORM_SUFFIX . '_submitform_' . '%d';
break;
case self::LINK_JAVASCRIPT:
$_extendedJavaScript = $_buttonLink;
break;
default:
break;
}
if (!empty($_buttonIcon))
{
if (substr($_buttonIcon, 0, strlen('http://')) != 'http://' && substr($_buttonIcon, 0, strlen('https://')) != 'https://')
{
$_buttonIcon = SWIFT::Get('themepath') .'images/' . $_buttonIcon;
}
}
if ($_buttonLinkType == self::LINK_NEWWINDOW) {
$this->_outputContainer .= ''. IIF(!empty($_buttonIcon), '
') . $_buttonTitle .'';
} else {
$this->_outputContainer .= ''. IIF(!empty($_buttonIcon), '
') . $_buttonTitle. '';
}
return true;
}
/**
* Render the Toolbar
*
* @author Varun Shoor
* @param bool $_noTable Whether to dispatch the tag or not
* @return mixed "_outputContainer" (STRING) on Success, "false" otherwise
*/
public function Render($_noTable = false)
{
if (!$this->GetIsClassLoaded())
{
return false;
}
$_outputData = '';
if (empty($this->_outputContainer))
{
return '';
}
if (!$_noTable)
{
$_outputData .= '_toolbarID), ' id="'. $this->_toolbarID .'"', 'id="tabtoolbartable"') .'>';
}
$_outputData .= '';
$_outputData .= '';
$_outputData .= ' |
';
if (!$_noTable)
{
$_outputData .= '
';
}
self::$_buttonIndex++;
return $_outputData;
}
}
?>