edit.php 888 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Copyright (c) 2012 Thomas Tanghus <thomas@tanghus.net>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. function bailOut($msg) {
  9. OC_JSON::error(array('data' => array('message' => $msg)));
  10. OC_Log::write('core', 'ajax/vcategories/edit.php: '.$msg, OC_Log::DEBUG);
  11. exit();
  12. }
  13. function debug($msg) {
  14. OC_Log::write('core', 'ajax/vcategories/edit.php: '.$msg, OC_Log::DEBUG);
  15. }
  16. OC_JSON::checkLoggedIn();
  17. $l = OC_L10N::get('core');
  18. $type = isset($_GET['type']) ? $_GET['type'] : null;
  19. if(is_null($type)) {
  20. bailOut($l->t('Category type not provided.'));
  21. }
  22. $tmpl = new OCP\Template("core", "edit_categories_dialog");
  23. $vcategories = new OC_VCategories($type);
  24. $categories = $vcategories->categories();
  25. debug(print_r($categories, true));
  26. $tmpl->assign('categories', $categories);
  27. $tmpl->printpage();