| Current Path : /home/sunflowe/www2/j15/administrator/components/com_jforms/elements/ |
| Current File : /home/sunflowe/www2/j15/administrator/components/com_jforms/elements/form.php |
<?php
/**
* Menu Element for JForms component
*
* @version $Id: form.php 29 2008-12-09 07:13:01Z dr_drsh $
* @package Joomla
* @subpackage JForms
* @copyright Copyright (C) 2008 Mostafa Muhammad. All rights reserved.
* @license GNU/GPL
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
class JElementForm extends JElement
{
/**
* Element name
*
* @access protected
* @var string
*/
var $_name = 'Form';
function fetchElement($name, $value, &$node, $control_name)
{
global $mainframe;
$db =& JFactory::getDBO();
$doc =& JFactory::getDocument();
$fieldName = $control_name.'['.$name.']';
JTable::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_jforms'.DS.'tables' );
$form =& JTable::getInstance( 'Forms', 'Table' );
if ( $value ) {
$form->load( $value );
} else {
$form->title = JText::_('Select a Form');
}
$js = "
function jSelectForm(id, title, object) {
document.getElementById(object + '_id').value = id;
document.getElementById(object + '_name').value = title;
document.getElementById('sbox-window').close();
}";
$doc->addScriptDeclaration($js);
$link = 'index.php?option=com_jforms&task=element&tmpl=component';
JHTML::_('behavior.modal', 'a.modal');
$html = "\n".'<div style="float: left;"><input style="background: #ffffff;" type="text" id="'.$name.'_name" value="'.htmlspecialchars($form->title, ENT_QUOTES, 'UTF-8').'" disabled="disabled" /></div>';
$html .= '<div class="button2-left"><div class="blank"><a class="modal" title="'.JText::_('Select a Form').'" href="'.$link.'" rel="{handler: \'iframe\', size: {x: 650, y: 375}}">'.JText::_('Select').'</a></div></div>'."\n";
$html .= "\n".'<input type="hidden" id="'.$name.'_id" name="'.$fieldName.'" value="'.(int)$value.'" />';
return $html;
}
}