Location: PHPKode > projects > FiForms Framework > FiForms/FiForms-includes/FiForms_iSubform.inc.php
<?php

/*
*******************************************************************************

    FiForms -- A collection of PHP classes designed 
    to facilitate rapid development of web-database software

    Copyright (C) 2004  Daniel McFeeters

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    General Public License for more details.

    You should have received a copy of the GNU General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


    The original author of this library can be contacted at the following
    address:

    Daniel McFeeters
    182 Baker Rd.
    Faubush, KY 42544-6526
    email:databases [at] fiforms [dot] org
    http://www.fiforms.org/


iText class
Project Started January 25, 2004
*******************************************************************************
FiForms_iSubform.inc.php

iSubform Definition File

This file contains the definitions for the iSubform input class
An iSubform will output an iframe HTML tag, linking to another FiForm 
definition

*******************************************************************************
*/
if(!isset($FIFORMS_CONFIG))
{
        die('No Configuration found. Did you perhaps call an include file' .
                        ' directly instead of calling it as part of the FiForms' .
                        ' application?'); 
}
require_once("FiForms_iInput.inc.php");

/* ?><code><?php */

$FIFORM_XML_INPUTS[] = 'f:iSubform';

class iSubform extends iInput
// an extension of iInput which outputs an iframe with a data bound
// subform (i.e. another linked FiForm)
{
    //var $currentRec;
    var $fieldList;  // field list to store field values from parent
    var $multiField; // flags the parent form to give this objects
                        // field values from parent
    var $form;
    var $width;
    var $height;
    var $params;
    var $javascript;
    var $filledparams;
    var $sheetView; // set to true to force subform into sheetView mode

    function iSubform()
    {
        $this->multiField = TRUE;
        $this->form = func_get_arg(0);
        $this->params = func_get_arg(2);
        $this->width = func_get_arg(3);
        $this->height = func_get_arg(4);
        $this->javascript = "";
        $this->sheetView = true;
        $this->iInput(func_get_args());
        if(func_num_args() <= 1 || func_get_arg(1) == "")
        {
            $this->caption = "";
        }

    } // function iSubform

    function drawInput()
    {
        if($this->value == "")
        {
            $this->value = $this->dbField;
        }
        $this->filledparams = fillVars($this->fieldList,$this->params);
        if(!strpos($this->filledparams,'sheetView') && $this->sheetView)
        {
            $this->filledparams .= "&amp;sheetView=YES";
        }
        $this->form = htmlentities($this->form);

        if($this->readOnly)
        {
            $returnValue = ("$this->javascript<iframe src=\"$this->form".(strpos($this->form,"?") ? "&amp;" : "?")."$this->filledparams&amp;readonly=TRUE\" ".
                            "$this->otherTags width=\"$this->width\" ".
                            "height=\"$this->height\"></iframe>");

        } // if readonly
        else
        {
            $returnValue = ("$this->javascript<iframe src=\"$this->form".(strpos($this->form,"?") ? "&amp;" : "?")."$this->filledparams\" ".
                            "$this->otherTags width=\"$this->width\" ".
                            "height=\"$this->height\"></iframe>
                            <input type=\"hidden\" name=\"".htmlentities($this->dbField)."\" value=\"$this->filledparams\"/>");
        } // else if readonly

        $pos = strpos($returnValue,"=%");
        if($pos)
        {
            return ("$this->javascript<iframe src=\"about:blank\" ".
                            "$this->otherTags width=\"$this->width\" ".
                            "height=\"$this->height\"></iframe>");
        }
        else
        {
            return($returnValue);
        }
    }

} // class iSubform

/* ?></code><?php */

?>
Return current item: FiForms Framework