function getCats($parent_cat_id) { $database =& JFactory::getDBO(); # Get pathway $mtPathWay = new mtPathWay($parent_cat_id); $return = $mtPathWay->printPathWayFromCat_withCurrentCat($parent_cat_id, 0); $return .= "\n"; $database->setQuery('SELECT cat_id, cat_name FROM #__mt_cats WHERE cat_parent = ' . $database->quote($parent_cat_id) . ' && cat_published = 1 && cat_approved = 1 ORDER BY cat_name ASC'); $cats = $database->loadObjectList(); if ($parent_cat_id > 0) { $database->setQuery('SELECT cat_parent FROM #__mt_cats WHERE cat_id = ' . $database->quote($parent_cat_id) . ' && cat_published = 1 && cat_approved = 1 LIMIT 1'); $browse_cat_parent = $database->loadResult(); $return .= $browse_cat_parent . "|" . JText::_('Arrow back'); if (!empty($cats)) { $return .= "\n"; } } else { // } if (!empty($cats)) { foreach ($cats as $key => $cat) { $return .= $cat->cat_id . '|' . $cat->cat_name; if ($key < count($cats) - 1) { $return .= "\n"; } } } echo $return; return true; }
$parent_cat_id = JRequest::getInt('parent_cat_id', 0); $task2 = JRequest::getCmd('task2', ''); switch ($task2) { case 'spiderurl': spiderurl($option); break; case 'checklinkcomplete': checklinkcomplete(); break; case 'checklink': checklink(); break; case 'getcats': # Get pathway $mtPathWay = new mtPathWay($parent_cat_id); $return = $mtPathWay->printPathWayFromCat_withCurrentCat($parent_cat_id, 0); $return .= "\n"; $database->setQuery('SELECT cat_id, cat_name FROM #__mt_cats WHERE cat_parent = ' . $database->quote($parent_cat_id) . ' ORDER BY cat_name ASC'); $cats = $database->loadObjectList(); if ($parent_cat_id > 0) { $database->setQuery('SELECT cat_parent FROM #__mt_cats WHERE cat_id = ' . $database->quote($parent_cat_id) . ' LIMIT 1'); $browse_cat_parent = $database->loadResult(); $return .= $browse_cat_parent . "|" . JText::_('Arrow back'); if (count($cats) > 0) { $return .= "\n"; } } else { // } if (count($cats) > 0) { foreach ($cats as $key => $cat) {
function getCats( $parent_cat_id ) { $database =& JFactory::getDBO(); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // OSE Added - OSE and Open Source Excellence is the registered trade mark of the Open Source Excellence PTE LTD. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (file_exists(JPATH_SITE.DS.'components'.DS.'com_osemsc'.DS.'init.php') && file_exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_ose_cpu'.DS.'define.php') && !file_exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_osemsc'.DS.'installer.dummy.ini')) { require_once(JPATH_SITE.DS.'components'.DS.'com_osemsc'.DS.'init.php'); $content_ids = oseRegistry::call('content')->getRestrictedContent('mtree','category'); $where = (COUNT($content_ids) > 0)?' AND cat_id NOT IN ('.implode(',',$content_ids).')':null; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // OSE Added - OSE and Open Source Excellence is the registered trade mark of the Open Source Excellence PTE LTD. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// # Get pathway $mtPathWay = new mtPathWay($parent_cat_id); $return = $mtPathWay->printPathWayFromCat_withCurrentCat($parent_cat_id,0); $return .= "\n"; $database->setQuery( 'SELECT cat_id, cat_name FROM #__mt_cats WHERE cat_parent = ' . $database->quote($parent_cat_id) . ' && cat_published = 1 && cat_approved = 1 '.$where.'ORDER BY cat_name ASC' ); $cats = $database->loadObjectList(); if($parent_cat_id > 0) { $database->setQuery( 'SELECT cat_parent FROM #__mt_cats WHERE cat_id = ' . $database->quote($parent_cat_id) . ' && cat_published = 1 && cat_approved = 1 LIMIT 1'); $browse_cat_parent = $database->loadResult(); $return .= $browse_cat_parent . "|" . JText::_( 'Arrow back' ); if(!empty($cats)) { $return .= "\n"; } } else { // } if(!empty($cats)) { foreach( $cats as $key => $cat ) { $return .= $cat->cat_id . '|' . $cat->cat_name; if($key<(count($cats)-1)) { $return .= "\n"; } } } echo $return; return true; }