documentation.php 36.7 KB
Newer Older
1 2 3
<?php
require_once("highlight.php");
error_reporting(E_ALL);
4

5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
$h = new PHP_Highlight();

function render($title,$t,$e) {
    global $h;
    print $e." <a name=\"$e\"><u>".$t."</u></a><br><br>\n";
    $c = "";

    if(file_exists("docs/$e.php")) {
        rename("docs/$e.php","docs/$title - $t.php");
    }
    if(file_exists("docs/$t.php")) {
        rename("docs/$t.php","docs/$title - $t.php");
    }
    if(file_exists("docs/$title - $t.php")) {
        $c = file_get_contents("docs/$title - $t.php");
        if(substr($c,0,5) == "<?php") {
            include("docs/$title - $t.php");
        } else
            print $c."<br><br>";
    }
    $c = "";
    if(file_exists("codes/$e.php")) {
        rename("codes/$e.php","codes/$title - $t.php");
    }
    if(file_exists("codes/$t.php")) {
        rename("codes/$t.php","codes/$title - $t.php");
    }
    if(file_exists("codes/$title - $t.php")) {
        print "<table border=1 class='dashed' cellpadding=0 cellspacing=0>";
        print "<tr><td>";
         $c = file_get_contents("codes/$title - $t.php");
        $c = trim($c);

        $h->loadString($c);
        print $h->toHtml();
        print "</td></tr>";
        print "</table>";
    }
    print "<br>";
}
zYne's avatar
zYne committed
45 46 47 48
/**
    public function parseIndex($index, $path = array(), $counters = array())
    {
    	$ret = array();
49

zYne's avatar
zYne committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
        foreach ($index as $k => $v) {
            $i = count($path) - 1;

            $counters[$i]++;

            if (is_array($v)) {
                if ( ! is_numeric($k)) {
                    $tmp   = $path;
                    $tmp[] = $k;
                    
                    $chapterName = ( ! empty($path)) ? implode(' - ', $path) . ' - ' . $k : $k;

                    $ret[] = array('index' => implode('.', $counters),
                                   'name'  => $chapterName);
                }

                $ret   = array_merge($ret, $this->parseIndex($v, $tmp, $counters));
            } else {
                $chapterName = ( ! empty($path)) ? implode(' - ', $path) . ' - ' . $v : $v;

                $ret[] = array('index' => implode('.', $counters), 
                               'name'  => $chapterName);
            }
        }
        return $ret;
    }*/
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
function render_block($name) {

    if(file_exists("docs/$name.php")) {
        $c = file_get_contents("docs/$name.php");
        if(substr($c,0,5) == "<?php") {
            include("docs/$name.php");
        } else {
            print $c."<br><br>";
        }
    }
    if(file_exists("codes/$name.php")) {
        $c = file_get_contents("codes/$name.php");
        $c = trim($c);
        renderCode($c);
    }
}
zYne's avatar
zYne committed
92

93
function renderCode($c = null) {
zYne's avatar
zYne committed
94
    global $h;
95
    if( ! empty($c)) {
zYne's avatar
zYne committed
96

97 98 99
        $h->loadString($c);

        print "<table width=500 border=1 class='dashed' cellpadding=0 cellspacing=0>";
zYne's avatar
zYne committed
100
        print "<tr><td><b>";
101

zYne's avatar
zYne committed
102
        $h->toHtml();
zYne's avatar
zYne committed
103
        print "</b></td></tr>";
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
        print "</table>";
    }
}
function array2path($array, $path = '') {
   $arrayValues = array();

   $index = 1;
   foreach ($array as $k => $value) {
       $p = ($path !== '')?$path.".".$index:$index;

       if (is_scalar($value) || is_resource($value)) {
             $arrayValues[$p] = $value;
       } elseif (is_array($value)) {
             $arrayValues[$p] = $k;
             $arrayValues = $arrayValues + array2path($value, $p);
       }
       $index++;
   }

   return $arrayValues;
}
zYne's avatar
zYne committed
125
$menu = array('Getting started' =>
126
                        array(
zYne's avatar
zYne committed
127 128 129 130 131 132 133 134
                        'Requirements',
                        'Installation',
                        'Compiling',
                        'Starting new project',
                        'Setting table definition' => array(
                                        'Introduction',
                                        'Table and class naming',
                                        'Field(Column) naming',
zYne's avatar
zYne committed
135
                                        'Column aliases',
zYne's avatar
zYne committed
136
                                        'Table options',
zYne's avatar
zYne committed
137 138 139 140
                                        'Data types and lengths',
                                        'Constraints and validators',
                                        'Default values',
                                        'Enum emulation',
141
                                        ),
zYne's avatar
zYne committed
142 143 144 145 146
                        'Working with existing databases' => array(
                                        'Introduction',
                                        'Making the first import',
                                        'Import options',
                                        ),
147

zYne's avatar
zYne committed
148 149 150 151 152
                        'Record identifiers' => array(
                                        'Introduction',
                                        'Autoincremented',
                                        'Natural',
                                        'Composite',
zYne's avatar
zYne committed
153 154 155 156 157 158 159
                                        'Sequence'),
                        'Indexes' => array(
                                     'Introduction',
                                     'Adding indexes',
                                     'Index options',
                                     'Special indexes',
                                    ),
zYne's avatar
zYne committed
160 161


162
                        ),
zYne's avatar
zYne committed
163
           'Connection management' =>
zYne's avatar
zYne committed
164
                        array(
zYne's avatar
zYne committed
165 166 167 168
                        'Opening a new connection',
                        'Lazy-connecting to database',
                        'Managing connections',
                        'Connection-component binding'
zYne's avatar
zYne committed
169
                        ),
zYne's avatar
zYne committed
170
           'Schema reference' =>
171
                        array(
zYne's avatar
zYne committed
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
                        'Data types' => array(
                                        'Introduction',
                                        'Type modifiers',
                                        'Boolean',
                                        'Integer',
                                        'Float',
                                        'String',
                                        'Array',
                                        'Object',
                                        'Blob',
                                        'Clob',
                                        'Timestamp',
                                        'Time',
                                        'Date',
                                        'Enum',
                                        'Gzip',
188
                        ),
zYne's avatar
zYne committed
189 190 191
            'Foreign keys' => array(
                            'Introduction',
                            ),
zYne's avatar
zYne committed
192
/**
zYne's avatar
zYne committed
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
                        'Column attributes' => array(
                                        'Introduction',
                                        'Primary',
                                        'Autoincrement',
                                        'Default',
                                        'Zerofill',
                                        'Collation',
                                        'Charset',
                                        'Unsigned',
                                        'Fixed',
                                        'Enum',
                                        'Unique',
                                        'Nospace',
                                        'Notblank',
                                        'Notnull',
                                        'Email',
                                        'Date',
                                        'Range',
                                        'Numeric',
                                        'Regexp',
                                        'Ip',
                                        'Usstate',
zYne's avatar
zYne committed
215 216
                                        ),

zYne's avatar
zYne committed
217 218 219 220 221
                        'Identifiers' => array(
                                        'Introduction',
                                        'Autoincremented',
                                        'Natural',
                                        'Composite',
zYne's avatar
zYne committed
222
                                        'Sequential')*/
223 224

                        ),
zYne's avatar
zYne committed
225
           'Basic Components' =>
226
                        array(
zYne's avatar
zYne committed
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
                        'Manager'
                                => array('Introduction',
                                         'Opening a new connection',
                                         'Managing connections'),
                        'Record'
                                => array('Introduction',
                                         'Creating new records',
                                         'Retrieving existing records',
                                         'Accessing properties',
                                         'Updating records',
                                         'Deleting records',
                                         'Getting record state',
                                         'Getting object copy',
                                         'Serializing',
                                         'Checking Existence',
                                         'Callbacks'),
                        'Connection'
                                => array('Introduction',
                                         'Available drivers',
                                         'Getting a table object',
                                         'Flushing the connection',
                                         'Querying the database',
                                         'Getting connection state'),

                        'Collection'
                                => array('Introduction',
                                         'Accessing elements',
                                         'Adding new elements',
                                         'Getting collection count',
                                         'Saving the collection',
                                         'Deleting collection',
                                         //'Fetching strategies',
                                         'Key mapping',
                                         'Loading related records',
                                         'Collection expanding',
262 263
                                         ),

zYne's avatar
zYne committed
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
                        'Table' => array('Introduction',
                                         'Getting table information',
                                         'Finder methods',
                                         'Custom table classes',
                                         'Custom finders',
                                         'Getting relation objects'),

                        'Query' => array('Introduction',
                                         'FROM - selecting tables',
                                         'LIMIT and OFFSET - limiting the query results',
                                         'WHERE - setting query conditions',
                                         'HAVING conditions',
                                         'ORDER BY - sorting query results',
                                         ),
                        'RawSql' => array(
                                         'Introduction',
                                         'Using SQL',
                                         'Adding components',
                                         'Method overloading'),
                        'Db'     => array(
                                         'Introduction',
                                         'Connecting to a database',
                                         'Using event listeners',
                                         'Chaining listeners'),
288
                                         /**
zYne's avatar
zYne committed
289 290 291 292 293
                        'Statement - <font color='red'>UNDER CONSTRUCTION</font>' => array('Introduction',
                                             'Setting parameters',
                                             'Getting parameters',
                                             'Getting row count',
                                             'Executing the statement'),
294
                                            */
zYne's avatar
zYne committed
295 296 297
                        'Exceptions' => array(
                                    'Overview',
                                    'List of exceptions'
298 299
                                    )
                        ),
zYne's avatar
zYne committed
300
           'Mapping object relations' =>
301
                        array(
zYne's avatar
zYne committed
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
                        'Introduction',
                        'Composites and aggregates',
                        'Relation aliases',
                        'Foreign key associations' => array(
                                        'One-to-One',
                                        'One-to-Many, Many-to-One',
                                        'Tree structure'),

                        'Join table associations' => array(
                                        'One-to-One',
                                        'One-to-Many, Many-to-One',
                                        'Many-to-Many',
                                        'Self-referencing'),
                        'Dealing with relations' => array(
                                        'Creating related records',
                                        'Retrieving related records',
                                        'Updating related records',
                                        'Deleting related records',
                                        'Working with associations'),
                        'Inheritance' =>
                                        array('One table many classes',
                                        'One table one class',
                                        'Column aggregation'
325 326
                                        ),
                        ),
zYne's avatar
zYne committed
327
           'Hierarchical data' => array(
328 329
                        'Introduction' => array(
								'About', 'Setting up', 'Node interface', 'Tree interface', 'Traversing or Walking Trees', 'Read me'),
zYne's avatar
zYne committed
330 331
                        'Adjacency list' => array(
                                'Introduction'),
332 333
                        'Nested set' => array(
                                'Introduction', 'Setting up', 'Tree options', 'Node support', 'Tree support', 'Read me'),
zYne's avatar
zYne committed
334 335 336
                        'Materialized path' => array(
                                'Introduction',
                                    ),
337
						'Examples'
zYne's avatar
zYne committed
338 339 340
                        ),


zYne's avatar
zYne committed
341
           'Configuration' =>
342
                        array(
zYne's avatar
zYne committed
343 344 345 346 347 348 349 350 351 352 353 354
                        'Introduction',
                        'Levels of configuration',
                        'Setting attributes'    => array(
                            'Portability',
                            'Identifier quoting',
                            'Table creation',
                            'Fetching strategy',
                            'Batch size',
                            'Session lockmode',
                            'Event listener',
                            'Validation',
                            'Offset collection limit'
355 356 357 358 359
                            )
                        ),



zYne's avatar
zYne committed
360 361
           'Advanced components' => array(
                      'Eventlisteners' =>
362
                                      array(
zYne's avatar
zYne committed
363 364 365 366 367 368 369
                                      'Introduction',
                                      'Creating new listener',
                                      'List of events',
                                      'Listening events',
                                      'Chaining',
                                      'AccessorInvoker',
                                      'Creating a logger',
370
                                      ),
zYne's avatar
zYne committed
371 372 373 374 375
                      'Validators' => array(
                                      'Introduction',
                                      'More Validation',
                                      'Valid or Not Valid',
                                      'List of predefined validators'
376
                                      ),
zYne's avatar
zYne committed
377 378 379 380
                      'View'        => array(
                                      'Intoduction',
                                      'Managing views',
                                      'Using views'
381
                                      ),
zYne's avatar
zYne committed
382 383 384 385 386 387 388 389 390
                      'Cache'       => array(
                                      'Introduction',
                                      'Query cache'),

                      'Locking Manager' => array(
                                        'Introduction',
                                        'Examples',
                                        'Planned',
                                        'Technical Details',
zYne's avatar
zYne committed
391 392 393 394 395 396
                                        'Maintainer'), 
                      'Db_Profiler'  => array(
                                        'Introduction',
                                        'Basic usage',
                                        'Advanced usage',
                                        ),
397 398 399 400 401 402
                      'Hook' => array(
                                        'Introduction',
                                        'Building queries',
                                        'List of parsers',

                         ),
403
                      /**
zYne's avatar
zYne committed
404 405 406 407 408 409 410 411 412 413 414
                      'Debugger' => array(
                                        'Introduction',
                                        'Debugging actions'),
                      'Library' => array(
                                        'Introduction',
                                        'Using library functions'),
                      'Iterator' => array(
                                        'Introduction',
                                        'BatchIterator',
                                        'ExpandableIterator',
                                        'OffsetIterator')
415 416
                        */
                    ),
417

zYne's avatar
zYne committed
418
           'DQL (Doctrine Query Language)' =>
419

420 421
                            array(
                                  'Introduction',
zYne's avatar
zYne committed
422 423 424 425
                                  'SELECT queries' =>
                                        array('DISTINCT keyword',
                                              'Aggregate values',
                                              ),
426 427
                                  'UPDATE queries',
                                  'DELETE queries',
428 429 430 431 432 433 434 435 436 437 438 439 440
                                  'FROM clause',
                                  'WHERE clause',
                                  'Conditional expressions' =>
                                        array('Literals',
                                              'Input parameters',
                                              'Operators and operator precedence',
                                              'Between expressions',
                                              'In expressions',
                                              'Like Expressions',
                                              'Null Comparison Expressions',
                                              'Empty Collection Comparison Expressions',
                                              'Collection Member Expressions',
                                              'Exists Expressions',
441
                                              'All and Any Expressions',
442 443 444 445 446 447 448 449
                                              'Subqueries'),
                                  'Functional Expressions' =>
                                        array('String functions',
                                              'Arithmetic functions',
                                              'Datetime functions',
                                              'Collection functions'),

                                  'GROUP BY, HAVING clauses',
zYne's avatar
zYne committed
450 451 452 453
                                  'ORDER BY clause' 
                                        => array('Introduction',
                                                 'Sorting by an aggregate value',
                                                 'Using random order'),
zYne's avatar
zYne committed
454 455 456 457 458 459
                                  'LIMIT and OFFSET clauses' =>
                                        array('Introduction',
                                              'Driver portability',
                                              'The limit-subquery-algorithm',
                                        ),

460 461 462
                                  'Examples',
                                  'BNF'),

zYne's avatar
zYne committed
463 464 465 466 467 468 469 470
           'Transactions' => array(
                        'Introduction',
                        'Unit of work',
                        'Nesting',
                        'Savepoints',
                        'Locking strategies' =>
                            array('Pessimistic locking',
                                  'Optimistic locking'),
471

zYne's avatar
zYne committed
472 473 474
                        'Lock modes',
                        'Isolation levels',
                        'Deadlocks',
475

zYne's avatar
zYne committed
476 477 478 479 480 481 482 483 484 485
                        ),
           'Caching' => array(
                        'Introduction',
                        'Availible options',
                        'Drivers' =>
                            array('Memcache',
                                  'APC',
                                  'Sqlite'
                                ),

zYne's avatar
zYne committed
486
                        ),
zYne's avatar
zYne committed
487 488 489 490
           'Native SQL' => array(
                        'Scalar queries',
                        'Component queries',
                        'Fetching multiple components',
491 492
                        ),
            /**
zYne's avatar
zYne committed
493 494 495 496
            'Developer components' => array(
                        'DataDict'  => array(
                                        'Introduction',
                                        'Usage'
497
                                        ),
zYne's avatar
zYne committed
498
                        'IndexGenerator' =>
499
                                       array(
zYne's avatar
zYne committed
500 501 502 503 504
                                        'Introduction',
                                        'Usage'),
                        'Relation'  => array(
                                        'Introduction',
                                        'Types of relations',
505
                                        ),
zYne's avatar
zYne committed
506 507 508
                        'Null'      => array(
                                        'Introduction',
                                        'Extremely fast null value checking'
509
                                        ),
zYne's avatar
zYne committed
510 511 512
                        'Access'    => array(
                                        'Introduction',
                                        'Usage'
513
                                        ),
zYne's avatar
zYne committed
514 515 516
                        'Configurable' => array(
                                        'Introduction',
                                        'Usage'
517 518 519
                                        ),
                        ),
            */
zYne's avatar
zYne committed
520
            /**
zYne's avatar
zYne committed
521 522 523
            'Improving performance' => array(
                            'Introduction',
                            'Data types' =>
zYne's avatar
zYne committed
524
                                array(
zYne's avatar
zYne committed
525
                                    'Enum',
zYne's avatar
zYne committed
526
                                ),
zYne's avatar
zYne committed
527 528
                            'Primary keys' => array(
                                'When to use surrogate primary keys',
zYne's avatar
zYne committed
529
                            ),
zYne's avatar
zYne committed
530 531 532 533
                            'Constraints' => array(
                                'General tips',
                                'Foreign keys',
                                'Triggers',
zYne's avatar
zYne committed
534
                            ),
zYne's avatar
zYne committed
535 536 537 538
                            'Data manipulation' => array(
                                'INSERT queries',
                                'UPDATE queries',
                                'DELETE queries',
zYne's avatar
zYne committed
539
                            ),
zYne's avatar
zYne committed
540 541 542
                            'Indexes' => array(
                                'General tips',
                                'Using compound indexes',
zYne's avatar
zYne committed
543
                            ),
zYne's avatar
zYne committed
544 545 546 547
                            'Transactions' => array(
                                'General tips',
                                'Locks',
                                'Isolation',
zYne's avatar
zYne committed
548
                            ),
zYne's avatar
zYne committed
549 550
                            'Data fetching' => array(
                                'General tips',
zYne's avatar
zYne committed
551
                            ),
zYne's avatar
zYne committed
552
                            'Normalization' => array(
zYne's avatar
zYne committed
553 554

                            ),
zYne's avatar
zYne committed
555 556
                            'Caching' => array(
                                'General tips'
zYne's avatar
zYne committed
557
                            ),
zYne's avatar
zYne committed
558
                            'Performance monitoring' => array( 'Using the database profiler') 
zYne's avatar
zYne committed
559 560
                            
                            ),
zYne's avatar
zYne committed
561
            */
zYne's avatar
zYne committed
562 563 564 565
            'Connection modules' => array(
                            'Export' => array('Introduction',
                                              'Creating new table',
                                              'Altering table'
zYne's avatar
zYne committed
566
                                              ),
zYne's avatar
zYne committed
567 568 569 570
                            'Import'    => array('Introduction',
                                                 'Getting table info',
                                                 'Getting foreign key info',
                                                 'Getting view info',
zYne's avatar
zYne committed
571
                                                ),
zYne's avatar
zYne committed
572 573 574 575
                            'Util'      => array('Using explain'),
                            'DataDict'  => array('Getting portable type',
                                                'Getting database declaration',
                                                'Reserved keywords'),
zYne's avatar
zYne committed
576
                            ),
zYne's avatar
zYne committed
577 578 579 580 581 582
            'Drivers' =>
                array('Oracle' 
                            => array('Making unsuported functions work'),
                      'Mysql' 
                            => array('Tips and tricks'),
                      ),
zYne's avatar
zYne committed
583 584 585 586 587 588 589 590 591
            'Technology' => array(
                'Architecture',
                'Design patterns used',
                'Speed',
                'Internal optimizations' =>

                        array('DELETE',
                              'INSERT',
                              'UPDATE'),
592
                ),
zYne's avatar
zYne committed
593
            'Real world examples' => array('User management system','Forum application','Album lister'),
594
            
zYne's avatar
zYne committed
595 596
            'Coding standards' => array(
                            'Overview' => 
597
                                array(
zYne's avatar
zYne committed
598 599
                                    'Scope',
                                    'Goals'
600
                                    ),
zYne's avatar
zYne committed
601 602 603 604 605
                            'PHP File Formatting' => array(
                                    'General',
                                    'Indentation',
                                    'Maximum line length',
                                    'Line termination'
606 607
                                    ),

zYne's avatar
zYne committed
608 609 610 611 612 613 614 615
                            'Naming Conventions' => array(
                                    'Classes',
                                    'Interfaces',
                                    'Filenames',
                                    'Functions and methods',
                                    'Variables',
                                    'Constants',
                                    'Record columns',
616 617 618
                                    ),


zYne's avatar
zYne committed
619 620 621 622 623 624 625 626
                            'Coding Style' => array(
                                    'PHP code demarcation',
                                    'Strings',
                                    'Arrays',
                                    'Classes',
                                    'Functions and methods',
                                    'Control statements',
                                    'Inline documentation'
627
                                    ),
zYne's avatar
zYne committed
628 629 630
                            'Testing' => array(
                                    'Writing tests',
                                ))
631 632
            );

runa's avatar
runa committed
633
$title = '';
634 635 636
if (!empty($_REQUEST['index'])){
	$ex = explode(".",$_REQUEST["index"]);
	$paths = array2path($menu);
runa's avatar
runa committed
637 638 639 640 641 642 643 644
	if( isset($paths[$ex[0]])){
		$currIndex = '';
		for($i=0; $i<count($ex); $i++){
			if ($currIndex) {$currIndex.=".";}
			$currIndex .= $ex[$i]; 
			if (!isset($paths[$currIndex])){ break; }
			$title .= " - ". $paths[$currIndex];
		}
645 646 647
	}
}
include("top.php");
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665

?>


<table width="100%" cellspacing=0 cellpadding=0>
    <tr>
        <td width=50>
        <td>
        <td align="left" valign="top">
            <table width="100%" cellspacing=1 cellpadding=1>
            <tr>
                <td colspan=2 bgcolor="white">
                <img src="images/logo.jpg" align="left"><b class="title">Doctrine - PHP Data Persistence and ORM Tool</b>
                <hr>
                </td>
            </tr>
            <tr>
                <td bgcolor="white" valign="top">
zYne's avatar
zYne committed
666

667 668 669 670 671 672
                <?php
                if( ! isset($_REQUEST["index"])) {
                $i = 1;
                $missing = array();
                $missing[0] = 0;
                $missing[1] = 0;
zYne's avatar
zYne committed
673
                print "<dl>\n";
674
                foreach($menu as $title => $titles) {
zYne's avatar
zYne committed
675 676
                    print "<dt>" . $i . ". <a href=\"".$_SERVER['PHP_SELF']."?index=$i#$i\">".$title."</a></dt>\n";
                    print "<dd><dl>";
677 678 679 680
                    $i2 = 1;
                    foreach($titles as $k => $t) {
                        $e = "$i.".$i2."";
                        if(is_array($t)) {
zYne's avatar
zYne committed
681
                            print "<dt>".$e." <a href=\"".$_SERVER['PHP_SELF']."?index=$i.$i2#$e\">".$k."</a><dt>\n";
682 683

                            $i3 = 1;
zYne's avatar
zYne committed
684
                            print "<dd><dl>";
685 686 687 688 689
                            foreach($t as $k2 => $v2) {
                                $str = "";
                                if( ! file_exists("docs/$title - $k - $v2.php")) {
                                    $missing[0]++;
                                    $str .= " [ <font color='red'>doc</font> ] ";
690
                                    //touch("docs/$title - $k - $v2.php");
691 692 693 694
                                }
                                if( ! file_exists("codes/$title - $k - $v2.php")) {
                                    $missing[1]++;
                                    $str .= " [ <font color='red'>code</font> ] ";
695
                                    //touch("codes/$title - $k - $v2.php");
696 697 698 699

                                }

                                $e = implode(".",array($i,$i2,$i3));
zYne's avatar
zYne committed
700
                                print "<dt>".$e." <a href=\"".$_SERVER['PHP_SELF']."?index=$i.$i2#$e\">".$v2."</a></dt>\n";
701 702
                                $i3++;
                            }
zYne's avatar
zYne committed
703 704
                            print "</dl></dd>";

705 706 707 708 709
                        } else {
                            $str = "";
                            if( ! file_exists("docs/$title - $t.php")) {
                                $missing[0]++;
                                $str .= " [ <font color='red'>doc</font> ] ";
710
                                //touch("docs/$title - $t.php");
711 712 713 714
                            }
                            if( ! file_exists("codes/$title - $t.php")) {
                                $missing[1]++;
                                $str .= " [ <font color='red'>code</font> ] ";
715
                                //touch("codes/$title - $t.php");
716
                            }
zYne's avatar
zYne committed
717
                            print "<dt>".$e." <a href=\"".$_SERVER['PHP_SELF']."?index=$i#$e\">".$t."</a></dt>\n";
718 719
                        }
                        $i2++;
zYne's avatar
zYne committed
720

721 722
                    }
                    $i++;
zYne's avatar
zYne committed
723
                    print "</dl></dd>";
724
                }
zYne's avatar
zYne committed
725 726
                print "</dl>\n";

727 728
                } else {
                    $i = 1;
729
                    // $paths was generated before, to display a correct document title
730 731 732 733 734
                    if( ! isset($paths[$ex[0]]))
                        exit;

                    $break = false;
                    $tmp   = $paths;
zYne's avatar
zYne committed
735

736 737 738 739 740 741
                    foreach($tmp as $path => $title) {
                        $e = explode(".", $path);
                        if(count($e) > 2) {
                            unset($tmp[$path]);
                        }
                    }
zYne's avatar
zYne committed
742

743
                    $prev = 1;
zYne's avatar
zYne committed
744
                    
745 746 747 748
                    foreach($tmp as $path => $title) {
                        if($break)
                            break;

zYne's avatar
zYne committed
749
                        if($path === $_REQUEST["index"]) {
750 751 752 753 754
                            $break = true;
                        } else {
                            $prev = $path;
                        }
                    }
zYne's avatar
zYne committed
755

756
                    $index = $_REQUEST['index'];
zYne's avatar
zYne committed
757

758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808
                    print "<table width='100%'>";
                    print "<tr><td colspan=3 align='center'><b></td></tr>";
                    print "<tr><td colspan=3 align='center'><b class='title'>".$paths[$ex[0]]."</b></td></tr>";
                    print "<tr><td align='left'><b><a href=documentation.php?index=$prev>Prev</a></b></td>";
                    print "<td align='right'><b><a href=documentation.php?index=$path>Next</a></b></td></tr>";
                    print "<tr><td>&nbsp;</td></tr>";
                    print "</table>";


                 $tmp = $ex;
                    if(count($tmp) > 2) {
                        //array_pop($tmp);
                    }
                    foreach($tmp as $k => $v) {
                        $numbers[] = $v;
                        $curr = implode(".",$numbers);
                        $stack[] = $paths[$curr];
                    }
                    if(isset($ex[1])) {
                        $name = implode(" - ", $stack);

                        print "<a name='$path'><b class='title'>".$paths[$curr]."</b></a><hr>";

                        $n = $numbers;

                        $o = $paths[$n[0]];
                        $numpath  = implode(".", array($n[0], $n[1]));
                        $o2 = $paths[$numpath];

                        $value = $menu[$o];
                        if( ! is_array($value))
                            exit;


                        if(in_array($o2, $value)) {
                            render_block($name);
                        } else {
                            $value = $menu[$o][$o2];

                            if(is_array($value)) {
                                foreach($value as $k => $title) {
                                    $numpath2 = $numpath . '.' . ($k + 1);
                                    print "<br \><a name='".$numpath2."'><b class='title'>".$title."</b></a><hr style='height: 1px' \>";

                                    $s = $name." - ".$title;

                                    render_block($s);
                                }
                            }
                        }
                    } else {
zYne's avatar
zYne committed
809

810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888
                        $tmp = $paths[$ex[0]];
                        $i = 1;
                        foreach($menu[$tmp] as $title => $value) {
                            $n = $ex[0].".".$i;

                            if(is_scalar($value)) {
                                print "<dd>".$n.". <a href=\"documentation.php?index=".$n."\">".$value."</a><br \>\n";
                            } else {
                                print "<dd>".$n.". <a href=\"documentation.php?index=".$n."\">".$title."</a><br \>\n";
                            }
                            $i++;
                        }
                    }
                    }
                ?>
                <td bgcolor="white" align="left" valign="top" width=300>
                <?php
                    $i = 1;
                    print "<dd>-- <b><a href=documentation.php>index</a></b><br>\n";
                    foreach($menu as $title => $titles) {
                        print "<dd>".$i.". <a href=\"".$_SERVER['PHP_SELF']."?index=$i\">".$title."</a><br>\n";
                        $i++;
                    }
                ?>
                </td>
            <td>
            <tr>
            <td bgcolor="white" valign="top" colspan="2">
            <?php






            /**
            foreach($menu as $title => $titles) {
                if($i == $ex[0]) {

                print $i.". <b><a class=\"big\" name=\"$i\">".$title."</a></b><hr><br>\n";
                    $i2 = 1;
                    foreach($titles as $k => $t) {
                        $e = "$i.".$i2;

                        if(is_array($t)) {
                            $tmp = "$title - $k";

                            if( ! isset($ex[1]) || $i2 != $ex[1]) {
                                $i2++;
                                continue;
                            }

                            print $e." <b><a class=\"big\" name=\"$e\">".$k."</a></b><hr><br><br>\n";
                            foreach($t as $k2 => $t2) {
                                if( ! isset($ex[1]) || $i2 != $ex[1])
                                    break;
                                $e = "$i.".$i2.".".($k2+1);
                                render($tmp,$t2,$e);
                            }
                        } else {
                            if( ! isset($ex[1])) {
                                render($title,$t,$e);
                            }
                        }
                        $i2++;
                    }
                }
                $i++;

            }
            */
            ?>
            </td>
            </tr>
        </td>
        <td>
        </td>
    </tr>
</table>