<?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: view.DictionaryPropertyRuleManager.php 81 2008-01-17 23:08:21Z yannromefort $
*/
//-----------------------------------------------------------------------------
// namespace
if (!defined("DefDictionaryPropertyRuleManager")) {
//-------------------------------------------------------------------------
// Define
define("DefDictionaryPropertyRuleManager", "1");
//-------------------------------------------------------------------------
// Include
@require_once (FRAMEWORK_DIR . VIEWHELPER);
//-------------------------------------------------------------------------
// Class
class DictionaryPropertyRuleManager extends ViewObject {
//---------------------------------------------------------------------
// Constructor
/**
*
* @param
*
*/
function DictionaryPropertyRuleManager() {
//
}
//---------------------------------------------------------------------
// Methods
/*
*
* @access public
*
* @param object DataSource object
* @param object ViewTemplate object
* @param string layout name is a template file name or a layer name in a template file
* @param string block name in layout
* @param integer view type { FORMVIEW, ITEMVIEW, LISTVIEW, TREEVIEW... }
* @param integer outputmode
*
*/
function renderView(&$datasource, &$template, $layout, $block, $view = NULL, $mode = OUTPUT) {
//
if (!is_object($template)) {
//
$this->m_errorSet[VIEW_SYSTEM_ERROR] = true;
//
return (false);
}
//
if ($template->define($layout) == false) {
//
$this->m_errorSet[VIEW_LAYOUT_ERROR] = $layout;
//
return (false);
}
//
$template->assign($this->m_fieldSet);
//
/*
* *- Error management
*/
//
if ($this->get_error_count() > 0) {
//
@include_once (FRAMEWORK_VIEW . "view.ErrorMessage.php");
//
$errorMessage = new ErrorMessage($this->errorSet());
if ($errorMessage->renderView($template, $block, $view) == false) {
//
$this->m_errorSet[VIEW_RENDER_ERROR] = true;
//
return (false);
}
}
//
switch ($view) {
case FORMVIEW:
//
break;
case ITEMVIEW:
/*
* * @see handler DictionaryPropertyRule-form.php
*/
//
/*
* 1- DictionaryPropertyRule
* 3- ApplicationCodificationSet scope
*/
//
/*
* 1- DictionaryPropertyRule
*/
//
@include_once (COMPONENTS_DATA . "data.DictionaryPropertyRule.php");
//
$rule = new DictionaryPropertyRule($this->m_fieldSet["DICPRULPKID"]);
if ($rule->selectRow($datasource) == false) {
//
$this->m_errorSet[VIEW_OBJECT_ERROR] = true;
//
return (false);
}
//
$template->assign($rule->fieldSet());
//
//
/*
* 2- ApplicationCodificationSet Dropdownlist
*/
//
@include_once (COMPONENTS_HTML . "html.ApplicationCodificationDDL.php");
//
$codificationSet = NULL;
$codificationSetDDL = new ApplicationCodificationDDL("stat", "formInput", 1);
$this->m_blockSet["DIRSTATLIST"] = $codificationSetDDL->renderObject($datasource, $codificationSet, $rule->get_field_value("DICPRULSTAT"));
//
/*
* 3- DictionaryPropertyRuleScopeSet Dropdownlist
*/
//
@include_once (COMPONENTS_DATA . "data.DictionaryPropertyRuleScopeSet.php");
//
$ruleScopeSet = new DictionaryPropertyRuleScopeSet($rule->get_field_value("DICPROPTYPE"));
if ($ruleScopeSet->selectSet($datasource, FOREIGNKEY) == false) {
//
$this->m_errorSet[HTML_OBJECT_ERROR] = true;
//
return (false);
}
//
$ruleScopeDDL = new HTMLDropdownList("mode", "formInput");
$this->m_blockSet["DICPRULMODE"] = $ruleScopeDDL->renderObject($datasource, $ruleScopeSet, $rule->get_field_value("DICPRULTYPE"));
//
$template->assign($this->m_blockSet);
//
break;
case LISTVIEW:
/*
* * @see handler DictionaryPropertyRule-list.php
*/
/*
* DictionaryPropertyRuleSet
*/
//
@include_once (COMPONENTS_DATA . "data.DictionaryPropertyRuleSet.php");
//
$ruleSet = new DictionaryPropertyRuleSet($this->m_fieldSet["DICPVALPKID"]);
if ($ruleSet->selectSet($datasource, FOREIGNKEY) == true) {
//
$template->assign($this->fieldSet());
//
for ($i = 0;$i < $ruleSet->rowCount();$i++) {
// select next row
if ($ruleSet->fetchCursorRow($datasource) == false) return (false);
//
$template->select("list");
$template->assign($ruleSet->fieldSet());
$template->render("list");
}
}
//
break;
case TREEVIEW:
/*
*
*/
//
//
break;
}
//
$template->output($mode);
//
return (true);
}
};
// Class
//-------------------------------------------------------------------------
}
// namespace
//-----------------------------------------------------------------------------
?>