Plugin Directory

Changeset 634007


Ignore:
Timestamp:
12/04/2012 02:08:09 PM (13 years ago)
Author:
raido357
Message:

getLearningResource html method

Location:
dippler/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • dippler/trunk/classes/dippler-html-builder.php

    r633980 r634007  
    289289   
    290290    function getResourceFolder() {
    291         global $dipplerWP;
    292291
    293292        /* Load resources and print the table */
     
    295294        $rootFolder= $resources->getResourceFolder( DipplerUtils::getResourceID() );
    296295       
     296        self::getResourceTableHead( $rootFolder );
     297       
     298        echo '<tbody>';
     299        if ( $rootFolder && $rootFolder->hasResources() ) {
     300            echo $resources->buildHTML( $rootFolder );
     301        } else {
     302            echo '<tr><td colspan="4">'.__( 'No learning resources added', self::getTextdomain() ).'</td></tr>';
     303        }
     304        echo '</tbody>';
     305        echo '</table>';
     306    }
     307   
     308    /*
     309     * Print resource page
     310     */
     311   
     312    function getLearningResources() {
     313        $title = __( 'Learning resources', self::getTextdomain() );
     314        self::getResourceTableHead( $title );
     315       
     316        /* Load resources and print the table */
     317        $resources= new DipplerLearningResources();
     318        $rootFolder= $resources->getRootFolder();
     319       
     320        if ( $rootFolder->hasResources() ) {
     321            echo $resources->buildHTML( $rootFolder );
     322        } else {
     323            echo '<tr><td colspan="4">'.__( 'No learning resources added', self::getTextdomain() ).'</td></tr>';
     324        }
     325       
     326        echo '</tbody>';
     327        echo '</table>';
     328    }
     329   
     330    /*
     331     * Helper method for learning resources table head
     332     */
     333   
     334    private static function getResourceTableHead( $resource ) {
    297335        echo '<h2 style="font-weight: bold;">';
    298             if ( $rootFolder ) {
    299                 echo $rootFolder->getTitle();
     336            if ( $resource ) {
     337                if ( is_object( $resource ) ) {
     338                    echo $resource->getTitle();
     339                } else {
     340                    echo $resource;
     341                }
    300342            } else {
    301                 _e( 'No such folder', self::getTextdomain() );
     343                _e( 'No such resource', self::getTextdomain() );
    302344            }
    303345        echo '</h2>';
     
    311353        echo '</tr>';
    312354        echo '</thead>';
    313         echo '<tbody>';
    314         if ( $rootFolder && $rootFolder->hasResources() ) {
    315             echo $resources->buildHTML( $rootFolder );
    316         } else {
    317             echo '<tr><td colspan="4">'.__( 'No learning resources added', self::getTextdomain() ).'</td></tr>';
    318         }
    319         echo '</tbody>';
    320         echo '</table>';
    321355    }
    322356}
  • dippler/trunk/themes/twentyeleven_dippler/dippler-resources-page.php

    r628932 r634007  
    99
    1010get_header();
    11 global $dipplerWP;
    1211?>
    1312
    1413        <div id="primary">
    1514            <div id="content" role="main">
    16                 <h2 style="font-weight: bold;">
    17                 <?php _e( 'Learning resources', $dipplerWP->getTextdomain() ); ?>
    18                 </h2>
    19                 <table style="width: 100%; font-size: .85em;" class="dippler-learning-resource">
    20                     <thead style="background-color: #ccc">
    21                         <tr>
    22                             <th style="width: 25px"><!-- for image --></th>
    23                             <th><?php _e( 'Title', $dipplerWP->getTextdomain() ); ?></th>
    24                             <th style="width: 100px"><?php _e( 'Author', $dipplerWP->getTextdomain() ); ?></th>
    25                             <th style="width: 160px"><?php _e( 'Published', $dipplerWP->getTextdomain() ); ?></th>
    26                         </tr>
    27                     </thead>
    28                     <tbody>
    29                 <?php
    30                
    31                 /* Load resources and print the table */
    32                 $resources= new DipplerLearningResources();
    33                 $rootFolder= $resources->getRootFolder();
    34                
    35                 if ( $rootFolder->hasResources() ) {
    36                     echo $resources->buildHTML( $rootFolder );
    37                 } else {
    38                     echo '<tr><td colspan="4">'.__( 'No learning resources added', $dipplerWP->getTextdomain() ).'</td></tr>';
    39                 }
    40                 ?>
    41                     </tbody>
    42                 </table>
     15                <?php DipplerHTML::getLearningResources(); ?>
    4316            </div><!-- #content -->
    4417        </div><!-- #primary -->
  • dippler/trunk/themes/twentyten_dippler/dippler-resources-page.php

    r629015 r634007  
    99
    1010get_header();
    11 global $dipplerWP;
    1211?>
    1312
    1413        <div id="container">
    1514            <div id="content" role="main">
    16                 <h2 style="font-weight: bold;">
    17                 <?php _e( 'Learning resources', $dipplerWP->getTextdomain() ); ?>
    18                 </h2>
    19                 <table style="width: 100%; font-size: .85em;" class="dippler-learning-resource">
    20                     <thead style="background-color: #ccc">
    21                         <tr>
    22                             <th style="width: 25px"><!-- for image --></th>
    23                             <th><?php _e( 'Title', $dipplerWP->getTextdomain() ); ?></th>
    24                             <th style="width: 100px"><?php _e( 'Author', $dipplerWP->getTextdomain() ); ?></th>
    25                             <th style="width: 160px"><?php _e( 'Published', $dipplerWP->getTextdomain() ); ?></th>
    26                         </tr>
    27                     </thead>
    28                     <tbody>
    29                 <?php
    30                
    31                 /* Load resources and print the table */
    32                 $resources= new DipplerLearningResources();
    33                 $rootFolder= $resources->getRootFolder();
    34                
    35                 if ( $rootFolder->hasResources() ) {
    36                     echo $resources->buildHTML( $rootFolder );
    37                 } else {
    38                     echo '<tr><td colspan="4">'.__( 'No learning resources added', $dipplerWP->getTextdomain() ).'</td></tr>';
    39                 }
    40                 ?>
    41                     </tbody>
    42                 </table>
     15                <?php DipplerHTML::getLearningResources(); ?>
    4316            </div><!-- #content -->
    4417        </div><!-- #primary -->
  • dippler/trunk/themes/twentytwelve_dippler/dippler-resources-page.php

    r633418 r634007  
    99
    1010get_header();
    11 global $dipplerWP;
    1211?>
    1312
    1413        <div id="primary" class="site-content">
    1514            <div id="content" role="main">
    16                 <h2 style="font-weight: bold;">
    17                 <?php _e( 'Learning resources', $dipplerWP->getTextdomain() ); ?>
    18                 </h2>
    19                 <table style="width: 100%; font-size: .85em;" class="dippler-learning-resource">
    20                     <thead style="background-color: #ccc">
    21                         <tr>
    22                             <th style="width: 25px"><!-- for image --></th>
    23                             <th><?php _e( 'Title', $dipplerWP->getTextdomain() ); ?></th>
    24                             <th style="width: 100px"><?php _e( 'Author', $dipplerWP->getTextdomain() ); ?></th>
    25                             <th style="width: 160px"><?php _e( 'Published', $dipplerWP->getTextdomain() ); ?></th>
    26                         </tr>
    27                     </thead>
    28                     <tbody>
    29                 <?php
    30                
    31                 /* Load resources and print the table */
    32                 $resources= new DipplerLearningResources();
    33                 $rootFolder= $resources->getRootFolder();
    34                
    35                 if ( $rootFolder->hasResources() ) {
    36                     echo $resources->buildHTML( $rootFolder );
    37                 } else {
    38                     echo '<tr><td colspan="4">'.__( 'No learning resources added', $dipplerWP->getTextdomain() ).'</td></tr>';
    39                 }
    40                 ?>
    41                     </tbody>
    42                 </table>
     15                <?php DipplerHTML::getLearningResources(); ?>
    4316            </div><!-- #content -->
    4417        </div><!-- #primary -->
Note: See TracChangeset for help on using the changeset viewer.