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; }
public static function insert($table, $insertValues) { $db = oseDB::instance(); oseDB::lock($table . ' WRITE'); $tables = self::getDBFields($table); $temp = array(); if (!empty($tables)) { foreach ($tables[$table] as $field => $info) { if (isset($insertValues[$field])) { $temp[$field] = $insertValues[$field]; } } $filterValues = array(); foreach ($temp as $key => $value) { $filterValues[$key] = $db->Quote($value); } $sql = array(); $sql1 = '`' . implode('`,`', array_keys($filterValues)) . '`'; $sql2 = '' . implode(',', $filterValues) . ''; if (empty($filterValues)) { oseDB::unlock(); return true; } $query = " INSERT INTO `{$table}` " . " ({$sql1}) " . " VALUES" . " ({$sql2})"; $db->setQuery($query); $result = $db->query() ? $db->insertid() : false; oseDB::unlock(); return $result; } else { oseDB::unlock(); return true; } }
function getProperty($msc_id) { $db = oseDB::instance(); oseDB::lock('#__osemsc_acl READ'); $query = " SELECT * FROM `#__osemsc_acl`" . " WHERE id = {$msc_id}"; $db->setQuery($query); $item = oseDB::loadItem(); oseDB::unlock(); return $item; }
public static function orderChange($node, $ordering) { $db = oseDB::instance(); $current = $node; $type = $db->Quote($current->type); oseDB::lock('#__osemsc_addon'); $query = " SELECT * FROM `#__osemsc_addon`" . " WHERE type={$type} AND ordering= {$ordering} "; $db->setQuery($query); // get the Current Msc paranet ID $obj = $db->loadObject(); if ($current->ordering > $ordering) { $query = " UPDATE `#__osemsc_addon` " . " SET ordering= ordering+1 " . " WHERE ordering >= {$ordering} AND ordering < {$current->ordering} " . " AND type={$type}"; $db->setQuery($query); if (!oseDB::query()) { oseDB::unlock(); return false; } $query = " UPDATE `#__osemsc_addon` " . " SET ordering= {$ordering} " . " WHERE id = {$current->id} "; $db->setQuery($query); if (!oseDB::query()) { oseDB::unlock(); return false; } } else { $query = " UPDATE `#__osemsc_addon` " . " SET ordering= ordering-1 " . " WHERE ordering <= {$ordering} AND ordering > {$current->ordering} " . " AND type={$type}"; $db->setQuery($query); if (!oseDB::query()) { oseDB::unlock(); return false; } $query = " UPDATE `#__osemsc_addon` " . " SET ordering= {$ordering} " . " WHERE id = {$current->id} "; $db->setQuery($query); if (!oseDB::query()) { oseDB::unlock(); return false; } } oseDB::unlock(); return true; }
public static function getNodeByOrder($parent_id, $ordering, $type = 'array') { $db = oseDB::instance(); oseDB::lock('#__osemsc_acl READ'); $query = " SELECT * FROM `#__osemsc_acl`" . " WHERE parent_id = {$parent_id} AND ordering = {$ordering} "; $db->setQuery($query); $obj = oseDB::loadItem($type); oseDB::unlock(); return $obj; }
function getloginRedirect($msc_id) { $db = oseDB::instance(); oseDB::lock('#__menu'); $objs = array(); $query = "SELECT * FROM `#__menu` WHERE `published` = 1 ORDER BY `menutype`, `ordering` ASC"; $db->setQuery($query); $menus = $db->loadObjectList(); $i = 0; if (!empty($menus)) { foreach ($menus as $menu) { $objs[$i]->menuid = $menu->id; $objs[$i]->displayText = '[ID-' . $menu->id . ']-' . $menu->name; $i++; } } oseDB::unlock(); return $objs; }