function smarty_block_container($params, $content = '', $template, &$repeat) { if ($repeat) { add_container($params, $template); return; } $layout = get_default($params, 'layout', false); if (isset($template->block_data->parent) && is_object($template->block_data->parent) && get_class($template->block_data->parent) == 'Pinet_Container') { $template->block_data = $template->block_data->parent; } else { $template->block_data = null; } if ($layout) { return create_tag('div', array('class' => make_classes(get_default($params, 'class'))), array(), $content); } return $content; }
function smarty_block_toolbar($params, $content = '', $template, &$repeat) { if ($repeat) { // This is the start part add_container($params, $template, 'toolbar'); return; } $params['id'] = get_default($params, 'id', 'toolbar'); $classes = get_default($params, 'class', array()); if (is_string($classes)) { $classes = explode(' ', $classes); } $classes[] = 'toolbar'; $classes[] = 'pinet-toolbar'; $params['class'] = implode(' ', $classes); return build_tag('div', $params, $content); }
function add_container($id, $path, $type) { global $oldPath; global $oldSite, $newSite; global $readClient, $writeClient; global $added; global $verbose; global $exit_on_error; # # have we already checked container *and* children? # if (isset($added["{$type}.{$group}"])) { return; } else { $added["{$type}.{$path}"] = 1; } #if ($verbose>2) echo "Adding $type $path...\n"; # # create the container # if ($type == 'target') { checkTarget($path); } else { checkContainer($id, $path, $type); } # # and its children # if (isset($id)) { $ident->id = $id; } $ident->path = $path; $ident->siteName = $oldSite; $ident->type = strtolower($type); $readClient->read($ident); if (!$readClient->success) { echo "Failed reading: {$type} " . $path . "\n"; echo print_r($ident); echo cleanup($readClient->response); if ($exit_on_error) { cleanexit(); } else { return; } } $asset = $readClient->asset; if (isset($asset->{$type}->children) && isset($asset->{$type}->children->child)) { $children = $asset->{$type}->children->child; if (!is_array($children)) { $children = array($children); } } else { $children = ""; } # # types of things we find in containers # $types = array("assetFactoryContainer", "pageConfigurationSetContainer", "contentTypeContainer", "dataDefinitionContainer", "metadataSetContainer", "publishSetContainer", "siteDestinationContainer", "transportContainer", "workflowDefinitionContainer", "assetFactory", "pageConfigurationSet", "contentType", "dataDefinition", "metadataSet", "publishSet", "destination", "target", "transport", "workflowDefinition", "connectorContainer", "twitterConnector", "wordPressConnector", "googleAnalyticsConnector"); $names['transport_db'] = 'transport'; $names['transport_fs'] = 'transport'; $names['transport_ftp'] = 'transport'; foreach ($types as $type) { $names[strtolower($type)] = $type; } if (is_array($children)) { while ($cur = array_pop($children)) { if (array_key_exists($cur->type, $names)) { if (preg_match('/container$/', $cur->type)) { add_container($cur->id, $cur->path->path, $names[$cur->type]); } else { if ($cur->type == 'target') { checkTarget($cur->path->path); add_container($cur->id, $cur->path->path, $names[$cur->type]); } else { checkAdminAsset($cur->id, $cur->path->path, $names[$cur->type]); } } } else { echo "Oops: don't know what to do with " . $cur->type . " " . $cur->path->path . "\n"; } } } }