本文整理汇总了PHP中oseDB::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP oseDB::insert方法的具体用法?PHP oseDB::insert怎么用?PHP oseDB::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oseDB
的用法示例。
在下文中一共展示了oseDB::insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
function create($xtype = false, $config = array())
{
$vals = $this->toArray();
unset($vals['id']);
$vals['params'] = oseJson::encode($vals['params']);
return oseDB::insert($this->table, $vals);
}
示例2: save
function save()
{
$result = array();
$post = JRequest::get('post');
$post = oseMscAddon::getPost('licseat_', $post);
if (!isset($post['contact_send'])) {
$post['contact_send'] = 0;
}
if (!isset($post['internal_contact_send'])) {
$post['internal_contact_send'] = 0;
}
$db = oseDB::instance();
$msc_id = JRequest::getInt('msc_id', 0);
$member_id = JRequest::getInt('member_id', 0);
//$member = oseRegistry::call('member');
//$member->instance($member_id);
//$memInfo = $member->getMembership($msc_id,'obj');
//$memInfoParams = oseObject::getParams($memInfo);
$mscLicInfo = oseRegistry::call('msc')->getExtInfo($msc_id, 'lic', 'obj');
$mscLicInfoParams = oseObject::getParams($mscLicInfo);
$where = array();
$where[] = "license_user_id = '{$member_id}'";
$post['id'] = $item->id;
$post['license_user_id'] = $member_id;
if (empty($post['id'])) {
$updated = oseDB::insert('#__oselic_license_seat', $post);
} else {
$updated = oseDB::update('#__oselic_license_seat', 'id', $post);
}
if (!$updated) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Fail Saving OSEMSC User Info.');
$result['member_id'] = '';
} else {
$result['success'] = true;
$result['title'] = 'Done';
$result['content'] = JText::_('Saved Joomla User Info.');
}
return $result;
}
示例3: save
function save()
{
$id = JRequest::getInt('id', 0);
//$domain = JRequest::getString('domain','','post', JREQUEST_ALLOWRAW);
$domain = JRequest::getString('domain');
$user_id = JRequest::getInt('user_id');
$msc_id = JRequest::getInt('msc_id');
$start_date = JRequest::getString('start_date');
//$start_date = date('Y-m-d H:i:s',strtotime($start_date));;
$end_date = JRequest::getString('end_date');
//$end_date = date('Y-m-d H:i:s',strtotime($end_date));;
//$data = JRequest::getString('data');
$vals = array();
$vals['id'] = $id;
$vals['userID'] = $user_id;
$vals['domain'] = $domain;
$vals['mscID'] = $msc_id;
$vals['start_date'] = $start_date;
$vals['end_date'] = $end_date;
if (empty($id)) {
unset($vals['id']);
$updated = oseDB::insert($this->table, $vals);
} else {
$updated = oseDB::update($this->table, 'id', $vals);
}
if ($updated) {
$result['success'] = true;
$result['title'] = JText::_('SUCCESS');
$result['content'] = JText::_('Saved');
} else {
$result['success'] = false;
$result['title'] = JText::_('ERROR');
$result['content'] = JText::_('Fail Saving');
}
$result = oseJSON::encode($result);
oseExit($result);
}
示例4: create
function create()
{
$db = oseDB::instance();
$query = " SELECT COUNT(*) FROM `{$this->_table}`";
$db->setQuery($query);
$num = $db->loadResult();
if ($num > 0) {
$this->set('lft', $num * 2 + 1);
$this->set('rgt', $num * 2 + 2);
$this->set('ordering', $num + 1);
}
$vals = $this->getProperties();
$updated = oseDB::insert($this->_table, $vals);
if ($updated) {
$this->set('id', $updated);
foreach ($this->_type as $k => $o) {
$class = $this->getTypeItem($o->id);
}
$this->__construct();
return $updated;
} else {
return false;
}
}
示例5: insertSubmit
function insertSubmit($args, $params = array())
{
$db = oseDB::instance();
$sql = $args;
$sql['id'] = null;
$sql['entry_id'] = null;
$sql['entry_type'] = 'credit_submit';
$sql['status'] = 1;
if (!empty($params)) {
$sql['credit'] = $params['credit_amount'];
$sql['params'] = oseJson::encode($params);
}
$keys = array();
$values = array();
$inserted_id = oseDB::insert($this->table, $sql);
$args = array();
$args['id'] = $inserted_id;
$args['content_id'] = $inserted_id;
$item = $this->getItemSubmit($inserted_id);
$result = $this->updateSubmit($item, $args, $params = array());
return $result;
}
示例6: create
function create()
{
$vals = $this->toArray();
unset($vals['id']);
$vals['params'] = oseJson::encode($this->get('params'));
return oseDB::insert($this->table, $vals);
}
示例7: addOrderInfoFix
protected function addOrderInfoFix($order_id)
{
$result = array();
$db = oseDB::instance();
$query = " SELECT * FROM `#__osemsc_order_fix`" . " WHERE `order_id` = '{$order_id}'";
$db->setQuery($query);
$item = oseDB::loadItem('obj');
if (empty($item)) {
$query = " SELECT b.*,a.entry_id,a.order_item_id" . " FROM `#__osemsc_order_item` AS a" . " INNER JOIN `#__osemsc_order` AS b ON b.order_id = a.order_id" . " WHERE a.`order_id` = '{$order_id}'";
$db->setQuery($query);
$oInfo = oseDB::loadItem('obj');
$query = " SELECT * FROM `#__osemsc_member`" . " WHERE `msc_id` = '{$oInfo->entry_id}' AND `member_id`='{$oInfo->user_id}'";
$db->setQuery($query);
$mItem = oseDB::loadItem('obj');
if (!empty($mItem)) {
// update the order paypal status
$ofVals = array();
$ofVals['order_id'] = $oInfo->order_id;
$ofVals['order_item_id'] = $oInfo->order_item_id;
$ofVals['member_id'] = $mItem->id;
$ofVals['msc_id'] = $mItem->msc_id;
$ofVals['user_id'] = $mItem->member_id;
$ofVals['hasParams'] = 1;
$ofVals['payment_method'] = $oInfo->payment_method;
$ofVals['payment_mode'] = 'a';
$ofVals['status'] = 'updated';
$ofVals['create_date'] = oseHtml::getDateTime();
$ofVals['params'] = $oInfo->params;
$user = JFactory::getUser($mItem->member_id);
$ofVals['email'] = $user->email;
oseDB::insert("#__osemsc_order_fix", $ofVals);
}
}
}
示例8: create
function create()
{
$vals = $this->getProperties();
return oseDB::insert($this->_table, $vals);
}
示例9: save
public static function save()
{
$result = array();
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_('Saved User Billing Info.');
$post = JRequest::get('post');
$user = oseMscPublic::getUser();
$member_id = $user->id;
if(!empty($post['juser_firstname']))
{
$post['bill_firstname'] = $post['juser_firstname'];
}
if(!empty($post['juser_lastname']))
{
$post['bill_lastname'] = $post['juser_lastname'];
}
$billinfo = array();
foreach($post as $key => $value)
{
if(strstr($key,'bill_'))
{
$billKey = str_replace('bill_','',$key);
$billinfo[$billKey] = $value;
}
}
if(empty($billinfo))
{
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_('Nothing need to save!');
}
//oseExit($billinfo);
$db = oseDB::instance();
//$member_id = JRequest::getInt('member_id',0);
$query = " SELECT count(*) FROM `#__osemsc_billinginfo` WHERE user_id='{$member_id}'";
$db->setQuery($query);
$num = $db->loadResult();
$fields = $db->getTableFields('#__osemsc_billinginfo');
foreach($billinfo as $key => $value)
{
$my = JFactory::getUser();
if(!isset($fields['#__osemsc_billinginfo'][$key]))
{
if(oseMscPublic::isUserAdmin($my))
{
$query = "ALTER TABLE `#__osemsc_billinginfo` ADD `{$key}` TEXT NULL DEFAULT NULL";
$db->setQuery($query);
if (!oseDB::query())
{
$result['success'] = false;
$result['title'] = JText::_('Error');
$result['content'] = JText::_('Fail Saving Joomla User Info.');
}
}
else
{
//unset($billinfo[$key]);
}
}
}
if (empty ($num)) {
$keys = array_keys($billinfo);
$keys = '`'.implode('`,`',$keys).'`';
/*
foreach($billinfo as $key => $value)
{
$billinfo[$key] = $db->Quote($value);
}
$values = implode(',',$billinfo);
if (empty($values))
{
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_('Nothing need to save!');
}
$query = "INSERT INTO `#__osemsc_billinginfo` (`user_id`,{$keys}) VALUES ('{$member_id}',{$values});";
$db->setQuery($query);
*/
$billinfo['user_id'] = $user->id;
if (!oseDB::insert('#__osemsc_billinginfo',$billinfo)) {
$result['success'] = false;
$result['title'] = JText::_('Error');
$result['content'] = JText::_('Fail Saving Joomla User Info.');
//.........这里部分代码省略.........
示例10: save
public static function save($app = 'msc', $config_type, $vals)
{
$db = oseDB::instance();
$config = self::load($app, $config_type, 'obj');
$updated = true;
foreach ($vals as $k => $v) {
$where = array();
$where[] = '`app`=' . $db->Quote($app);
$where[] = '`type`=' . $db->Quote($config_type);
$where[] = '`key`=' . $db->Quote($k);
$where = oseDB::implodeWhere($where);
$query = " SELECT COUNT(id) FROM `#__ose_app_config`" . $where;
$db->setQuery($query);
$total = $db->loadResult();
if ($total > 0) {
$iVals = array();
$iVals['id'] = $total;
$iVals['value'] = $v;
$updated = oseDB::update('#__ose_app_config', 'id', $iVals);
} else {
$iVals = array();
$iVals['app'] = $app;
$iVals['type'] = $config_type;
$iVals['key'] = $k;
$iVals['value'] = $v;
$updated = oseDB::insert('#__ose_app_config', $iVals);
}
}
return $updated;
}
示例11: checkTableInfo
function checkTableInfo()
{
$db = oseDB::instance();
// check billing
$query = " SELECT COUNT(*) FROM `#__osemsc_billinginfo`" . " WHERE `user_id` = '{$this->member_id}'";
$db->setQuery($query);
$result = $db->loadResult();
if ($result <= 0) {
$user = new JUser($this->member_id);
$names = explode(' ', $user->name);
$firstname = $names[0];
$lastname = count($names) > 1 ? $names[1] : '';
oseDB::insert('#__osemsc_billinginfo', array('user_id' => $this->member_id, 'firstname' => $firstname, 'lastname' => $lastname));
}
// check user info
$query = " SELECT COUNT(*) FROM `#__osemsc_userinfo`" . " WHERE `user_id` = '{$this->member_id}'";
$db->setQuery($query);
$result = $db->loadResult();
if ($result <= 0) {
$user = new JUser($this->member_id);
$names = explode(' ', $user->name);
$firstname = $names[0];
$lastname = count($names) > 1 ? $names[1] : '';
oseDB::insert('#__osemsc_userinfo', array('user_id' => $this->member_id, 'firstname' => $firstname, 'lastname' => $lastname));
}
return true;
}
示例12: updateCoupon
private function updateCoupon($item,$coupon_number = null)
{
$db = oseDB::instance();
$user = oseMscPublic::getUser();
$coupon_id = oseObject::getValue($item,'id',0);
$where = array();
if($user->guest)
{
$where[] = "coupon_number = '{$coupon_number}'";
}
else
{
$where[] = "user_id = '{$user->id}'";
}
$where[] = "`coupon_id` = '{$coupon_id}'";
$where[] = "`paid` = 0";
$where = oseDB::implodeWhere($where);
$query = " SELECT * FROM `#__osemsc_coupon_user`"
. $where
." ORDER BY `id` DESC"
;
$db->setQuery($query);
$obj = oseDB::loadItem('obj');
$array = array();
if(empty($obj))
{
$array['coupon_id'] = $coupon_id;
$array['user_id'] = $user->id;
$array['msc_id'] = 0;
$array['coupon_number'] = $coupon_number;
$updated = oseDB::insert('#__osemsc_coupon_user',$array);
$coupon_user_id = $updated;
if(!$updated)
{
return false;
}
if(oseObject::getValue($item,'amount_infinity') == 0)
{
$couponParams = oseJson::decode($item->params);
$couponParams->amount_left--;
$couponParams = oseJson::encode($couponParams);
$array = array();
$array['id'] = $coupon_id;
$array['params'] = $couponParams;
//oseExit($couponParams);
$updated = oseDB::update('#__osemsc_coupon','id',$array);
if(!$updated)
{
return false;
}
}
}
else
{
$array['id'] = $obj->id;
$array['coupon_id'] = $coupon_id;
$array['user_id'] = $user->id;
$array['msc_id'] = 0;
$coupon_user_id = $obj->id;
$updated = oseDB::update('#__osemsc_coupon_user','id',$array);
}
if($updated)
{
$updated = $coupon_user_id;
}
return $updated;
}
示例13: saveState
function saveState()
{
$db = oseDB::instance();
$post = JRequest::get('post');
$state_id = JRequest::getInt('state_id', 0);
$country_id = JRequest::getInt('country_id', 0);
$state_name = JRequest::getCmd('state_name', null);
$state_3_code = JRequest::getCmd('state_3_code', null);
$state_2_code = JRequest::getCmd('state_2_code', null);
$where = array();
//$where[] = '`State_3_code` ='.$db->Quote($State_3_code);
//$where[] = '`State_2_code` ='.$db->Quote($State_2_code);
$where[] = '`state_id` =' . $db->Quote($state_id);
$where = oseDB::implodeWhere($where);
$query = "SELECT * FROM `#__osemsc_state`" . $where . ' LIMIT 1';
$db->setQuery($query);
$item = oseDB::loadItem('obj');
if (!empty($item)) {
$id = $item->state_id;
} else {
$id = $state_id;
}
if (empty($id)) {
$updated = oseDB::insert('#__osemsc_state', $post);
} else {
$updated = oseDB::update('#__osemsc_state', 'state_id', $post);
}
if ($updated) {
$result['success'] = true;
$result['title'] = JText::_('DONE');
$result['content'] = JText::_('SAVE_SUCCESSFULLY');
} else {
$result['success'] = false;
$result['title'] = JText::_('ERROR');
$result['content'] = JText::_('ERROR');
}
$result = oseJson::encode($result);
oseExit($result);
}
示例14: save
public static function save($params)
{
$result = array();
$result['success'] = true;
if(empty($params['allow_work']))
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Error");
return $result;
}
unset($params['allow_work']);
if($params['join_from'] != 'payment')
{
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Success");
return $result;
}
$db = oseDB::instance();
$msc_id = oseObject::getValue($params,'msc_id');
$member_id = oseObject::getValue($params,'member_id');
$mscLicInfo = oseRegistry::call('msc')->getExtInfo($msc_id,'lic','obj');
$mscLicSeatInfo = oseRegistry::call('msc')->getExtInfo($msc_id,'licseat','obj');
if(!oseObject::getValue($mscLicSeatInfo,'enabled',false))
{
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Success");
return $result;
}
if(empty($mscLicSeatInfo) || empty($mscLicInfo->license_id))
{
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Success");
return $result;
}
$lic_id = $mscLicInfo->license_id;
$user = new JUser($member_id);
$post = array();
$post['license_id'] = $lic_id;
$post['licenser_id'] = $member_id;
$post['seat_number'] = $mscLicSeatInfo->seat_number;
$post['contact_send'] = $mscLicSeatInfo->contact_send;
$post['internal_contact_send'] = $mscLicSeatInfo->internal_contact_send;
$post['contact'] = $user->email;
$post['internal_contact'] = $user->email;
$order_id = oseObject::getValue($params,'order_id');
$order_item_id = oseObject::getValue($params,'order_item_id');
$where = array();
$where[] = 'order_item_id = '.$db->Quote($order_item_id);
$orderInfo = oseRegistry::call('payment')->getOrderItem($where,'obj');
if($orderInfo->entry_type == 'license')
{
$updated = oseDB::insert('#__oselic_license_seat',$post);
if($updated)
{
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Success");
}
else
{
$result['success'] = false;
$result['title'] = JText::_('Error');
$result['content'] = JText::_("Error: License Seat Addon Fail");
}
}
else
{
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Success");
}
return $result;
}
示例15: createChild
function createChild($vals)
{
$db = oseDB::instance();
$level = $this->getNodeLevel();
$vals['level'] = $level + 1;
$children = $this->getChildren();
$childrenTotal = count($children);
if ($childrenTotal > 0) {
$child = $children[$childrenTotal - 1];
$query = " UPDATE `{$this->_table}` AS acl2 SET acl2.rgt = acl2.rgt + 2 " . " WHERE acl2.rgt > {$child->rgt} ";
$db->setQuery($query);
if (!oseDB::query()) {
return false;
}
$query = " UPDATE `{$this->_table}` AS acl2 SET acl2.lft = acl2.lft + 2 " . " WHERE acl2.lft > {$child->rgt} ";
$db->setQuery($query);
if (!oseDB::query()) {
return false;
}
$vals['lft'] = $child->rgt + 1;
$vals['rgt'] = $child->rgt + 2;
$vals['ordering'] = $child->ordering + 1;
$updated = oseDB::insert($this->_table, $vals);
if ($updated) {
$this->load();
}
return $updated;
} else {
// make two vacancy for the new item
$query = " UPDATE `{$this->_table}` SET rgt = rgt + 2 " . " WHERE rgt > {$this->lft} ";
$db->setQuery($query);
if (!oseDB::query()) {
return false;
}
$query = " UPDATE `{$this->_table}` AS acl2 SET acl2.lft = acl2.lft + 2 " . " WHERE acl2.lft > {$this->lft} ";
$db->setQuery($query);
if (!oseDB::query()) {
return false;
}
$vals['lft'] = $this->lft + 1;
$vals['rgt'] = $this->rgt + 1;
$updated = oseDB::insert($this->_table, $vals);
if ($updated) {
$this->load();
}
return $updated;
}
}