本文整理汇总了PHP中oseDB::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP oseDB::instance方法的具体用法?PHP oseDB::instance怎么用?PHP oseDB::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oseDB
的用法示例。
在下文中一共展示了oseDB::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public static function create()
{
$msc_id = JRequest::getInt('msc_id', null);
if (empty($msc_id)) {
$result['success'] = false;
$result['title'] = JText::_('ERROR');
$result['content'] = JText::_('ERROR');
return $result;
}
$mscItem = oseRegistry::call("msc")->getInfo($msc_id, $type = 'array');
if (empty($mscItem)) {
$result['success'] = false;
$result['title'] = JText::_('ERROR');
$result['content'] = JText::_('ERROR');
return $result;
}
$db = oseDB::instance();
$query = " SELECT `shopper_group_id` FROM `#__vm_shopper_group` " . " WHERE `shopper_group_name` = " . $db->Quote($mscItem['title']);
$db->setQuery($query);
$items = oseDB::loadList();
if (empty($items)) {
$query = " INSERT INTO `#__vm_shopper_group` (`shopper_group_id`, `vendor_id`, `shopper_group_name`, `shopper_group_desc`, `shopper_group_discount`, `show_price_including_tax`, `default`) VALUES (NULL, 1, " . $db->Quote($mscItem['title']) . ", " . $db->Quote($mscItem['title']) . ", 0.00, 1, 0);";
$db->setQuery($query);
if (!$db->query()) {
$result['success'] = false;
$result['title'] = JText::_('ERROR');
$result['content'] = $db->getErrorMsg();
return $result;
}
}
$result['success'] = true;
$result['title'] = JText::_('DONE');
$result['content'] = JText::_('SAVE_SUCCESSFULLY');
return $result;
}
示例2: save
public static function save($params) {
$result = array();
$post = JRequest::get('post');
$member_id = $params['member_id'];
JRequest::setVar('member_id', $member_id);
if (empty($member_id)) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error');
return $result;
}
$db = oseDB::instance();
$firstname = $db->Quote(oseObject::getValue($post, 'juser_firstname', $post['juser_username']));
$lastname = $db->Quote(oseObject::getValue($post, 'juser_lastname'));
$query = " SELECT COUNT(*) FROM `#__osemsc_userinfo` WHERE user_id = ". (int)$member_id;
$db->setQuery($query);
$exists = ($db->loadResult() > 0) ? true : false;
if ($exists) {
return array('success' => true);
} else {
$query = " INSERT INTO `#__osemsc_userinfo` (user_id,firstname,lastname)"
. " VALUES" . " ({$member_id},{$firstname},{$lastname})";
$db->setQuery($query);
if (!oseDB::query()) {
$result = array();
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Fail Saving OSE User Info.');
return $result;
}
return array('success' => true);
}
}
示例3: activate
public static function activate($params)
{
$result = array();
$result['success'] = true;
if (empty($params['allow_work'])) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Renew.History');
return $result;
}
unset($params['allow_work']);
$db = oseDB::instance();
$post = JRequest::get('post');
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
$result = array();
$result['success'] = true;
if (empty($msc_id)) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_(" History Error ");
return $result;
}
$history = oseRegistry::call('member')->getInstance('History');
if (!$history->record($msc_id, $member_id, 'activate')) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_(" Fail Record Member's Footprint! ");
}
return $result;
}
示例4: getMSCs
public static function getMSCs()
{
$my = JFactory::getUser();
$member_id = $my->id;
$result = array();
$db= oseDB :: instance();
$query= " SELECT acl.id, acl.title FROM `#__osemsc_member_history` AS omh"
." INNER JOIN `#__osemsc_acl` AS acl"
." ON omh.`msc_id` = acl.`id`"
." WHERE omh.`member_id` = '{$member_id}'"
." GROUP BY acl.`id`";
$db->setQuery($query);
$items = oseDB :: loadList();
if(count($items) < 1)
{
$result['total'] = 0;
$result['results'] = '';
}else
{
$result['total'] = count($items);
$result['results'] = $items;
}
$result = oseJson :: encode($result);
oseExit($result);
}
示例5: generateDesc
function generateDesc($order_id)
{
$title = null;
$db = oseDB::instance();
$query = "SELECT * FROM `#__osemsc_order_item` WHERE `order_id` = '{$order_id}'";
$db->setQuery($query);
$obj = $db->loadObject();
$params = oseJson::decode($obj->params);
$msc_id = $obj->entry_id;
$query = "SELECT title FROM `#__osemsc_acl` WHERE `id` = " . (int) $msc_id;
$db->setQuery($query);
$msc_name = $db->loadResult();
$msc_option = $params->msc_option;
$query = "SELECT params FROM `#__osemsc_ext` WHERE `type` = 'payment' AND `id` = " . (int) $msc_id;
$db->setQuery($query);
$result = oseJson::decode($db->loadResult());
foreach ($result as $key => $value) {
if ($msc_option == $key) {
if ($value->recurrence_mode == 'period') {
if ($value->eternal) {
$title = 'Life Time Membership';
} else {
$title = $value->recurrence_num . ' ' . ucfirst($value->recurrence_unit) . ' Membership';
}
} else {
$start_date = date("l,d F Y", strtotime($value->start_date));
$expired_date = date("l,d F Y", strtotime($value->expired_date));
$title = $start_date . ' - ' . $expired_date . ' Membership';
}
}
}
$title = $msc_name . ' : ' . $title;
return $title;
}
示例6: getLangID
function getLangID($lang)
{
$db = oseDB::instance();
$query = "SELECT id FROM `#__languages` WHERE `code` = " . $db->Quote($lang, true) . " OR `shortcode` = " . $db->Quote($lang, true);
$id = $db->loadResult();
return $id;
}
示例7: getMemlist
public function getMemlist() {
$search = JRequest::getString('search', null);
$start = JRequest::getInt('start', 0);
$limit = JRequest::getInt('limit', 20);
$msc_id = JRequest::getInt('msc');
$status = JRequest::getVar('status');
$db = oseDB::instance();
$where = array();
$where[] = ' m.msc_id = ' . $msc_id;
if (isset($status) && $status != 'all') {
$where[] = ' m.status = ' . $status;
}
if (!empty($search)) {
$searchQuery = $db->Quote('%' . $search . '%');
$where[] = "m.username LIKE {$searchQuery} OR m.name LIKE {$searchQuery} OR m.email LIKE {$searchQuery}";
}
$where = oseDB::implodeWhere($where);
$query = " SELECT COUNT(*) " . " FROM `#__osemsc_member_view` AS m " . " INNER JOIN `#__osemsc_billinginfo` AS b ON m.member_id = b.user_id" . $where;
$db->setQuery($query);
$total = $db->loadResult();
$query = " SELECT * " . " FROM `#__osemsc_member_view` AS m " . " INNER JOIN `#__osemsc_billinginfo` AS b ON m.member_id = b.user_id" . $where;
$db->setQuery($query, $start, $limit);
$items = oseDB::loadList();
$result = array();
$result['total'] = $total;
$result['results'] = $items;
return $result;
}
示例8: cancel
public static function cancel($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']);
$db = oseDB::instance();
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
$msc = oseRegistry::call('msc');
$member = oseRegistry::call('member');
$payment = oseRegistry::call('payment');
$ext = $msc->getExtInfo($msc_id, 'msc', 'obj');
$member->instance($member_id);
$userInfo = $member->getBasicInfo('obj');
$member = oseRegistry::call('member');
$email = $member->getInstance('email');
$emailTempDetail = $email->getDoc($ext->cancel_email, 'obj');
$variables = $email->getEmailVariablesCancel($member_id, $msc_id);
$emailParams = $email->buildEmailParams($emailTempDetail->type);
$emailDetail = $email->transEmail($emailTempDetail, $variables, $emailParams);
$email->sendEmail($emailDetail, $userInfo->email);
$emailConfig = oseMscConfig::getConfig('email', 'obj');
if ($emailConfig->sendWel2Admin) {
$email->sendToAdminGroup($emailDetail, $emailConfig->admin_group);
}
return $result;
}
示例9: getloginRedirect
function getloginRedirect($msc_id)
{
$db = oseDB::instance();
oseDB::lock('#__menu');
$objs = array();
$where = array();
//$where = array_merge($where,oseJSON::generateQueryWhere());
// Added in V 4.4, menu access levels
//$where[] = 'm.menutype = '.$db->Quote($menutype);
$where[] = 'm.published != -2';
$where[] = 'm.client_id = 0';
$where = count($where) ? ' WHERE (' . implode(') AND (', $where) . ')' : '';
$query = 'SELECT m.*, com.name AS com_name' . ' FROM `#__menu` AS m' . ' LEFT JOIN `#__extensions` AS com ON com.extension_id = m.component_id' . $where . ' ORDER BY m.lft';
$db->setQuery($query);
//oseExit($db->getQuery());
$menus = $db->loadObjectList();
$i = 0;
if (!empty($menus)) {
foreach ($menus as $menu) {
$objs[$i]->menuid = $menu->id;
$objs[$i]->displayText = str_repeat('<span class="gtr">|—</span>', $menu->level) . '[ID-' . $menu->id . ']-' . $menu->title;
$i++;
}
}
oseDB::unlock();
return $objs;
}
示例10: getItem
function getItem()
{
$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);
$mscLicInfo = oseRegistry::call('msc')->getExtInfo($msc_id, 'lic', 'obj');
$mscLicInfoParams = oseObject::getParams($mscLicInfo);
$where = array();
$where[] = "license_user_id = '{$member_id}'";
if (empty($mscLicInfoParams->id)) {
$where[] = "license_id = '{$mscLicInfoParams->id}'";
}
$where = oseDB::implodeWhere();
$query = " SELECT * FROM `#__oselic_license_seat`" . $where . " ORDER BY id DESC";
$db->setQuery($query);
$item = oseDB::loadItem('obj');
$result['success'] = empty($item) ? false : true;
$result['total'] = empty($item) ? 0 : 1;
$result['result'] = empty($item) ? array() : $item;
//$result = oseJson::encode($result);
return $result;
}
示例11: 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;
}
示例12: getList
function getList()
{
$db = oseDB::instance();
$query = 'SELECT * FROM `#__groups` AS a ORDER by a.id ASC';
$db->setQuery($query);
$results = oseDB::loadList();
return $results;
}
示例13: 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 Join.Order.1');
return $result;
}
unset($params['allow_work']);
if ($params['join_from'] != 'payment') {
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_('Done Join.Order');
return $result;
}
$db = oseDB::instance();
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
$order_id = $params['order_id'];
$order_item_id = $params['order_item_id'];
$where = array();
$where[] = "order_id = {$order_id}";
$payment = oseRegistry::call('payment');
$curOrder = $payment->getOrder($where, 'obj');
$member = oseRegistry::call('member');
$member->instance($member_id);
$memParams = $member->getMemberInfo($msc_id, 'obj')->memParams;
if (empty($memParams)) {
$memParams = new stdClass();
} else {
$memParams = oseJSON::decode($memParams);
}
$memParams->order_id = $order_id;
$memParams->payment_mode = $curOrder->payment_mode;
$memParams->order_item_id = $order_item_id;
// Order problem for system add
$memParams = oseJSON::encode($memParams);
$query = " UPDATE `#__osemsc_member`" . " SET `params` = " . $db->Quote($memParams) . " WHERE msc_id = {$msc_id} AND member_id = {$member_id}";
$memConfig = oseMscConfig::getConfig('register', 'obj');
$db->setQuery($query);
if (!oseDB::query()) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Join.Order.2');
}
// User activation function;
$params = JComponentHelper::getParams('com_users');
$useractivation = $params->get('useractivation');
if (oseObject::getValue($memConfig, 'disabled_non_paid', false) == true) {
if ($useractivation == 0) {
$query = " UPDATE `#__users` SET `block` = 0 where `id` = " . $member_id;
$db->setQuery($query);
$db->query();
}
}
return $result;
}
示例14: activate
public static function activate($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']);
//oseExit($params);
$db = oseDB::instance();
$post = JRequest::get('post');
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
if (empty($msc_id)) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Renew Msc: No Msc ID");
return $result;
}
// get the docman groups_id of msc
$query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$msc_id}' AND `type` = 'docman'";
$db->setQuery($query);
$data = $db->loadObject();
$data = oseJson::decode($data->params);
if (empty($data->groups_id) || $data->groups_id == '-1') {
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
$docman_group_id = $data->groups_id;
$query = "SELECT * FROM `#__docman_groups` WHERE `groups_id` = " . (int) $docman_group_id;
$db->setQuery($query);
$obj = $db->loadObject();
if (!empty($obj)) {
$newmembers[] = $member_id;
if (!empty($obj->groups_members)) {
$oldmembers = explode(",", $obj->groups_members);
if (count($oldmembers) > 0) {
$newmembers = array_merge($oldmembers, $newmembers);
}
}
$newmembers = array_unique($newmembers);
$newmembers = implode(",", $newmembers);
$query = "UPDATE `#__docman_groups` SET `groups_members` = '" . $newmembers . "' WHERE `groups_id` = " . (int) $docman_group_id;
$db->setQuery($query);
if (!$db->query()) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Error");
return $result;
}
}
return $result;
}
示例15: renew
public static function renew($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']);
//oseExit($params);
$db = oseDB::instance();
$post = JRequest::get('post');
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
if (empty($msc_id)) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Renew Msc: No Msc ID");
return $result;
}
// get the plan id of msc
$query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$msc_id}' AND `type` = 'osecredit'";
$db->setQuery($query);
$data = $db->loadObject();
$data = oseJson::decode($data->params);
if (empty($data->osecredit_id) || empty($data->enable)) {
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
$query = "SELECT credit_amount FROM `#__ose_credit_plan` WHERE `id` = '{$data->osecredit_id}'";
$db->setQuery($query);
$amount = $db->loadResult();
$query = "SELECT * FROM `#__ose_credit_member` WHERE `member_id` = '{$member_id}'";
$db->setQuery($query);
$obj = $db->loadObject();
if (empty($obj)) {
$credit_params = oseJson::encode(array());
$query = " INSERT INTO `#__ose_credit_member` (`member_id`, `credit_amount`, `params`)" . " VALUES" . " ('{$member_id}', '{$amount}', '{$credit_params}')";
} else {
$amount = $amount + $obj->credit_amount;
$query = "UPDATE `#__ose_credit_member` SET `credit_amount` = '{$amount}' WHERE `id` = '{$obj->id}'";
}
$db->setQuery($query);
if (!$db->query()) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error');
return $result;
}
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}