示例#1
0
 /**
  * Executes the PHP function for the operator cleanup and modifies $operatorValue.
  * 
  * @param eZTemplate $tpl
  * @param string $operatorName
  * @param array $operatorParameters
  * @param string $rootNamespace
  * @param string $currentNamespace
  * @param mixed $operatorValue
  * @param array $namedParameters
  */
 public function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
 {
     switch ($operatorName) {
         case 'json':
             $operatorValue = eZFlowAjaxContent::jsonEncode($operatorValue);
             break;
     }
 }
                                        FROM $poolTMPTable, ezcontentobject_tree
                                        WHERE $poolTMPTable.block_id='" . $block->attribute('id') . "'
                                          AND $poolTMPTable.ts_visible>0
                                          AND $poolTMPTable.ts_hidden=0
                                          AND ezcontentobject_tree.node_id = $poolTMPTable.node_id
                                        ORDER BY $poolTMPTable.priority DESC" );

        if( count( $validNodes ) )
        {
            $validNodesObjects = array();
            foreach( $validNodes as $validNode )
            {
                $validNodeID = $validNode['node_id'];
                $validNodesObjects[] = eZContentObjectTreeNode::fetch( $validNodeID );
            }
            $block->setAttribute( 'valid_nodes', $validNodesObjects );
        }

        $outputBlock = array( 'objectid' => $block->attribute('zone_id') . '-' . $block->attribute('id') );
        $tpl->setVariable( 'block', $block );
        $outputBlock['xhtml'] = htmlentities( str_replace( array( "\r\n", "\r", "\n" ), array(""), $tpl->fetch( 'design:page/preview.tpl' ) ), ENT_QUOTES, $httpCharset );
        $output[] = $outputBlock;
    }
}

header( 'Content-Type: application/json; charset=' . $httpCharset );

echo eZFlowAjaxContent::jsonEncode( $output );
eZExecution::cleanExit();

?>
            }
            break;
        case 'zone':
            $blockINI = eZINI::instance('block.ini');
            if ($http->hasPostVariable('zone')) {
                $zoneID = $http->postVariable('zone');
                if ($page instanceof eZPage) {
                    foreach ($page->attribute('zones') as $zone) {
                        if ($zone->attribute('id') === $zoneID) {
                            foreach ($zone->attribute('blocks') as $index => $block) {
                                if ($blockINI->hasVariable($block->attribute('type'), 'ManualAddingOfItems') && $blockINI->variable($block->attribute('type'), 'ManualAddingOfItems') === 'enabled') {
                                    if ($blockINI->hasVariable($block->attribute('type'), 'AllowedClasses')) {
                                        $allowedClasses = $blockINI->variable($block->attribute('type'), 'AllowedClasses');
                                        if (in_array($classIdentifier, $allowedClasses)) {
                                            $res[] = array('index' => $index, 'id' => $block->attribute('id'), 'name' => $block->attribute('name'));
                                        }
                                    } else {
                                        $res[] = array('index' => $index, 'id' => $block->attribute('id'), 'name' => $block->attribute('name'));
                                    }
                                }
                            }
                            break;
                        }
                    }
                }
            }
            break;
    }
    echo eZFlowAjaxContent::jsonEncode($res);
}
eZExecution::cleanExit();