当前位置: 首页>>代码示例>>PHP>>正文


PHP Fields::Insert方法代码示例

本文整理汇总了PHP中Fields::Insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Fields::Insert方法的具体用法?PHP Fields::Insert怎么用?PHP Fields::Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fields的用法示例。


在下文中一共展示了Fields::Insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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']);
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:30,代码来源:WorkModel.php

示例2: 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('"', '&quot;', str_replace("'", '&rsquo;', $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++;
            }
        }
    }
开发者ID:sov-20-07,项目名称:billing,代码行数:79,代码来源:CatalogModel.php


注:本文中的Fields::Insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。