function cria_html() { // adiciona a biblioteca juri jimport('joomla.environment.uri'); // verifica se a urlbase foi adicionada if (!is_null($this->url_base)) { $u =& JURI::getInstance($this->url_base); } else { $u =& JURI::getInstance(); } $links = ''; $paginas_adm_select = ''; $select = ''; // loop nas páginas for ($i = 1; $i <= $this->total_paginas; $i++) { // adiciona a var na url $u->setVar($this->get_var_pagina, $i); // retorna o html tag a $class = $i == $this->pagina_atual ? ' class="atual"' : ''; $links .= sprintf('<a href="%s"%s>%d</a> ', JRoute::_($u->toString()), $class, $i); // retorna o html select $selected = $i == $this->pagina_atual ? ' selected="selected"' : ''; // cria o select para o site $select .= sprintf('<option value="%s" %s>Página %d</option> ', JRoute::_($u->toString()), $selected, $i); // cria o select para o adm $paginas_adm_select .= sprintf('<option value="%s" %s>Página %d</option> ', $i, $selected, $i); } // paginas para o adm $query = JRequest::get('post'); unset($query[JUtility::getToken()], $query['funcao'], $query['method'], $query['class'], $query['pagina'], $query['programa'], $query['template'], $query['processID']); $u->setQuery($query); $u->setVar($this->get_var_pagina, ''); $js = sprintf('<script type="text/javascript">$(function(){ $(\'select#%s\').change(function(){ eDesktop.dialog.load({programa: "%s", processID: "%s", pagina: "%s", query: "%s"+ $(this).val() }); });});</script>', $this->get_var_pagina, JRequest::getvar('programa'), JRequest::getvar('processID'), JRequest::getvar('pagina'), $u->getQuery()); $paginas_adm_select = sprintf('<select name="%s" id="%s">%s</select>%s ', $this->get_var_pagina, $this->get_var_pagina, $paginas_adm_select, $js); $this->html['paginas.adm.select'] = $paginas_adm_select; // páginas para o site $js = sprintf('<script type="text/javascript">$(function(){ $(\'select#%s\').change(function(){window.location = $(this).val();});});</script>', $this->get_var_pagina); $select = sprintf('<select name="%s" id="%s">%s</select>%s', $this->get_var_pagina, $this->get_var_pagina, $select, $js); $this->html['paginas.links'] = $links; $this->html['paginas.select'] = $select; // ordem para site $order = ''; $this->order_atual = JRequest::getVar($this->get_var_order); if (count($this->orders)) { foreach ($this->orders as $k => $v) { $u->setVar($this->get_var_pagina, 1); $u->setVar($this->get_var_order, $k); $selected = $k == $this->order_atual ? ' selected="selected"' : ''; $order .= sprintf('<option value="%s" %s>%s</option> ', JRoute::_($u->toString()), $selected, $v['label']); } $js = sprintf('<script type="text/javascript">$(function(){ $(\'select#%s\').change(function(){window.location = $(this).val();});});</script>', $this->get_var_order); $order = sprintf('<select name="%s" id="%s">%s</select>%s', $this->get_var_order, $this->get_var_order, $order, $js); // $this->html['order.select'] = $order; } foreach ($this->html as $k => $v) { $key = str_replace('.', '_', $k); $this->html[$key] = $v; } }
/** * downloads a file * * @return void */ function downloadFile() { $user = JFactory::getUser(); $productfile_id = intval(JRequest::getvar('id', '', 'request', 'int')); $product_id = intval(JRequest::getvar('product_id', '', 'request', 'int')); $link = 'index.php?option=com_tienda&view=products&task=edit&id=' . $product_id; Tienda::load('TiendaHelperBase', 'helpers._base'); $helper = TiendaHelperBase::getInstance('ProductDownload', 'TiendaHelper'); JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_tienda' . DS . 'tables'); $productfile = JTable::getInstance('ProductFiles', 'TiendaTable'); $productfile->load($productfile_id); if (empty($productfile->productfile_id)) { $this->messagetype = 'notice'; $this->message = JText::_('COM_TIENDA_INVALID FILE'); $this->setRedirect($link, $this->message, $this->messagetype); return false; } // log and download Tienda::load('TiendaFile', 'library.file'); // geting the ProductDownloadId to updated for which productdownload_max is greater then 0 $productToDownload = $helper->getProductDownloadInfo($productfile->productfile_id, $user->id); if ($downloadFile = TiendaFile::download($productfile)) { $link = JRoute::_($link, false); $this->setRedirect($link); } }
/** * Retireve a list of countries from the database. * * @author RickG, Max Milbers * @return object List of state objects */ public function getStates($countryId, $noLimit = false, $published = false, $search = '') { $where = array(); $where[] = '`virtuemart_country_id`= "' . (int) $countryId . '"'; if ($search) { $search = '"%' . $this->_db->escape($search, true) . '%"'; $where[] = '`state_name` LIKE ' . $search; } if ($published) { $where[] = '`published`="1"'; } else { $published = JRequest::getvar('filter_published'); if ($published === '1') { $where[] = '`published` = 1'; } else { if ($published === '0') { $where[] = '`published` = 0'; } } } $whereString = ''; if (count($where) > 0) { $whereString = ' WHERE ' . implode(' AND ', $where); } $ordering = $this->_getOrdering(); // var_dump($ordering,$this->_selectedOrdering); jexit(); return $this->_data = $this->exeSortSearchListQuery(0, '*', ' FROM `#__virtuemart_states`', $whereString, '', $ordering); }
/** * Select the products to list on the product list page */ public function getRatings() { $where = array(); $tables = ' FROM `#__virtuemart_ratings` AS `r` JOIN `#__virtuemart_products_' . VMLANG . '` AS `p` USING (`virtuemart_product_id`) '; if ($filter_ratings = jrequest::getvar('filter_ratings')) { $where[] = 'product_name like "%' . $this->_db->escape($filter_ratings) . '%"'; } $published = JRequest::getvar('filter_published'); if ($published === '1') { $where[] = "`r`.`published` = 1 "; } else { if ($published === '0') { $where[] = "`r`.`published` = 0 "; } } if (!empty($where)) { $whereString = 'where ' . implode(" AND ", $where); } else { $whereString = ''; } echo $whereString; $this->_data = $this->exeSortSearchListQuery(0, ' r.*,p.`product_name` ', $tables, $whereString, '', $this->_getOrdering()); // $this->_data = $this->_getList($q, $this->getState('limitstart'), $this->getState('limit')); // set total for pagination // $this->_total = $this->_getListCount($q) ; // if(empty($this->_data)) $this->_data = array(); // if(!isset($this->_total)) $this->_total = 0; return $this->_data; }
/** * Collect the filters for the query * @author RolandD * @author Max Milbers */ private function getInventoryFilter() { /* Check some filters */ $filters = array(); if ($search = JRequest::getVar('filter_inventory', false)) { $search = '"%' . $this->_db->escape($search, true) . '%"'; //$search = $this->_db->Quote($search, false); $filters[] = '`#__virtuemart_products`.`product_name` LIKE ' . $search; } if (JRequest::getInt('stockfilter', 0) == 1) { $filters[] = '`#__virtuemart_products`.`product_in_stock` > 0'; } if ($catId = JRequest::getInt('virtuemart_category_id', 0) > 0) { $filters[] = '`#__virtuemart_categories`.`virtuemart_category_id` = ' . $catId; } $published = JRequest::getvar('filter_published'); if ($published === '1') { $filters[] = "`#__virtuemart_products`.`published` = 1 "; } else { if ($published === '0') { $filters[] = "`#__virtuemart_products`.`published` = 0 "; } } $filters[] = '(`#__virtuemart_shoppergroups`.`default` = 1 OR `#__virtuemart_shoppergroups`.`default` is NULL)'; return ' WHERE ' . implode(' AND ', $filters) . $this->_getOrdering(); }
function attack() { $db = JFactory::getDBO(); $user = JFactory::getUser(); $id = JRequest::getvar('id'); $monster = $this->getMonster($id, $db); $player = $this->getPlayer($user, $db); $attackRoundMonster = $monster->defence + rand(0, 6); $attackRoundPlayer = $monster->attack + rand(0, 6); if ($attackRoundPlayer > $attackRoundMonster) { $query = "UPDATE #__jigs_monsters SET health = health -10 WHERE id= {$id}"; $db->setQuery($query); $db->query(); $message = 'You caused 10 hit points of damage'; MessagesHelper::sendFeedback($user->id, $message); } $query = "SELECT health FROM #__jigs_monsters WHERE id= {$id}"; $db->setQuery($query); $result['id'] = $id; $result['health'] = $db->loadResult(); $entryData = array('category' => 'monsterHealthCategory', 'title' => 'title', 'article' => $result, 'when' => time()); $context = new ZMQContext(); $socket = $context->getSocket(ZMQ::SOCKET_PUSH, 'my pusher'); if ($socket->connect("tcp://localhost:5555")) { // echo 'connected'; } if ($socket->send(json_encode($entryData))) { // echo 'delivered'; } return true; }
/** * Paste the table in json format * */ public function paste() { // TODO Test user ? $json = array(); $json['fields'] = 'error'; $json['msg'] = 'Invalid Token'; $json['structure'] = 'empty'; if (!JSession::checkToken('get')) { echo json_encode($json); jexit(); } $lang = JRequest::getvar('lg'); $langs = VmConfig::get('active_languages', array()); $language = JFactory::getLanguage(); if (!in_array($lang, $langs)) { $json['msg'] = 'Invalid language ! ' . $lang; $json['langs'] = $langs; echo json_encode($json); jexit(); } $lang = strtolower($lang); // Remove tag if defaut or // if ($language->getDefault() == $lang ) $dblang =''; $dblang = strtr($lang, '-', '_'); $id = JRequest::getInt('id', 0); $viewKey = JRequest::getWord('editView'); // we have here 2 access user & vendor give same results if ($viewKey == 'user') { $viewKey = 'vendor'; } // Not needed , vendor is checked in constructor //if ($viewKey == 'vendor') $id = 1 ; $tables = array('category' => 'categories', 'product' => 'products', 'manufacturer' => 'manufacturers', 'manufacturercategories' => 'manufacturercategories', 'vendor' => 'vendors', 'paymentmethod' => 'paymentmethods', 'shipmentmethod' => 'shipmentmethods'); if (!isset($tables[$viewKey])) { $json['msg'] = "Invalid view " . $viewKey; echo json_encode($json); jExit(); } $tableName = '#__virtuemart_' . $tables[$viewKey] . '_' . $dblang; $db = JFactory::getDBO(); $q = 'select * FROM `' . $tableName . '` where `virtuemart_' . $viewKey . '_id` =' . $id; $db->setQuery($q); if ($json['fields'] = $db->loadAssoc()) { $json['structure'] = 'filled'; $json['msg'] = jText::_('COM_VIRTUEMART_SELECTED_LANG') . ':' . $lang; } else { $json['structure'] = 'empty'; $db->setQuery('SHOW COLUMNS FROM ' . $tableName); $tableDescribe = $db->loadAssocList(); array_shift($tableDescribe); $fields = array(); foreach ($tableDescribe as $key => $val) { $fields[$val['Field']] = $val['Field']; } $json['fields'] = $fields; $json['msg'] = JText::sprintf('COM_VIRTUEMART_LANG_IS_EMPTY', $lang, jText::_('COM_VIRTUEMART_' . strtoupper($viewKey))); } echo json_encode($json); jExit(); }
function get_all_spells() { $db = JFactory::getDBO(); $parent = JRequest::getvar('parent'); $query = "SELECT *\n FROM #__jigs_spell_types\n WHERE #__jigs_spell_types.parent_id = '{$parent}'"; $db->setQuery($query); return $db->loadAssocList(); }
public function getPlate() { $idPlate = JRequest::getvar('id'); if (empty($this->_data)) { $query = "SELECT * FROM #__jigs_plates WHERE id = {$idPlate}"; $this->_data = $this->_getList($query); } return $this->_data; }
function get_weapons($id) { $db = JFactory::getDBO(); $user = JFactory::getUser(); $character_id = JRequest::getvar(id); $db->setQuery("SELECT #__jigs_weapons.item_id, #__jigs_weapon_types.name, #__jigs_weapon_types.sell_price, #__jigs_weapon_types.image " . "FROM #__jigs_weapons " . "LEFT JOIN #__jigs_weapon_types " . "ON #__jigs_weapons.item_id = #__jigs_weapon_types.id " . "WHERE #__jigs_weapons.player_id =" . $id); $result = $db->loadAssocList(); return $result; }
function get_charactor_inventory() { $db =& JFactory::getDBO(); $user =& JFactory::getUser(); $character_id = JRequest::getvar(character_id); $db->setQuery("SELECT #__jigs_inventory.item_id, " . "#__jigs_objects.name " . "FROM #__jigs_inventory " . "LEFT JOIN #__jigs_objects " . "ON #__jigs_inventory.item_id = #__jigs_objects.id " . "WHERE #__jigs_inventory.player_id =" . $character_id); $result = $db->loadAssocList(); return $result; }
function enter_Canvas() { $db = JFactory::getDBO(); $user = JFactory::getUser(); $query = "Update #__jigs_players SET active=4 WHERE id = " . $user->id; $db->setQuery($query); $db->query(); return JRequest::getvar('id'); //return; }
function get_software() { $db = JFactory::getDBO(); $user = JFactory::getUser(); $parent = JRequest::getvar('parent'); $query = "SELECT * FROM #__jigs_software\n WHERE #__jigs_software.iduser = {$user->id}"; $db->setQuery($query); $data = $db->loadAssocList(); return $data; }
function work_conveyer() { $building_id = JRequest::getvar(building_id); $line = JRequest::getvar(line); $type = JRequest::getvar(type); $quantity = JRequest::getvar(quantity); $model = $this->getModel('building'); $result = $model->work_conveyer($building_id, $quantity, $type, $line); echo Json_encode($result); }
/** * Function Description * * @author RolandD * @author George * @access public */ public function display($cachable = false, $urlparams = false) { if (JRequest::getvar('search')) { $view = $this->getView('category', 'html'); $view->display(); } else { // Display it all $safeurlparams = array('virtuemart_category_id' => 'INT', 'virtuemart_manufacturer_id' => 'INT', 'virtuemart_currency_id' => 'INT', 'return' => 'BASE64', 'lang' => 'CMD', 'orderby' => 'CMD', 'limitstart' => 'CMD', 'order' => 'CMD', 'limit' => 'CMD'); parent::display(true, $safeurlparams); } }
function assist_player_account() { $building_id = JRequest::getvar('bank_id'); $account_id = JRequest::getvar('id'); $now = time(); $db = JFactory::getDBO(); $query = " SELECT j17_jigs_players.level,\n j17_jigs_players.name,\n j17_jigs_players.id\n FROM j17_jigs_bank_accounts\n\n LEFT JOIN j17_jigs_players\n ON j17_jigs_players.id = j17_jigs_bank_accounts.player_id\n WHERE j17_jigs_bank_accounts.bank_id = {$building_id}"; $db->setQuery($query); $result = $db->loadAssocList(); return $result; }
public function add() { $programa = JRequest::getvar('programa', false); if ($programa) { $processID = $this->next_processID(); $dados = array('id' => $processID, 'programa' => $programa, 'criado' => date("d/m/Y H:i:s")); $this->processos[$processID] = $dados; $this->save_session(); $this->get($processID); } else { echo "Programa inválido"; } }
/** * Method to get a JDatabaseQuery object for retrieving the data set from a database. * * @return object A JDatabaseQuery object to retrieve the data set. */ protected function getListQuery() { // valamiért a lapozás nem akar jó lenni, áthidaló megoldás //JRequest::setVar('limit','200'); $db = $this->getDbo(); $query = $db->getQuery(true); $catid = (int) $this->getState('authorlist.id', 1); $limitStart = JRequest::getVar('limitstart', 0); if (JRequest::getVar('filterStr') != '') { $filter = ' and (u.name like "%' . JRequest::getVar('filterStr') . '%" or u.username like "%' . JRequest::getVar('filterStr') . '%")'; } else { $filter = ''; } $order = JRequest::getVar('order', 1); if ($order == 5) { $order = '5 DESC'; } if (JRequest::getVar('task') == 'ujTag') { /* $query = 'select u.* from #__users u left outer join #__tagok t on t.user_id = u.id and t.temakor_id="'.JRequest::getVar('temakor').'" where t.id is null '.$filter.' order by '.JRequest::getVar('order'); */ $query->select('u.*'); $query->from('#__users u left outer join #__tagok t on t.user_id = u.id and t.temakor_id="' . JRequest::getVar('temakor', 0) . '"'); $query->where('t.id is null and u.block = 0 ' . $filter); $query->order($order); } else { if (JRequest::getVar('temakor', 0) > 0) { $query->select('u.id, u.name, u.username, if(a.admin=1,"ADMIN","") admin, count(distinct k.user_id) kepviselt'); $query->from('#__tagok as a inner join #__users u on a.user_id = u.id left outer join #__kepviselok k on k.kepviselo_id = a.user_id and (k.temakor_id = ' . JRequest::getVar('temakor', 0) . ' or k.temakor_id = 0)'); $query->where('a.temakor_id="' . JRequest::getvar('temakor', 0) . '" and u.block = 0 ' . $filter); $query->group('u.id, u.name, u.username'); $query->order($order); } else { $query->select('u.id, u.name, u.username, if(max(m.group_id)>=6,"ADMIN","") admin, count(distinct k.user_id) kepviselt'); $query->from('#__users u inner join #__user_usergroup_map m on u.id = m.user_id left outer join #__kepviselok k on k.kepviselo_id = u.id'); $query->where('u.id = m.user_id and u.block = 0 ' . $filter); $query->group('u.id,u.name,u.username'); $query->order($order); } } return $query; }
/** * Function Description * * @author RolandD * @author George * @access public */ public function display() { if (JRequest::getvar('search')) { $view = $this->getView('category', 'html'); $view->display(); } else { // Display it all $safeurlparams = array('virtuemart_category_id' => 'INT', 'virtuemart_manufacturer_id' => 'INT', 'virtuemart_currency_id' => 'INT', 'return' => 'BASE64', 'lang' => 'CMD', 'orderby' => 'CMD', 'limitstart' => 'CMD', 'order' => 'CMD', 'limit' => 'CMD'); parent::display(false, $safeurlparams); } if ($categoryId = JRequest::getInt('virtuemart_category_id', 0)) { shopFunctionsF::setLastVisitedCategoryId($categoryId); } }
/** * Function Description * * @author RolandD * @author George * @access public */ public function display($cachable = false, $urlparams = false) { if (JRequest::getvar('search')) { $safeurlparams = ''; $cachable = false; } else { // Display it all $safeurlparams = array('virtuemart_category_id' => 'INT', 'virtuemart_manufacturer_id' => 'INT', 'virtuemart_currency_id' => 'INT', 'return' => 'BASE64', 'lang' => 'CMD', 'orderby' => 'CMD', 'limitstart' => 'CMD', 'order' => 'CMD', 'limit' => 'CMD'); } parent::display($cachable, $safeurlparams); if ($categoryId = JRequest::getInt('virtuemart_category_id', 0)) { shopFunctionsF::setLastVisitedCategoryId($categoryId); } return $this; }
public function show() { $pagina = JRequest::getvar('pagina'); $ativarMenu = JRequest::getvar('ativarMenu'); $html = '<div class="menu_lateral"><h2>' . $this->titulo . '</h2>'; foreach ($this->menus as $alias => $menu) { $class = $alias == $pagina || $alias == "{$pagina}.{$ativarMenu}" ? 'ativo' : ''; $html .= '<a href="javascript:void(0);" class="link ' . $class . '" rel="' . $menu['rel'] . '"><span class="ui-icon ui-icon-bullet"></span>' . $menu['titulo'] . '</a>'; } $html .= '</div>'; echo $html; if ($this->voltar) { echo $this->criar_link_voltar(); } }
function tick_flag() { $db = JFactory::getDBO(); $user = JFactory::getUser(); $flag = JRequest::getvar('flag'); $query = "SELECT flags FROM #__jigs_players WHERE id = {$user->id}"; $db->setQuery($query); $result = $db->loadResult(); $pieces = explode(",", $result); $pieces[] = $flag; $flags = implode(",", $pieces); $query = "Update #__jigs_players SET flags = '{$flags}' WHERE id = {$user->id}"; $db->setQuery($query); $db->query(); return $query; }
function jAccess($var, $params = array()) { // Carrega as sessoes $usuario = $_SESSION['eDesktop.usuario']; $grupo = $_SESSION['eDesktop.usuario.grupo']; $permissoes = $_SESSION['eDesktop.usuario.grupo.permissoes']; // Se o usuário for Administrador, tem acesso liberado (FULL) if ($grupo['id'] != 1) { // Mescla os parametros $params = array_merge(array('retorno' => 'txt', 'programa' => false), $params); // Verifica o parametro programa if (!$params['programa']) { $params['programa'] = JRequest::getvar('programa'); } // Carrega a var programa $permissao = "{$params['programa']}.{$var}"; $permissoes = array_flip($permissoes); $result = isset($permissoes[$permissao]); // Verifica se o usuário tem permissão if (!$result) { jimport('edesktop.programa'); $config = new programa(); // Carrega as configurações do programa $config = $config->get_config($params['programa'], false, false); // Carrega a var $liberadas = array_flip($config['permissoes.liberadas']); // verifica se o pagina está liberada para todos if (!isset($liberadas[$var])) { // Se o tipo de retorno for boolean if ($params['retorno'] == 'bool') { return false; } // Se o tipo de retorno for texto if ($params['retorno'] == 'txt') { $funcao = JRequest::getvar('funcao'); $msg = "Acesso negado! Você não tem permissão para acessar essa página!"; if ($funcao) { jexit("{ 'msg' : '{$msg}', 'tipo' : 'error' }"); } else { jexit("eDesktop: {$msg}"); } } } } } return true; }
function configgetrecords() { $base = JURI::base(); $playid = $playid_playlistname = $mid = $moduleid = $comppid = 0; $rs_moduleparams = ''; $db = JFactory::getDBO(); $query = 'SELECT `id`, `published`, `logopath`,`player_icons` , `player_colors`, `player_values` FROM `#__hdflvplayersettings`'; $db->setQuery($query); $settingsrows = $db->loadObject(); $midrollads = true; ## Playlist id $playid_playlistname = JRequest::getvar('playid', '', 'get', 'var'); ## Video id; $id = JRequest::getvar('id', '', 'get', 'int'); if (version_compare(JVERSION, '3.0.0', 'ge')) { $id = JRequest::getvar('id'); } if ($id) { $playid = $id; } ## Module video id $videoid = JRequest::getvar('videoid', '', 'get', 'int'); if (version_compare(JVERSION, '3.0.0', 'ge')) { $videoid = JRequest::getvar('videoid'); } if ($videoid) { $playid = $videoid; } ## fetch playlist id from URL parameter $comppid = JRequest::getvar('compid', '', 'get', 'int'); if (version_compare(JVERSION, '3.0.0', 'ge')) { $comppid = JRequest::getvar('compid'); } ## Fetch module id and the parameter settings $moduleid = JRequest::getvar('mid', '', 'get', 'int'); if (version_compare(JVERSION, '3.0.0', 'ge')) { $moduleid = JRequest::getvar('mid'); } if ($moduleid) { $moduleid = $moduleid; $query = "SELECT id,params FROM `#__modules` WHERE id={$moduleid} and module='mod_hdflvplayer'"; $db->setQuery($query); $rs_moduleparams = $db->loadObjectList(); $midrollads = false; } $this->configxml($rs_moduleparams, $settingsrows, $playid, $playid_playlistname, $moduleid, $comppid, $base, $midrollads); }
/** * rekord sorozat beolvasása az adatbázisból * @JRequest filter, order, limit, limitstart * @return array of records */ public function getItems($state) { $db = Jfactory::getDBO(); $query = $this->getListQuery($state); $limit = JRequest::getvar('limit', 20); $limitstart = JRequest::getvar('limitstart', 0); if ($limit == '') { $limit = 20; } if ($limit == 0) { $limit = 20; } if ($limitstart == '') { $limitstart = 0; } $db->setQuery($query, $limitstart, $limit); return $db->loadObjectList(); }
/** * Function Description * * @author RolandD * @author George * @access public */ public function display($cachable = false, $urlparams = false) { if (JRequest::getvar('search')) { $view = $this->getView('category', 'html'); $view->display(); } else { // Display it all $document = JFactory::getDocument(); $viewType = $document->getType(); $viewName = JRequest::getCmd('view', $this->default_view); $viewLayout = JRequest::getCmd('layout', 'default'); $view = $this->getView($viewName, $viewType, '', array('base_path' => $this->basePath, 'layout' => $viewLayout)); $view->assignRef('document', $document); $view->display(); } if ($categoryId = JRequest::getInt('virtuemart_category_id', 0)) { shopFunctionsF::setLastVisitedCategoryId($categoryId); } return $this; }
function display($tpl = null) { $model = $this->getModel('Cart'); $this->configs = JComponentHelper::getComponent('com_digicom')->params; $this->Itemid = JRequest::getvar("Itemid", "0"); $this->customer = new DigiComSiteHelperSession(); $this->items = $model->getCartItems($this->customer, $this->configs); $this->plugins = $this->get('PluginList'); $this->session = JFactory::getSession(); $disc = 0; foreach ($this->items as $i => $item) { if ($i < 0) { continue; } if (isset($item->discounted_price) && $item->discounted_price && $item->discount > 0) { $disc = 1; } } $this->discount = $disc; $this->tax = $model->calc_price($this->items, $this->customer, $this->configs); $promo = $model->get_promo($this->customer, 1); if (isset($promo)) { $this->promocode = $promo->code; $this->promoerror = $promo->error; } else { $this->promocode = ''; $this->promoerror = ''; } $this->cat_url = $this->get('cat_url'); $template = new DigiComSiteHelperTemplate($this); $input = JFactory::getApplication()->input; $layout = $input->get('layout', 'cart'); $from = JRequest::getVar("from", ""); if ($from == "ajax") { $template->rander('cart_popup'); } else { $template->rander($layout); } parent::display($tpl); }
function _buildQuery() { $app = JFactory::getApplication(); $jinput = $app->input; $option = $jinput->getCmd('option'); $cid = JRequest::getvar('cid', 0, 'GET', 'INT'); $filter_state = $app->getUserStateFromRequest($this->context . '.filter_state', 'filter_state', '', 'word'); $filter_order = $app->getUserStateFromRequest($this->context . '.filter_order', 'filter_order', 't.ordering', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($this->context . '.filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $app->getUserStateFromRequest($this->context . '.search', 'search', '', 'string'); $search_mode = $app->getUserStateFromRequest($this->context . '.search_mode', 'search_mode', '', 'string'); $search = JString::strtolower($search); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('t.*'); $query->from('#__joomleague_team AS t'); $query->select(array('c.name as clubname', 'c.id AS club_id')); $query->join('LEFT', '#__joomleague_club AS c ON t.club_id = c.id'); $query->select('u.name AS editor'); $query->join('LEFT', '#__users AS u ON u.id = t.checked_out'); // Where if ($search) { if ($search_mode) { $query->where('LOWER(t.name) LIKE ' . $db->Quote($search . '%')); } else { $query->where('LOWER(t.name) LIKE ' . $db->Quote('%' . $search . '%')); } } if ($cid) { $query->where('club_id =' . $cid); } // Order if ($filter_order == 't.ordering') { $query->order('t.ordering ' . $filter_order_Dir); } else { $query->order($filter_order . ' ' . $filter_order_Dir, 't.ordering '); } return $query; }
public function getTasksofProject($project_id) { $db = JFactory::getDBO(); $recent = JRequest::getVar('recent'); $orderbydeadline = JRequest::getvar('deadline'); $priority = JRequest::getVar('priority'); if (!empty($recent)) { $orderby = "t.cdate DESC"; } if (!empty($orderbydeadline)) { $orderby = "t.edate DESC"; } if (!empty($priority)) { $orderby = "t.priority DESC"; } if (empty($recent) && $recent == '' && empty($orderbydeadline) && empty($priority)) { $orderby = "ms.title, t.title DESC"; } $query = "SELECT t. * , DATE_FORMAT( FROM_UNIXTIME( t.edate ) , '%m %d, %Y' ) AS deadline,u.name, p.title AS project_title, COUNT( DISTINCT (\n\t\t\tc.id\n\t\t\t) ) AS comments\n\t\t\tFROM pdb_pf_tasks AS t\n\t\t\tLEFT JOIN pdb_pf_milestones AS ms ON ms.id = t.milestone\n\t\t\tLEFT JOIN pdb_pf_projects AS p ON p.id = t.project\n\t\t\tLEFT JOIN pdb_pf_comments AS c ON c.item_id = t.id\n\t\t\tAND c.scope = 'tasks'\n\t\t\tLEFT JOIN pdb_pf_task_users AS tu ON tu.task_id = t.id\n\t\t\tLEFT JOIN pdb_users AS u ON u.id = tu.user_id\n\t\t\tWHERE (\n\t\t\tt.project = '{$project_id}'\n\t\t\t) \n\t\t\tGROUP BY t.id\n\t\t\tORDER BY " . $orderby; $db->setQuery($query); return $alltaskslist = $db->loadObjectList(); }
function get_subsection_hobbit_names() { $building_id = JRequest::getvar('building_id'); $dir = JRequest::getvar('dir'); $section_id = JRequest::getvar('section'); $db = JFactory::getDBO(); $user = JFactory::getUser(); if ($dir == 'up') { $query1 = "Update #__jigs_hobbits SET status = 1 ,section = {$section_id} WHERE owner = {$building_id} AND status = 1 AND section = 0 LIMIT 1"; $db->setQuery($query1); $db->query(); } if ($dir == 'down') { $query1 = "Update #__jigs_hobbits SET status = 0 , section = 0 WHERE owner = {$building_id} AND status = 1 AND section={$section_id} LIMIT 1"; $db->setQuery($query1); $db->query(); } $query = "SELECT name FROM #__jigs_hobbits WHERE section = {$section_id} AND owner = {$building_id}"; $db->setQuery($query); $result = $db->loadAssocList(); //return $query1; return $result; }