personal.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com>
  4. * This file is licensed under the Affero General Public License version 3 or later.
  5. * See the COPYING-README file.
  6. */
  7. require_once('../lib/base.php');
  8. OC_Util::checkLoggedIn();
  9. // Highlight navigation entry
  10. OC_Util::addScript( 'settings', 'personal' );
  11. OC_Util::addStyle( 'settings', 'settings' );
  12. OC_Util::addScript( '3rdparty', 'chosen/chosen.jquery.min' );
  13. OC_Util::addStyle( '3rdparty', 'chosen' );
  14. OC_App::setActiveNavigationEntry( 'personal' );
  15. // calculate the disc space
  16. $rootInfo=OC_FileCache::get('');
  17. $used=$rootInfo['size'];
  18. $free=OC_Filesystem::free_space();
  19. $total=$free+$used;
  20. $relative=round(($used/$total)*10000)/100;
  21. $email=OC_Preferences::getValue(OC_User::getUser(), 'settings','email','');
  22. $lang=OC_Preferences::getValue( OC_User::getUser(), 'core', 'lang', OC_L10N::findLanguage() );
  23. $languageCodes=OC_L10N::findAvailableLanguages();
  24. sort ($languageCodes);
  25. //put the current language in the front
  26. unset($languageCodes[array_search($lang,$languageCodes)]);
  27. array_unshift($languageCodes,$lang);
  28. $languageNames=include 'languageCodes.php';
  29. $languages=array();
  30. foreach($languageCodes as $lang){
  31. $l=new OC_L10N('settings',$lang);
  32. if(substr($l->t('__language_name__'),0,1)!='_'){//first check if the language name is in the translation file
  33. $languages[]=array('code'=>$lang,'name'=>$l->t('__language_name__'));
  34. }elseif(isset($languageNames[$lang])){
  35. $languages[]=array('code'=>$lang,'name'=>$languageNames[$lang]);
  36. }else{//fallback to language code
  37. $languages[]=array('code'=>$lang,'name'=>$lang);
  38. }
  39. }
  40. // Return template
  41. $tmpl = new OC_Template( 'settings', 'personal', 'user');
  42. $tmpl->assign('usage',OC_Helper::humanFileSize($used));
  43. $tmpl->assign('total_space',OC_Helper::humanFileSize($total));
  44. $tmpl->assign('usage_relative',$relative);
  45. $tmpl->assign('email',$email);
  46. $tmpl->assign('languages',$languages);
  47. $forms=OC_App::getForms('personal');
  48. $tmpl->assign('forms',array());
  49. foreach($forms as $form){
  50. $tmpl->append('forms',$form);
  51. }
  52. $tmpl->printPage();
  53. ?>