+ add some new functions to print menu and link.
This commit is contained in:
@@ -166,6 +166,7 @@ EOT;
|
||||
$alias = '';
|
||||
$float = '';
|
||||
$active = '';
|
||||
$target = '';
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD>ò˵<C3B2><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>õģ<C3B5><C4A3><EFBFBD><F2B8B2B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD><EFBFBD>á<EFBFBD>*/
|
||||
if(is_array($submenu)) extract($submenu);
|
||||
@@ -188,7 +189,7 @@ EOT;
|
||||
if($currentModule == $subModule) $active = 'active';
|
||||
if($module == $currentModule and ($method == $currentMethod or strpos($alias, $currentMethod) !== false)) $active = 'active';
|
||||
|
||||
echo "<li class='$float $active'>" . html::a(helper::createLink($module, $method, $vars), $label) . "</li>\n";
|
||||
echo "<li class='$float $active'>" . html::a(helper::createLink($module, $method, $vars), $label, $target) . "</li>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,6 +222,68 @@ EOT;
|
||||
}
|
||||
}
|
||||
|
||||
/* <20><><EFBFBD>ò˵<C3B2><CBB5>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
public function setMenuVars($menu, $key, $params)
|
||||
{
|
||||
if(is_array($params))
|
||||
{
|
||||
if(is_array($menu->$key))
|
||||
{
|
||||
$menu->$key = (object)$menu->$key;
|
||||
$menu->$key->link = vsprintf($menu->$key->link, $params);
|
||||
$menu->$key = (array)$menu->$key;
|
||||
}
|
||||
else
|
||||
{
|
||||
$menu->$key = vsprintf($menu->$key, $params);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(is_array($menu->$key))
|
||||
{
|
||||
$menu->$key = (object)$menu->$key;
|
||||
$menu->$key->link = sprintf($menu->$key->link, $params);
|
||||
$menu->$key = (array)$menu->$key;
|
||||
}
|
||||
else
|
||||
{
|
||||
$menu->$key = sprintf($menu->$key, $params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* <20><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>orderby<62><79><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD> */
|
||||
public static function printOrderLink($fieldName, $orderBy, $vars, $label, $module = '', $method = '')
|
||||
{
|
||||
global $lang, $app;
|
||||
if(empty($module)) $module= $app->getModuleName();
|
||||
if(empty($method)) $method= $app->getMethodName();
|
||||
if(strpos($orderBy, $fieldName) !== false)
|
||||
{
|
||||
if(stripos($orderBy, 'desc') !== false)
|
||||
{
|
||||
$orderBy = str_ireplace('desc', 'asc', $orderBy);
|
||||
}
|
||||
elseif(stripos($orderBy, 'asc') !== false)
|
||||
{
|
||||
$orderBy = str_ireplace('asc', 'desc', $orderBy);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$orderBy = $fieldName . '|' . 'asc';
|
||||
}
|
||||
$link = helper::createLink($module, $method, sprintf($vars, $orderBy));
|
||||
echo html::a($link, $label);
|
||||
}
|
||||
|
||||
/* <20><>ӡ<EFBFBD><D3A1><EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>*/
|
||||
public static function printLink($module, $method, $vars = '', $label, $target = '', $misc = '')
|
||||
{
|
||||
if(common::hasPriv($module, $method)) echo html::a(helper::createLink($module, $method, $vars), $label, $target, $misc);
|
||||
}
|
||||
|
||||
/**
|
||||
* <20><><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>ʵĹ<CAB5>˾<EFBFBD><CBBE>Ϣ<EFBFBD><CFA2>
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user