本文整理汇总了PHP中block::block_group_block方法的典型用法代码示例。如果您正苦于以下问题:PHP block::block_group_block方法的具体用法?PHP block::block_group_block怎么用?PHP block::block_group_block使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类block
的用法示例。
在下文中一共展示了block::block_group_block方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: block_group_block_options
function block_group_block_options($block_group, $code, $block_uid, $status)
{
global $layout;
global $website;
global $theme;
$block = block::block_group_block($block_group, $code);
$properties = $block->properties;
if (empty($properties)) {
return;
}
$layout = null;
$layout = new layout('navigate');
if ($status !== null) {
if ($status) {
$layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
} else {
$layout->navigate_notification(t(56, "Unexpected error"), true, true);
}
}
$navibars = new navibars();
$naviforms = new naviforms();
$navibars->title(t(556, 'Block from group') . ' [' . $theme->t($block_group) . ']');
$layout->navigate_media_browser();
// we can use media browser in this function
$navibars->add_actions(array('<a href="#" onclick="javascript: navigate_media_browser();">
<img height="16" align="absmiddle" width="16" src="img/icons/silk/images.png"> ' . t(36, 'Media') . '</a>'));
$navibars->add_actions(array('<a href="#" onclick="navigate_tabform_submit(0);">
<img height="16" align="absmiddle" width="16" src="img/icons/silk/accept.png"> ' . t(34, 'Save') . '</a>'));
$navibars->form();
$navibars->add_tab(t(200, 'Options'));
$navibars->add_tab_content($naviforms->hidden('form-sent', 'true'));
// show a language selector (only if it's a multi language website)
if (count($website->languages) > 1) {
$website_languages_selector = $website->languages();
$website_languages_selector = array_merge(array('' => '(' . t(443, 'All') . ')'), $website_languages_selector);
$navibars->add_tab_content_row(array('<label>' . t(63, 'Languages') . '</label>', $naviforms->buttonset('language_selector', $website_languages_selector, '', "navigate_tabform_language_selector(this);")));
}
$properties_values = property::load_properties($code, $block_group, 'block_group_block', $code, $block_uid);
foreach ($properties as $option) {
$property = new property();
$property_value = '';
foreach ($properties_values as $pv) {
if ($pv->id == $option->id) {
$property_value = $pv->value;
}
}
$property->load_from_object($option, $property_value, $theme);
if ($property->type == 'tab') {
$navibars->add_tab($property->name);
if (count($website->languages) > 1) {
$website_languages_selector = $website->languages();
$website_languages_selector = array_merge(array('' => '(' . t(443, 'All') . ')'), $website_languages_selector);
$navibars->add_tab_content_row(array('<label>' . t(63, 'Languages') . '</label>', $naviforms->buttonset('language_selector', $website_languages_selector, '', "navigate_tabform_language_selector(this);")));
}
}
$navibars->add_tab_content(navigate_property_layout_field($property));
}
$layout->add_content('<div id="navigate-content" class="navigate-content ui-corner-all">' . $navibars->generate() . '</div>');
navigate_property_layout_scripts();
$layout->navigate_additional_scripts();
$layout->add_script('
$("html").css("background", "transparent");
');
$out = $layout->generate();
return $out;
}
示例2: save_properties_from_array
public static function save_properties_from_array($object_type, $object_id, $template, $properties_assoc = array(), $ws = null, $node_uid = "")
{
global $DB;
global $website;
global $theme;
if (empty($ws)) {
$ws = $website;
}
$dictionary = array();
$property_object_type = $object_type;
// object_type: item, structure, block, block_group_block
if ($object_type == 'block_group_block') {
// we have to identify the block subtype: block, block_type, block_group_block or extension_block
// so we can get its properties definition
if (!is_numeric($object_id)) {
// assume there can only be one block group of the same type
$block_group_id = $DB->query_single('MAX(id)', 'nv_block_groups', ' code = ' . protect($template) . ' AND website = ' . $ws->id);
$object_id = $block_group_id;
if (empty($block_group_id)) {
$object_id = 0;
}
}
if (!empty($node_uid)) {
$bg = new block_group();
$bg->load($object_id);
for ($b = 0; $b < count($bg->blocks); $b++) {
if ($bg->blocks[$b]['uid'] == $node_uid) {
$block_id = $bg->blocks[$b]['id'];
if ($bg->blocks[$b]['type'] == 'extension') {
// an extension block
$property_object_type = 'block_group-extension-block';
// load the extension, if installed in this instance
$extension = new extension();
$extension->load($bg->blocks[$b]['extension']);
// find the property declaration in the extension definition
if (isset($extension->definition->blocks)) {
for ($eb = 0; $eb < count($extension->definition->blocks); $eb++) {
if ($extension->definition->blocks[$eb]->id == $block_id) {
$block = $extension->definition->blocks[$eb];
break;
}
}
} else {
// ignore this property, extension is not installed or it does not have the requested block definition
continue;
}
} else {
// a block group block
$property_object_type = 'block_group_block';
$block = block::block_group_block($template, $block_id);
}
// note: standard blocks don't "embed" their properties in a block group,
// they have their own separate values
break;
}
}
} else {
// compatibility with < Navigate 2.1 themes (to be removed)
$properties_names = array_keys($properties_assoc);
$block = block::block_group_block_by_property($properties_names[0]);
}
if (!isset($block->properties) || empty($block->properties)) {
return false;
}
$properties = $block->properties;
} else {
$properties = property::elements($template, $object_type);
}
if (!is_array($properties)) {
$properties = array();
}
foreach ($properties as $property) {
if (!isset($properties_assoc[$property->name]) && !isset($properties_assoc[$property->id])) {
continue;
}
$values_dict = array();
$value = '';
// we try to find the property value by "property name", if empty then we try to find it via "property id"
if (isset($properties_assoc[$property->name])) {
$value = $properties_assoc[$property->name];
}
if (empty($value)) {
$value = $properties_assoc[$property->id];
}
// multilanguage property?
if (in_array($property->type, array('text', 'textarea', 'link', 'rich_textarea')) || @$property->multilanguage == 'true' || @$property->multilanguage === true) {
if (isset($properties_assoc[$property->name])) {
$values_dict = $properties_assoc[$property->name];
}
if (empty($values_dict)) {
$values_dict = $properties_assoc[$property->id];
}
$value = '[dictionary]';
}
if ($property->type == 'coordinates') {
if (is_array($value)) {
$value = $value['latitude'] . '#' . $value['longitude'];
}
// if it isn't an array, then we suppose it already has the right format
}
//.........这里部分代码省略.........
示例3: nvweb_properties
//.........这里部分代码省略.........
}
}
break;
case 'block':
if (!isset($properties['block-' . $vars['id']])) {
// load item type
if (empty($vars['type'])) {
$vars['type'] = $DB->query_single('type', 'nv_blocks', ' id = ' . protect($vars['id']));
if (empty($cache['block_types'])) {
$cache['block_types'] = block::types();
}
// we need to know if the block is defined in the active theme or in the database (numeric ID)
foreach ($cache['block_types'] as $bt) {
if ($bt['code'] == $vars['type']) {
$vars['type'] = $bt['id'];
break;
}
}
}
$properties['block-' . $vars['id']] = property::load_properties("block", $vars['type'], 'block', $vars['id']);
}
$current_properties = $properties['block-' . $vars['id']];
// now we find the property requested
if (!is_array($current_properties)) {
$current_properties = array();
}
foreach ($current_properties as $property) {
if ($property->id == $vars['property'] || $property->name == $vars['property']) {
$out = nvweb_properties_render($property, $vars);
break;
}
}
break;
case 'block_group_block':
// find block_group block definition
$block_group = null;
// unknown
$block_code = $vars['id'];
$block_uid = $vars['uid'];
if (empty($block_code)) {
$block = block::block_group_block_by_property($vars['property']);
$block_code = $block->type;
} else {
// find the block group block by its type
$block = block::block_group_block($block_group, $block_code);
}
$properties = $block->properties;
$current_properties = property::load_properties($block_code, $block->_block_group_id, 'block_group_block', $block_code, $block_uid);
// now we find the property requested
if (!is_array($current_properties)) {
$current_properties = array();
}
foreach ($current_properties as $property) {
if ($property->id == $vars['property'] || $property->name == $vars['property']) {
$out = nvweb_properties_render($property, $vars);
break;
}
}
break;
case 'structure':
if (empty($vars['id'])) {
if ($current['type'] == 'structure') {
$vars['id'] = $current['id'];
} else {
$vars['id'] = $current['object']->category;
}