personal.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. $used=OC_Filesystem::filesize('/');
  17. $free=OC_Filesystem::free_space();
  18. $total=$free+$used;
  19. $relative=round(($used/$total)*10000)/100;
  20. $email=OC_Preferences::getValue(OC_User::getUser(), 'settings','email','');
  21. $lang=OC_Preferences::getValue( OC_User::getUser(), 'core', 'lang', 'en' );
  22. $languageCodes=OC_L10N::findAvailableLanguages();
  23. //put the current language in the front
  24. unset($languageCodes[array_search($lang,$languageCodes)]);
  25. array_unshift($languageCodes,$lang);
  26. $languageNames=include 'languageCodes.php';
  27. $languages=array();
  28. foreach($languageCodes as $lang){
  29. $languages[]=array('code'=>$lang,'name'=>$languageNames[$lang]);
  30. }
  31. // Return template
  32. $tmpl = new OC_Template( 'settings', 'personal', 'user');
  33. $tmpl->assign('usage',OC_Helper::humanFileSize($used));
  34. $tmpl->assign('total_space',OC_Helper::humanFileSize($total));
  35. $tmpl->assign('usage_relative',$relative);
  36. $tmpl->assign('email',$email);
  37. $tmpl->assign('languages',$languages);
  38. $forms=OC_App::getForms('personal');
  39. $tmpl->assign('forms',array());
  40. foreach($forms as $form){
  41. $tmpl->append('forms',$form);
  42. }
  43. $tmpl->printPage();
  44. ?>