本文整理汇总了PHP中common_node::nodeUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP common_node::nodeUpdate方法的具体用法?PHP common_node::nodeUpdate怎么用?PHP common_node::nodeUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common_node
的用法示例。
在下文中一共展示了common_node::nodeUpdate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mainAction
/**
* main action
*/
public function mainAction()
{
// initialize
require_once 'models/ecommerce/ecommerce_store.php';
$Store = new ecommerce_store();
// save
if ($_POST['save']) {
// set values
if (!isset($_POST['store']['publish'])) {
$_POST['store']['publish'] = 0;
}
$_POST['store']['modified'] = date('c');
// handle other_data
$_POST['store']['other_data'] = serialize($_POST['store']['other_data']);
// force numeric types
$_POST['store']['coordinates_x'] = (int) $_POST['store']['coordinates_x'];
$_POST['store']['coordinates_y'] = (int) $_POST['store']['coordinates_y'];
$_POST['store']['latitude'] = (double) $_POST['store']['latitude'];
$_POST['store']['longitude'] = (double) $_POST['store']['longitude'];
// serialize street_view_options
$_POST['store']['street_view_options'] = serialize($_POST['store']['street_view_options']);
// remove if country_id isn't numeric
if (!is_numeric($_POST['store']['country_id'])) {
unset($_POST['store']['country_id']);
}
// update store
if ($id = $Store->update($_POST['store'])) {
msg("Store ID={$id} updated");
// update node info (if exists)
$store_homepage = $Store->getStoreHomepage($_POST['store']['id']);
if (is_array($store_homepage) && count($store_homepage) > 0) {
$store_homepage['publish'] = $_POST['store']['publish'];
require_once 'models/common/common_node.php';
$Node = new common_node();
$Node->nodeUpdate($store_homepage);
}
// forward to store list main page and exit
onxshopGoTo("/backoffice/stores");
return true;
} else {
msg("Cannot update store details", 'error');
}
}
// store detail
$store = $Store->detail($this->GET['id']);
$store['publish'] = $store['publish'] == 1 ? 'checked="checked" ' : '';
$store['street_view_options'] = unserialize($store['street_view_options']);
$this->tpl->assign('STORE', $store);
$this->tpl->assign('STREET_VIEW_IMAGE_' . (int) $store['street_view_options']['image'], 'checked="checked"');
$this->parseTypeSelect($store['type_id']);
return true;
}
示例2: updateProduct
/**
* updateProduct
*/
public function updateProduct($data)
{
if (!is_array($data)) {
return false;
}
if (!is_numeric($data['id'])) {
return false;
}
/**
* set values
*/
if (!isset($data['publish'])) {
$data['publish'] = 0;
}
$data['modified'] = date('c');
/**
* handle other_data
*/
$data['other_data'] = serialize($data['other_data']);
/**
* update product
*/
if ($id = $this->update($data)) {
msg("Product ID={$id} updated");
/**
* update node info (if exists)
*/
$product_homepage = $this->getProductHomepage($id);
if (is_array($product_homepage) && count($product_homepage) > 0) {
$product_homepage['publish'] = $data['publish'];
require_once 'models/common/common_node.php';
$Node = new common_node();
$Node->nodeUpdate($product_homepage);
}
return $id;
} else {
return false;
}
}
示例3: moveRecipeNode
/**
* move recipe node
*/
function moveRecipeNode($recipe_id, $parent_id)
{
if (!is_numeric($recipe_id)) {
return false;
}
if (!is_numeric($parent_id)) {
return false;
}
$Node = new common_node();
$Recipe = new ecommerce_recipe();
/**
* get current detail
*/
$recipe_homepage = $Recipe->getRecipeHomepage($recipe_id);
/**
* modify node data
*/
$recipe_homepage['parent'] = $parent_id;
if ($Node->nodeUpdate($recipe_homepage)) {
msg("Recipe node has been updated", 'ok');
return $recipe_homepage;
} else {
msg("Can't update recipe node.");
return false;
}
}
示例4: updateRecipe
/**
* update recipe
*/
function updateRecipe($data)
{
// set values
if (!isset($data['publish'])) {
$data['publish'] = 0;
}
$data['modified'] = date('c');
// make sure values are int
$data['serving_people'] = (int) $data['serving_people'];
$data['preparation_time'] = (int) $data['preparation_time'];
$data['cooking_time'] = (int) $data['cooking_time'];
// handle other_data
$data['other_data'] = serialize($data['other_data']);
if ($id = $this->update($data)) {
// update node info (if exists)
$recipe_homepage = $this->getRecipeHomepage($id);
if (is_array($recipe_homepage) && count($recipe_homepage) > 0) {
$recipe_homepage['publish'] = $data['publish'];
require_once 'models/common/common_node.php';
$Node = new common_node();
$Node->nodeUpdate($recipe_homepage);
}
return $id;
} else {
return false;
}
}
示例5: moveStoreNode
/**
* move store node
*/
function moveStoreNode($store_id, $parent_id)
{
if (!is_numeric($store_id)) {
return false;
}
if (!is_numeric($parent_id)) {
return false;
}
$Node = new common_node();
$Store = new ecommerce_store();
/**
* get current detail
*/
$store_homepage = $Store->getStoreHomepage($store_id);
/**
* modify node data
*/
$store_homepage['parent'] = $parent_id;
if ($Node->nodeUpdate($store_homepage)) {
msg("Store node has been updated", 'ok');
return $store_homepage;
} else {
msg("Can't update store node.");
return false;
}
}