defined('_JEXEC') or die('=;)');
jimport('joomla.application.component.view');
class vxcViewOrderFeetData extends JView
{
function MakeImage($src,$readOnly)
{
$caption = $readOnly?JText::_('Open'):JText::_('Edit');
return "
escape($caption)."\" title=\"".$this->escape($caption)."\" src=\"".$src."?".rand()."\" />";
}
function DisplayThumb(&$thumb, $readOnly)
{
$existsL = @file_exists(LegacyHelper::getFilesRoot() . $thumb['image_left']);
$existsR = @file_exists(LegacyHelper::getFilesRoot() . $thumb['image_right']);
$html ="
";
$html.="";
if ($existsL!==false || $existsR!==false)
{
$imageLeft = $this->MakeImage($thumb['image_left'],$readOnly);
$imageRight = $this->MakeImage($thumb['image_right'],$readOnly);
if ($existsL!==false && $existsR!==false)
$html.= "| $imageLeft |
|
$imageRight | ";
else if ($existsL!==false)
$html.="$imageLeft | ";
else
$html.="$imageRight | ";
}
else if ($thumb['value_left'])
$html.="".$thumb['value_left']." | ";
else
$html.="Id: ".$thumb['id']." | ";
$html .="
";
return $html;
}
function makePluginLink($plugin, $atId, $caption, $order)
{
$ro = $order->readOnly ?1:0;
if ($plugin !='VideoViewer')
$linkplugin =
"$caption";
else
{
if ($atId=='')
$linkplugin=
"$caption";
else
$linkplugin=
"$caption";
}
return $linkplugin;
}
function display($tpl = null)
{
$document = & JFactory::getDocument();
$this->loadHelper('vxcloadcsshelper');
$cssHelper = new VxcLoadCssHelper();
$cssHelper->loadCss();
$orderId = JRequest::getVar('orderId');
$modelOrder =& $this->getModel('order');
$modelOrder->SetId($orderId);
$order = $modelOrder->getData();
$realReadOnly = $order->readOnly;
$order->readOnly &= $order->readOnly && !SiteOptionsHelper::canAlwaysEditIntake();
$orderAttributes =& $modelOrder->getAttributes();
$this->loadHelper('orderballshelper');
$ballsHelper = new OrderBallsHelper();
$ballsHelper->SetCurrentStep($order->currentStep);
$ballsHelper->SetCompletedStep($order->completedSteps);
$balls = $ballsHelper->render();
$document->addScript(JURI::base().'components/com_vxc/assets/js/attachevent.js');
$js="
function OnPluginClose()
{
SqueezeBox.close();
}
function VXLCloseEvent()
{
var loader=null;
if (window.frames['modal'] && window.frames['modal'].gLoader);
loader = window.frames['modal'].gLoader;
if (loader)
loader.SendToPlugin('PLUGIN_CLOSE',null,'');
document.mainForm.submit();
}
var width,height;
function UpdateSize()
{
if (!SqueezeBox.isOpen) return;
var curw,curh,str;
curw=document.body.parentNode.offsetWidth;
curh=document.body.parentNode.offsetHeight;
if (curw<1) curw=1;
if (curh<1) curh=1;
if (curw!=width || curh!=height)
{
SqueezeBox.resize(SqueezeBox.options.size, true);
}
width=curw;
height=curh;
}
function OnLoad()
{
UpdateSize();
setInterval('UpdateSize()',500);
}
AttachEvent(window, 'onload', function() { OnLoad(); });
";
$document =& JFactory::getDocument();
$document->addScriptDeclaration($js);
JHTML::_('behavior.modal','a.modal',null);
$caption =JText::_('Add');
$editCaption = $order->readOnly?JText::_('Open'):JText::_('Edit');
$this->_layout = SiteOptionsHelper::getInputLayout();
$pluginForType = array('fp' => 'DataUploader2Plugin',
'apd' => 'DataUploader2Plugin',
'foambox' => 'InsoleScannerPlugin',
'bb1' => 'BB1v2Plugin',
'video' => 'VideoViewer',
'analysis' => 'VideoAnalysisPlugin');
$linkplugins = array();
foreach($pluginForType as $type=>$plugin)
{
$thumbs[$type] = array();
$linkplugins[$type] = $this->makePluginLink($plugin,'',"
escape($caption)."\" title=\"".$this->escape($caption)."\" />",$order);
}
foreach($orderAttributes as $orderAt)
{
$type ='';
switch($orderAt->typename)
{
case 'FootPrint': $type = 'fp'; break;
case 'FoamBox': $type = 'foambox'; break;
case 'BB1Scan': $type = 'bb1'; break;
case 'APD': $type = 'apd'; break;
case 'Video': $type='video'; break;
case 'VideoAnalysisData': $type='analysis'; break;
}
if (!$type) continue;
$item = array();
$item['id'] = $orderAt->id;
$modelOrderAttribute =& $this->getModel("orderattribute");
$modelOrderAttribute->GetRelativeThumbs($item['id'], $thumbLeft,$thumbRight);
$modelOrderAttribute->GetRelativeFilenames($item['id'], $fileLeft,$fileRight,$fileExtra);
if ($orderAt->typename!= "VideoAnalysisData" )
{
$item['image_left'] = $thumbLeft;
$item['image_right'] = $thumbRight;
}
else
$item['image_left'] = 'components/com_vxc/assets/images/videoanalysisthumb.png';
$item['value_left'] =$orderAt->value_left;
$contentEdit = $this->DisplayThumb($item,$order->readOnly);
$item['html'] = $this->makePluginLink($pluginForType[$type],$item['id'],$contentEdit,$order);
if ($orderAt->typename == 'Video')
{
$item['html'].="".
"
escape(JText::_('Download'))."\" title=\"".$this->escape(JText::_('Download'))."\" />".
"";
}
if (!$realReadOnly)
{
$item['html'].=" ".
"
escape(JText::_('Eliminar'))."\" title=\"".$this->escape(JText::_('Delete'))."\" />".
"";
}
$thumbs[$type][] = $item;
}
$this->assignRef('thumbs',$thumbs);
$this->assignRef('linkplugins',$linkplugins);
$this->assignRef('balls', $balls);
$this->assignRef('order',$order);
parent::display($tpl);
}// function
}// class
?>