upload.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * Avatar upload form
  4. *
  5. * @uses $vars['entity']
  6. */
  7. elgg_require_js('webcam');
  8. $selected_tab = get_input('tab', 'acquire');
  9. $options = array(
  10. 'tabs' => array(),
  11. 'class' => 'avatar-tabs'
  12. );
  13. $tabs = array('acquire', 'upload', 'url');
  14. foreach ($tabs as $tab) {
  15. $options['tabs'][] = array(
  16. 'text' => elgg_echo("webcam:tab:$tab"),
  17. 'id' => "avatar-$tab-tab",
  18. 'selected' => $selected_tab == $tab,
  19. 'href' => '#'
  20. );
  21. }
  22. $tab_nav = elgg_view('navigation/tabs', $options);
  23. echo $tab_nav;
  24. ?>
  25. <div id="avatar-options">
  26. <div id="avatar-upload" class="hidden">
  27. <label><?php echo elgg_echo("avatar:upload"); ?></label><br />
  28. <?php echo elgg_view("input/file", array('name' => 'avatar')); ?>
  29. </div>
  30. <div id="avatar-acquire">
  31. <label><?php echo elgg_echo("webcam:acquire:info"); ?></label><br />
  32. <div id="webcam">
  33. <canvas id="webcam-canvas" class="hidden"></canvas>
  34. <video id="webcam-video"></video>
  35. </div>
  36. </div>
  37. <div id="avatar-url" class="hidden">
  38. <label><?php echo elgg_echo("webcam:url:info"); ?></label><br />
  39. <?php echo elgg_view("input/text", array('name' => 'avatar_url')); ?>
  40. </div>
  41. </div>
  42. <div class="elgg-foot">
  43. <?php
  44. echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $vars['entity']->guid));
  45. echo elgg_view('input/submit', array(
  46. 'value' => elgg_echo('upload'),
  47. 'id' => 'avatar-upload'
  48. ));
  49. ?>
  50. </div>