• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP update_item函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中update_item函数的典型用法代码示例。如果您正苦于以下问题:PHP update_item函数的具体用法?PHP update_item怎么用?PHP update_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: testRemoveItemWhenSetPrivate

 /**
  * When an existing item is switched from public to private, it should be
  * removed from Solr.
  */
 public function testRemoveItemWhenSetPrivate()
 {
     // Insert public item.
     $item = insert_item(array('public' => true));
     // Set the item private.
     update_item($item, array('public' => false));
     // Should remove the Solr document.
     $this->_assertNotRecordInSolr($item);
 }
开发者ID:rameysar,项目名称:Omeka-Grinnell-RomanCiv,代码行数:13,代码来源:ItemsTest.php


示例2: testHookAfterSaveItem

 /**
  * `hookAfterSaveItem` should update records that reference the item.
  */
 public function testHookAfterSaveItem()
 {
     $item = $this->_item('title');
     $exhibit = $this->_exhibit();
     $record = $this->_record($exhibit, $item);
     // Update the item.
     update_item($item, array(), array('Dublin Core' => array('Title' => array(array('text' => 'title', 'html' => false)))));
     // Record should be compiled.
     $record = $this->_reload($record);
     $this->assertEquals('title', $record->item_title);
 }
开发者ID:saden1,项目名称:Neatline,代码行数:14,代码来源:HookAfterSaveItemTest.php


示例3: process_item

function process_item($window, $id)
{
    global $mainwin;
    switch ($id) {
        case IDOK:
            if (update_item($window)) {
                wb_destroy_window($window);
                update_items($mainwin);
            }
            break;
        case IDCANCEL:
        case IDCLOSE:
            wb_destroy_window($window);
            break;
    }
}
开发者ID:BackupTheBerlios,项目名称:winbinder-svn,代码行数:16,代码来源:todo_dlg_item.inc.php


示例4: add_item

function add_item(&$cart, $key, $quantity)
{
    global $products;
    if ($quantity < 1) {
        return;
    }
    // If item already exists in cart, update quantity
    if (isset($cart[$key])) {
        $quantity += $cart[$key]['qty'];
        update_item($cart, $key, $quantity);
        return;
    }
    // Add item
    $cost = $products[$key]['cost'];
    $total = $cost * $quantity;
    $item = array('name' => $products[$key]['name'], 'cost' => $cost, 'qty' => $quantity, 'total' => $total);
    $cart[$key] = $item;
}
开发者ID:j-jm,项目名称:web182,代码行数:18,代码来源:cart.php


示例5: import

 public function import()
 {
     //grab the data needed for using update_item or insert_item
     $elementTexts = $this->elementTexts();
     $itemMetadata = $this->itemMetadata();
     //avoid accidental duplications
     if ($this->record && $this->record->exists()) {
         $itemMetadata['overwriteElementTexts'] = true;
         update_item($this->record, $itemMetadata, $elementTexts);
         $this->updateItemOwner($this->record);
     } else {
         $this->record = insert_item($itemMetadata, $elementTexts);
         //dig up the correct owner information, importing the user if needed
         $this->updateItemOwner($this->record);
         $this->addOmekaApiImportRecordIdMap();
     }
     //import files after the item is there, so the file has an item id to use
     //we're also keeping track of the correspondences between local and remote
     //file ids, so we have to introduce this little inefficiency of not passing
     //the file data
     $this->importFiles($this->record);
 }
开发者ID:Daniel-KM,项目名称:OmekaApiImport,代码行数:22,代码来源:ItemAdapter.php


示例6: unrateAction

 public function unrateAction()
 {
     $db = $this->_helper->db->getTable('Ratings');
     // Allow only AJAX requests.
     if (!$this->getRequest()->isXmlHttpRequest()) {
         $this->_helper->redirector->gotoUrl('/');
     }
     $record_id = $this->_getParam('record_id');
     $user_id = $this->_getParam('user_id');
     // validation needed?
     if (isset($record_id) && isset($user_id)) {
         $this->_helper->db->getTable('Ratings')->removeRating($record_id, $user_id);
     }
     // update AVG rating
     $avgRating = $db->getAvgRating($record_id);
     // Get Item
     $item = get_record_by_id('Item', $record_id);
     // Update the average rating for this item
     $metaData = array('overwriteElementTexts' => true);
     $elementText = array('Ratings' => array('Average Rating' => array(array('text' => $avgRating, 'html' => false))));
     $itemUpdated = update_item($item, $metaData, $elementText);
 }
开发者ID:anuragji,项目名称:Omeka-Ratings,代码行数:22,代码来源:IndexController.php


示例7: perform

 public function perform()
 {
     if (!($itemIds = $this->_options['itemIds'])) {
         return;
     }
     $delete = $this->_options['delete'];
     $metadata = $this->_options['metadata'];
     $custom = $this->_options['custom'];
     foreach ($itemIds as $id) {
         $item = $this->_getItem($id);
         if ($delete == '1') {
             $item->delete();
         } else {
             foreach ($metadata as $key => $value) {
                 if ($value === '') {
                     unset($metadata[$key]);
                 }
             }
             update_item($item, $metadata);
             fire_plugin_hook('items_batch_edit_custom', array('item' => $item, 'custom' => $custom));
         }
         release_object($item);
     }
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:24,代码来源:ItemBatchEdit.php


示例8: update

             }
         }
     } else {
         $data = " menu_name = '{$i_name}', \n\t\t\t\t\t\t\tmenu_type_id = '{$i_menu_type_id}',\n\t\t\t\t\t\t\tmenu_original_price = '{$i_original_price}',\n\t\t\t\t\t\t\tmenu_margin_price = '{$i_margin_price}',\n\t\t\t\t\t\t\tmenu_price = '{$i_price}',\n\t\t\t\t\t\t\tpartner_id = '{$i_partner_id}',\n\t\t\t\t\t\t\tout_time = '{$i_out_time}'\n\t\t\t\t\t";
     }
     update($data, $id);
     header('Location: menu.php?page=list&did=2');
     break;
 case 'edit_item':
     extract($_POST);
     $id = get_isset($_GET['id']);
     $menu_id = get_isset($_GET['menu_id']);
     $i_item_id = get_isset($i_item_id);
     $i_item_qty = get_isset($i_item_qty);
     $data = " item_id = '{$i_item_id}', \n\t\t\t\t\t\t\titem_qty = '{$i_item_qty}'\n\t\t\t\t\t";
     update_item($data, $id);
     header("Location: menu.php?page=form&id={$menu_id}");
     break;
 case 'delete':
     $id = get_isset($_GET['id']);
     $path = "../img/menu/";
     $get_img_old = get_img_old($id);
     if ($get_img_old) {
         if (file_exists($path . $get_img_old)) {
             unlink($path . $get_img_old);
         }
     }
     delete($id);
     header('Location: menu.php?page=list&did=3');
     break;
 case 'delete_item':
开发者ID:candradwiprasetyo,项目名称:rafli_resto,代码行数:31,代码来源:menu.php


示例9: update

 /**
  * Update item
  *
  * {@source}
  * @access public
  * @static
  * @since 1.8
  * @version 1
  *
  * @static
  * @param array $items multidimensional array with items data
  * @return boolean
  */
 public static function update($items)
 {
     $result = false;
     $itemids = array();
     DBstart(false);
     foreach ($items as $item) {
         $result = update_item($item['itemid'], $item);
         if (!$result) {
             break;
         }
         $itemids[$result] = $result;
     }
     $result = DBend($result);
     if ($result) {
         return $itemids;
     } else {
         self::$error = array('error' => ZBX_API_ERROR_INTERNAL, 'data' => 'Internal zabbix error');
         return false;
     }
 }
开发者ID:phedders,项目名称:zabbix,代码行数:33,代码来源:class.citem.php


示例10: db_save_httptest

function db_save_httptest($httptestid, $hostid, $application, $name, $delay, $status, $agent, $macros, $steps)
{
    $history = 30;
    // TODO !!! Allow user set this parametr
    $trends = 90;
    // TODO !!! Allow user set this parametr
    if (!eregi('^([0-9a-zA-Z\\_\\.[.-.]\\$ ]+)$', $name)) {
        error("Scenario name should contain '0-9a-zA-Z_.\$ '- characters only");
        return false;
    }
    DBstart();
    if ($applicationid = DBfetch(DBselect('select applicationid from applications ' . ' where name=' . zbx_dbstr($application) . ' and hostid=' . $hostid))) {
        $applicationid = $applicationid['applicationid'];
    } else {
        $applicationid = add_application($application, $hostid);
        if (!$applicationid) {
            error('Can\'t add new application. [' . $application . ']');
            return false;
        }
    }
    if (isset($httptestid)) {
        $result = DBexecute('update httptest set ' . ' applicationid=' . $applicationid . ', name=' . zbx_dbstr($name) . ', delay=' . $delay . ',' . ' status=' . $status . ', agent=' . zbx_dbstr($agent) . ', macros=' . zbx_dbstr($macros) . ',' . ' error=' . zbx_dbstr('') . ', curstate=' . HTTPTEST_STATE_UNKNOWN . ' where httptestid=' . $httptestid);
    } else {
        $httptestid = get_dbid("httptest", "httptestid");
        if (DBfetch(DBselect('select t.httptestid from httptest t, applications a where t.applicationid=a.applicationid ' . ' and a.hostid=' . $hostid . ' and t.name=' . zbx_dbstr($name)))) {
            error('Scenario with name [' . $name . '] already exist');
            return false;
        }
        $result = DBexecute('insert into httptest' . ' (httptestid, applicationid, name, delay, status, agent, macros, curstate) ' . ' values (' . $httptestid . ',' . $applicationid . ',' . zbx_dbstr($name) . ',' . $delay . ',' . $status . ',' . zbx_dbstr($agent) . ',' . zbx_dbstr($macros) . ',' . HTTPTEST_STATE_UNKNOWN . ')');
        $test_added = true;
    }
    if ($result) {
        $httpstepids = array();
        foreach ($steps as $sid => $s) {
            if (!isset($s['name'])) {
                $s['name'] = '';
            }
            if (!isset($s['timeout'])) {
                $s['timeout'] = 15;
            }
            if (!isset($s['url'])) {
                $s['url'] = '';
            }
            if (!isset($s['posts'])) {
                $s['posts'] = '';
            }
            if (!isset($s['required'])) {
                $s['required'] = '';
            }
            if (!isset($s['status_codes'])) {
                $s['status_codes'] = '';
            }
            $result = db_save_step($hostid, $applicationid, $httptestid, $name, $s['name'], $sid + 1, $s['timeout'], $s['url'], $s['posts'], $s['required'], $s['status_codes'], $delay, $history, $trends);
            if (!$result) {
                break;
            }
            $httpstepids[$result] = $result;
        }
        if ($result) {
            /* clean unneeded steps */
            $db_steps = DBselect('select httpstepid from httpstep where httptestid=' . $httptestid);
            while ($step_data = DBfetch($db_steps)) {
                if (isset($httpstepids[$step_data['httpstepid']])) {
                    continue;
                }
                delete_httpstep($step_data['httpstepid']);
            }
        }
    }
    if ($result) {
        $monitored_items = array(array('description' => 'Download speed for scenario \'$1\'', 'key_' => 'web.test.in[' . $name . ',,bps]', 'type' => ITEM_VALUE_TYPE_FLOAT, 'units' => 'bps', 'httptestitemtype' => HTTPSTEP_ITEM_TYPE_IN), array('description' => 'Failed step of scenario \'$1\'', 'key_' => 'web.test.fail[' . $name . ']', 'type' => ITEM_VALUE_TYPE_UINT64, 'units' => '', 'httptestitemtype' => HTTPSTEP_ITEM_TYPE_LASTSTEP));
        foreach ($monitored_items as $item) {
            $item_data = DBfetch(DBselect('select i.itemid,i.history,i.trends,i.status,i.delta,i.valuemapid ' . ' from items i, httptestitem hi ' . ' where hi.httptestid=' . $httptestid . ' and hi.itemid=i.itemid ' . ' and hi.type=' . $item['httptestitemtype']));
            if (!$item_data) {
                $item_data = DBfetch(DBselect('select i.itemid,i.history,i.trends,i.status,i.delta,i.valuemapid ' . ' from items i where i.key_=' . zbx_dbstr($item['key_']) . ' and i.hostid=' . $hostid));
            }
            $item_args = array('description' => $item['description'], 'key_' => $item['key_'], 'hostid' => $hostid, 'delay' => $delay, 'type' => ITEM_TYPE_HTTPTEST, 'snmp_community' => '', 'snmp_oid' => '', 'value_type' => $item['type'], 'data_type' => ITEM_DATA_TYPE_DECIMAL, 'trapper_hosts' => 'localhost', 'snmp_port' => 161, 'units' => $item['units'], 'multiplier' => 0, 'snmpv3_securityname' => '', 'snmpv3_securitylevel' => 0, 'snmpv3_authpassphrase' => '', 'snmpv3_privpassphrase' => '', 'formula' => 0, 'logtimefmt' => '', 'delay_flex' => '', 'params' => '', 'ipmi_sensor' => '', 'applications' => array($applicationid));
            if (!$item_data) {
                $item_args['history'] = $history;
                $item_args['status'] = ITEM_STATUS_ACTIVE;
                $item_args['delta'] = 0;
                $item_args['trends'] = $trends;
                $item_args['valuemapid'] = 0;
                if (!($itemid = add_item($item_args))) {
                    $result = false;
                    break;
                }
            } else {
                $itemid = $item_data['itemid'];
                $item_args['history'] = $item_data['history'];
                $item_args['status'] = $item_data['status'];
                $item_args['delta'] = $item_data['delta'];
                $item_args['trends'] = $item_data['trends'];
                $item_args['valuemapid'] = $item_data['valuemapid'];
                if (!update_item($itemid, $item_args)) {
                    $result = false;
                    break;
                }
            }
            $httptestitemid = get_dbid('httptestitem', 'httptestitemid');
//.........这里部分代码省略.........
开发者ID:rennhak,项目名称:zabbix,代码行数:101,代码来源:httptest.inc.php


示例11: display_error

        $input_error = 1;
        display_error(tr('The item name must be entered.'));
        set_focus('description');
    } elseif (strlen($_POST['NewStockID']) == 0) {
        $input_error = 1;
        display_error(tr('The item code cannot be empty'));
        set_focus('NewStockID');
    } elseif (strstr($_POST['NewStockID'], " ") || strstr($_POST['NewStockID'], "'") || strstr($_POST['NewStockID'], "+") || strstr($_POST['NewStockID'], "\"") || strstr($_POST['NewStockID'], "&")) {
        $input_error = 1;
        display_error(tr('The item code cannot contain any of the following characters -  & + OR a space OR quotes'));
        set_focus('NewStockID');
    }
    if ($input_error != 1) {
        if (!isset($_POST['New'])) {
            /*so its an existing one */
            update_item($_POST['NewStockID'], $_POST['description'], $_POST['long_description'], $_POST['category_id'], $_POST['tax_type_id'], $_POST['sales_account'], $_POST['inventory_account'], $_POST['cogs_account'], $_POST['adjustment_account'], $_POST['assembly_account'], $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['selling'], $_POST['depending'], $_POST['barcode'], $_POST['weight'], $blob, $_POST['units']);
        } else {
            //it is a NEW part
            add_item($_POST['NewStockID'], $_POST['description'], $_POST['long_description'], $_POST['category_id'], $_POST['tax_type_id'], $_POST['units'], $_POST['mb_flag'], $_POST['sales_account'], $_POST['inventory_account'], $_POST['cogs_account'], $_POST['adjustment_account'], $_POST['assembly_account'], $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['selling'], $_POST['depending'], $_POST['barcode'], $_POST['weight'], $blob);
        }
        meta_forward($_SERVER['PHP_SELF']);
    }
}
function can_delete($stock_id)
{
    $sql = "SELECT COUNT(*) FROM stock_moves " . "WHERE stock_id='{$stock_id}'";
    $result = db_query($sql, "could not query stock moves");
    $myrow = db_fetch_row($result);
    if ($myrow[0] > 0) {
        display_error(tr('Cannot delete this item because there are stock ' . 'movements that refer to this item.'));
        return false;
开发者ID:ravenii,项目名称:guardocs,代码行数:31,代码来源:items.php


示例12: _testChangeIdentifierAndCollection

 /**
  * Check simultaneous change of identifier and collection of the item.
  */
 protected function _testChangeIdentifierAndCollection()
 {
     $elementSetName = 'Dublin Core';
     $elementName = 'Identifier';
     // Create a new collection.
     $this->collection = insert_collection(array('public' => true));
     // Need to release item and to reload it.
     $itemId = $this->item->id;
     release_object($this->item);
     $this->item = get_record_by_id('Item', $itemId);
     // Update item.
     update_item($this->item, array('collection_id' => $this->collection->id, 'overwriteElementTexts' => true), array($elementSetName => array($elementName => array(array('text' => 'my_new_item_identifier', 'html' => false)))));
     $files = $this->item->getFiles();
     foreach ($files as $key => $file) {
         $this->_checkFile($file);
     }
 }
开发者ID:AdrienneSerra,项目名称:Digitalsc,代码行数:20,代码来源:ManageFilesTest.php


示例13: switch

        $action = 'show_add_item';
    }
}
// Add or update cart as needed
switch ($action) {
    case 'add':
        $product_key = filter_input(INPUT_POST, 'productkey');
        $item_qty = filter_input(INPUT_POST, 'itemqty');
        add_item($product_key, $item_qty);
        include 'cart_view.php';
        break;
    case 'update':
        $new_qty_list = filter_input(INPUT_POST, 'newqty', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
        foreach ($new_qty_list as $key => $qty) {
            if ($_SESSION['cart12'][$key]['qty'] != $qty) {
                update_item($key, $qty);
            }
        }
        include 'cart_view.php';
        break;
    case 'show_cart':
        include 'cart_view.php';
        break;
    case 'show_add_item':
        include 'add_item_view.php';
        break;
    case 'empty_cart':
        unset($_SESSION['cart12']);
        include 'cart_view.php';
        break;
    case 'end_session':
开发者ID:j-jm,项目名称:web182,代码行数:31,代码来源:index.php


示例14: update

 /**
  * Update item
  *
  * @param array $items
  * @return boolean
  */
 public static function update($items)
 {
     $items = zbx_toArray($items);
     $itemids = zbx_objectValues($items, 'itemid');
     try {
         self::BeginTransaction(__METHOD__);
         $options = array('itemids' => $itemids, 'editable' => 1, 'webitems' => 1, 'extendoutput' => 1, 'preservekeys' => 1);
         $upd_items = self::get($options);
         foreach ($items as $gnum => $item) {
             if (!isset($upd_items[$item['itemid']])) {
                 self::exception(ZBX_API_ERROR_PERMISSIONS, S_NO_PERMISSIONS);
             }
         }
         foreach ($items as $inum => $item) {
             $item_db_fields = $upd_items[$item['itemid']];
             unset($item_db_fields['lastvalue']);
             unset($item_db_fields['prevvalue']);
             unset($item_db_fields['lastclock']);
             unset($item_db_fields['prevorgvalue']);
             unset($item_db_fields['lastns']);
             if (!check_db_fields($item_db_fields, $item)) {
                 self::exception(ZBX_API_ERROR_PARAMETERS, 'Incorrect parameters used for Item');
             }
             $result = update_item($item['itemid'], $item);
             if (!$result) {
                 self::exception(ZBX_API_ERROR_PARAMETERS, 'Cannot update item');
             }
         }
         self::EndTransaction(true, __METHOD__);
         return array('itemids' => $itemids);
     } catch (APIException $e) {
         self::EndTransaction(false, __METHOD__);
         $error = $e->getErrors();
         $error = reset($error);
         self::setError(__METHOD__, $e->getCode(), $error);
         return false;
     }
 }
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:44,代码来源:class.citem.php


示例15: _processForm

 /**
  * Handle the POST for adding an item via the public form.
  *
  * Validate and save the contribution to the database.  Save the ID of the
  * new item to the session.  Redirect to the consent form.
  *
  * If validation fails, render the Contribution form again with errors.
  *
  * @param array $post POST array
  * @return bool
  */
 protected function _processForm($post)
 {
     if (!empty($post)) {
         //for the "Simple" configuration, look for the user if exists by email. Log them in.
         //If not, create the user and log them in.
         $user = current_user();
         $simple = get_option('contribution_simple');
         if (!$user && $simple) {
             $user = $this->_helper->db->getTable('User')->findByEmail($post['contribution_simple_email']);
         }
         // if still not a user, need to create one based on the email address
         if (!$user) {
             $user = $this->_createNewGuestUser($post);
             if ($user->hasErrors()) {
                 $errors = $user->getErrors()->get();
                 //since we're creating the user behind the scenes, skip username and name errors
                 unset($errors['name']);
                 unset($errors['username']);
                 foreach ($errors as $error) {
                     $this->_helper->flashMessenger($error, 'error');
                 }
                 return false;
             }
         }
         // The final form submit was not pressed.
         if (!isset($post['form-submit'])) {
             return false;
         }
         if (!$this->_validateContribution($post)) {
             return false;
         }
         $contributionTypeId = trim($post['contribution_type']);
         if ($contributionTypeId !== "" && is_numeric($contributionTypeId)) {
             $contributionType = get_db()->getTable('ContributionType')->find($contributionTypeId);
             $itemTypeId = $contributionType->getItemType()->id;
         } else {
             $this->_helper->flashMessenger(__('You must select a type for your contribution.'), 'error');
             return false;
         }
         $itemMetadata = array('public' => false, 'featured' => false, 'item_type_id' => $itemTypeId);
         $collectionId = get_option('contribution_collection_id');
         if (!empty($collectionId) && is_numeric($collectionId)) {
             $itemMetadata['collection_id'] = (int) $collectionId;
         }
         $fileMetadata = $this->_processFileUpload($contributionType);
         // This is a hack to allow the file upload job to succeed
         // even with the synchronous job dispatcher.
         if ($acl = get_acl()) {
             $acl->allow(null, 'Items', 'showNotPublic');
             $acl->allow(null, 'Collections', 'showNotPublic');
         }
         try {
             //in case we're doing Simple, create and save the Item so the owner is set, then update with the data
             $item = new Item();
             $item->setOwner($user);
             $item->save();
             $item = update_item($item, $itemMetadata, array(), $fileMetadata);
         } catch (Omeka_Validator_Exception $e) {
             $this->flashValidatonErrors($e);
             return false;
         } catch (Omeka_File_Ingest_InvalidException $e) {
             // Copying this cruddy hack
             if (strstr($e->getMessage(), "'contributed_file'")) {
                 $this->_helper->flashMessenger("You must upload a file when making a {$contributionType->display_name} contribution.", 'error');
             } else {
                 $this->_helper->flashMessenger($e->getMessage());
             }
             return false;
         } catch (Exception $e) {
             $this->_helper->flashMessenger($e->getMessage());
             return false;
         }
         $this->_addElementTextsToItem($item, $post['Elements']);
         // Allow plugins to deal with the inputs they may have added to the form.
         fire_plugin_hook('contribution_save_form', array('contributionType' => $contributionType, 'record' => $item, 'post' => $post));
         $item->save();
         //if not simple and the profile doesn't process, send back false for the error
         $this->_processUserProfile($post, $user);
         $this->_linkItemToContributedItem($item, $contributor, $post);
         $this->_sendEmailNotifications($user, $item);
         return true;
     }
     return false;
 }
开发者ID:sgbalogh,项目名称:peddler_clone5,代码行数:95,代码来源:ContributionController.php


示例16: _addCoverageElement

 /**
  * Add a Dublin Core "Coverage" element to an item.
  *
  * @param Item $item The parent item.
  * @param string $coverage The feature coverage.
  */
 protected function _addCoverageElement($item, $coverage)
 {
     update_item($item, array(), array('Dublin Core' => array('Coverage' => array(array('text' => $coverage, 'html' => false)))));
 }
开发者ID:rameysar,项目名称:Omeka-Grinnell-RomanCiv,代码行数:10,代码来源:Neatline_Case_Default.php


示例17: process_edit_item

function process_edit_item()
{
    $item_id = $_POST['item_id'];
    $item_name = $_POST['item_name'];
    $item_description = $_POST['item_description'];
    if (!empty($_FILES['item_image']['name'])) {
        $image_file = wp_upload_bits($_FILES['item_image']['name'], null, @file_get_contents($_FILES['item_image']['tmp_name']));
        $image_file_name = $image_file['file'];
        $pos = strpos($image_file_name, 'upload');
        $item_image = substr_replace($image_file_name, '', 0, $pos);
    }
    $item_price = $_POST['item_price'];
    $item_type_id = $_POST['item_type_id'];
    $return = update_item($item_id, $item_name, $item_description, $item_image, $item_price, $item_type_id);
    if ($return) {
        wp_redirect(admin_url('admin.php?page=items_settings&settings-saved'));
    } else {
        wp_redirect(admin_url('admin.php?page=items_settings&error'));
    }
}
开发者ID:Trying-On-The-Trades,项目名称:panomanager,代码行数:20,代码来源:functions.php


示例18: EndElement


//.........这里部分代码省略.........
             }
             if (!isset($data['params'])) {
                 $data['params'] = '';
             }
             if (!isset($data['ipmi_sensor'])) {
                 $data['ipmi_sensor'] = '';
             }
             if (!isset($data['applications'])) {
                 $data['applications'] = array();
             }
             if (!empty($data['valuemap'])) {
                 $sql = 'SELECT valuemapid ' . ' FROM valuemaps ' . ' WHERE ' . DBin_node('valuemapid', get_current_nodeid(false)) . ' AND name=' . zbx_dbstr($data['valuemap']);
                 if ($valuemap = DBfetch(DBselect($sql))) {
                     $data['valuemapid'] = $valuemap['valuemapid'];
                 } else {
                     $data['valuemapid'] = add_valuemap($data['valuemap'], array());
                 }
             }
             $sql = 'SELECT itemid,valuemapid,templateid ' . ' FROM items ' . ' WHERE key_=' . zbx_dbstr($data['key']) . ' AND hostid=' . $this->data[XML_TAG_HOST]['hostid'] . ' AND ' . DBin_node('itemid', get_current_nodeid(false));
             if ($item = DBfetch(DBselect($sql))) {
                 /* exist */
                 if ($this->item['exist'] == 1) {
                     info('Item [' . $data['description'] . '] skipped - user rule');
                     break;
                 }
                 if (!isset($data['valuemapid'])) {
                     $data['valuemapid'] = $item['valuemapid'];
                 }
                 $data['key_'] = $data['key'];
                 $data['hostid'] = $this->data[XML_TAG_HOST]['hostid'];
                 $data['applications'] = array_unique(array_merge($data['applications'], get_applications_by_itemid($item['itemid'])));
                 $data['templateid'] = $item['templateid'];
                 check_db_fields($item, $data);
                 update_item($item['itemid'], $data);
             } else {
                 /* missed */
                 if ($this->item['missed'] == 1) {
                     info('Item [' . $data['description'] . '] skipped - user rule');
                     break;
                     // case
                 }
                 if (!isset($data['valuemapid'])) {
                     $data['valuemapid'] = 0;
                 }
                 $data['hostid'] = $this->data[XML_TAG_HOST]['hostid'];
                 $data['key_'] = $data['key'];
                 add_item($data);
             }
             break;
             // case
         // case
         case XML_TAG_TRIGGER:
             if (!isset($data['expression'])) {
                 $data['expression'] = '';
             }
             if (!isset($data['description'])) {
                 $data['description'] = '';
             }
             if (!isset($data['type'])) {
                 $data['type'] = 0;
             }
             if (!isset($data['priority'])) {
                 $data['priority'] = 0;
             }
             if (!isset($data['status'])) {
                 $data['status'] = 0;
开发者ID:phedders,项目名称:zabbix,代码行数:67,代码来源:import.inc.php


示例19: _updateRecord

 /**
  * Update metadata and extra data to an existing record.
  *
  * @param Record $record An existing and checked record object.
  * @param array $document A normalized document.
  * @return Record|boolean The updated record or false if error.
  */
 protected function _updateRecord($record, $document)
 {
     // Check action.
     $action = $document['process']['action'];
     if (!in_array($action, array(ArchiveFolder_Importer::ACTION_UPDATE, ArchiveFolder_Importer::ACTION_ADD, ArchiveFolder_Importer::ACTION_REPLACE))) {
         $message = __('Only update actions are allowed here, not "%s".', $action);
         throw new ArchiveFolder_ImporterException($message);
     }
     $recordType = get_class($record);
     if ($document['process']['record type'] != $recordType) {
         $message = __('The record type "%s" is not the same than the record to update ("%s").', $document['process']['record type'], $recordType);
         throw new ArchiveFolder_ImporterException($message);
     }
     // The Builder doesn't allow action "Update", only "Add" and "Replace",
     // and it doesn't manage file directly.
     // Prepare element texts.
     $elementTexts = $document['metadata'];
     // Trim metadata to avoid spaces.
     $elementTexts = $this->_trimElementTexts($elementTexts);
     // Keep only the non empty metadata to avoid removing them with Omeka
     // methods, and to allow update.
     if ($action == ArchiveFolder_Importer::ACTION_ADD || $action == ArchiveFolder_Importer::ACTION_REPLACE) {
         $elementTexts = $this->_removeEmptyElements($elementTexts);
     }
     // Overwrite existing element text values if wanted.
     if ($action == ArchiveFolder_Importer::ACTION_UPDATE || $action == ArchiveFolder_Importer::ACTION_REPLACE) {
         $elementsToDelete = array();
         foreach ($elementTexts as $elementSetName => $elements) {
             foreach ($elements as $elementName => $elementTexts) {
                 $element = $this->_getElementFromIdentifierField($elementSetName . ':' . $elementName);
                 if ($element) {
                     $elementsToDelete[] = $element->id;
                 }
             }
         }
         if ($elementsToDelete) {
             $record->deleteElementTextsbyElementId($elementsToDelete);
         }
     }
     // Update the specific metadata and the element texts.
     // Update is different for each record type.
     switch ($recordType) {
         case 'Item':
             // Check and create collection if needed.
             // TODO Add an option to create or not a default collection.
             $collection = null;
             if (!empty($document['specific']['collection'])) {
                 $collection = $this->_createCollectionFromIdentifier($document['specific']['collection']);
                 $document['specific'][Builder_Item::COLLECTION_ID] = $collection->id;
                 unset($document['specific']['collection']);
             }
             // Update specific data of the item.
             switch ($action) {
                 case ArchiveFolder_Importer::ACTION_UPDATE:
                     // The item type is cleaned: only the name is available,
                     // if any.
                     if (empty($document['specific'][Builder_Item::ITEM_TYPE_NAME])) {
                         // TODO Currently, item type cannot be reset.
                         // $recordMetadata[Builder_Item::ITEM_TYPE_NAME] = null;
                         unset($document['specific'][Builder_Item::ITEM_TYPE_NAME]);
                     }
                     break;
                 case ArchiveFolder_Importer::ACTION_ADD:
                 case ArchiveFolder_Importer::ACTION_REPLACE:
                     if (empty($document['specific'][Builder_Item::COLLECTION_ID])) {
                         $document['specific'][Builder_Item::COLLECTION_ID] = $record->collection_id;
                     }
                     if (empty($document['specific'][Builder_Item::ITEM_TYPE_NAME])) {
                         if (!empty($record->item_type_id)) {
                             $document['specific'][Builder_Item::ITEM_TYPE_ID] = $record->item_type_id;
                         }
                         unset($document['specific'][Builder_Item::ITEM_TYPE_NAME]);
                     }
                     break;
             }
             if (empty($document['specific'][Builder_Item::TAGS])) {
                 unset($document['specific'][Builder_Item::TAGS]);
             }
             $record = update_item($record, $document['specific'], $document['metadata']);
             break;
         case 'File':
             $record->addElementTextsByArray($document['metadata']);
             $record->save();
             break;
         case 'Collection':
             $record = update_collection($record, $document['specific'], $document['metadata']);
             break;
         default:
             $message = __('Record type "%s" is not allowed.', $recordType);
             throw new ArchiveFolder_ImporterException($message);
     }
     // Update the extra metadata.
     $this->_setExtraData($record, $document['extra'], $action);
//.........这里部分代码省略.........
开发者ID:Daniel-KM,项目名称:ArchiveFolder,代码行数:101,代码来源:Importer.php


示例20: update

     }
     update($data, $id);
     $data_building = "building_name = '{$i_name}'";
     update_building($data_building, $id);
     // edit list menu
     $query_menu = mysql_query("select a.*, b.menu_type_name\n                                                from menus a    \n                                                join menu_types b on b.menu_type_id = a.menu_type_id\n                                                order by menu_id");
     while ($row_menu = mysql_fetch_array($query_menu)) {
         $i_check = isset($_POST['i_check_' . $row_menu['menu_id']]) ? $_POST['i_check_' . $row_menu['menu_id']] : "";
         if ($i_check) {
             $check_exist = check_exist($id, $row_menu['menu_id']);
             if ($check_exist == 0) {
                 $data = "'',\n\t\t\t\t\t\t\t\t\t'{$id}',\n\t\t\t\t\t\t\t\t\t'" . $row_menu['menu_id'] . "',\n\t\t\t\t\t\t\t\t\t'" . $_POST['i_branch_menu_price_' . $row_menu['menu_id']] . "'\n\t\t\t\t\t\t\t";
                 create_item($data);
             } else {
                 $get_exist = get_exist($id, $row_menu['menu_id']);
                 update_item($_POST['i_branch_menu_price_' . $row_menu['menu_id']], $get_exist);
             }
         } else {
             //echo "gagal"."<br>";
             delete_item($id, $row_menu['menu_id']);
         }
     }
     header('Location: branch.php?page=list&did=2');
     break;
 case 'delete':
     $id = get_isset($_GET['id']);
     $path = "../img/branch/";
     $get_img_old = get_img_old($id);
     if ($get_img_old) {
         if (file_exists($path . $get_img_old)) {
             unlink("../img/branch/" . $path . $get_img_old);
开发者ID:candradwiprasetyo,项目名称:rafli_resto,代码行数:31,代码来源:branch.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP update_last_username函数代码示例发布时间:2022-05-23
下一篇:
PHP update_internal_user_password函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap