123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <?php
- function session()
- {
- return Chamilo::session();
- }
- class Chamilo
- {
- public static function name()
- {
-
- return 'chamilo';
- }
- static function is_test_server()
- {
- return api_get_setting('server_type') == 'test';
- }
- static function is_production_server()
- {
- return api_get_setting('server_type') == 'production';
- }
-
- static function session()
- {
- return ChamiloSession::instance();
- }
-
- static function user()
- {
- return ChamiloSession::instance()->user();
- }
-
- public static function url($path = '', $params = array(), $html = true)
- {
- return Uri::url($path, $params, $html);
- }
- public static function here($params = array(), $html = true)
- {
- return Uri::here($params, $html);
- }
-
- public static function www()
- {
- return Uri::www();
- }
-
- public static function root()
- {
- return api_get_path(SYS_PATH);
- }
- public static function root_courses()
- {
- return api_get_path(SYS_COURSE_PATH);
- }
-
- public static function temp_file($ext = '')
- {
- $ext = $ext ? '.' . $ext : '';
- Temp::set_temp_root(api_get_path(SYS_ARCHIVE_PATH) . 'temp');
- $path = Temp::get_temporary_name() . $ext;
- return Temp::create($path);
- }
-
- public static function temp_dir()
- {
- $ext = $ext ? '.' . $ext : '';
- Temp::set_temp_root(api_get_path(SYS_ARCHIVE_PATH) . 'temp');
- $path = Temp::get_temporary_name() . $ext;
- return Temp::dir($path);
- }
-
- public static function temp_zip()
- {
- return Zip::create(self::temp_file('zip'));
- }
- public static function path($path = '')
- {
- $root = self::root();
- if (empty($path)) {
- return $root;
- }
- return $root . $path;
- }
- }
|