|
|
|
@ -3,6 +3,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
namespace Chamilo\CoreBundle\Twig\Extension; |
|
|
|
namespace Chamilo\CoreBundle\Twig\Extension; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use Twig\TwigFunction; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Class ChamiloExtension. |
|
|
|
* Class ChamiloExtension. |
|
|
|
* |
|
|
|
* |
|
|
|
@ -27,7 +29,35 @@ class ChamiloExtension extends \Twig_Extension |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function getFunctions() |
|
|
|
public function getFunctions() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return []; |
|
|
|
return [ |
|
|
|
|
|
|
|
new TwigFunction('chamilo_page_title_get', [$this, 'getChamiloPageTitle']), |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getChamiloPageTitle(): string |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$urlPath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); |
|
|
|
|
|
|
|
$urlPath = rtrim($urlPath, '/'); |
|
|
|
|
|
|
|
$parts = explode('/', $urlPath); |
|
|
|
|
|
|
|
$title = end($parts); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$titleList = []; |
|
|
|
|
|
|
|
$titleList[] = 'OFAJ'; // api_get_setting('Institution'); |
|
|
|
|
|
|
|
$titleList[] = 'PARKUR'; // api_get_setting('siteName'); |
|
|
|
|
|
|
|
$titleList[] = ucfirst(str_replace('-', ' ', $title)); // Page title |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$titleString = ''; |
|
|
|
|
|
|
|
for ($i = 0; $i < count($titleList); $i++) { |
|
|
|
|
|
|
|
$titleString .= $titleList[$i]; |
|
|
|
|
|
|
|
if (isset($titleList[$i + 1])) { |
|
|
|
|
|
|
|
$item = trim($titleList[$i + 1]); |
|
|
|
|
|
|
|
if (!empty($item)) { |
|
|
|
|
|
|
|
$titleString .= ' - '; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $titleString; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|