<?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.DirectoryProjectExplorer.php 97 2008-02-05 21:08:53Z yannromefort $
*/
//-----------------------------------------------------------------------------
// namespace
if (!defined("DefDirectoryProjectExplorer")) {
//-------------------------------------------------------------------------
// Define
define("DefDirectoryProjectExplorer", "1");
//-------------------------------------------------------------------------
// Include
@require_once (FRAMEWORK_DIR . VIEWHELPER);
//-------------------------------------------------------------------------
// Class
class DirectoryProjectExplorer extends ViewObject {
//---------------------------------------------------------------------
// Constructor
/**
*
* @param integer DirectoryProjectAccount pkid // primary key
*/
function DirectoryProjectExplorer($DIRPUSRPKID = 0) {
//
$this->m_fieldSet["DIRPUSRPKID"] = $DIRPUSRPKID;
}
//---------------------------------------------------------------------
// 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 { 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 (!empty($layout) && ($template->define($layout) == false)) {
//
$this->m_errorSet[VIEW_LAYOUT_ERROR] = $layout;
//
return (false);
}
//
switch ($view) {
case ITEMVIEW:
//
@include_once (COMPONENTS_DATA . "data.DirectoryProjectInfo.php");
//
$projectInfo = new DirectoryProjectInfo($this->m_fieldSet["DIRPUSRPKID"]);
if ($projectInfo->selectRow($datasource) == false) {
//
$this->m_errorSet[VIEW_OBJECT_ERROR] = true;
//
return (false);
}
//
$template->assign($projectInfo->fieldSet());
//
$DIRUSERLANG = $projectInfo->get_field_value("DIRUSERLANG");
$DIRPROJPKID = $projectInfo->get_field_value("DIRPROJPKID");
$DIRECTOPKID = $projectInfo->get_field_value("DIRECTOPKID");
$DIRPROJDATE = $projectInfo->get_field_value("DIRPROJDATE");
//
$language = substr($DIRUSERLANG, 3, 2);
if ($language != "")
@setlocale("LC_TIME", $language);
//
$this->m_fieldSet["DIRPROJDATE"] = strftime("%a %d %b %Y", mktime(0, 0, 0, substr($DIRPROJDATE, 6, 2) , substr($DIRPROJDATE, 8, 2) , substr($DIRPROJDATE, 0, 4)));
//
$template->assign($projectInfo->fieldSet());
$template->assign($this->fieldSet());
//
switch( $this->m_fieldSet["WORKSPACE"] ) {
case "Dictionary":
//
@include_once (COMPONENTS_VIEW . "view.DictionaryExplorer.php");
//
$dictionaryExplorer = new DictionaryExplorer($DIRECTOPKID);
$dictionaryExplorer->renderView($datasource, $template, "", "dictionary-list", ITEMVIEW, RENDER);
unset($dictionaryExplorer);
//
break;
case "Objectory":
//
@include_once (COMPONENTS_VIEW . "view.ObjectoryExplorer.php");
//
$objectoryExplorer = new ObjectoryExplorer($DIRPROJPKID);
$objectoryExplorer->renderView($datasource, $template, "", "objectory-list", ITEMVIEW, RENDER);
unset($objectoryExplorer);
//
break;
case "Repository":
//
@include_once (COMPONENTS_VIEW . "view.RepositoryExplorer.php");
//
$repositoryExplorer = new RepositoryExplorer($DIRECTOPKID);
$repositoryExplorer->renderView($datasource, $template, "", "repository-list", ITEMVIEW, RENDER);
unset($repositoryExplorer);
//
break;
default:
//
@include_once (COMPONENTS_VIEW . "view.ObjectoryExplorer.php");
//
$objectoryExplorer = new ObjectoryExplorer($DIRPROJPKID);
$objectoryExplorer->renderView($datasource, $template, "", "objectory-list", ITEMVIEW, RENDER);
unset($objectoryExplorer);
//
break;
}
//
break;
case TREEVIEW:
//
$objRData = "obj-res-data";
$objRHost = "obj-res-host";
//
@include_once (COMPONENTS_DATA . "data.DirectoryProjectInfo.php");
//
$projectInfo = new DirectoryProjectInfo($this->m_fieldSet["DIRPUSRPKID"]);
if ($projectInfo->selectRow($datasource) == false) return (false);
//
$template->assign($projectInfo->fieldSet());
//
$DIRPUSRPKID = $projectInfo->get_field_value("DIRPUSRPKID");
$REPTYPEPKID = $projectInfo->get_field_value("REPTYPEPKID");
$DIRPROJPKID = $projectInfo->get_field_value("DIRPROJPKID");
$DIRECTOPKID = $projectInfo->get_field_value("DIRECTOPKID");
//
/*
* OBJECTORY DIRECTORY
*/
//
// Objectory.Resources.DataServices menu
//
@include_once (COMPONENTS_VIEW . "view.ObjectoryResourceExplorer.php");
//
$ORD_Explorer = new ObjectoryResourceExplorer();
$ORD_Explorer->set_field_value("DIRPROJPKID", $DIRPROJPKID);
$ORD_Explorer->set_field_value("DIRRESTPKID", DATARESOURCE);
$ORD_Explorer->renderView($datasource, $template, "", $objRData, TREEVIEW, RENDER);
unset($ORD_Explorer);
//
// Objectory.Resources.HostServices menu
//
@include_once (COMPONENTS_VIEW . "view.ObjectoryResourceExplorer.php");
//
$ORH_Explorer = new ObjectoryResourceExplorer();
$ORH_Explorer->set_field_value("DIRPROJPKID", $DIRPROJPKID);
$ORH_Explorer->set_field_value("DIRRESTPKID", HOSTRESOURCE);
$ORH_Explorer->renderView($datasource, $template, "", $objRHost, TREEVIEW, RENDER);
unset($ORH_Explorer);
//
/*
* OBJECTORY
*/
//
/*
* ObjectoryExplorer view
*/
//
@include_once (COMPONENTS_VIEW . "view.ObjectoryExplorer.php");
//
$objectoryExplorer = new ObjectoryExplorer($DIRPROJPKID);
$objectoryExplorer->renderView($datasource, $template, "", NULL, TREEVIEW, RENDER);
unset($objectoryExplorer);
//
/*
* REPOSITORY
*/
//
/*
* RepositoryExplorer view
*/
//
@include_once (COMPONENTS_VIEW . "view.RepositoryExplorer.php");
//
$REP_Explorer = new RepositoryExplorer($DIRECTOPKID);
$REP_Explorer->renderView($datasource, $template, "", NULL, TREEVIEW, RENDER);
unset($REP_Explorer);
//
/*
* REPOSITORY DIRECTORY
*/
//
/*
* DirectoryExplorer view
*/
//
@include_once (COMPONENTS_VIEW . "view.DirectoryExplorer.php");
//
$DIR_Explorer = new DirectoryExplorer($DIRECTOPKID);
$DIR_Explorer->renderView($datasource, $template, "", NULL, TREEVIEW, RENDER);
//
break;
case MENUVIEW:
//
@include_once (COMPONENTS_DATA . "data.UserAccount.php");
//
$account = new UserAccount($this->m_fieldSet["DIRPUSRPKID"]);
if ($account->selectRow($datasource) == false) {
return (false);
}
//
$DIRUSERLANG = $account->get_field_value("DIRUSERLANG");
$DIRPUSRDATE = $account->get_field_value("DIRPUSRDATE");
//
$language = substr($DIRUSERLANG, 3, 2);
if ($language != "")
@setlocale("LC_TIME", $language);
//
$today = Date("Y-m-d");
$this->m_fieldSet["CURRENTDATE"] = strftime("%a %d %b %Y", mktime(0, 0, 0, substr($today, 5, 2) , substr($today, 8, 2) , substr($today, 0, 4)));
$this->m_fieldSet["DIRPUSRDATE"] = strftime("%a %d %b %Y", mktime(0, 0, 0, substr($DIRPUSRDATE, 5, 2) , substr($DIRPUSRDATE, 8, 2) , substr($DIRPUSRDATE, 0, 4)));
//
$template->assign($account->fieldSet());
$template->assign($this->fieldSet());
//
break;
}
//
$template->output();
//
return (true);
}
};
// Class
//-------------------------------------------------------------------------
}
// namespace
//-----------------------------------------------------------------------------
?>