Zikula_System_Modules
[ class tree: Zikula_System_Modules ] [ index: Zikula_System_Modules ] [ all elements ]

Source for file xslt.php

Documentation is available at xslt.php

  1. <?php
  2. /**
  3.  * Zikula Application Framework
  4.  * @copyright (c) 2001, Zikula Development Team
  5.  * @link http://www.zikula.org
  6.  * @version $Id: html.php 20806 2006-12-19 13:46:28Z markwest $
  7.  * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
  8.  * @package Zikula_System_Modules
  9.  * @subpackage Blocks
  10.  * @author Mark West
  11.  */
  12.  
  13. /**
  14.  * initialise block
  15.  *
  16.  * @author       The Zikula Development Team
  17.  */
  18. {
  19.     // Security
  20.     pnSecAddSchema('xsltblock::''Block title::');
  21. }
  22.  
  23. /**
  24.  * get information on block
  25.  *
  26.  * @author       The Zikula Development Team
  27.  * @return       array       The block information
  28.  */
  29. {
  30.     return array('text_type'       => 'XSLT',
  31.                  'module'          => 'Blocks',
  32.                  'text_type_long'  => 'XSLT',
  33.                  'allow_multiple'  => true,
  34.                  'form_content'    => false,
  35.                  'form_refresh'    => false,
  36.                  'show_preview'    => true,
  37.                  'admin_tableless' => true);
  38. }
  39.  
  40. /**
  41.  * display block
  42.  *
  43.  * @author       The Zikula Development Team
  44.  * @param        array       $blockinfo     a blockinfo structure
  45.  * @return       output      the rendered bock
  46.  */
  47. function Blocks_xsltblock_display($blockinfo)
  48. {
  49.     if (!SecurityUtil::checkPermission('xsltblock::'"$blockinfo[title]::"ACCESS_OVERVIEW)) {
  50.         return;
  51.     }
  52.  
  53.     // Get our block vars
  54.     $vars pnBlockVarsFromContent($blockinfo['content']);
  55.     if ( (!isset($vars['docurl']|| !isset($vars['styleurl'])) &&     
  56.          (!isset($vars['doccontents']|| !isset($vars['stylecontents']))) {
  57.         return;
  58.     }
  59.  
  60.     // create new objects
  61.     $doc new DOMDocument();
  62.     $xsl new XSLTProcessor();
  63.  
  64.     // load stylesheet
  65.     if (isset($vars['styleurl']&& !empty($vars['styleurl'])) {
  66.         $doc->load($vars['styleurl']);
  67.     else {
  68.         $doc->loadXML($vars['stylecontents']);
  69.     }
  70.     $xsl->importStyleSheet($doc);
  71.  
  72.     // load xml source
  73.     if (isset($vars['docurl']&& !empty($vars['docurl'])) {
  74.         $doc->load($vars['docurl']);
  75.     else {
  76.         $doc->loadXML($vars['doccontents']);
  77.     }
  78.  
  79.     // apply stylesheet and return output
  80.     $blockinfo['content'$xsl->transformToXML($doc);
  81.     return pnBlockThemeBlock($blockinfo);
  82. }
  83.  
  84. /**
  85.  * modify block settings
  86.  *
  87.  * @author       The Zikula Development Team
  88.  * @param        array       $blockinfo     a blockinfo structure
  89.  * @return       output      the bock form
  90.  */
  91. function Blocks_xsltblock_modify($blockinfo)
  92. {
  93.     // Get our block vars
  94.     $vars pnBlockVarsFromContent($blockinfo['content']);
  95.  
  96.     // Create output object
  97.     $pnRender pnRender::getInstance('Blocks'false);
  98.  
  99.     // assign our block vars
  100.     $pnRender->assign($vars);
  101.  
  102.     // return the output
  103.     return $pnRender->fetch('blocks_block_xslt_modify.htm');
  104. }
  105.  
  106. /**
  107.  * update block settings
  108.  *
  109.  * @author       The Zikula Development Team
  110.  * @param        array       $blockinfo     a blockinfo structure
  111.  * @return       $blockinfo  the modified blockinfo structure
  112.  */
  113. function Blocks_xsltblock_update($blockinfo)
  114. {
  115.     $vars['docurl'FormUtil::getPassedValue('docurl''''POST');
  116.     $vars['styleurl'FormUtil::getPassedValue('styleurl''''POST');
  117.     $vars['doccontents'FormUtil::getPassedValue('doccontents''''POST');
  118.     $vars['stylecontents'FormUtil::getPassedValue('stylecontents''''POST');
  119.  
  120.     $blockinfo['content'pnBlockVarsToContent($vars);
  121.  
  122.     return($blockinfo);
  123. }

Documentation generated on Fri, 18 Jul 2008 21:59:19 +0200 by phpDocumentor 1.4.1