aboutsummaryrefslogtreecommitdiff
path: root/mod/categories/views
diff options
context:
space:
mode:
Diffstat (limited to 'mod/categories/views')
-rw-r--r--mod/categories/views/default/categories.php12
-rw-r--r--mod/categories/views/default/categories/css.php12
-rw-r--r--mod/categories/views/default/categories/view.php8
-rw-r--r--mod/categories/views/default/input/categories.php56
-rw-r--r--mod/categories/views/default/output/categories.php29
-rw-r--r--mod/categories/views/default/plugins/categories/settings.php22
6 files changed, 139 insertions, 0 deletions
diff --git a/mod/categories/views/default/categories.php b/mod/categories/views/default/categories.php
new file mode 100644
index 000000000..8577ef01b
--- /dev/null
+++ b/mod/categories/views/default/categories.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * Categories input view
+ *
+ * @package ElggCategories
+ *
+ * @deprecated 1.8
+ */
+
+elgg_deprecated_notice("Use input/categories instead of categories", 1.8);
+
+echo elgg_view('input/categories', $vars);
diff --git a/mod/categories/views/default/categories/css.php b/mod/categories/views/default/categories/css.php
new file mode 100644
index 000000000..5f38e2867
--- /dev/null
+++ b/mod/categories/views/default/categories/css.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * Categories CSS extender
+ *
+ * @package Categories
+ */
+?>
+
+.categories li label {
+ font-size: 100%;
+ line-height: 1.2em;
+}
diff --git a/mod/categories/views/default/categories/view.php b/mod/categories/views/default/categories/view.php
new file mode 100644
index 000000000..6d1f7c1bb
--- /dev/null
+++ b/mod/categories/views/default/categories/view.php
@@ -0,0 +1,8 @@
+<?php
+/**
+ * @deprecated 1.8
+ */
+
+elgg_deprecated_notice("Use output/categories instead of categories/view", 1.8);
+
+echo elgg_view('output/categories', $vars);
diff --git a/mod/categories/views/default/input/categories.php b/mod/categories/views/default/input/categories.php
new file mode 100644
index 000000000..b543cde45
--- /dev/null
+++ b/mod/categories/views/default/input/categories.php
@@ -0,0 +1,56 @@
+<?php
+/**
+ * Categories input view
+ *
+ * @package ElggCategories
+ *
+ * @uses $vars['entity'] The entity being edited or created
+ */
+
+if (isset($vars['entity']) && $vars['entity'] instanceof ElggEntity) {
+ $selected_categories = $vars['entity']->universal_categories;
+}
+
+// use sticky values if set
+if (isset($vars['universal_categories_list'])) {
+ $selected_categories = $vars['universal_categories_list'];
+}
+
+$categories = elgg_get_site_entity()->categories;
+if (empty($categories)) {
+ $categories = array();
+}
+if (empty($selected_categories)) {
+ $selected_categories = array();
+}
+
+if (!empty($categories)) {
+ if (!is_array($categories)) {
+ $categories = array($categories);
+ }
+
+ // checkboxes want Label => value, so in our case we need category => category
+ $categories = array_flip($categories);
+ array_walk($categories, create_function('&$v, $k', '$v = $k;'));
+
+ ?>
+
+<div class="categories">
+ <label><?php echo elgg_echo('categories'); ?></label><br />
+ <?php
+ echo elgg_view('input/checkboxes', array(
+ 'options' => $categories,
+ 'value' => $selected_categories,
+ 'name' => 'universal_categories_list',
+ 'align' => 'horizontal',
+ ));
+
+ ?>
+ <input type="hidden" name="universal_category_marker" value="on" />
+</div>
+
+ <?php
+
+} else {
+ echo '<input type="hidden" name="universal_category_marker" value="on" />';
+}
diff --git a/mod/categories/views/default/output/categories.php b/mod/categories/views/default/output/categories.php
new file mode 100644
index 000000000..4b3a3fb6a
--- /dev/null
+++ b/mod/categories/views/default/output/categories.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * View categories on an entity
+ *
+ * @uses $vars['entity']
+ */
+
+$linkstr = '';
+if (isset($vars['entity']) && $vars['entity'] instanceof ElggEntity) {
+
+ $categories = $vars['entity']->universal_categories;
+ if (!empty($categories)) {
+ if (!is_array($categories)) {
+ $categories = array($categories);
+ }
+ foreach($categories as $category) {
+ $link = elgg_get_site_url() . 'categories/list?category=' . urlencode($category);
+ if (!empty($linkstr)) {
+ $linkstr .= ', ';
+ }
+ $linkstr .= '<a href="'.$link.'">' . $category . '</a>';
+ }
+ }
+
+}
+
+if ($linkstr) {
+ echo '<p class="elgg-output-categories">' . elgg_echo('categories') . ": $linkstr</p>";
+}
diff --git a/mod/categories/views/default/plugins/categories/settings.php b/mod/categories/views/default/plugins/categories/settings.php
new file mode 100644
index 000000000..3802da95a
--- /dev/null
+++ b/mod/categories/views/default/plugins/categories/settings.php
@@ -0,0 +1,22 @@
+<?php
+/**
+ * Administrator sets the categories for the site
+ *
+ * @package ElggCategories
+ */
+
+// Get site categories
+$site = elgg_get_site_entity();
+$categories = $site->categories;
+
+if (empty($categories)) {
+ $categories = array();
+}
+
+?>
+<div>
+ <p><?php echo elgg_echo('categories:explanation'); ?></p>
+<?php
+ echo elgg_view('input/tags', array('value' => $categories, 'name' => 'categories'));
+?>
+</div> \ No newline at end of file