public static function getCategoryRoute($catid) { if ($catid instanceof CategoryNode) { $id = $catid->id; $category = $catid; } else { $id = (int) $catid; $category = Categories::getInstance('JFoobars')->get($id); } if ($id < 1) { $link = ''; } else { $needles = array('category' => array($id)); if ($item = self::_findItem($needles)) { $link = 'index.php?Itemid=' . $item; } else { //Create the link $link = 'index.php?option=com_jfoobars&view=category&id=' . $id; if ($category) { $catids = array_reverse($category->getPath()); $needles = array('category' => $catids, 'categories' => $catids); if ($item = self::_findItem($needles)) { $link .= '&Itemid=' . $item; } elseif ($item = self::_findItem()) { $link .= '&Itemid=' . $item; } } } } return $link; }
function actionSavecopy() { $cid = Request::getVar("id", 0); $model = Categories::getInstance(); $cid = $model->copyitem($cid); $this->redirect(Router::buildLink("categories", array("layout" => "edit", 'cid' => $cid))); }