/** * Display a tip block * * @package application.helper.smarty * @author Integry Systems * * @package application.helper.smarty */ function smarty_block_tip($params, $content, LiveCartSmarty $smarty, &$repeat) { if (!$repeat) { $smarty->assign('tipContent', $content); return $smarty->display('block/backend/tip.tpl'); } }
/** * Displays backend language selection menu * * @param array $params * @param Smarty $smarty * @return string * * @package application.helper.smarty * @author Integry Systems */ function smarty_function_backendLangMenu($params, LiveCartSmarty $smarty) { if (!$smarty->getApplication()->getLanguageArray()) { return false; } $smarty->assign('currentLang', Language::getInstanceByID($smarty->getApplication()->getLocaleCode())->toArray()); $smarty->assign('returnRoute', base64_encode($smarty->getApplication()->getRouter()->getRequestedRoute())); return $smarty->display('block/backend/langMenu.tpl'); }
/** * Displays backend navigation menu * * @param array $params * @param Smarty $smarty * @return string * * @package application.helper.smarty * @author Integry Systems */ function smarty_function_backendMenu($params, LiveCartSmarty $smarty) { $locale = $smarty->getApplication()->getLocale(); $controller = $smarty->_tpl_vars['request']['controller']; $action = $smarty->_tpl_vars['request']['action']; // load language file for menu $locale->translationManager()->loadFile('backend/menu'); $menuLoader = new MenuLoader($smarty->getApplication()); $structure = $menuLoader->getCurrentHierarchy($controller, $action); $router = $smarty->getApplication()->getRouter(); // get translations and generate URL's $items = array(); foreach ($structure['items'] as $topValue) { if (!empty($topValue['role']) && !AccessStringParser::run($topValue['role'])) { continue; } $filteredValue = array(); foreach (array('title', 'descr') as $field) { $filteredValue[$field] = $smarty->branding($locale->translator()->translate($topValue[$field])); } $filteredValue['controller'] = $topValue['controller']; $filteredValue['action'] = $topValue['action']; $filteredValue['icon'] = $topValue['icon']; if (!empty($topValue['controller'])) { $filteredValue['url'] = $router->createUrl(array('controller' => $topValue['controller'], 'action' => $topValue['action']), true); } if (is_array($topValue['items'])) { $subItems = array(); foreach ($topValue['items'] as &$subValue) { if (!empty($subValue['role']) && !AccessStringParser::run($subValue['role'])) { continue; } $filteredSubValue = array(); foreach (array('title', 'descr') as $field) { $filteredSubValue[$field] = $smarty->branding($locale->translator()->translate($subValue[$field])); } $filteredSubValue['url'] = $router->createUrl(array('controller' => $subValue['controller'], 'action' => $subValue['action']), true); $filteredSubValue['controller'] = $subValue['controller']; $filteredSubValue['action'] = $subValue['action']; $filteredSubValue['icon'] = $subValue['icon']; $subItems[] = $filteredSubValue; } if (count($subItems) > 0) { $filteredValue['items'] = $subItems; } } $items[] = $filteredValue; } $smarty->assign('menuArray', json_encode($items)); $smarty->assign('controller', $controller); $smarty->assign('action', $action); return $smarty->display('block/backend/backendMenu.tpl'); }
/** * Displays ActiveGrid table * * @param array $params * @param Smarty $smarty * @return string * * @package application.helper.smarty * @author Integry Systems */ function smarty_function_activeGrid($params, LiveCartSmarty $smarty) { if (!isset($params['rowCount']) || !$params['rowCount']) { $params['rowCount'] = 15; } foreach ($params as $key => $value) { $smarty->assign($key, $value); } if (isset($params['filters']) && is_array($params['filters'])) { $smarty->assign('filters', $params['filters']); } $smarty->assign('url', $smarty->getApplication()->getRouter()->createUrl(array('controller' => $params['controller'], 'action' => $params['action']), true)); $smarty->assign('thisMonth', date('m')); $smarty->assign('lastMonth', date('Y-m', strtotime(date('m') . '/15 -1 month'))); return $smarty->display('block/activeGrid/gridTable.tpl'); }