本文整理汇总了PHP中JSFactory类的典型用法代码示例。如果您正苦于以下问题:PHP JSFactory类的具体用法?PHP JSFactory怎么用?PHP JSFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JSFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
function getList($groupordering = 0, $order = null, $orderDir = null, $filter = array())
{
$db = JFactory::getDBO();
$lang = JSFactory::getLang();
$ordering = "F.ordering";
if ($order && $orderDir) {
$ordering = $order . " " . $orderDir;
}
if ($groupordering) {
$ordering = "G.ordering, " . $ordering;
}
$where = '';
$_where = array();
if ($filter['group']) {
$_where[] = " F.group = '" . $db->escape($filter['group']) . "' ";
}
if ($filter['text_search']) {
$text_search = $filter['text_search'];
$word = addcslashes($db->escape($text_search), "_%");
$_where[] = "(LOWER(F.`" . $lang->get('name') . "`) LIKE '%" . $word . "%' OR LOWER(F.`" . $lang->get('description') . "`) LIKE '%" . $word . "%' OR F.id LIKE '%" . $word . "%')";
}
if (count($_where) > 0) {
$where = " WHERE " . implode(" AND ", $_where);
}
$query = "SELECT F.id, F.`" . $lang->get("name") . "` as name, F.`" . $lang->get("description") . "` as description, F.allcats, F.type, F.cats, F.ordering, F.`group`, G.`" . $lang->get("name") . "` as groupname, multilist FROM `#__jshopping_products_extra_fields` as F left join `#__jshopping_products_extra_field_groups` as G on G.id=F.group " . $where . " order by " . $ordering;
$db->setQuery($query);
return $db->loadObjectList();
}
示例2: getName
function getName($status_id)
{
$lang = JSFactory::getLang();
$query = "SELECT `" . $lang->get('name') . "` as name FROM `#__jshopping_order_status` WHERE status_id = '" . $this->_db->escape($status_id) . "'";
$this->_db->setQuery($query);
return $this->_db->loadResult();
}
示例3: getAllList
function getAllList($display = 0)
{
$db = JFactory::getDBO();
$lang = JSFactory::getLang();
$query = "SELECT id, `" . $lang->get("name") . "` as name, field_id FROM `#__jshopping_products_extra_field_values` order by ordering";
extract(js_add_trigger(get_defined_vars(), "before"));
$db->setQuery($query);
if ($display == 0) {
return $db->loadObjectList();
} elseif ($display == 1) {
$rows = $db->loadObjectList();
$list = array();
foreach ($rows as $k => $row) {
$list[$row->id] = $row->name;
unset($rows[$k]);
}
return $list;
} else {
$rows = $db->loadObjectList();
$list = array();
foreach ($rows as $k => $row) {
$list[$row->field_id][$row->id] = $row->name;
unset($rows[$k]);
}
return $list;
}
}
示例4: getCategory
public static function getCategory($catid, $order = 'id', $ordering = 'asc', $limit, $publish = 0)
{
$_db = JFactory::getDBO();
$lang = JSFactory::getLang();
$user = JFactory::getUser();
$add_where = $publish ? " AND category_publish = '1' " : "";
$groups = implode(',', $user->getAuthorisedViewLevels());
$add_where .= ' AND access IN (' . $groups . ')';
if ($order == "id") {
$orderby = "category_id";
}
if ($order == "name") {
$orderby = "`" . $lang->get('name') . "`";
}
if ($order == "ordering") {
$orderby = "ordering";
}
if (!$orderby) {
$orderby = "ordering";
}
if ($limit > 0) {
$_limit = " LIMIT 0 , " . $limit;
} else {
$_limit = "";
}
$query = "SELECT `" . $lang->get('name') . "` as name,`" . $lang->get('description') . "` as description,`" . $lang->get('short_description') . "` as short_description, category_id, category_publish, ordering, category_image FROM `#__jshopping_categories`\r\n WHERE category_id IN (" . $catid . ") " . $add_where . "\r\n ORDER BY " . $orderby . " " . $ordering . " " . $_limit;
$_db->setQuery($query);
$categories = $_db->loadObjectList();
foreach ($categories as $key => $value) {
$categories[$key]->link = SEFLink('index.php?option=com_jshopping&controller=category&task=view&category_id=' . $categories[$key]->category_id, 1);
}
return $categories;
}
示例5: save
function save()
{
$id = JRequest::getInt("id");
$configdisplayprice = JSFactory::getTable('configDisplayPrice', 'jshop');
$post = JRequest::get("post");
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeSaveConfigDisplayPrice', array(&$post));
if (!$post['countries_id']) {
JError::raiseWarning("", _JSHOP_ERROR_BIND);
$this->setRedirect("index.php?option=com_jshopping&controller=configdisplayprice&task=edit&id=" . $post['id']);
return 0;
}
if (!$configdisplayprice->bind($post)) {
JError::raiseWarning("", _JSHOP_ERROR_BIND);
$this->setRedirect("index.php?option=com_jshopping&controller=configdisplayprice");
return 0;
}
$configdisplayprice->setZones($post['countries_id']);
if (!$configdisplayprice->store()) {
JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE);
$this->setRedirect("index.php?option=com_jshopping&controller=configdisplayprice");
return 0;
}
updateCountConfigDisplayPrice();
$dispatcher->trigger('onAftetSaveConfigDisplayPrice', array(&$configdisplayprice));
if ($this->getTask() == 'apply') {
$this->setRedirect("index.php?option=com_jshopping&controller=configdisplayprice&task=edit&id=" . $configdisplayprice->id);
} else {
$this->setRedirect("index.php?option=com_jshopping&controller=configdisplayprice");
}
}
示例6: display
function display($cachable = false, $urlparams = false)
{
$mainframe = JFactory::getApplication();
$context = "jshoping.list.admin.coupons";
$limit = $mainframe->getUserStateFromRequest($context . 'limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
$limitstart = $mainframe->getUserStateFromRequest($context . 'limitstart', 'limitstart', 0, 'int');
$filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', "C.coupon_code", 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', "asc", 'cmd');
$jshopConfig = JSFactory::getConfig();
$coupons = $this->getModel("coupons");
$total = $coupons->getCountCoupons();
jimport('joomla.html.pagination');
$pageNav = new JPagination($total, $limitstart, $limit);
$rows = $coupons->getAllCoupons($pageNav->limitstart, $pageNav->limit, $filter_order, $filter_order_Dir);
$currency = JTable::getInstance('currency', 'jshop');
$currency->load($jshopConfig->mainCurrency);
$view = $this->getView("coupons", 'html');
$view->setLayout("list");
$view->assign('rows', $rows);
$view->assign('currency', $currency->currency_code);
$view->assign('pageNav', $pageNav);
$view->assign('filter_order', $filter_order);
$view->assign('filter_order_Dir', $filter_order_Dir);
JPluginHelper::importPlugin('jshoppingadmin');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeDisplayCoupons', array(&$view));
$view->displayList();
}
示例7: getAllCountries
/**
* get list country
*
* @param int $publish (0-all, 1-publish, 2-unpublish)
* @param int $limitstart
* @param int $limit
* @param int $orderConfig use order config
* @return array
*/
function getAllCountries($publish = 1, $limitstart = null, $limit = null, $orderConfig = 1, $order = null, $orderDir = null)
{
$db = JFactory::getDBO();
$jshopConfig = JSFactory::getConfig();
if ($publish == 0) {
$where = " ";
} else {
if ($publish == 1) {
$where = " WHERE country_publish = '1' ";
} else {
if ($publish == 2) {
$where = " WHERE country_publish = '0' ";
}
}
}
$ordering = "ordering";
if ($orderConfig && $jshopConfig->sorting_country_in_alphabet) {
$ordering = "name";
}
if ($order && $orderDir) {
$ordering = $order . " " . $orderDir;
}
$lang = JSFactory::getLang();
$query = "SELECT country_id, country_publish, ordering, country_code, country_code_2, `" . $lang->get("name") . "` as name FROM `#__jshopping_countries` " . $where . " ORDER BY " . $ordering;
$db->setQuery($query, $limitstart, $limit);
return $db->loadObjectList();
}
示例8: getFreightPrice
private function getFreightPrice($weight, $type)
{
$vendor = JSFactory::getTable('vendor', 'jshop');
$vendor->loadMain();
$client = JSFactory::getUser();
$cep = preg_replace('|[^\\d]|', '', $client->d_zip ? $client->d_zip : $client->zip);
$cost = $this->getCache($weight, $type, $cep);
if ($cost) {
return $cost;
}
$data = array('email' => plgSystemLigminchaFreight::$pagseguro_email, 'token' => plgSystemLigminchaFreight::$pagseguro_token, 'currency' => 'BRL', 'itemId1' => 1, 'itemDescription1' => 'Livros do Ligmincha Brasil Loja', 'itemAmount1' => '1.00', 'itemQuantity1' => 1, 'itemWeight1' => $weight, 'reference' => strtoupper(substr(uniqid('LB'), 1, 6)), 'senderName' => $vendor->shop_name, 'senderAreaCode' => $vendor->zip, 'senderEmail' => $vendor->email, 'shippingType' => $type, 'shippingAddressStreet' => $client->d_street ? $client->d_street : $client->street, 'shippingAddressNumber' => $client->d_street_nr ? $client->d_street_nr : $client->street_nr, 'shippingAddressPostalCode' => $cep, 'shippingAddressCity' => $client->d_city ? $client->d_city : $client->city, 'shippingAddressState' => $client->d_state ? $client->d_state : $client->state, 'shippingAddressCountry' => 'BRA');
$result = $this->post('https://ws.pagseguro.uol.com.br/v2/checkout/', $data);
$code = preg_match('|<code>(.+?)</code>|', $result, $m) ? $m[1] : false;
if ($code) {
JFactory::getApplication()->enqueueMessage("Code: {$code}");
$html = file_get_contents("https://pagseguro.uol.com.br/v2/checkout/payment.html?code={$code}");
$cost = preg_match('|"freightRow".+?R\\$.+?([\\d,]+)|s', $html, $m) ? $m[1] : 0;
$cost = str_replace(',', '.', $cost);
} else {
JError::raiseWarning('', curl_error($result));
}
if ($cost == 0) {
JError::raiseWarning('', 'Failed to obtain freight price!');
} else {
$this->setCache($weight, $type, $cep, $cost);
}
return $cost;
}
示例9: showEndForm
function showEndForm($pmconfigs, $order)
{
$jshopConfig = JSFactory::getConfig();
$pm_method = $this->getPmMethod();
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->clear();
$query->update('#__jshopping_orders')->set($db->quoteName('order_created') . ' = 1 ')->where($db->quoteName('order_id') . ' = ' . (int) $order->order_id);
$db->setQuery($query);
echo '<div id="begateway_erip">';
try {
$db->execute();
$model = JSFactory::getModel('orderMail', 'jshop');
$model->setData($order->order_id, 0);
$model->send();
if ($pmconfigs['auto'] == '1') {
JPluginHelper::importPlugin('PlgSystemJoomShoppingErip');
$dispatcher = JEventDispatcher::getInstance();
$result = $dispatcher->trigger('onBeforeChangeOrderStatusAdmin', array($order->order_id, $this->getStatusId(), 'auto'));
if (!$result) {
throw new Exception(JText::_('PLG_JSERIPPAYMENT_ORDER_ERROR'));
}
$instruction = JText::_('PLG_JSERIPPAYMENT_ERIP_INSTRUCTION');
$instruction = str_replace('#TABS#', '<strong>' . $pmconfigs['tree_path_email'] . '</strong>', $instruction);
$instruction = str_replace('#ORDER_ID#', '<strong>' . $order->order_id . '</strong>', $instruction);
echo nl2br($instruction);
} else {
echo nl2br(JText::_('PLG_JSERIPPAYMENT_ORDER_CONFIRMATION'));
}
} catch (RuntimeException $e) {
echo JText::_('PLG_JSERIPPAYMENT_ORDER_ERROR');
}
echo '</div>';
}
示例10: showEndForm
function showEndForm($pmconfigs, $order)
{
$mainframe =& JFactory::getApplication();
$jshopConfig =& JSFactory::getConfig();
$item_name = sprintf(_JSHOP_PAYMENT_NUMBER, $order->order_number);
$notify_url = JURI::root() . "index.php?option=com_jshopping&controller=checkout&task=step7&act=notify&js_paymentclass=pm_ideal&no_lang=1";
$return = JURI::root() . "index.php?option=com_jshopping&controller=checkout&task=step7&act=return&js_paymentclass=pm_ideal";
$cancel_return = JURI::root() . "index.php?option=com_jshopping&controller=checkout&task=step7&act=cancel&js_paymentclass=pm_ideal";
$params_data = $order->getPaymentParamsData();
$bank_id = $params_data['bank_id'];
$amount = intval($order->order_total * 100);
$iDEAL = new iDEAL_Payment($pmconfigs['partnerid']);
if ($pmconfigs['testmode']) {
$iDEAL->setTestMode();
}
if ($iDEAL->createPayment($bank_id, $amount, $item_name, $return, $notify_url)) {
$order1 =& JTable::getInstance('order', 'jshop');
$order1->load($order->order_id);
$order1->transaction = $iDEAL->getTransactionId();
$order1->store();
header("Location: " . $iDEAL->getBankURL());
exit;
} else {
saveToLog("payment.log", "Error: Order ID " . $order->order_id . ". CODE: " . $iDEAL->getErrorCode() . ". MSG: " . $iDEAL->getErrorMessage());
JError::raiseWarning("", $iDEAL->getErrorMessage());
$mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step5', 0, 1, $jshopConfig->use_ssl));
exit;
}
}
示例11: display
function display($cachable = false, $urlparams = false)
{
$jshopConfig = JSFactory::getConfig();
$mainframe = JFactory::getApplication();
$context = "jshoping.list.admin.currencies";
$filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', "currency_ordering", 'cmd');
$filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', "asc", 'cmd');
$current_currency = JTable::getInstance('currency', 'jshop');
$current_currency->load($jshopConfig->mainCurrency);
if ($current_currency->currency_value != 1) {
JError::raiseWarning("", _JSHOP_ERROR_MAIN_CURRENCY_VALUE);
}
$currencies = $this->getModel("currencies");
$rows = $currencies->getAllCurrencies(0, $filter_order, $filter_order_Dir);
$view = $this->getView("currencies", 'html');
$view->setLayout("list");
$view->assign('rows', $rows);
$view->assign('config', $jshopConfig);
$view->assign('filter_order', $filter_order);
$view->assign('filter_order_Dir', $filter_order_Dir);
JPluginHelper::importPlugin('jshoppingadmin');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeDisplayCourencies', array(&$view));
$view->displayList();
}
示例12: addTitleHead
function addTitleHead()
{
$jshopConfig = JSFactory::getConfig();
$vendorinfo = $this->_vendorinfo;
$this->Image($jshopConfig->path . 'images/header.jpg', 1, 1, $jshopConfig->pdf_header_width, $jshopConfig->pdf_header_height);
# $this->Image($jshopConfig->path.'images/footer.jpg',1,265,$jshopConfig->pdf_footer_width,$jshopConfig->pdf_footer_height);
}
示例13: getAllLanguages
function getAllLanguages($publish = 1)
{
$jshopConfig = JSFactory::getConfig();
$db = JFactory::getDBO();
$where_add = $publish ? "where `publish`='1'" : "";
$query = "SELECT * FROM `#__jshopping_languages` " . $where_add . " order by `ordering`";
extract(js_add_trigger(get_defined_vars(), "before"));
$db->setQuery($query);
$rowssort = array();
$rows = $db->loadObjectList();
foreach ($rows as $k => $v) {
$rows[$k]->lang = substr($v->language, 0, 2);
if ($jshopConfig->cur_lang == $v->language) {
$rowssort[] = $rows[$k];
}
}
foreach ($rows as $k => $v) {
if (isset($rowssort[0]) && $rowssort[0]->language == $v->language) {
continue;
}
$rowssort[] = $v;
}
unset($rows);
return $rowssort;
}
示例14: showAdminFormParams
function showAdminFormParams($params)
{
JSFactory::loadExtLanguageFile("pm_saferpay");
$orders =& JModel::getInstance('orders', 'JshoppingModel');
//admin model
include dirname(__FILE__) . "/adminparamsform.php";
}
示例15: save
function save()
{
$mainframe = JFactory::getApplication();
$id = JRequest::getInt("id");
$deliveryTimes = JSFactory::getTable('deliveryTimes', 'jshop');
$post = JRequest::get("post");
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onBeforeSaveDeliveryTime', array(&$post));
if (!$deliveryTimes->bind($post)) {
JError::raiseWarning("", _JSHOP_ERROR_BIND);
$this->setRedirect("index.php?option=com_jshopping&controller=deliverytimes");
return 0;
}
if (!$deliveryTimes->store()) {
JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE);
$this->setRedirect("index.php?option=com_jshopping&controller=deliverytimes");
return 0;
}
$dispatcher->trigger('onAfterSaveDeliveryTime', array(&$deliveryTimes));
if ($this->getTask() == 'apply') {
$this->setRedirect("index.php?option=com_jshopping&controller=deliverytimes&task=edit&id=" . $deliveryTimes->id);
} else {
$this->setRedirect("index.php?option=com_jshopping&controller=deliverytimes");
}
}