steffen: server/kolab-horde-framework/kolab-horde-framework/Block Block.php, NONE, 1.1 package.xml, NONE, 1.1

cvs at intevation.de cvs at intevation.de
Fri Oct 14 16:33:05 CEST 2005


Author: steffen

Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Block
In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Block

Added Files:
	Block.php package.xml 
Log Message:
Separated Horde Framework from kolab-resource-handlers

--- NEW FILE: Block.php ---
<?php
/**
 * The abstract Horde_Block:: class represents a single block within
 * the Blocks framework.
 *
 * $Horde: framework/Block/Block.php,v 1.29 2004/05/29 16:31:51 jan Exp $
 *
 * Copyright 2003-2004 Mike Cochrane <mike at graftonhall.co.nz>
 * Copyright 2003-2004 Jan Schneider <jan at horde.org>
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 *
 * @author  Mike Cochrane <mike at graftonhall.co.nz>
 * @author  Jan Schneider <jan at horde.org>
 * @version $Revision: 1.1 $
 * @since   Horde 3.0
 * @package Horde_Block
 */
class Horde_Block {

    /**
     * Block specific parameters.
     *
     * @var array $_params
     */
    var $_params = array();

    /**
     * Application that this block originated from.
     *
     * @var string $_app
     */
    var $_app;

    /**
     * Constructor.
     *
     * @param array $params  Any parameters the block needs.
     */
    function Horde_Block($params = array()) 
    {
        $this->_params = $params;
    }

    /**
     * Returns the application that this block belongs to.
     *
     * @return string  The application name.
     */
    function getApp()
    {
        return $this->_app;
    }

    /**
     * Returns any settable parameters for this block. This is a
     * static method. It does *not* reference $this->_params; that is
     * for runtime parameters (the choices made from these options).
     *
     * @static
     *
     * @return array  The block's configurable parameters.
     */
    function getParams()
    {
        return array();
    }

    /**
     * Returns the text to go in the title of this block.
     *
     * This function handles the changing of current application as needed
     * so code is executed in the scope of the application the block
     * originated from.
     *
     * @return string  The title text
     */
    function getTitle()
    {
        global $registry;

        /* Switch application contexts, if necessary. Return an
         * error immediately if pushApp() fails. */
        $pushed = $registry->pushApp($this->_app);
        if (is_a($pushed, 'PEAR_Error')) {
            return $pushed->getMessage();
        }

        $title = $this->_title();

        /* If we changed application context in the course of this
         * call, undo that change now. */
        if ($pushed === true) {
            $registry->popApp();
        }

        return $title;
    }

    /**
     * Returns the content for this block.
     *
     * This function handles the changing of current application as needed
     * so code is executed in the scope of the application the block
     * originated from.
     *
     * @return string  The content
     */
    function getContent()
    {
        global $registry;

        /* Switch application contexts, if necessary. Return an error
         * immediately if pushApp() fails. */
        $pushed = $registry->pushApp($this->_app);
        if (is_a($pushed, 'PEAR_Error')) {
            return $pushed->getMessage();
        }

        $content = $this->_content();

        /* If we changed application context in the course of this
         * call, undo that change now. */
        if ($pushed === true) {
            $registry->popApp();
        }

        return $content;
    }

    /**
     * The title to go in this block.
     * This function should be defined in all subclasses of this class.
     *
     * @abstract
     * @return string   The title text.
     */
    function _title()
    {
        return 'No title';
    }

    /**
     * The content to go in this block.
     * This function should be defined in all subclasses of this class.
     *
     * @abstract
     * @return string   The content
     */
    function _content()
    {
        return 'No content';
    }

}

--- NEW FILE: package.xml ---
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- $Horde: framework/Block/package.xml,v 1.1 2004/02/14 00:25:13 chuck Exp $ -->
<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.1">
<package version="1.0">
  <name>Horde_Block</name>
  <summary>Horde Block API</summary>
  <description>
    The Horde_Block API provides a mechanism for displaying content
    blocks from numerous Horde applications or other sources,
    manipulating those blocks, configuring them, etc.
  </description>
  <license>LGPL</license>

  <maintainers>
    <maintainer>
      <user>chuck</user>
      <role>lead</role>
      <name>Chuck Hagenbuch</name>
      <email>chuck at horde.org</email>
    </maintainer>
    <maintainer>
      <user>jan</user>
      <role>lead</role>
      <name>Jan Schneider</name>
      <email>jan at horde.org</email>
    </maintainer>
  </maintainers>

  <release>
    <version>0.0.1</version>
    <state>alpha</state>
    <date>2004-02-13</date>
    <notes>Initial packaging</notes>

    <filelist>
      <file baseinstalldir="/Horde" role="php" name="Block.php" />
      <dir baseinstalldir="/Horde" name="Block" role="php">
        <file name="Collection.php" />
        <file name="Layout.php" />
        <file name="UI.php" />
      </dir>
    </filelist>

    <provides type="class" name="Horde_Block" />
    <provides type="class" name="Horde_Block_Collection" />
    <provides type="class" name="Horde_Block_Layout" />
    <provides type="class" name="Horde_Block_UI" />

    <deps>
      <dep type="ext" rel="has" optional="yes">gettext</dep>
      <dep type="pkg" rel="has">Horde_Framework</dep>
      <dep type="pkg" rel="has">Horde_Util</dep>
    </deps>
  </release>

  <changelog>
    <release>
      <version>0.0.1</version>
      <state>alpha</state>
      <date>2004-02-13</date>
      <notes>Initial packaging</notes>
    </release>
  </changelog>
</package>





More information about the commits mailing list