1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace Icybee\Modules\Taxonomy\Vocabulary;
13
14 use ICanBoogie\I18n;
15 use ICanBoogie\Operation;
16
17 class Module extends \Icybee\Module
18 {
19 const OPERATION_ORDER = 'order';
20
21 protected function block_order($vid)
22 {
23 global $core;
24
25 $document = $core->document;
26
27 $document->js->add(DIR . 'public/order.js');
28 $document->css->add(DIR . 'public/order.css');
29
30 $terms = $core->models['taxonomy.terms']->filter_by_vid($vid)->order('term.weight, vtid')->all;
31
32 $rc = '<form id="taxonomy-order" method="post">';
33 $rc .= '<input type="hidden" name="' . Operation::NAME . '" value="' . self::OPERATION_ORDER . '" />';
34 $rc .= '<input type="hidden" name="' . Operation::DESTINATION . '" value="' . $this . '" />';
35 $rc .= '<input type="hidden" name="' . Operation::KEY . '" value="' . $vid . '" />';
36 $rc .= '<ol>';
37
38 foreach ($terms as $term)
39 {
40 $rc .= '<li>';
41 $rc .= '<input type="hidden" name="terms[' . $term->vtid . ']" value="' . $term->weight . '" />';
42 $rc .= \ICanBoogie\escape($term->term);
43 $rc .= '</li>';
44 }
45
46 $rc .= '</ol>';
47
48 $rc .= '<div class="actions">';
49 $rc .= '<button class="save">' . I18n\t('label.save') . '</button>';
50 $rc .= '</div>';
51
52 $rc .= '</form>';
53
54 return $rc;
55 }
56 }