Location: PHPKode > projects > OpenBizMap > obm2007.1/mydata/script/tmp_detail_mobile.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.
*/

//init
  $sort_variable_name='';
  $column_array=array();
  $tab_array=array();

  $variable_array=$record_array[0];

  //looking for column names
    //config
    $variable_array2=load_config($group_name);

    reset($variable_array2);
    while(list($variable_name,$val)=each($variable_array2))
    {
      if(substr($variable_name,0,3)!='sys' and check_access($variable_name,1)!=0)
      {
        if($variable_array2[$variable_name]['show_cond']==0 and substr($variable_name,0,3)!='sys')
          $variable_array2[$variable_name]['show_cond']=2;

        if($variable_array2[$variable_name]['tab']=='')
          $variable_array2[$variable_name]['tab']=$variable_array2['sysDetailTitle']['value'];

        if($variable_array2[$variable_name]['show_cond']>1 and $variable_array2[$variable_name]['show_cond']!=5)
        {
          $column_array[$variable_name]=$variable_array2[$variable_name]['template'];//split_label($variable_name);
        }

        if(!isset($record_array[0][$variable_name]))
        {
          $record_array[0]='$'.$variable_name.'='.$record_array[0];
        }

        $tab_array[$variable_array2[$variable_name]['tab']]=1;
      }
    }


  echo '<div>';

  $show_name='odb_'.$id;


  echo '<a name="'.$group_name.'0"></a>';

   echo '<h2>';
    myecho($variable_array2['sysDetailTitle']['value']);
  echo '</h2>';


  myecho('Details');

  echo ' | ';

  echo '<a href="#mark'.($cnt_mark+1).'">';
    //myecho('Skip %1',myecho($variable_array2['sysListTitle']['value'],'RETURN'));
    myecho('Skip');
  echo '</a> | ';

  echo '<a href="#top">';
    myecho('Page Top');
  echo '</a>';



  if(read($variable_array,'Quality')=='Suspected')
  {
    echo('<div style="padding:5px; margin:10px; border:#000 1px solid; background-color:#ff0; width:290px;"><img src="images/radioactive1.jpg" />');
    echo('<div style="text-align:center;"><b>');
    myecho('WARNING: Quality suspected.');
    echo('<br />');
    echo(' <a href="index.php?odb_run=quality&amp;odb_id='.read($variable_array,'sysId').'&amp;odb_search='.$search.'">');
    myecho('Please confirm this quality here.');
    echo('</a></b>');
    echo('</div></div>');
  }




  $validfrom=read($variable_array,'sysValidFrom');
  $validfrom=substr($validfrom,6,2).'.'.substr($validfrom,4,2).'.'.substr($validfrom,0,4);
  $validto=read($variable_array,'sysValidTo');
  $validto=substr($validto,6,2).'.'.substr($validto,4,2).'.'.substr($validto,0,4);
  $modby=read($variable_array,'sysModBy');
  //$modby=substr($modby,6,2).'.'.substr($modby,4,2).'.'.substr($modby,0,4).substr($modby,8);
  //$modby=substr($modby,14);
  $comment=read($variable_array,'sysComment');
  $info='Valid:'.$validfrom.'-'.$validto.' by '.$modby;



  //$standard_display_mode=$display_mode;
  $field_cnt=1;
  $tab_cnt=0;

  reset($tab_array);
  while(list($tab_name,$val)=each($tab_array))
  {
    if($val and $tab_name!='...')
    {
      $tab_cnt++;

      $fulllabel=split_label($tab_name);
      if(strlen($fulllabel)>14)
        $label=substr($fulllabel,0,12).'...';
      else
        $label=$fulllabel;

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

        echo '<hr />';

         echo '<a name="'.$group_name.($tab_cnt).'"></a>';

          echo '<a href="#'.$group_name.($tab_cnt+1).'">';
            myecho('Next');
          echo '</a> | ';

          if($ii>0)
          {
            echo '<a href="#'.$group_name.($tab_cnt-1).'">';
              myecho('Previous');
            echo '</a> | ';
          }

          if(check_access(read($variable_array,'MyBag'))>1)
          {
            echo '<a href="#'.$group_name.'save">';
            myecho('Save');
            echo '</a> | ';
          }

          echo '<a href="#'.$group_name.'0">';
          myecho('Top');
          echo '</a>';

          echo '<h3>';
          myecho($variable_array2['sysDetailTitle']['value']);
          echo ' - ';
          myecho($fulllabel);
          echo '</h3>';

        echo '<table border="0">';

        //showing fields
        $sizeof=sizeof($record_array);
        for($ii=0;$ii<$sizeof;$ii++)
        {
          $variable_array=$record_array[$ii];

          //$display_mode=$standard_display_mode;

            if(!read($variable_array,'sysValid'))
              $validity='titleDeleted';
            elseif(read($variable_array,'sysValidTo')=='99991231')
              $validity='titleActive';
            else
              $validity='titleValid';

          reset($column_array);
          while(list($variable_name,$val)=each($column_array))
          {
            if($variable_array2[$variable_name]['tab']==$tab_name)
            {
              $template=trim($column_array[$variable_name]);//$variable_array[$variable_name]['template'];
              $formula=$variable_array2[$variable_name]['formula'];

              $show_name='odb_'.purename($variable_name).'_'.$id;
              $show_label='';//split_label($variable_name);
              //$show_tooltip=$variable_array2[$variable_name]['description'].' '.$formula;
              //$show_value=read($variable_array,$variable_name);
              $show_value=htmlspecialchars(read($variable_array,$variable_name));

              $show_dictionary=$variable_array2[$variable_name]['dict'];

              if($template=='file')
              {
                echo '<tr class="record">';

                  echo '<td>';
                  echo ''.$field_cnt.'. ';
                  $field_cnt++;

                if($variable_name=='MyBag' and check_access(read($variable_array,'MyBag'))==2)
                  $show_mode=CFG_SHOW;
                elseif(check_access(read($variable_array,'MyBag'))==1)
                  $show_mode=CFG_SHOW;
                elseif($variable_array2[$variable_name]['formula']=='' and $variable_array2[$variable_name]['show_cond']==2)
                  $show_mode=CFG_EDIT;
                else
                  $show_mode=CFG_SHOW;

                  if($variable_array2[$variable_name]['hl'])
                  {
                    echo '<b>';
                    myecho($variable_name);
                    echo '</b>';
                  }
                  else
                    myecho($variable_name);

                  echo '<br />';

                  if(file_exists(cfg_data_path.'/config/script/fld_'.$template.'.txt'))
                  {
                    include(cfg_data_path.'/config/script/fld_'.$template.'.txt');
                  }
                  else
                  {
                    if(!file_exists(cfg_data_path.'/script/fld_'.$template.'.txt'))
                      $template='';

                    include(cfg_data_path.'/script/fld_'.$template.'.txt');
                  }

                  echo '</td>';
                echo '</tr>';
              }
              else //non-file
              {
              echo '<tr class="record">';

                echo '<td>';

                  echo ''.$field_cnt.'. ';
                  $field_cnt++;

                  if($variable_array2[$variable_name]['hl'])
                  {
                    echo '<b>';
                    myecho($variable_name);
                    echo '</b>';
                  }
                  else
                    myecho($variable_name);

                  echo '<br />';


              if($variable_name=='MyBag' and check_access(read($variable_array,'MyBag'))==2)
                $show_mode=CFG_SHOW;
              elseif(check_access(read($variable_array,'MyBag'))==1)
                $show_mode=CFG_SHOW;
              elseif($variable_array2[$variable_name]['show_cond']==2)
                $show_mode=CFG_EDIT;
              else
                $show_mode=CFG_SHOW;


                if(file_exists(cfg_data_path.'/config/script/fld_'.$template.'.txt'))
                {
                  include(cfg_data_path.'/config/script/fld_'.$template.'.txt');
                }
                else
                {
                  if(!file_exists(cfg_data_path.'/script/fld_'.$template.'.txt'))
                    $template='';

                  include(cfg_data_path.'/script/fld_'.$template.'.txt');
                }

                echo '</td>';
              echo '</tr>';
            }
          }
        }
        }

        //USEREXIT OnTabShow
        $userexit='ontabshow';
        if(file_exists(cfg_data_path.'/config/userexit/exit_'.$userexit.'.txt'))
        {
          include(cfg_data_path.'/config/userexit/exit_'.$userexit.'.txt');
        }
        else
        {
          include(cfg_data_path.'/script/userexit/exit_'.$userexit.'.txt');
        }

        echo '</table>';
      echo '</div>';
    }
  }


  global $main_history_array;
  if(get('history') and count($main_history_array[read($variable_array,'sysId')]))
  {
    echo '<hr />';

    $tab_cnt++;
    echo '<a name="'.$group_name.($tab_cnt).'"></a>';
    echo '<a name="history"></a>';

    echo '<a href="#'.$group_name.($tab_cnt+1).'">';
      myecho('Next');
    echo '</a> | ';

    if($ii>0)
    {
      echo '<a href="#'.$group_name.($tab_cnt-1).'">';
        myecho('Previous');
      echo '</a> | ';
    }

    if(check_access(read($variable_array,'MyBag'))>1)
    {
      echo '<a href="#'.$group_name.'save">';
      myecho('Save');
      echo '</a> | ';
    }

    echo '<a href="#'.$group_name.'0">';
    myecho('Top');
    echo '</a>';

    echo '<h3>';
    myecho($variable_array2['sysDetailTitle']['value']);
    echo ' - ';
    myecho('History');
    echo '</h3>';


    echo '<div class="detGroup">';
    echo '<table>';

    $sorted_main_history_array=array();
    reset($main_history_array);
    while(list($tmp,$line)=each($main_history_array[read($variable_array,'sysId')]))
      $sorted_main_history_array[read($line,'sysModInfo').read($line,'sysValidFrom').rand(1000,9999)]=$line;

    //~ echo '<pre>';
    //~ print_r($main_history_array);
    //~ echo '</pre>';

    ksort($sorted_main_history_array);

    //~ echo '<pre>';
    //~ print_r($sorted_main_history_array);
    //~ echo '</pre>';

    $main_history_array[read($variable_array,'sysId')]=$sorted_main_history_array;

    //$ver0_array=line2array($main_history_array[0]);
    $ver0_array=array();
    reset($main_history_array);
    while(list($tmp,$line)=each($main_history_array[read($variable_array,'sysId')]))
    {
      $last_ver_array=line2array($line);

      $tmp=substr(read($line,'sysModInfo'),6,2).'.'.substr(read($line,'sysModInfo'),4,2).'.'.substr(read($line,'sysModInfo'),0,4).' '.substr(read($line,'sysModInfo'),8);

      if(strpos($line,'sysComment=PreSave Deleted')==0 and strpos($line,'sysComment=Deleted')==0)
      {
        echo '<tr><td class="label" colspan="3"><b>'.$last_ver_array['sysComment'].'</b><br />'.$tmp.'<br />Valid:'.$last_ver_array['sysValid'].' '.substr($last_ver_array['sysValidFrom'],6,2).'.'.substr($last_ver_array['sysValidFrom'],4,2).'.'.substr($last_ver_array['sysValidFrom'],0,4).'-'.substr($last_ver_array['sysValidTo'],6,2).'.'.substr($last_ver_array['sysValidTo'],4,2).'.'.substr($last_ver_array['sysValidTo'],0,4).'</td></tr>';

        if($tmp>0)
        {
          echo '<tr><td class="label" style="width:200px;">Changes</td><td class="label" style="width:180px;">Before</td><td class="label" style="width:180px;">After</td></tr>';
          reset($last_ver_array);
          while(list($key,$value)=each($last_ver_array))
            if(substr($key,0,3)!='sys' and $last_ver_array[$key]!=$ver0_array[$key])
              echo '<tr><td class="label">'.$key.'</td><td class="show">'.$ver0_array[$key].'</td><td class="show">'.$last_ver_array[$key].'</td></tr>';
          $ver0_array=$last_ver_array;
        }
      }
      //~ else
        //~ echo '<tr><td class="label">'.($tmp).'</td><td class="label" colspan="3">'.read($line,'sysComment').': '.substr(read($line,'sysModInfo'),6,2).'.'.substr(read($line,'sysModInfo'),4,2).'.'.substr(read($line,'sysModInfo'),0,4).' '.substr(read($line,'sysModInfo'),8).'</td></tr>';
    }
    echo '</table>';
    echo '</div>';
  }



  if(check_access(read($variable_array,'MyBag'))>1)
  {
    echo '<hr />';

    $tab_cnt++;
    echo '<a name="'.$group_name.($tab_cnt).'"></a>';
    echo '<a name="'.$group_name.'save"></a>';

          if($ii>0)
          {
            echo '<a href="#'.$group_name.($tab_cnt-1).'">';
              myecho('Previous');
            echo '</a> | ';
          }

          echo '<a href="#'.$group_name.'0">';
          myecho('Top');
          echo '</a>';

          echo '<h3>';
          myecho($variable_array2['sysDetailTitle']['value']);
          echo ' - ';
          myecho('Actions');
          echo '</h3>';

    echo('<input id="sw'.$cnt_mark.'" name="'.$show_name.'" type="checkbox" /> ');
    myecho('Confirm action');

    echo '<br />';
    echo('<input class="button" name="odb_save" type="submit" value="'.myecho('Save','RETURN').'" />');
    echo('<input class="button" name="odb_copy" type="submit" value="'.myecho('Clone','RETURN').'" />');
    echo('<input class="button" name="odb_delete" type="submit" value="'.myecho('Delete','RETURN').'" />');
    echo('<input class="button" name="reset" type="reset" value="'.myecho('Cancel','RETURN').'" />');
  }
  echo '<hr />';

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

  echo '<span class="rec_info">';
    //~ if($validto=='31.12.9999')
      //~ myecho('Data valid from %1',$validfrom);
    //~ else
      //~ myecho('Data valid: %1 - %2',$validfrom,$validto);


    //~ if(read($variable_array,'MyBag'))
    //~ {
      //~ echo ' ';
      //~ myecho('in bag %1, changed by %2',read($variable_array,'MyBag'),$modby);
    //~ }
    //~ else
    //~ {
      //~ echo ', ';
      //~ myecho('changed by %1',$modby);
    //~ }

    //~ echo ' ';
    //~ myecho('with comment: \'%1\'.',$comment);
    //~ echo ' ';
    if(!get('history') or !count($main_history_array[read($variable_array,'sysId')]))
    {
      echo '<a href="index.php?odb_search=sysId%3D'.read($variable_array,'sysId').'&amp;odb_history=1#history">';
      myecho('Show history');
      echo '</a>';
    }
  echo '</span>';

  echo('</div>');


?>
Return current item: OpenBizMap