All pastes #390739 Raw Edit

dwees

public text v1 · immutable
·published 2007-03-11 17:22 UTC
rendered paste body
.info
; $Id$
name = Form tables
description = Adds a built-in theming function for the FORMS API.



.module
<?php 
/**include('sites/deityproject/scripts/parser.php');**/
/**
* Display help and module information
* @param section which section of the site we're displaying help
* @return help text for section
*/
function library_help($section='') {

  $output = '';
    switch ($section) {

        case "admin/helplibrary":

              $output = '<p>'.  t("Displays a list of chapters from a given textfile book (siddhartha)"). '</p>';

        break;

      }

 

    return $output;

} // function library_help


/**

* Valid permissions for this module

* @return array An array of valid permissions for library module

*/

 

function library_perm() {

 

  return array('access library content');

 

} // function library_perm()

/**

* Generate HTML for the library block

* @param op the operation from the URL

* @param delta offset

* @returns block HTML

*/

 

function library_block($op='list', $delta=0) {

 

  // listing of blocks, such as on the admin/block page

    if ($op == "list") {

      $block[0]["info"] = t('Library');

      return $block;

    }

 

} // end library_block



function library_all() {

/** $page_content variable that will be returned for display **/

/** check to see if there was any content before **/

/** setting up the block **/

 

$page_content = '';

 

$arr_content = drupal_library_extract_chapters('siddhartha.txt');

 

for each $arr_content as $chapter:

    $page_content .= ('<div>' .$chapter .'</div>');

endforeach;

 

 if ($page_content == '') {

  $page_content = "No content to display.";

  }

 

  print theme("page", $page_content);

 

}


function library_menu() {

 

  $items = array();

 

/** first we set up the administrations menu $items **/

 

/**      $items[] = array(

*      'path' => 'admin/settings/library',

*      'callback' => 'drupal_get_form',

*      'callback arguments' => 'library_admin',

*      'access' => user_access('access administration pages'),

*      'type' => MENU_NORMAL_ITEM,

*     );

**/

 

/** then we set up the user access  **/

 

    $items[] = array(

     'path' => 'library',

     'title' => t('library'),

     'callback' => 'library_all',

     'access' => user_access('access content'),

     'type' => MENU_NORMAL_ITEM

   );

 

     return $items;

} 
?>