/** * 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) { $objectId = $namedParameters['object_id']; switch ($operatorName) { case 'pagelink': $links = array(); $ini = eZINI::instance('block.ini'); $items = eZFlowPoolItem::fetchListByContentObjectId($objectId); foreach ($items as $item) { $block = $item->attribute('block'); $node = $block->attribute('node'); if (!$node->attribute('can_read')) { continue; } $nodeId = $node->attribute('node_id'); $links[$nodeId]['node'] = $node; if ($block->attribute('name') == '') { $block->setAttribute('name', $ini->variable($block->attribute('block_type'), 'Name')); } $links[$nodeId]['blocks'][] = $block; } $operatorValue = $links; break; } }
// 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 ## // define( 'ROTATION_NONE', 0 ); define( 'ROTATION_SIMPLE', 1 ); define( 'ROTATION_RANDOM', 2 ); $db = eZDB::instance(); $ini = eZINI::instance( 'block.ini' ); $blockTableDef = eZFlowBlock::definition(); $poolTableDef = eZFlowPoolItem::definition(); $blockTMPTable = $db->generateUniqueTempTableName( 'ezm_block_tmp_%' ); $poolTMPTable = $db->generateUniqueTempTableName( 'ezm_pool_tmp_%' ); $nodeID = 2; $time = time() - 5; if( isset( $Params['NodeID'] ) ) $nodeID = (int)$Params['NodeID']; if( isset( $Params['Time'] ) ) $time = (int)$Params['Time']; $db->createTempTable( 'CREATE TEMPORARY TABLE ' . $blockTMPTable . ' AS SELECT * FROM ' . $blockTableDef['name'] . ' WHERE node_id=\'' . $nodeID . '\'' );
/** * Method executed when an object copy is created * by using the clone keyword * */ public function __clone() { $oldBlockID = $this->attributes['id']; $this->attributes['id'] = md5( (string)microtime() . (string)mt_rand() ); $this->attributes['action'] = 'add'; $oldItems = eZPersistentObject::fetchObjectList( eZFlowPoolItem::definition(), null, array( 'block_id' => $oldBlockID ) ); foreach ( $oldItems as $oldItem ) { $attrs = array( 'object_id' => $oldItem->attribute( 'object_id' ), 'node_id' => $oldItem->attribute( 'node_id' ), 'priority' => $oldItem->attribute( 'priority' ), 'ts_publication' => $oldItem->attribute( 'ts_publication' ), 'action' => 'add' ); $newPageBlockItem = new eZPageBlockItem( $attrs ); $this->addItem( $newPageBlockItem ); } }