From: Ben H. <bdv...@us...> - 2010-11-22 23:06:02
|
Update of /cvsroot/stack/stack-dev/lib/blocks In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29766/lib/blocks Added Files: Tag: question_reporting BlockInterface.php Log Message: Merging from the current HEAD into question_reporting. Apologies in advance if this all goes horribly wrong. --- NEW FILE: BlockInterface.php --- <?php /** * * Welcome to STACK. A system for teaching and assessment using a * computer algebra kernel. * * This file is licensed under the GPL License. * * A copy of the license is in your STACK distribution called * license.txt. If you are missing this file you can obtain * it from: * http://www.stack.bham.ac.uk/license.txt * * * @author Matti Harjula * */ require_once("../ui/BlockHandler.php"); /** * Block class "interface". All blocks must implement this "interface". All blocks * must also be stored in /lib/blocks/active/ and named as *Block and placed in * files named *Block.php */ abstract class BlockInterface { /** * Returns the possible identifiers of "pseudo-blocks" that should be * ignored by the parser when inside this type of an block. * * This is used to define substructure for blocks using the same block-syntax * as with real blocks. The main example is the if-else-if: * {% if something %} * {% else %} <= That is not a start tag for an else-block it is just * internal structure of the if block and the parser should * ignore it. Naturally, should it exist somewhere where it is * not a direct child of an if-block it must be considered as * a syntax error. * {% end if %} * * Returns an empty array or false if no identifiers are needed. * * @return array of strings e.g. array("else") for the if-else-if block */ abstract public function getSubBlockIdentifiers(); /** * Returns the identifier of this block. If this is a "for"-block we return * "for". * * @return string */ abstract public function getBlockIdentifier(); /** * Processes the blocks contents. Then returns the processed contents. * * @param string $blockContent * @param array $blockVars Maxima strings of the evaluated variables * @param object $casTextHandler can be used to evaluate the content of this * block if needed. May be needed when block needs to act on the * real contents of the block. For example when the contents of this * block are used as the source code for something it may be necessary * evaluate possible if and for blocks beforehand. * * * * @return string the processed string that replaces the original content * of this block */ abstract public function processBlock($blockContent,$blockVars,$casTextHandler); } ?> |