</multiselect> */ $field_name = "languages"; echo "Testing {$field_name}", BR; if ($m->hasDynamicField($field_name)) { $multiselect = $m->getDynamicField($field_name); u\DebugUtility::dump($multiselect->toStdClass()); $new_values = array("Japanese", "English"); if ($ms->hasDynamicMetadataFieldDefinition($field_name)) { $dmfd = $ms->getDynamicMetadataFieldDefinition($field_name); $valid = true; foreach ($new_values as $new_value) { if (!$dmfd->hasPossibleValue($new_value)) { $valid = false; break; } } if ($valid) { $m->setDynamicFieldValues($field_name, $new_values); } } } u\DebugUtility::dump($m->toStdClass()); // commit all changes $block->edit(); echo u\ReflectionUtility::getClassDocumentation("cascade_ws_property\\Metadata"); } catch (\Exception $e) { echo S_PRE . $e . E_PRE; } catch (\Error $er) { echo S_PRE . $er . E_PRE; }
<?php require_once 'auth_tutorial7.php'; use cascade_ws_AOHS as aohs; use cascade_ws_constants as c; use cascade_ws_asset as a; use cascade_ws_property as p; use cascade_ws_utility as u; use cascade_ws_exception as e; try { // test static method $id = "06e401898b7ffe83765c5582e367462b"; $block = a\Block::getBlock($service, $id); //->dump( true ); // no type info supplied echo a\Block::getBlockType($service, $id), BR; // get methods echo "Created by: ", $block->getCreatedBy(), BR, "Created on: ", $block->getCreatedDate(), BR, "Expiration folder ID: ", $block->getExpirationFolderId(), BR, "Expiration folder path: ", $block->getExpirationFolderPath(), BR, "Expiration folder recycled: ", u\StringUtility::boolToString($block->getExpirationFolderRecycled()), BR, "Last modified by: ", $block->getLastModifiedBy(), BR, "Last modified date: ", $block->getLastModifiedDate(), BR, "Metadata set ID: ", $block->getMetadataSetId(), BR, "Metadata set path: ", $block->getMetadataSetPath(), BR; u\DebugUtility::dump($block->getDynamicFields()); u\DebugUtility::dump($block->getMetadataStdClass()); echo u\ReflectionUtility::getClassDocumentation("cascade_ws_asset\\Block"); } catch (\Exception $e) { echo S_PRE . $e . E_PRE; } catch (\Error $er) { echo S_PRE . $er . E_PRE; }
$rmsc = $cascade->getAsset(a\MetadataSetContainer::TYPE, $id); u\DebugUtility::dump($rmsc->getParentContainer()); // NULL // metadata set container $id = 'e10375238b7ffe8364375ac7a41ad6e3'; $msc = $cascade->getAsset(a\MetadataSetContainer::TYPE, $id); $msc->getParentContainer()->display(); // folder $id = '38906a9f8b7ffe83164c9314b9bdebfd'; $f = $cascade->getAsset(a\Folder::TYPE, $id); $f->getParentContainer()->display(); // data definition $id = '38a20d858b7ffe83164c931479486e6f'; $dd = $cascade->getAsset(a\DataDefinition::TYPE, $id); $dd->getParentContainer()->display(); echo $dd->getParentContainerId(), BR, $dd->getParentContainerPath(), BR; echo u\StringUtility::boolToString($dd->isDescendantOf($msc)), BR; if ($mode != 'all') { break; } case 'raw': if ($mode != 'all') { break; } } echo u\ReflectionUtility::getClassDocumentation("cascade_ws_asset\\ContainedAsset"); } catch (\Exception $e) { echo S_PRE . $e . E_PRE; } catch (\Error $er) { echo S_PRE . $er . E_PRE; }
echo "Tis true", BR; } else { echo "Tis false", BR; } if (u\StringUtility::stringToBool(0)) { echo "Tis true", BR; } else { echo "Tis false", BR; } if (u\StringUtility::stringToBool("")) { echo "Tis true", BR; } else { echo "Tis false", BR; } echo u\StringUtility::boolToString(true), BR; echo u\StringUtility::startsWith("Hello", "He") ? "yes" : "no", BR; echo u\StringUtility::startsWith("Hello", "e") ? "yes" : "no", BR; echo u\StringUtility::removeSiteNameFromPath("site://cascade-admin/web-services/api/utility-classes/debug-utility"), BR; echo u\StringUtility::getParentPathFromPath("/web-services/api/utility-classes/debug-utility"), BR; echo u\StringUtility::getNameFromPath("/web-services/api/utility-classes/debug-utility"), BR; echo u\StringUtility::getMethodName("structuredData"), BR; u\DebugUtility::dump(u\StringUtility::getExplodedStringArray(";", "this;0;that;3;these")); echo u\StringUtility::getFullyQualifiedIdentifierWithoutPositions("this;0;that;3;these"), BR; echo u\StringUtility::endsWith("Hello", "lo") ? "yes" : "no", BR; echo u\StringUtility::endsWith("Hello", "l") ? "yes" : "no", BR; echo u\ReflectionUtility::getClassDocumentation("cascade_ws_utility\\StringUtility", true); } catch (\Exception $e) { echo S_PRE . $e . E_PRE; } catch (\Error $er) { echo S_PRE . $er . E_PRE; }
break; } case 'plugin': $temp_plugins = $af->getPluginStd(); $af->addPlugin(a\AssetFactory::CREATE_RESIZED_IMAGES_PLUGIN)->addPlugin(a\AssetFactory::FILE_LIMIT_PLUGIN)->dump(true); $af->setPluginParameterValue(a\AssetFactory::CREATE_RESIZED_IMAGES_PLUGIN, a\AssetFactory::CREATE_RESIZED_PARAM_WIDTH, "foo")->setPluginParameterValue(a\AssetFactory::FILE_LIMIT_PLUGIN, a\AssetFactory::FILE_LIMIT_PARAM_SIZE, "13")->dump(true); $af->removePlugin(a\AssetFactory::CREATE_RESIZED_IMAGES_PLUGIN)->dump(true); $af->addPlugin(a\AssetFactory::IMAGE_RESIZER_PLUGIN)->setPluginParameterValue(a\AssetFactory::IMAGE_RESIZER_PLUGIN, a\AssetFactory::IMAGE_RESIZER_PARAM_HEIGHT, "45")->setPluginParameterValue(a\AssetFactory::IMAGE_RESIZER_PLUGIN, a\AssetFactory::IMAGE_RESIZER_PARAM_WIDTH, "80")->dump(true); $af->removePlugin(a\AssetFactory::PAGE_NAME_CHARS_LIMIT_PLUGIN)->dump(true); $af->addPlugin(a\AssetFactory::STRUCTURED_DATA_FIELD_TO_SYSTEM_NAME_PLUGIN)->setPluginParameterValue(a\AssetFactory::STRUCTURED_DATA_FIELD_TO_SYSTEM_NAME_PLUGIN, a\AssetFactory::SD_FIELD_TO_SYSTEM_NAME_PARAM_FIELD_ID, "those")->dump(true); $af->removePluginParameter(a\AssetFactory::STRUCTURED_DATA_FIELD_TO_SYSTEM_NAME_PLUGIN, a\AssetFactory::SD_FIELD_TO_SYSTEM_NAME_PARAM_FIELD_ID)->dump(true); // undo everything $af->setPlugins($temp_plugins)->dump(true); if ($mode != 'all') { break; } case 'raw': $af = $service->retrieve($service->createId(c\T::ASSETFACTORY, $id), c\P::ASSETFACTORY); echo S_PRE; u\DebugUtility::dump($af); echo E_PRE; if ($mode != 'all') { break; } } echo u\ReflectionUtility::getClassDocumentation("cascade_ws_asset\\AssetFactory"); } catch (\Exception $e) { echo S_PRE . $e . E_PRE; } catch (\Error $er) { echo S_PRE . $er . E_PRE; }