<?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.office
* @copyright Copyright (c) 2006 Entier Studio team. All rights reserved.
* @version $Id: view.ObjectoryExplorer.php 81 2008-01-17 23:08:21Z yannromefort $
*/
// $Id: view.ObjectoryExplorer.php 81 2008-01-17 23:08:21Z yannromefort $
//-----------------------------------------------------------------------------
// namespace
if (!defined("DefObjectoryExplorer")) {
//-------------------------------------------------------------------------
// Define
define("DefObjectoryExplorer", "1");
define(ROOTVIEW, 10);
//-------------------------------------------------------------------------
// Include
@require_once (FRAMEWORK_DIR . VIEWHELPER);
//-------------------------------------------------------------------------
// Class
class ObjectoryExplorer extends ViewObject {
//---------------------------------------------------------------------
// Constructor
/**
*
* @param object Instance of ViewTemplate
* @param object Instance of DataSource
*/
function ObjectoryExplorer($template, $database) {
//
parent::ViewObject($template, $database);
}
//---------------------------------------------------------------------
// Methods
/**
*
* @access public
*
* @return object
*/
function getObject() {
//
@include_once (COMPONENTS_DATA . "data.Objectory.php");
//
return (new Objectory);
}
/**
*
* @access public
*
* @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 { ITEMVIEW, LISTVIEW, TREEVIEW }
* @param integer outputmode
* @return boolean
*/
function renderView($layout, $block = NULL, $view = NULL, $mode = OUTPUT) {
//
if (!is_object($this->Template())) return (false);
//
if (isset($layout) && ($this->m_Template->define($layout) == false)) return (false);
//
switch ($view) {
case FORMVIEW:
/*
* @see handler Objectory-form.php
*/
//
break;
case ITEMVIEW:
/*
* @see handler Objectory-view.php
*/
//
break;
case LISTVIEW:
/*
* @see handler Objectory-list.php
*/
/*
* 1- DirectoryUser
* 2- ObjectoryTypeSet
*/
//
/*
* 1- DirectoryUser
*/
//
@include_once (COMPONENTS_DATA . "data.DirectoryUser.php");
//
$user = new DirectoryUser($this->m_fieldSet["LOGUSERPKID"]);
if ($user->selectRow($this->Database()) == false) {
//
$this->m_errorSet[VIEW_OBJECT_ERROR] = true;
//
return (false);
}
//
$this->m_Template->assign($user->fieldSet());
$this->m_Template->assign($this->m_fieldSet);
//
/*
* 2- ObjectoryTypeSet
*/
//
@include_once (COMPONENTS_DATA . "data.ObjectoryTypeSet.php");
//
$typeSet = new ObjectoryTypeSet($user->get_field_value("DIRECTOPKID") , $this->m_fieldSet["DIRPROJPKID"]);
if ($typeSet->selectSet($this->Database() , DEFAULTKEY, $this->m_fieldSet["LISTVIEWSRT"], $this->m_fieldSet["LISTVIEWORD"]) == true) {
//
for ($i = 0;$i < $typeSet->rowCount();$i++) {
// select row
if ($typeSet->fetchCursorRow($this->Database()) == false) return (false);
//
$this->m_Template->select($block);
$this->m_Template->assign($typeSet->fieldSet());
$this->m_Template->render($block);
}
}
//
break;
case GRIDVIEW:
/*
* @see handler Objectory-list.php
*/
/*
* 1- DirectoryUser
* 2- ObjectorySet
*/
//
/*
* 1- DirectoryUser
*/
//
@include_once (COMPONENTS_DATA . "data.DirectoryUser.php");
//
$user = new DirectoryUser($this->m_fieldSet["LOGUSERPKID"]);
if ($user->selectRow($this->Database()) == false) {
//
$this->m_errorSet[VIEW_OBJECT_ERROR] = true;
//
return (false);
}
//
$this->m_Template->assign($user->fieldSet());
$this->m_Template->assign($this->m_fieldSet);
$this->m_Template->assign($this->m_blockSet);
//
/*
* 2- ObjectorySet
*/
//
@include_once (COMPONENTS_DATA . "data.ObjectorySet.php");
//
$objectorySet = new ObjectorySet($this->m_fieldSet["DIRPROJPKID"]);
if ($objectorySet->selectSet($this->Database() , FOREIGNKEY, $this->m_fieldSet["LISTVIEWSRT"], $this->m_fieldSet["LISTVIEWORD"]) == true) {
//
for ($i = 0;$i < $objectorySet->rowCount();$i++) {
// select row
if ($objectorySet->fetchCursorRow($this->Database()) == false) return (false);
//
$this->m_Template->select($block);
$this->m_Template->assign($objectorySet->fieldSet());
$this->m_Template->render($block);
}
}
//
break;
case FRAMEVIEW:
/*
* * @see handler Objectory-frame.php
*/
//
break;
}
//
$this->m_Template->output($mode);
//
return (true);
}
};
// Class
//-------------------------------------------------------------------------
}
// namespace
//-----------------------------------------------------------------------------
?>