Xaraya / Postnuke CVS Notices - Message

Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites

View Statistics - Next Notice - Previous Notice

Directory filter : [ all ] / postnuke_official / html / modules / example / pnblocks [ view in CVS ]


Deprecated: Function gmstrftime() is deprecated in /home/mikespub/www/list.php on line 509
Date Directory [filter] File(s) [view] Author [filter]
07 Aug 2002 01:32:30postnuke_official/html/modules/example/pnblocksfirst.php,NONE,1.1Mike
 "new" example module

Update of /home/cvsroot/postnuke_official/html/modules/example/pnblocks
In directory ns7.hostnuke.net:/tmp/cvs-serv22416/pnblocks

Added Files:
	first.php 
Log Message:
"new" example module


--- NEW FILE: first.php ---
<?php // $Id: first.php,v 1.1 2002/08/07 01:32:28 mikespub Exp $
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// PostNuke Content Management System
// Copyright (C) 2002 by the PostNuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// 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.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Jim McDonald
// Purpose of file: Example Block
// ----------------------------------------------------------------------

/**
 * initialise block
 */
function example_firstblock_init()
{
    // Security
    pnSecAddSchema('Example:Firstblock:', 'Block title::');
}

/**
 * get information on block
 */
function example_firstblock_info()
{
    // Values
    return array('text_type' => 'First',
                 'module' => 'example',
                 'text_type_long' => 'Show first example items (alphabetical)',
                 'allow_multiple' => true,
                 'form_content' => false,
                 'form_refresh' => false,
                 'show_preview' => true);
}

/**
 * display block
 */
function example_firstblock_display($blockinfo)
{
    // Security check
    if (!pnSecAuthAction(0,
                         'Example:Firstblock:',
                         "$blockinfo[title]::",
                         ACCESS_READ)) {
        return;
    }

    // Get variables from content block
    $vars = @unserialize($blockinfo['content']);

    // Defaults
    if (empty($vars['numitems'])) {
        $vars['numitems'] = 5;
    }

    // Database information
    pnModDBInfoLoad('example');
    list($dbconn) = pnDBGetConn();
    $pntable =pnDBGetTables();
    $exampletable = $pntable['example'];

    // Query
    $sql = "SELECT pn_exid,
                   pn_name
            FROM $exampletable
            ORDER by pn_name";
    $result = $dbconn->SelectLimit($sql, $vars['numitems']);

    if ($dbconn->ErrorNo() != 0) {
        return;
    }

    if ($result->EOF) {
        return;
    }
    // Create output object
    $output = new pnHTML();

    // Display each item, permissions permitting
    for (; !$result->EOF; $result->MoveNext()) {
        list($exid, $name) = $result->fields;

        if (pnSecAuthAction(0,
                            'Example::',
                            "$name::$exid",
                            ACCESS_OVERVIEW)) {
            if (pnSecAuthAction(0,
                                'Example::',
                                "$name::$exid",
                                ACCESS_READ)) {
                $output->URL(pnModURL('example',
                                      'user',
                                      'display',
                                      array('exid' => $exid)),
                             $name);
            } else {
                $output->Text($name);
            }
            $output->Linebreak();
        }

    }
    $output->Linebreak();

// TODO: shouldn't this stuff be BL-able too ??
// Besides the fact that title & content are placed according to some
// master block template, why can't we create content via BL ?

    // Populate block info and pass to theme
    $blockinfo['content'] = $output->GetOutput();
    return $blockinfo;
}


/**
 * modify block settings
 */
function example_firstblock_modify($blockinfo)
{
    // Create output object
    $output = new pnHTML();

    // Get current content
    $vars = @unserialize($blockinfo['content']);

    // Defaults
    if (empty($vars['numitems'])) {
        $vars['numitems'] = 5;
    }

    // Create row
    $row = array();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $row[] = $output->Text(_NUMITEMS);
    $row[] = $output->FormText('numitems',
                               pnVarPrepForDisplay($vars['numitems']),
                               5,
                               5);
    $output->SetOutputMode(_PNH_KEEPOUTPUT);

    // Add row
    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->TableAddRow($row, 'left');
    $output->SetInputMode(_PNH_PARSEINPUT);

    // Return output
    return $output->GetOutput();
}

/**
 * update block settings
 */
function example_firstblock_update($blockinfo)
{
    $vars['numitems'] = pnVarCleanFromInput('numitems');

    $blockinfo['content'] = serialize($vars);

    return $blockinfo;
}

/**
 * built-in block help/information system.
 */
function example_firstblock_help()
{
    $output = new pnHTML();

    $output->SetInputMode(_PNH_VERBATIMINPUT);
    $output->Text('Any related block info should be placed in your modname_blocknameblock_help() function.');
    $output->LineBreak(2);
    $output->Text('More information.');
    $output->SetInputMode(_PNH_PARSEINPUT);

    return $output->GetOutput();
}
?>


Directory filter : [ all ] / postnuke_official / html / modules / example / pnblocks [ view in CVS ]

View Statistics - Next Notice - Previous Notice


Visit Developer Site - Browse CVS Repository Syndicate via backend.rss
(max. once per hour please)
Powered by CVSNotice 0.1.3