本文整理汇总了PHP中block::types_update方法的典型用法代码示例。如果您正苦于以下问题:PHP block::types_update方法的具体用法?PHP block::types_update怎么用?PHP block::types_update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类block
的用法示例。
在下文中一共展示了block::types_update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
//.........这里部分代码省略.........
$dataset = block::custom_types();
for ($i = 0; $i < count($dataset); $i++) {
if ($dataset[$i]['id'] > $max_id) {
$max_id = $dataset[$i]['id'];
}
if ($dataset[$i]['id'] == $_REQUEST['id']) {
$item = $dataset[$i];
$position = $i;
}
}
if (empty($item)) {
$layout->navigate_notification(t(599, "Sorry, can't display a theme block type info."));
$out = blocks_types_list();
} else {
if (isset($_REQUEST['form-sent'])) {
if (empty($item)) {
$item = array('id' => $max_id + 1);
}
$item['type'] = $_REQUEST['type'];
$item['title'] = $_REQUEST['title'];
$item['code'] = $_REQUEST['code'];
$item['width'] = $_REQUEST['width'];
$item['height'] = $_REQUEST['height'];
$item['order'] = $_REQUEST['order'];
$item['maximum'] = $_REQUEST['maximum'];
$item['notes'] = pquotes($_REQUEST['notes']);
if (!is_null($position)) {
$dataset[$position] = $item;
} else {
$dataset[] = $item;
}
try {
// save
$ok = block::types_update($dataset);
$layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
} catch (Exception $e) {
$layout->navigate_notification($e->getMessage(), true, true);
}
}
$out = blocks_type_form($item);
}
break;
case 'block_type_delete':
case 84:
// remove block type
$dataset = block::custom_types();
$item = NULL;
for ($i = 0; $i < count($dataset); $i++) {
if ($dataset[$i]['id'] == $_REQUEST['id']) {
unset($dataset[$i]);
break;
}
}
try {
block::types_update($dataset);
$layout->navigate_notification(t(55, 'Item removed successfully.'), false);
$out = blocks_types_list();
} catch (Exception $e) {
$out = $layout->navigate_message("error", t(23, 'Blocks'), t(56, 'Unexpected error.'));
}
break;
case 'block_property_load':
$property = new property();
if (!empty($_REQUEST['id'])) {
if (is_numeric($_REQUEST['id'])) {
$property->load(intval($_REQUEST['id']));