本文整理汇总了PHP中waSystem::getVars方法的典型用法代码示例。如果您正苦于以下问题:PHP waSystem::getVars方法的具体用法?PHP waSystem::getVars怎么用?PHP waSystem::getVars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waSystem
的用法示例。
在下文中一共展示了waSystem::getVars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: myNav
/**
* @return array
* array(
* 'shop' => 'shop my nav html...',
* 'helpdesk' => 'helpdesk my nav html...',
* ...
* )
*/
public function myNav($ul_class = true)
{
$domain = wa()->getRouting()->getDomain(null, true);
$domain_config_path = wa()->getConfig()->getConfigPath('domains/' . $domain . '.php', true, 'site');
if (file_exists($domain_config_path)) {
$domain_config = (include $domain_config_path);
} else {
$domain_config = array();
}
$routes = wa()->getRouting()->getRoutes();
$apps = wa()->getApps();
$result = array();
foreach ($routes as $r) {
if (isset($r['app']) && !empty($apps[$r['app']]['my_account'])) {
$result[$r['app']] = $r;
}
}
if (isset($domain_config['personal'])) {
$tmp = array();
foreach ($domain_config['personal'] as $app_id => $enabled) {
if (!isset($result[$app_id])) {
continue;
}
if ($enabled) {
$tmp[$app_id] = $result[$app_id];
} else {
unset($result[$app_id]);
}
}
foreach ($result as $app_id => $r) {
$tmp[$app_id] = $r;
}
$result = array_reverse($tmp, true);
}
$old_app = wa()->getApp();
$my_nav_selected = $this->view->getVars('my_nav_selected');
$old_params = waRequest::param();
$i = 0;
foreach ($result as $app_id => $r) {
unset($r['url']);
unset($r['app']);
if ($i || $old_app != $app_id) {
waSystem::getInstance($app_id, null, true);
waRequest::setParam($r);
}
$class_name = $app_id . 'MyNavAction';
if (class_exists($class_name)) {
/**
* @var waViewAction $action
*/
try {
$action = new $class_name();
wa()->getView()->assign('my_nav_selected', $app_id == $old_app ? $my_nav_selected : '');
$result[$app_id] = $action->display();
} catch (Exception $e) {
unset($result[$app_id]);
}
} else {
unset($result[$app_id]);
}
$i++;
}
if (isset($app_id) && $old_app != $app_id) {
waRequest::setParam($old_params);
wa()->setActive($old_app);
}
$result = array_reverse($result, true);
if ($ul_class) {
$html = '<ul' . (is_string($ul_class) ? ' class="' . $ul_class . '"' : '') . '>';
foreach ($result as $app_result) {
$html .= $app_result;
}
$html .= '</ul>';
return $html;
} else {
return $result;
}
}