本文整理匯總了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']));