<?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.RepositoryModelResourcePropertyList.php 81 2008-01-17 23:08:21Z yannromefort $
*/
//-----------------------------------------------------------------------------
// namespace
if (!defined("DefRepositoryModelResourcePropertyList")) {
//-------------------------------------------------------------------------
// Define
define("DefRepositoryModelResourcePropertyList", "1");
//-------------------------------------------------------------------------
// Include
@require_once (FRAMEWORK_DIR . VIEWHELPER);
//-------------------------------------------------------------------------
// Class
/*
* RepositoryCoreElementProperty DAO
*
* DictionaryProperty<->RepositoryCoreElementProperty -> tbl_repository_core_element_property_value
*
* @see class RepositoryCoreElement
*/
class RepositoryModelResourcePropertyList extends ViewObject {
//---------------------------------------------------------------------
// Constructor
/*
*
*/
function RepositoryModelResourcePropertyList() {
//
}
//---------------------------------------------------------------------
// Methods
/*
*
* @access private
*
* @param object DataSource object
* @param object ViewTemplate object
* @param string block name in layout
* @param object foreign key value
* @param integer tree level
*
*/
function renderTree(&$datasource, &$template, $block, $property, $level) {
//
$propertySet = new RepositoryModelResourceRuledPropertySet($property->get_field_value("DICPVALPKID") , $this->m_fieldSet["REPMRESPKID"], $this->m_fieldSet["REPMELTPKID"]);
if ($propertySet->selectSet($datasource, REFLECTKEY) == true) {
# List items
//
$treelevel = $level+1;
//
for ($i = 0;$i < $propertySet->rowCount();$i++) {
// retrieve next row
if ($propertySet->fetchCursorRow($datasource) == false) return (false);
//
$template->select($block);
$template->assign("TreeSpan", $level*15);
$template->assign($propertySet->fieldSet());
//
// Property values Dropdownlist
$valueSet = new DictionaryPropertyValueSet($propertySet->get_field_value("DICPROPPKID"));
if ($valueSet->selectSet($datasource, FOREIGNKEY) == true) {
//
$valueSetDDL = new HTMLDropdownList("cvals[]", "listItem");
$template->assign("DICPVALLIST", $valueSetDDL->renderObject($datasource, $valueSet, $propertySet->get_field_value("DICPVALPKID")));
}
//
unset($valueSet);
unset($valueSetDDL);
//
$template->render($block);
//
//
// lookup for ruled properties
$REPMRPVPKID = $propertySet->get_field_value("REPCEPVPKID"); // empty quirk
if (!empty($REPMRPVPKID)) {
//
if ($this->renderTree($datasource, $template, $block, $propertySet, $treelevel++) == false) return (false);
}
}
}
//
return (true);
}
/*
*
* @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)) return (false);
//
if (!empty($layout) && ($template->define($layout) == false)) return (false);
//
switch ($view) {
case LISTVIEW:
/*
* @see view.RepositoryModelElementExplorer.php
*/
/*
* 1- RepositoryModelResourcePropertySet
*/
//
@include_once (COMPONENTS_DATA . "data.RepositoryModelResourcePropertySet.php");
//
$propertySet = new RepositoryModelResourcePropertySet($this->m_fieldSet["REPMELTPKID"], $this->m_fieldSet["REPMRESPKID"]);
if ($propertySet->selectSet($datasource, FOREIGNKEY, PRIMARYKEY) == true) {
//
@include_once (FRAMEWORK_DIR . "htmldropdownlist.php");
@include_once (COMPONENTS_DATA . "data.DictionaryPropertyValueSet.php");
@include_once (COMPONENTS_DATA . "data.RepositoryModelResourceRuledPropertySet.php");
//
# List items
for ($i = 0;$i < $propertySet->rowCount();$i++) {
// retrieve next row
if ($propertySet->fetchCursorRow($datasource) == false) return (false);
//
$template->select($block);
$template->assign($propertySet->fieldSet());
//
// Property values Dropdownlist
$valueSet = new DictionaryPropertyValueSet($propertySet->get_field_value("DICPROPPKID"));
if ($valueSet->selectSet($datasource, FOREIGNKEY) == true) {
//
$valueSetDDL = new HTMLDropdownList("cvals[]", "listItem");
$template->assign("DICPVALLIST", $valueSetDDL->renderObject($datasource, $valueSet, $propertySet->get_field_value("DICPVALPKID")));
}
//
unset($valueSet);
unset($valueSetDDL);
//
$template->render($block);
//
// lookup for ruled properties
$REPMRPVPKID = $propertySet->get_field_value("REPMRPVPKID"); // empty quirk
if (!empty($REPMRPVPKID)) {
//
if ($this->renderTree($datasource, $template, $block, $propertySet, 1) == false) return (false);
}
}
}
//
break;
}
//
$template->output($mode);
//
return (true);
}
};
// Class
//-------------------------------------------------------------------------
}
// namespace
//-----------------------------------------------------------------------------
?>