<?php
/**
* Entier Studio
*
* LICENSE
*
* Copyright 2006 Entier Studio team.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @package entier.studio
* @copyright Copyright (c) 2006 Entier Studio team. All rights reserved.
* @version $Id: proc.ElementOperationWriter.php 115 2008-03-07 22:29:12Z yannromefort $
*/
//-----------------------------------------------------------------------------
// namespace
if (!defined("DefElementOperationWriter")) {
//-------------------------------------------------------------------------
// Define
define("DefElementOperationWriter", "1");
//-------------------------------------------------------------------------
// Include
@require_once (INTERCHANGE_PROC. "proc.ElementWriter.php");
@require_once (INTERCHANGE_DATA. "data.InterchangeElementReference.php");
//-------------------------------------------------------------------------
// Class
class ElementOperationWriter extends ElementWriter {
//---------------------------------------------------------------------
// Constructor
/**
*
*/
function ElementOperationWriter() {
//
}
//---------------------------------------------------------------------
// Methods
/**
*
* @access protected
*
* @param object name="datasource"
* @param object name="template"
* @param integer name="handle"
* @param string name="block"
* @param integer name="primarykey"
* @return boolean
*/
function addParameterAttribute(&$datasource, &$template, $handle, $block, $primarykey) {
// 1- Operation set
$reference = new InterchangeElementReference($primarykey);
if ($reference->selectRow($datasource, FOREIGNKEY) == true) {
//
$template->select($block, $handle);
$template->assign($reference->fieldSet() , NULL, $handle);
$template->render($block, $handle);
}
//
return (true);
}
/**
*
* @access protected
*
* @param object name="datasource"
* @param object name="template"
* @param integer name="handle"
* @param string name="block"
* @param integer name="primarykey"
* @return boolean
*/
function addParameterSet(&$datasource, &$template, $handle, $block, $primarykey) {
// 1- Parameter set
$elementSet = new ObjectoryContainedElementSet($primarykey, PARAMETER_TYPE);
if ($elementSet->selectSet($datasource, FOREIGNKEY, FOREIGNKEY) == true) {
//
$block_1 = "operation-parameter-properties";
$block_2 = "operation-parameter-attribute";
//
for ($i = 0;$i < $elementSet->rowCount();$i++) {
// select row
if ($elementSet->fetchCursorRow($datasource) == false)
return (false);
//
$template->select($block, $handle);
$template->assign($elementSet->fieldSet() , NULL, $handle);
//
if (false == $this->addPropertySet(
$datasource, $template, $handle, $block_1, $elementSet->get_field_value("OBJELEMPKID")))
return (false);
//
if (false == $this->addParameterAttribute(
$datasource, $template, $handle, $block_2, $elementSet->get_field_value("OBJELEMPKID")))
return (false);
//
$template->render($block, $handle);
}
}
//
return (true);
}
/**
*
* @access public
*
* @param object name="datasource"
* @param object name="template"
* @param integer name="handle"
* @param string name="block"
* @param integer name="primarykey"
* @return boolean
*/
function addOperationSet(&$datasource, &$template, $handle, $block, $primarykey) {
// 1- Operation set
$elementSet = new ObjectoryContainedElementSet($primarykey, OPERATION_TYPE);
if ($elementSet->selectSet($datasource, FOREIGNKEY, FOREIGNKEY) == true) {
//
for ($i = 0;$i < $elementSet->rowCount();$i++) {
// select row
if ($elementSet->fetchCursorRow($datasource) == false)
return (false);
//
$template->select($block[0], $handle);
$template->assign($elementSet->fieldSet() , NULL, $handle);
//
if (false == $this->addPropertySet(
$datasource, $template, $handle, $block[1], $elementSet->get_field_value("OBJELEMPKID")))
return (false);
//
if (false == $this->addParameterSet(
$datasource, $template, $handle, $block[2], $elementSet->get_field_value("OBJELEMPKID")))
return (false);
//
$template->render($block[0], $handle);
}
}
//
return (true);
}
};
// Class
//-------------------------------------------------------------------------
}
// namespace
//-----------------------------------------------------------------------------
?>