本文整理汇总了PHP中Tree::editTree方法的典型用法代码示例。如果您正苦于以下问题:PHP Tree::editTree方法的具体用法?PHP Tree::editTree怎么用?PHP Tree::editTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree::editTree方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
public function edit()
{
$model = new Tree();
$model->editTree();
$this->redirect('/');
}
示例2: edit
function edit()
{
$sql = 'SELECT path FROM {{modules}} WHERE id=' . $_POST['module'];
$module = DB::getOne($sql);
$sql = '
DELETE FROM {{multival}}
WHERE data IN (SELECT id FROM {{data}} WHERE tree=' . $_POST['tree'] . ')
';
DB::exec($sql);
$sql = '
DELETE FROM {{relations}}
WHERE modul1=\'data\'
AND id1 IN (SELECT id FROM {{data}} WHERE tree=' . $_POST['tree'] . ' AND type<>\'gallery\')
';
DB::exec($sql);
$sql = '
DELETE FROM {{data}}
WHERE tree=' . $_POST['tree'] . '
AND type<>\'gallery\'
';
DB::exec($sql);
$i = 0;
if ($_POST['data']) {
foreach ($_POST['data'] as $key => $item) {
Fields::Insert($_POST['tree'], $_POST['module'], $key, $item, $_POST['fieldtypes'][$i], $i);
$i++;
}
}
Tree::editTree($_POST['tree']);
}
示例3: edit
public function edit()
{
$fields = array();
$sql = '
DELETE FROM {{multival}}
WHERE data IN (SELECT id FROM {{data}} WHERE tree=' . $_POST['tree'] . ')
';
DB::exec($sql);
$sql = '
DELETE FROM {{relations}}
WHERE modul1=\'data\'
AND id1 IN (SELECT id FROM {{data}} WHERE tree=' . $_POST['tree'] . ' AND type<>\'gallery\')
';
DB::exec($sql);
$sql = '
DELETE FROM {{data}}
WHERE tree=' . $_POST['tree'] . '
AND type<>\'gallery\'
';
DB::exec($sql);
$module = Module::getModuleById($_POST['module']);
Tree::editTree($_POST['tree']);
if (isset($_POST['data']['price'])) {
$fields['price'] = $_POST['data']['price'] == '' ? 0 : $_POST['data']['price'];
}
if (isset($_POST['data']['subprice'])) {
$fields['subprice'] = $_POST['data']['subprice'] == '' ? 0 : $_POST['data']['subprice'];
}
if (isset($_POST['data']['vendor'])) {
$fields['vendor'] = $_POST['data']['vendor'] == '' ? 0 : $_POST['data']['vendor'];
}
if (isset($_POST['data']['available'])) {
$fields['available'] = $_POST['data']['available'] == '' ? 0 : $_POST['data']['available'];
}
if (isset($_POST['data']['bid'])) {
$fields['bid'] = $_POST['data']['bid'] == '' ? 0 : $_POST['data']['bid'];
}
if (isset($_POST['data']['cbid'])) {
$fields['cbid'] = $_POST['data']['cbid'] == '' ? 0 : $_POST['data']['cbid'];
}
if (isset($_POST['data']['manufacturer_warranty'])) {
$fields['manufacturer_warranty'] = $_POST['data']['manufacturer_warranty'] == '' ? 0 : $_POST['data']['manufacturer_warranty'];
}
foreach (OneSSA::$catalogStandart as $item) {
if (array_key_exists($item, $fields) === false) {
$fields[$item] = trim($_POST['data'][$item]);
}
}
$sql = '
UPDATE {{catalog}}
SET
';
foreach ($fields as $key => $item) {
if (strpos($item, '<') === false || strpos($item, '>') === false) {
$item = str_replace('"', '"', str_replace("'", '’', $item));
}
$sql .= $key . '=\'' . $item . '\',';
}
$sql = substr($sql, 0, strlen($sql) - 1);
$sql .= '
WHERE tree=' . $_POST['tree'] . '
';
$dataId = DB::exec($sql);
$i = 0;
//print_r($_POST);
foreach ($_POST['data'] as $key => $item) {
if (!in_array($key, OneSSA::$catalogStandart)) {
Fields::Insert($_POST['tree'], $_POST['module'], $key, $item, $_POST['fieldtypes'][$i], $i);
}
$i++;
}
$i = 0;
if (!empty($_POST['features'])) {
foreach ($_POST['features'] as $key => $item) {
Fields::insertFeatures($_POST['tree'], $_POST['featuresid'][$i], $key, $_POST['featurestype'][$i], $item, $i);
$i++;
}
}
}