/**
     * Fetches valid items and do merge with those already available
     *
     * @return array(eZPageBlockItem)
     */
    protected function getValidItems()
    {
        $validItems = eZFlowPool::validItems( $this->id() );
        $merged = $this->merge( $validItems );
        usort( $merged, array( $this, 'sortItemsByPriority' ) );

        return $merged;
    }
Exemplo n.º 2
0
 function fetchValid($blockID)
 {
     $result = array('result' => eZFlowPool::validItems($blockID));
     return $result;
 }
Exemplo n.º 3
0
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);
            }
        }
        $obj->html = htmlentities($tpl->fetch($template), ENT_QUOTES);
        header('Content-type: application/json');
        echo json_encode(array('block' => $obj));
        break;
    case 'xml':
        $dom = new DOMDocument('1.0', 'utf-8');
        $dom->formatOutput = true;
        $items = eZFlowPool::validItems($blockID);
        foreach ($items as $item) {
            $block->addItem(new eZPageBlockItem($item, true));
        }
        $block->setAttribute('xhtml', $tpl->fetch($template));
        $blockElement = $block->toXML($dom);
        $dom->appendChild($blockElement);
        echo $dom->saveXML();
        break;
    case 'xhtml':
    default:
        echo $tpl->fetch($template);
        break;
}
eZExecution::cleanExit();