CODE STYLE class.toolBar.php

This commit is contained in:
Fernando Ontiveros
2012-10-09 13:25:46 -04:00
parent 46a75b7867
commit eb8a057ac1

View File

@@ -1,6 +1,8 @@
<?php
/**
* class.toolBar.php
*
* @package workflow.engine.ProcessMaker
*
* ProcessMaker Open Source Edition
@@ -26,6 +28,7 @@
/**
* ToolBar - ToolBar class
*
* @package workflow.engine.ProcessMaker
*/
class ToolBar extends form
@@ -34,8 +37,9 @@ class ToolBar extends form
var $align = 'left';
}
/**
/**
* XmlForm_Field_ToolBar - XmlForm_Field_ToolBar class
*
* @package workflow.engine.ProcessMaker
*/
class XmlForm_Field_ToolBar extends XmlForm_Field
@@ -43,34 +47,36 @@ class XmlForm_Field_ToolBar extends XmlForm_Field
var $xmlfile = '';
var $type = 'toolbar';
var $toolBar;
var $home='';
var $home = '';
var $withoutLabel = true;
/**
* Constructor of the class XmlForm_Field_ToolBar
*
* @param string $xmlNode
* @param string $lang
* @param string $home
* @param string $owner
* @return void
*/
function XmlForm_Field_ToolBar($xmlNode, $lang='en', $home='', $owner)
function XmlForm_Field_ToolBar ($xmlNode, $lang = 'en', $home = '', $owner)
{
parent::XmlForm_Field($xmlNode, $lang, $home, $owner);
parent::XmlForm_Field( $xmlNode, $lang, $home, $owner );
$this->home = $home;
}
/**
* Prints the ToolBar
*
* @param string $value
* @return string
*/
function render( $value )
function render ($value)
{
$this->toolBar = new toolBar( $this->xmlfile , $this->home );
$this->toolBar = new toolBar( $this->xmlfile, $this->home );
$template = PATH_CORE . 'templates/' . $this->type . '.html';
$out = $this->toolBar->render( $template , $scriptCode ) ;
$oHeadPublisher =& headPublisher::getSingleton();
$out = $this->toolBar->render( $template, $scriptCode );
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( $this->toolBar->scriptURL );
$oHeadPublisher->addScriptCode( $scriptCode );
return $out;
@@ -79,6 +85,7 @@ class XmlForm_Field_ToolBar extends XmlForm_Field
/**
* XmlForm_Field_toolButton - XmlForm_Field_toolButton class
*
* @package workflow.engine.ProcessMaker
*/
class XmlForm_Field_toolButton extends XmlForm_Field
@@ -98,77 +105,64 @@ class XmlForm_Field_toolButton extends XmlForm_Field
var $withoutLabel = false;
var $buttonStyle = '';
/*$hoverMethod : back | switch*/
var $hoverMethod='back';
var $hoverMethod = 'back';
var $class;
/**
* Prints the components of the toolBar
*
* @param string $value
* @return string
*/
function render( $value )
function render ($value)
{
$url = $this->file;
if ($this->home === "methods")
$url = G::encryptlink( SYS_URI . $url );
if ($this->home === "public_html")
$url ='/' . $url ;
$url = '/' . $url;
$urlAlt = $this->fileAlt;
if ($this->fileAlt!=='') {
if ($this->fileAlt !== '') {
if ($this->home === "methods")
$urlAlt = G::encryptlink( SYS_URI . $urlAlt );
if ($this->home === "public_html")
$urlAlt ='/' . $urlAlt ;
$urlAlt = '/' . $urlAlt;
}
$this->url=$url;
$this->urlAlt=$urlAlt;
switch($this->buttonType){
$this->url = $url;
$this->urlAlt = $urlAlt;
switch ($this->buttonType) {
case 'image':
$html='';
if ($this->hoverMethod==='back') {
$html='<img src="'.htmlentities( $url, ENT_QUOTES, 'utf-8').'"'.
(($this->style)?' style="'.$this->style.'"':'').' onmouseover=\'backImage(this,"url('.htmlentities( $urlAlt, ENT_QUOTES, 'utf-8').') no-repeat")\' onmouseout=\'backImage(this,"")\' title=\'' . addslashes($this->label) . '\' />';
}
elseif($this->hoverMethod==='switch'){
$html='<img src="'.htmlentities( $url, ENT_QUOTES, 'utf-8').'"'.
(($this->style)?' style="'.$this->style.'"':'').' onmouseover=\'switchImage(this,"'.htmlentities( $url, ENT_QUOTES, 'utf-8').'","'.htmlentities( $urlAlt, ENT_QUOTES, 'utf-8').'")\' onmouseout=\'switchImage(this,"'.htmlentities( $url, ENT_QUOTES, 'utf-8').'","'.htmlentities( $urlAlt, ENT_QUOTES, 'utf-8').'")\'/>';
}
else {
$html='<img src="'.htmlentities( $url, ENT_QUOTES, 'utf-8').'"'.
(($this->style)?' style="'.$this->style.'"':'').'/>';
$html = '';
if ($this->hoverMethod === 'back') {
$html = '<img src="' . htmlentities( $url, ENT_QUOTES, 'utf-8' ) . '"' . (($this->style) ? ' style="' . $this->style . '"' : '') . ' onmouseover=\'backImage(this,"url(' . htmlentities( $urlAlt, ENT_QUOTES, 'utf-8' ) . ') no-repeat")\' onmouseout=\'backImage(this,"")\' title=\'' . addslashes( $this->label ) . '\' />';
} elseif ($this->hoverMethod === 'switch') {
$html = '<img src="' . htmlentities( $url, ENT_QUOTES, 'utf-8' ) . '"' . (($this->style) ? ' style="' . $this->style . '"' : '') . ' onmouseover=\'switchImage(this,"' . htmlentities( $url, ENT_QUOTES, 'utf-8' ) . '","' . htmlentities( $urlAlt, ENT_QUOTES, 'utf-8' ) . '")\' onmouseout=\'switchImage(this,"' . htmlentities( $url, ENT_QUOTES, 'utf-8' ) . '","' . htmlentities( $urlAlt, ENT_QUOTES, 'utf-8' ) . '")\'/>';
} else {
$html = '<img src="' . htmlentities( $url, ENT_QUOTES, 'utf-8' ) . '"' . (($this->style) ? ' style="' . $this->style . '"' : '') . '/>';
}
break;
case 'text':
$html=$this->htmlentities($this->label, ENT_QUOTES,'utf-8');
$html = $this->htmlentities( $this->label, ENT_QUOTES, 'utf-8' );
break;
case 'html':
$html='<div '.
' onmouseover=\'backImage(this,"url('.htmlentities( $urlAlt, ENT_QUOTES, 'utf-8').') no-repeat")\' onmouseout=\'backImage(this,"")\' style="width:25px;height:25px;margin-bottom:3px">'.
$this->label.'</div>';
$html = '<div ' . ' onmouseover=\'backImage(this,"url(' . htmlentities( $urlAlt, ENT_QUOTES, 'utf-8' ) . ') no-repeat")\' onmouseout=\'backImage(this,"")\' style="width:25px;height:25px;margin-bottom:3px">' . $this->label . '</div>';
//$html=$this->label;
break;
case 'image/text':
$html='<img src="'.htmlentities( $url, ENT_QUOTES, 'utf-8').'"'.
(($this->style)?' style="'.$this->style.'"':'').'/><br/>'.
$this->htmlentities($this->label, ENT_QUOTES,'utf-8');
$html = '<img src="' . htmlentities( $url, ENT_QUOTES, 'utf-8' ) . '"' . (($this->style) ? ' style="' . $this->style . '"' : '') . '/><br/>' . $this->htmlentities( $this->label, ENT_QUOTES, 'utf-8' );
break;
case 'text/image':
$html=$this->htmlentities($this->label, ENT_QUOTES,'utf-8').
'<br/><img src="'.htmlentities( $url, ENT_QUOTES, 'utf-8').'"'.
(($this->style)?' style="'.$this->style.'"':'').'/>';
$html = $this->htmlentities( $this->label, ENT_QUOTES, 'utf-8' ) . '<br/><img src="' . htmlentities( $url, ENT_QUOTES, 'utf-8' ) . '"' . (($this->style) ? ' style="' . $this->style . '"' : '') . '/>';
break;
case 'class':
$html='<a href="#" onclick="'. $this->onclick.'" onmouseover="backImage(this, \'url(/images/dynamicForm/hover.gif) no-repeat\')" onmouseout="backImage(this, \'\')" style="width:25px;height:25px;margin-bottom:3px">
<div class="'.$this->class.'" title="'.strip_tags($this->label).'" style="width:25px;height:25px;margin-bottom:3px"></div>
$html = '<a href="#" onclick="' . $this->onclick . '" onmouseover="backImage(this, \'url(/images/dynamicForm/hover.gif) no-repeat\')" onmouseout="backImage(this, \'\')" style="width:25px;height:25px;margin-bottom:3px">
<div class="' . $this->class . '" title="' . strip_tags( $this->label ) . '" style="width:25px;height:25px;margin-bottom:3px"></div>
</a>';
return $html;
}
return '<a class="toolButton" '.
(($this->buttonStyle)?' style="'.$this->buttonStyle.'"':'').
(($this->onclick)?' onclick="'. htmlentities($this->onclick, ENT_QUOTES,'utf-8').'"':'').
'>'.$html.'</a>';
return '<a class="toolButton" ' . (($this->buttonStyle) ? ' style="' . $this->buttonStyle . '"' : '') . (($this->onclick) ? ' onclick="' . htmlentities( $this->onclick, ENT_QUOTES, 'utf-8' ) . '"' : '') . '>' . $html . '</a>';
}
}
?>