本文整理汇总了PHP中oseJson类的典型用法代码示例。如果您正苦于以下问题:PHP oseJson类的具体用法?PHP oseJson怎么用?PHP oseJson使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了oseJson类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getInstance
public static function getInstance($type)
{
static $instance;
$className = "osePaymentSC{$type}";
$arrayInstance = array();
$arrayInstance['MscList'] = 'osePaymentMscList';
$arrayInstance['View'] = 'osePaymentView';
$arrayInstance['Price'] = 'osePaymentPrice';
$arrayInstance['Tax'] = 'osePaymentTax';
$arrayInstance['GateWay'] = 'osePaymentGateWay';
if (isset($arrayInstance[$type])) {
if (strtolower($type) == 'price') {
$primaryCurrency = osePayment::getCurrencyInfo();
$instance = new osePaymentPrice($primaryCurrency->value, oseJson::decode($primaryCurrency->default));
return $instance;
}
$className = $arrayInstance[$type];
} else {
$className = "osePaymentSC{$type}";
}
if (!$instance instanceof $className) {
$instance = new $className();
}
return $instance;
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:25,代码来源:paymentSC.php
示例2: add
public static function add($params)
{
$result = array();
$result['success'] = true;
if(empty($params))
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Register_Order.PAP');
return $result;
}
//unset($params['allow_work']);
if(!empty($_COOKIE['PAPVisitorId']))
{
$orderParams = oseJson::decode($params['params']);
$orderParams->pap_visitorid = $_COOKIE['PAPVisitorId'];
$orderParams->first_ip = oseMscPublic::getIP();
$params['params'] = oseJson::encode($orderParams);
return $params;
}
else
{
return $params;
}
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:29,代码来源:register_order.pap.php
示例3: 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);
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:25,代码来源:member.join_history.php
示例4: add
public static function add($params)
{
$result = array();
$result['success'] = true;
if(empty($params))
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Register_Order.PAP');
return $result;
}
//unset($params['allow_work']);
if(!empty($_COOKIE['oseAffiliate']))
{
$orderParams = oseJson::decode($params['params']);
$oseAffiliate = oseJSON::decode($_COOKIE['oseAffiliate']);
$orderParams->oseaffiliateID = $oseAffiliate->oafid;
$orderParams->osebannerID = $oseAffiliate->obid;
$orderParams->first_ip = oseMscPublic::getIP();
//$orderParams->first_ip = oseMscPublic::getIP();
$params['params'] = oseJson::encode($orderParams);
return $params;
}
else
{
return $params;
}
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:32,代码来源:register_order.oseaffiliate.php
示例5: display
function display($tpl = null)
{
$tmpl = JRequest::getVar('tmpl');
if (empty($tmpl)) {
JRequest::setVar('tmpl', 'component');
}
if (JOOMLA16 == false) {
require_once OSEMSC_B_PATH . DS . 'helpers' . DS . "extLanguage.php";
oseHTML::script(OSEMSC_F_URL . '/libraries/joomla.core.js', '1.5');
$strings = oseJson::encode(oseText::jsStrings());
$document = JFactory::getDocument();
$document->addScriptDeclaration('(function(){var strings=' . $strings . ';Joomla.JText.load(strings)})()');
}
$com = OSECPU_PATH_JS . '/com_ose_cpu/extjs';
oseHTML::initScript();
oseHTML::script($com . '/ose/app.msg.js', '1.5');
oseHTML::script(OSEMSC_F_URL . '/libraries/init.js', '1.5');
require_once OSEMSC_B_PATH . DS . 'helpers' . DS . "extLanguage.php";
$OSESoftHelper = new OSESoftHelper();
$footer = $OSESoftHelper->renderOSETM();
$this->assignRef('footer', $footer);
$preview_menus = $OSESoftHelper->getPreviewMenus();
$this->assignRef('preview_menus', $preview_menus);
$this->assignRef('OSESoftHelper', $OSESoftHelper);
$title = JText::_('OSE Membership™ Profile Management');
$this->assignRef('title', $title);
parent::display($tpl);
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:28,代码来源:view.html.php
示例6: 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;
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:34,代码来源:osePaymentOrderclickbank.php
示例7: 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;
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:58,代码来源:renew.osecredit.php
示例8: 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;
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:58,代码来源:renew.docman.php
示例9: getItems
function getItems()
{
// Get a storage key.
$store = $this->getStoreId('getItems');
// Try to load the data from internal storage.
if (!empty($this->cache[$store])) {
return $this->cache[$store];
}
$search = $this->getState('filter.search');
$searchid = $this->getState('filter.searchid');
$searchpe = $this->getState('filter.searchpe');
// Load the list items.
$items = parent::getItems();
// If emtpy or an error, just return.
if (empty($items)) {
return array();
}
//oseExit($items);
$db = oseDB::instance();
// Inject the values back into the array.
foreach ($items as $k => $item) {
$order_id = null;
if ($item->msc_id > 0) {
$params = oseJson::decode($item->params);
$order_id = oseGetValue($params, 'order_id', 0);
$query = " SELECT `title` FROM `#__osemsc_acl`" . " WHERE `id` = '{$item->msc_id}'";
$db->setQuery($query);
$item->membership = $db->loadResult();
$query = " SELECT *" . " FROM `#__osemsc_order_fix`" . " WHERE `member_id` = '{$item->id}'";
$db->setQuery($query);
$ofItem = oseDB::loadItem('obj');
$item->paypal_email = oseObject::getValue($ofItem, 'email', $item->email);
} else {
$item->expired_date = null;
$item->status = '';
}
if (empty($search) && empty($searchid) && empty($searchpe)) {
//return array();
} else {
//$item->order_number = null;
if (!empty($order_id)) {
$query = " SELECT `order_id`,`order_number`,`payment_serial_number`,`order_status`" . " FROM `#__osemsc_order`" . " WHERE `order_id` = '{$order_id}'";
$db->setQuery($query);
$oItem = oseDB::loadItem('obj');
$item->order_number = $oItem->order_number;
$item->order_id = $oItem->order_id;
$item->payment_serial_number = $oItem->payment_serial_number;
$item->order_status = $oItem->order_status;
} else {
}
}
$items[$k] = $item;
}
// Add the items to the internal cache.
$this->cache[$store] = $items;
return $this->cache[$store];
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:57,代码来源:paypal.php
示例10: PayFastOneOffPostForm
function PayFastOneOffPostForm($orderInfo, $params = array())
{
$pConfig = oseMscConfig::getConfig('payment', 'obj');
$merchantId = $pConfig->payfast_merchant_id;
$merchantKey = $pConfig->payfast_merchant_key;
$html = array();
$test_mode = $pConfig->payfast_testmode;
if (!$test_mode) {
if (empty($merchantId) || empty($merchantKey)) {
$html['form'] = "";
$html['url'] = "";
return $html;
}
}
if ($test_mode == true) {
$merchantId = '10000100';
$merchantKey = '46f0cd694581a';
$url = "https://sandbox.payfast.co.za/eng/process";
} else {
$url = "https://www.payfast.co.za/eng/process";
}
$db = oseDB::instance();
$member = oseRegistry::call('member');
$member->instance($orderInfo->user_id);
$payment = oseRegistry::call('payment');
$paymentOrder = $payment->getInstance('Order');
$billinginfo = $paymentOrder->getBillingInfo($orderInfo->user_id);
$amount = $orderInfo->payment_price;
$currency = $orderInfo->payment_currency;
$order_id = $orderInfo->order_id;
$order_number = $orderInfo->order_number;
$user =& JFactory::getUser($orderInfo->user_id);
$orderInfoParams = oseJson::decode($orderInfo->params);
$cancelUrl = JURI::base() . "index.php";
$notifyUrl = JURI::base() . "components/com_osemsc/ipn/payfast_notify.php";
$returnUrl = urldecode(JROUTE::_(JURI::base() . "index.php?option=com_osemsc&view=thankyou&order_id=" . $orderInfo->order_id));
$returnUrl = $returnUrl ? $returnUrl : JURI::base() . "index.php?option=com_osemsc&view=member&result=success&amount={$amount}&ordernumber={$order_number}";
// Create description
$description = '';
$vendor_image_url = "";
$app =& JFactory::getApplication();
$currentSession = JSession::getInstance('none', array());
$stores = $currentSession->getStores();
$html['form'] = '<form action="' . $url . '" method="post">';
// Construct variables for post
$post_variables = array('merchant_id' => $merchantId, 'merchant_key' => $merchantKey, 'return_url' => $returnUrl, 'cancel_url' => $cancelUrl, 'notify_url' => $notifyUrl, 'name_first' => substr($billinginfo->firstname, 0, 100), 'name_last' => substr($billinginfo->lastname, 0, 100), 'email_address' => substr($billinginfo->email, 0, 255), 'item_name' => JText::_('Order ID: ') . $order_id, 'item_description' => $description, 'amount' => number_format($amount, 2, '.', ''), 'm_payment_id' => $order_id, 'currency_code' => $currency, 'custom_str1' => $order_number, 'user_agent' => 'Open Source Membership Control V5');
$html['form'] .= '<input type="image" id="payfast_image" name="cartImage" src="' . "components/com_osemsc/assets/images/checkout.png" . '" alt="' . JText::_('Click to pay with PayFast') . '" />';
// Process payment variables;
$html['url'] = $url . "?";
foreach ($post_variables as $name => $value) {
$html['form'] .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />';
$html['url'] .= $name . "=" . urlencode($value) . "&";
}
$html['form'] .= '</form>';
return $html;
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:56,代码来源:osePaymentOrderpayfast.php
示例11: getTerm
function getTerm()
{
$id = JRequest::getInt('id',0);
$terms = oseRegistry::call('member')->getInstance('Email')->getTerm($id);
$terms = str_replace("../", JURI::root(), $terms);
$result = empty($terms)?'':$terms;
$result = oseJson::encode($result);
oseExit($result);
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:10,代码来源:register.terms.php
示例12: 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']);
$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::_("Join Msc: No Msc ID");
return $result;
}
// get the sobi2 credit of msc
$query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$msc_id}' AND `type` = 'sobi2credit'";
$db->setQuery($query);
$data = $db->loadObject();
$data = oseJson::decode($data->params);
if (empty($data->credit)) {
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
$query = "SELECT * FROM `#__osemsc_credit` WHERE `member_id` = '{$member_id}'";
$db->setQuery($query);
$obj = $db->loadObject();
if (empty($obj)) {
$query = " INSERT INTO `#__osemsc_credit`" . " (`member_id`, `credit`, `recharge_times`, `total_consume_amout`)" . " VALUES" . " ('{$member_id}', '{$data->credit}', '0', '0')";
} else {
$credit = $obj->credit + $data->credit;
$recharge_times = $obj->recharge_times + 1;
$query = "UPDATE `#__osemsc_credit` SET `credit` = '{$credit}', `recharge_times` = '{$recharge_times}' WHERE `member_id` = '{$member_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;
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:54,代码来源:renew.sobi2credit.php
示例13: save
public static function save($params)
{
$result = array();
$result['success'] = true;
//oseExit($params);
if (empty($params['allow_work'])) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Join.Idev');
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;
}
$oseMscConfig = oseRegistry::call('msc')->getConfig('thirdparty', 'obj');
if (empty($oseMscConfig->idev_enable)) {
return $result;
}
if (empty($oseMscConfig->idev_url)) {
return $result;
}
$db = oseDB::instance();
//$post = JRequest::get('post');
$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');
$curOrderParams = oseJson::decode($curOrder->params);
$member = oseRegistry::call('member');
$member->instance($member_id);
$userInfo = $member->getUserInfo('obj');
$memParams = $member->getMemberInfo($msc_id, 'obj')->memParams;
$memParams = oseJSON::decode($memParams);
$memParams->first_ip = $curOrderParams->first_ip;
try {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $oseMscConfig->idev_url . "/sale.php?profile=72198&idev_saleamt={$curOrder->payment_price}&idev_ordernum={$order_id}&ip_address={$memParams->first_ip}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
return $result;
} catch (Exception $e) {
return $result;
}
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:53,代码来源:join.idev.php
示例14: setParams
function setParams($item, $params)
{
$itemParams = oseGetValue($item, 'params', '{}');
$itemParams = oseJson::decode($itemParams);
if (!is_Array($params)) {
$params = (array) $params;
}
foreach ($params as $key => $value) {
$itemParams = oseSetValue($itemParams, $key, $value);
}
$itemParams = oseJson::encode($itemParams);
$item = oseSetValue($item, 'params', $itemParams);
return $item;
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:14,代码来源:oseObject.php
示例15: init
protected function init($item)
{
$item = empty($item) ? array() : (array) $item;
foreach ($item as $key => $value) {
if ($key == 'config') {
$value = empty($value) ? '{}' : $value;
$this->set($key, oseJson::decode($value));
} elseif ($key == 'params') {
$this->set($key, $this->getParams($item));
} else {
$this->set($key, $value);
}
}
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:14,代码来源:osePaymentGateWay.php
示例16: getOwnMsc
function getOwnMsc()
{
$model = $this->getModel('member');
$items = $model->getOwnMsc();
$total = count($items);
if ($total > 0) {
$result['total'] = $total;
$result['results'] = $items;
} else {
$result['total'] = 0;
$result['results'] = null;
}
$result = oseJson::encode($result);
oseExit($result);
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:15,代码来源:member.php
示例17: add
public static function add($params)
{
$result = array();
$result['success'] = true;
if (empty($params)) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Register_Order.Idev');
return $result;
}
$orderParams = oseJson::decode($params['params']);
$orderParams->first_ip = oseMscPublic::getIP();
$params['params'] = oseJson::encode($orderParams);
return $params;
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:15,代码来源:register_order.idev.php
示例18: getList
function getList()
{
$model = $this->getModel('levels');
$results = $model->getList();
$result = array();
if (count($results) > 0) {
$result['total'] = count($results);
$result['results'] = $results;
} else {
$result['total'] = 0;
$result['results'] = array();
}
$result = oseJson::encode($result);
oseExit($result);
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:15,代码来源:levels.php
示例19: save
public static function save($params)
{
$result = array();
$result['success'] = true;
//oseExit($params);
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();
//$post = JRequest::get('post');
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
$order_id = $params['order_id'];
$order_item_id = $params['order_item_id'];
$payment= oseRegistry :: call('payment');
$orderInfo= $payment->getInstance('Order')->getOrder(array("order_id = {$order_id}"), 'obj');
$orderInfoParams = oseJson::decode($orderInfo->params);
$array = array();
$array['id'] = $orderInfoParams->coupon_user_id;
if(!empty($array['id']))
{
$array['paid'] = 1;
$array['user_id'] = $member_id;
$updated = oseDB::update('#__osemsc_coupon_user','id',$array);
}
return $result;
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:48,代码来源:join.coupon.php
示例20: 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 groupid of msc
$query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$msc_id}' AND `type` = 'jgroup'";
$db->setQuery($query);
$data = $db->loadObject();
$data = oseJson::decode($data->params);
if (empty($data->jgroup_id)) {
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
$user = JUser::getInstance($member_id);
$group['groups'] = array_merge($user->groups, (array) $data->jgroup_id);
$user->bind($group);
if (!$user->save()) {
$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;
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:47,代码来源:renew.jgroup.php
注:本文中的oseJson类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论