Example #1
0
 function fetchBlock($blockID)
 {
     $result = array('result' => eZPageBlock::fetch($blockID));
     return $result;
 }
Example #2
0
//   GNU General Public License for more details.
//
//   You should have received a copy of version 2.0 of the GNU General
//   Public License along with this program; if not, write to the Free
//   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
//   MA 02110-1301, USA.
//
//
// ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
//
include_once 'extension/ezflow/classes/ezpageblock.php';
include_once 'extension/ezflow/classes/ezpageblockitem.php';
$module = $Params['Module'];
$blockID = $Params['BlockID'];
$output = $Params['Output'];
$block = eZPageBlock::fetch($blockID);
$tpl = eZTemplate::factory();
$tpl->setVariable('block', $block);
$template = 'design:page/block.tpl';
if (!isset($output)) {
    $output = 'xhtml';
}
switch (strtolower($output)) {
    case 'json':
        $template = 'design:page/preview.tpl';
        $obj = new stdClass();
        foreach ($block->attributes() as $attr) {
            if (!in_array($attr, array('waiting', 'valid', 'valid_nodes', 'archived'))) {
                $obj->{$attr} = $block->attribute($attr);
            }
        }