User:Stephen.moz/dwdoc01/sad stash ant adore

 /// main: ///  - name:   test nested variable creation from flat path ///    date:   created="Wed Apr 08 04:03:23 2009" ///    last:   lastmod="Wed Apr 08 04:03:23 2009" ///    desc: | ///        test variable creation from flat path ///        online copy: ///        http://en.wikibooks.org/wiki/User:Stephen.moz/dwdoc01/sad_stash_ant_adore ///   ///  */

/// begin_: init php ///    /// resolve server-dependent paths $mmb_sysroot = ""; $mmb_sysroot = (file_exists("/sm/xampp1/htdocs")        && $mmb_sysroot=='') ? "/sm/xampp1/htdocs" : ""; $mmb_sysroot = (file_exists("/var/www/html/bao_web1")   && $mmb_sysroot=='') ? "/var/www/html/bao_web1" : ""; $mmb_sysroot = (file_exists("c:/sm/programs")           && $mmb_sysroot=='') ? "c:/sm/programs" : ""; $mmb_homedir = "c:/sm/programs/trybits/__p/tryphp/tryrecursion/sch_reporter";

/// included libraries include_once("$mmb_sysroot/_weblib/php/addon/addon_php_string.php"); include_once("$mmb_sysroot/_weblib/php/addon/addon_php_array.php"); include_once("$mmb_sysroot/_weblib/_demo/sch_reporter/sch_reporter_foxtree.php");

/// begin_: init vars ///    $oss    =   new addon_php_string; $arry  =   new addon_php_array; $vroot =   Array;

/// begin_: start with raw delimited text data ///

/// first start with dummy raw data for testing /// this could have been generated from a database query $sraw  =   "        AAA;ARCHITECTURE;AAA;AAA;2006;Fall;1;0        AAA;ARCHITECTURE;AAA;AAA;2006;Spring;1;0        AAA;ARCHITECTURE;AAA;AAA;2006;Winter;0;0        AAA;ARCHITECTURE;AAA;AAA;2006;00aaq_;2;0        AAA;ARCHITECTURE;AAA;AAA;00aaq_;00aaq_;2;0        AAA;ARCHITECTURE;AAA;ARCH;2006;Fall;1,448;0        AAA;ARCHITECTURE;AAA;ARCH;2006;Spring;1,132;0        AAA;ARCHITECTURE;AAA;ARCH;2006;Summer;2;171        AAA;ARCHITECTURE;AAA;ARCH;2006;Winter;1,176;0        AAA;ARCHITECTURE;AAA;ARCH;2006;00aaq_;3,758;171        AAA;ARCHITECTURE;AAA;ARCH;00aaq_;00aaq_;3,758;171        AAA;ARCHITECTURE;AAA;00aaq_;00aaq_;00aaq_;3,760;171        AAA;ARCHITECTURE;00aaq_;00aaq_;00aaq_;00aaq_;3,760;171        AAA;ART;AAA;ART;2006;Fall;1,077;24        AAA;ART;AAA;ART;2006;Spring;578;17        AAA;ART;AAA;ART;2006;Summer;123;0        AAA;ART;AAA;ART;2006;Winter;1,161;23        AAA;ART;AAA;ART;2006;00aaq_;2,939;64 AAA;ART;AAA;ART;00aaq_;00aaq_;2,939;64 AAA;ART;AAA;ARTC;2006;Fall;94;0 AAA;ART;AAA;ARTC;2006;Spring;20;0 AAA;ART;AAA;ARTC;2006;Summer;17;0 AAA;ART;AAA;ARTC;2006;Winter;41;0 AAA;ART;AAA;ARTC;2006;00aaq_;172;0 AAA;ART;AAA;ARTC;00aaq_;00aaq_;172;0 AAA;ART;AAA;ARTD;2006;Fall;359;0 AAA;ART;AAA;ARTD;2006;Spring;352;0 AAA;ART;AAA;ARTD;2006;Summer;20;0 AAA;ART;AAA;ARTD;2006;Winter;367;0 AAA;ART;AAA;ARTD;2006;00aaq_;1,098;0 AAA;ART;AAA;ARTD;00aaq_;00aaq_;1,098;0 AAA;ART;AAA;ARTF;2006;Fall;22;0 AAA;ART;AAA;ARTF;2006;Spring;0;0 AAA;ART;AAA;ARTF;2006;Summer;0;0 AAA;ART;AAA;ARTF;2006;Winter;8;0 AAA;ART;AAA;ARTF;2006;00aaq_;30;0 AAA;ART;AAA;ARTF;00aaq_;00aaq_;30;0 AAA;ART;AAA;ARTM;2006;Fall;36;0 AAA;ART;AAA;ARTM;2006;Spring;32;0 AAA;ART;AAA;ARTM;2006;Summer;0;0 AAA;ART;AAA;ARTM;2006;Winter;8;0 AAA;ART;AAA;ARTM;2006;00aaq_;76;0 AAA;ART;AAA;ARTM;00aaq_;00aaq_;76;0 AAA;ART;AAA;ARTO;2006;Fall;96;0 AAA;ART;AAA;ARTO;2006;Spring;129;0 AAA;ART;AAA;ARTO;2006;Summer;0;0 AAA;ART;AAA;ARTO;2006;Winter;72;0 AAA;ART;AAA;ARTO;2006;00aaq_;297;0 AAA;ART;AAA;ARTO;00aaq_;00aaq_;297;0 AAA;ART;AAA;ARTP;2006;Fall;32;0 AAA;ART;AAA;ARTP;2006;Spring;20;0 AAA;ART;AAA;ARTP;2006;Summer;15;0 AAA;ART;AAA;ARTP;2006;Winter;45;0 AAA;ART;AAA;ARTP;2006;00aaq_;112;0 AAA;ART;AAA;ARTP;00aaq_;00aaq_;112;0 AAA;ART;AAA;ARTR;2006;Fall;4;0 AAA;ART;AAA;ARTR;2006;Spring;8;0 AAA;ART;AAA;ARTR;2006;Summer;6;0 AAA;ART;AAA;ARTR;2006;Winter;20;0 AAA;ART;AAA;ARTR;2006;00aaq_;38;0 AAA;ART;AAA;ARTR;00aaq_;00aaq_;38;0 AAA;ART;AAA;ARTS;2006;Fall;52;0 AAA;ART;AAA;ARTS;2006;Spring;32;0 AAA;ART;AAA;ARTS;2006;Summer;0;4 AAA;ART;AAA;ARTS;2006;Winter;44;0 AAA;ART;AAA;ARTS;2006;00aaq_;128;4 AAA;ART;AAA;ARTS;00aaq_;00aaq_;128;4 AAA;ART;AAA;00aaq_;00aaq_;00aaq_;4,890;68 AAA;ART;00aaq_;00aaq_;00aaq_;00aaq_;4,890;68 AAA;ART HISTORY;AAA;ARH;2006;Fall;1,417;0 AAA;ART HISTORY;AAA;ARH;2006;Spring;812;0 AAA;ART HISTORY;AAA;ARH;2006;Summer;32;0 AAA;ART HISTORY;AAA;ARH;2006;Winter;1,480;0 AAA;ART HISTORY;AAA;ARH;2006;00aaq_;3,741;0 AAA;ART HISTORY;AAA;ARH;00aaq_;00aaq_;3,741;0 AAA;ART HISTORY;AAA;00aaq_;00aaq_;00aaq_;3,741;0 AAA;ART HISTORY;00aaq_;00aaq_;00aaq_;00aaq_;3,741;0 AAA;ARTS & ADMINISTRATION;AAA;AAD;2006;Fall;578;332 AAA;ARTS & ADMINISTRATION;AAA;AAD;2006;Spring;735;405 AAA;ARTS & ADMINISTRATION;AAA;AAD;2006;Summer;79;212 AAA;ARTS & ADMINISTRATION;AAA;AAD;2006;Winter;352;342 AAA;ARTS & ADMINISTRATION;AAA;AAD;2006;00aaq_;1,744;1,291 AAA;ARTS & ADMINISTRATION;AAA;AAD;00aaq_;00aaq_;1,744;1,291 AAA;ARTS & ADMINISTRATION;AAA;00aaq_;00aaq_;00aaq_;1,744;1,291 AAA;ARTS & ADMINISTRATION;00aaq_;00aaq_;00aaq_;00aaq_;1,744;1,291 AAA;HISTORIC PRESERVATION;AAA;AAAP;2006;Fall;0;0 AAA;HISTORIC PRESERVATION;AAA;AAAP;2006;Spring;0;0 AAA;HISTORIC PRESERVATION;AAA;AAAP;2006;Summer;0;10 AAA;HISTORIC PRESERVATION;AAA;AAAP;2006;Winter;11;0 AAA;HISTORIC PRESERVATION;AAA;AAAP;2006;00aaq_;11;10 AAA;HISTORIC PRESERVATION;AAA;AAAP;00aaq_;00aaq_;11;10 AAA;HISTORIC PRESERVATION;AAA;00aaq_;00aaq_;00aaq_;11;10 AAA;HISTORIC PRESERVATION;00aaq_;00aaq_;00aaq_;00aaq_;11;10 AAA;INTERIOR ARCHITECTURE;AAA;IARC;2006;Fall;220;0 AAA;INTERIOR ARCHITECTURE;AAA;IARC;2006;Spring;33;0 AAA;INTERIOR ARCHITECTURE;AAA;IARC;2006;Winter;84;0 AAA;INTERIOR ARCHITECTURE;AAA;IARC;2006;00aaq_;337;0 AAA;INTERIOR ARCHITECTURE;AAA;IARC;00aaq_;00aaq_;337;0 AAA;INTERIOR ARCHITECTURE;AAA;00aaq_;00aaq_;00aaq_;337;0 AAA;INTERIOR ARCHITECTURE;00aaq_;00aaq_;00aaq_;00aaq_;337;0 AAA;LANDSCAPE ARCHITECTURE;AAA;LA;2006;Fall;394;0 AAA;LANDSCAPE ARCHITECTURE;AAA;LA;2006;Spring;402;0 AAA;LANDSCAPE ARCHITECTURE;AAA;LA;2006;Summer;8;12 AAA;LANDSCAPE ARCHITECTURE;AAA;LA;2006;Winter;88;0 AAA;LANDSCAPE ARCHITECTURE;AAA;LA;2006;00aaq_;892;12 AAA;LANDSCAPE ARCHITECTURE;AAA;LA;00aaq_;00aaq_;892;12 AAA;LANDSCAPE ARCHITECTURE;AAA;00aaq_;00aaq_;00aaq_;892;12 AAA;LANDSCAPE ARCHITECTURE;00aaq_;00aaq_;00aaq_;00aaq_;892;12 AAA;PLANNING, PUBLIC POLICY, & MGMT;AAA;PPPM;2006;Fall;283;0 AAA;PLANNING, PUBLIC POLICY, & MGMT;AAA;PPPM;2006;Spring;200;2 AAA;PLANNING, PUBLIC POLICY, & MGMT;AAA;PPPM;2006;Summer;4;0 AAA;PLANNING, PUBLIC POLICY, & MGMT;AAA;PPPM;2006;Winter;258;0 AAA;PLANNING, PUBLIC POLICY, & MGMT;AAA;PPPM;2006;00aaq_;745;2 AAA;PLANNING, PUBLIC POLICY, & MGMT;AAA;PPPM;00aaq_;00aaq_;745;2 AAA;PLANNING, PUBLIC POLICY, & MGMT;AAA;00aaq_;00aaq_;00aaq_;745;2 AAA;PLANNING, PUBLIC POLICY, & MGMT;00aaq_;00aaq_;00aaq_;00aaq_;745;2 AAA;00aaq_;00aaq_;00aaq_;00aaq_;00aaq_;16,120;1,554 00aaq_;00aaq_;00aaq_;00aaq_;00aaq_;00aaq_;16,120;1,554 ";

/// NOTE: the string 00aaq_ is used as a pivot_sigil. /// (start with 00) Choose a pivot_sigil that will help render the rows in correct order /// when the data is sorted. /// (Make it unique) Make sure pivot_sigil is a substring that does not occur anywhere else /// in your data.

/// begin_: specify parameters for translation ///    $sout   =   ''; $vout  =   ''; $passthru                  =   Array; $passthru['delimiter']     =   ';';        // char or char sequence $passthru['rawtable']      =   $sraw;      // entire raw string $passthru['pivot_depth']   =   6;          // number of columns considered "left pivot" columns $passthru['pivot_sigil']   =   '00aaq_';   // globally-unique string that indicates a rollup_summary item $passthru['fieldnames']    =   preg_split('/;/', 'College;Department;Division;Credit Subject;Year;Term;Digits1;Digits2'); $passthru['uuid']          =   'journey_envoys_climb'; $passthru['mmb_sysroot']   =   $mmb_sysroot;

/// translate $otte  =   new sch_reporter_foxtree; $otte->reset($passthru); $vout  =   $otte->convert_raw_to_vtree($passthru);

$otte->vtree_tobluetable($vout['_root_']); $sout  .=      $otte->bluetable_pagetop($passthru); $sout  .=      $otte->outstring; $sout  .=      '   ';

print($sout);

/// begin_: end:php /// ?>