Location: PHPKode > projects > OpenBizMap > openbizmap/mydata/script/sys_structure.txt
<?php
/*
OpenDataBag - Data Web Interface
Copyright (C) 2004 Nawara

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

$group=get('group');

$change_array=array();

if(get('new'))
{
  $res=opendir(cfg_data_path.'/script/structure/');
  while($fl = readdir($res))
    if(substr($fl,0,4)=='grp_')
    {
      $change_array[substr($fl,4,-4)]=1;
    }
  closedir($res);
}

addpath(cfg_data_path.'/config/structure/');
$res=opendir(cfg_data_path.'/config/structure/');
while($fl = readdir($res))
  if(substr($fl,0,4)=='grp_')
  {
    $change_array[substr($fl,4,-4)]=2;
  }
closedir($res);

ksort($change_array);

echo '<div class="supergroup">';

echo '<h1>';
myecho('Data Structure');
echo '</h1>';

echo '<h2>';
if(get('new'))
  myecho('Choose template');
else
  myecho('Objects');
echo '</h2>';

echo '<ol>';

  if(!get('new'))
  {
    //echo '<li><a href="index.php?odb_sys=structure&amp;odb_new=1" title="Add new object">';
     echo '<li><a href="index.php?odb_sys=change&amp;odb_change=" title="Add new object">';
      myecho('Add New...');
     echo '</a></li>';
  }

reset($change_array);
while(list($change,$level)=each($change_array))
{
  $variable_array=load_config($change);

  $font_size='';
      if( count($variable_array)>99)  $font_size='font-size:17px;';
  elseif( count($variable_array)>40)  $font_size='font-size:16px;';
  elseif( count($variable_array)>20)  $font_size='font-size:15px;';
  elseif( count($variable_array)<21)  $font_size='font-size:12px;';

  if($level==1) //system default objects
    echo '<li><a style="'.$font_size.'" href="index.php?odb_sys=change&amp;odb_change='.$variable_array['sysGroupBy']['value'].'#object">'.$variable_array['sysGroupBy']['value'].'</a></li>';
  else
    echo '<li><a style="'.$font_size.'" href="index.php?odb_sys=structure&amp;odb_group='.$variable_array['sysGroupBy']['value'].'#object">'.$variable_array['sysGroupBy']['value'].'</a></li>';
}
echo '</ol>';
echo '</div>';


if($group)
{
  $variable_array=load_config($group);

  $current_order=1;

  $group_name=$variable_array['sysGroupBy']['value'];
  echo '<a id="object"></a><div id="'.$group_name.'" class="supergroup">';

    echo '<h2>';
    myecho('Object');
    echo(' '.$variable_array['sysGroupBy']['value']);
    echo '</h2>';

    echo '<br />';

    echo '<table>';

      echo '<tr>';
        echo '<th>Name</th>';
        echo '<td><div class="fld_">'.$variable_array['sysGroupBy']['value'].'</div></td>';
      echo '</tr>';

      echo '<tr>';
        echo '<th>Detail Title</th>';
        echo '<td><div class="fld_">'.$variable_array['sysDetailTitle']['value'].'</div></td>';
      echo '</tr>';

      echo '<tr>';
        echo '<th>List Title</th>';
        echo '<td><div class="fld_">'.$variable_array['sysListTitle']['value'].'</div></td>';
      echo '</tr>';

    echo '</table>';

    echo '<p><a href="index.php?odb_sys=change&amp;odb_change='.$group_name.'" title="Change fields of a whole group of records">';
    myecho('Manage fields');
    echo '</a></p>';

    echo '<div class="detGroup">';
      echo '<table style="width:90%;">';

        echo '<tr class="header">';
          echo '<th>'; myecho('No.'); echo '</th>';
          echo '<th>'; myecho('Important'); echo '</th>';
          echo '<th style="width:20%;">'; myecho('Name'); echo '</th>';
          echo '<th>'; myecho('Tab'); echo '</th>';
          //echo '<tr>'; myecho('Description'); echo '</td>';
          //echo '<tr>'; myecho('Formula'); echo '</td>';
          //echo '<tr>'; myecho('Value'); echo '</td>';
          //echo '<tr>'; myecho('Dictionary'); echo '</td>';
          echo '<th>'; myecho('Type'); echo '</th>';
          echo '<th>'; myecho('Size'); echo '</th>';
          echo '<th>'; myecho('Read Only'); echo '</th>';
          echo '<th>'; myecho('Dictionary'); echo '</th>';
          echo '<th>'; myecho('Last Modification'); echo '</th>';
        echo '</tr>';


        reset($variable_array);
        while(list($key,$val)=each($variable_array))
        {
          if(substr($key,0,3)!='sys')
          {
            //echo '<tr>';
            echo '<tr class="record'.(($current_order+1)%2).'">';

              echo '<th>';
                echo($current_order);
              echo '</th>';

              echo '<td><div class="fld_" style="text-align:center;">';
                $variable_name='hl';
                if($val[$variable_name]==1)
                  echo('X');
                else
                  echo('');
              echo '</div></td>';

              if($val['hl']==1)
                echo '<td><div class="fld_" style="font-size:1.2em; font-weight:bold;">';
              else
                echo '<td><div class="fld_">';
                echo($key);
              echo '</div></td>';

              echo '<td><div class="fld_">';
                $variable_name='tab';
                echo($val[$variable_name]);
              echo '</div></td>';

              //~ echo '<td class="show ">';
                //~ $variable_name='formula';
                //~ echo($val[$variable_name]);
              //~ echo '</td>';

              echo '<td><div class="fld_">';
                $variable_name='template';
                echo($val[$variable_name]);
              echo '</div></td>';

              if($val['template'])
              {
                echo '<td><div class="fld_">';
                myecho('by type');
                echo '</div></td>';
              }
              else
              {
                echo '<td><div class="fld_">';
                  $variable_name='size';
                  echo($val[$variable_name]);
                echo '</div></td>';
              }

              echo '<td><div class="fld_">';
                $variable_name='show_cond';
                if($val['formula']!='')
                  echo('X');
                elseif($val[$variable_name]==3)
                  echo('X');
                else
                  echo('');
              echo '</div></td>';

              echo '<td><div class="fld_">';
                echo('<a href="index.php?odb_sys=dictionaries&odb_dictionary='.urlencode($key).'">');
                myecho('Manage dictionary');
                echo('</a>');
              echo '</div></td>';

              echo '<td><div class="fld_">';
                $variable_name='mod';
                echo($val[$variable_name]);
              echo '</div></td>';
                
            echo '</tr>';
            $current_order++;
          }
        }

      echo '</table>';
      
      echo '<div class="more">';
        myecho('Last Object Structure Modification'); echo(' '.$variable_array['sysId']['mod']);
      echo('</div>');
      
    echo('</div>');

  echo('<div class="clearer"></div>');

  echo('</div>');

  echo('<br />');
  echo('<hr />');

}
?>
Return current item: OpenBizMap