aboutsummaryrefslogtreecommitdiff
path: root/mod/categories/views
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-11 22:51:08 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-11 22:51:08 +0000
commit891739afadddad56b517b7d565458296eeb58c0b (patch)
tree1891b4f21abd3df6aa1ec4b8847758644e1622fb /mod/categories/views
parent1f1a9d691360eac9bb3eeaf98ebaaec6b6305b2b (diff)
downloadelgg-891739afadddad56b517b7d565458296eeb58c0b.tar.gz
elgg-891739afadddad56b517b7d565458296eeb58c0b.tar.bz2
some clean up of the categories plugin - html/css polish needed
git-svn-id: http://code.elgg.org/elgg/trunk@8122 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/categories/views')
-rw-r--r--mod/categories/views/default/categories.php46
-rw-r--r--mod/categories/views/default/categories/list.php62
-rw-r--r--mod/categories/views/default/categories/view.php24
-rw-r--r--mod/categories/views/default/input/categories.php45
-rw-r--r--mod/categories/views/default/output/categories.php27
-rw-r--r--mod/categories/views/default/settings/categories/edit.php17
6 files changed, 89 insertions, 132 deletions
diff --git a/mod/categories/views/default/categories.php b/mod/categories/views/default/categories.php
index f69283e9f..8577ef01b 100644
--- a/mod/categories/views/default/categories.php
+++ b/mod/categories/views/default/categories.php
@@ -1,48 +1,12 @@
<?php
-
/**
- * Elgg categories plugin
+ * Categories input view
*
* @package ElggCategories
+ *
+ * @deprecated 1.8
*/
-if (isset($vars['entity']) && $vars['entity'] instanceof ElggEntity) {
- $selected_categories = $vars['entity']->universal_categories;
-}
-$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);
- }
-
- ?>
-
-<div id="content_area_user_title"><h2 class="categoriestitle"><?php echo elgg_echo('categories'); ?></h2></div>
-<div class="categories">
- <p>
-
- <?php
-
- echo elgg_view('input/checkboxes',array(
- 'options' => $categories,
- 'value' => $selected_categories,
- 'internalname' => 'universal_categories_list'
- ));
-
- ?>
- <input type="hidden" name="universal_category_marker" value="on" />
- </p>
-</div>
-
- <?php
+elgg_deprecated_notice("Use input/categories instead of categories", 1.8);
-} else {
- echo '<input type="hidden" name="universal_category_marker" value="on" />';
-}
+echo elgg_view('input/categories', $vars);
diff --git a/mod/categories/views/default/categories/list.php b/mod/categories/views/default/categories/list.php
deleted file mode 100644
index 7a6dadff4..000000000
--- a/mod/categories/views/default/categories/list.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-$categories = elgg_get_site_entity()->categories;
-
-if ($categories) {
- if (!is_array($categories)) {
- $categories = array($categories);
- }
-
- if (!empty($vars['subtype'])) {
- $flag = array();
- $owner_guid = '';
- if (isset($vars['owner_guid'])) {
- $owner_guid = (int) $vars['owner_guid'];
- }
-
- elgg_register_tag_metadata_name('universal_categories');
- $params = array(
- 'threshold' => 1,
- 'limit' => 999,
- 'tag_names' => array('universal_categories'),
- 'types' => 'object',
- 'subtypes' => $vars['subtype'],
- 'owner_guid' => $owner_guid,
- );
- $cats = elgg_get_tags($params);
- if ($cats) {
- foreach($cats as $cat) {
- $flag[] = $cat->tag;
- }
- }
-
- } else {
- $flag = null;
- }
-
- if (is_null($flag) || !empty($flag)) {
-
- ?>
-
-<h2><?php echo elgg_echo('categories'); ?></h2>
-<div class="categories">
- <?php
-
- $catstring = '';
- if (!empty($categories)) {
- foreach($categories as $category) {
- if (is_null($flag) || (is_array($flag) && in_array($category,$flag))) {
- $catstring .= '<li><a href="'.$vars['baseurl'].urlencode($category).'">'. $category .'</a></li>';
- }
- }
- }
- if (!empty($catstring)) {
- echo "<ul>{$catstring}</ul>";
- }
-
- ?>
-</div>
- <?php
- }
-
-}
diff --git a/mod/categories/views/default/categories/view.php b/mod/categories/views/default/categories/view.php
index 043b1d78e..6d1f7c1bb 100644
--- a/mod/categories/views/default/categories/view.php
+++ b/mod/categories/views/default/categories/view.php
@@ -1,22 +1,8 @@
<?php
+/**
+ * @deprecated 1.8
+ */
-$linkstr = '';
-if (isset($vars['entity']) && $vars['entity'] instanceof ElggEntity) {
+elgg_deprecated_notice("Use output/categories instead of categories/view", 1.8);
- $categories = $vars['entity']->universal_categories;
- if (!empty($categories)) {
- if (!is_array($categories)) {
- $categories = array($categories);
- }
- foreach($categories as $category) {
- $link = elgg_get_site_url() . 'pg/categories/list/?category=' . urlencode($category);
- if (!empty($linkstr)) {
- $linkstr .= ', ';
- }
- $linkstr .= '<a href="'.$link.'">' . $category . '</a>';
- }
- }
-
-}
-
-echo $linkstr;
+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..6f57a0c29
--- /dev/null
+++ b/mod/categories/views/default/input/categories.php
@@ -0,0 +1,45 @@
+<?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;
+}
+$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);
+ }
+
+ ?>
+
+<p class="categories">
+ <label><?php echo elgg_echo('categories'); ?></label><br />
+ <?php
+ echo elgg_view('input/checkboxes', array(
+ 'options' => $categories,
+ 'value' => $selected_categories,
+ 'internalname' => 'universal_categories_list'
+ ));
+
+ ?>
+ <input type="hidden" name="universal_category_marker" value="on" />
+</p>
+
+ <?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..724c46037
--- /dev/null
+++ b/mod/categories/views/default/output/categories.php
@@ -0,0 +1,27 @@
+<?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() . 'pg/categories/list/?category=' . urlencode($category);
+ if (!empty($linkstr)) {
+ $linkstr .= ', ';
+ }
+ $linkstr .= '<a href="'.$link.'">' . $category . '</a>';
+ }
+ }
+
+}
+
+echo $linkstr;
diff --git a/mod/categories/views/default/settings/categories/edit.php b/mod/categories/views/default/settings/categories/edit.php
index 9e0af0e48..e4750f02f 100644
--- a/mod/categories/views/default/settings/categories/edit.php
+++ b/mod/categories/views/default/settings/categories/edit.php
@@ -1,11 +1,11 @@
<?php
/**
- * Elgg categories plugin settings page
+ * Administrator sets the categories for the site
*
* @package ElggCategories
*/
-// Get site and categories
+// Get site categories
$site = elgg_get_site_entity();
$categories = $site->categories;
@@ -14,11 +14,8 @@ if (empty($categories)) {
}
?>
-<div class="contentWrapper">
- <p>
- <?php echo elgg_echo('categories:explanation'); ?>
- </p>
- <?php
- echo elgg_view('input/tags', array('value' => $categories, 'internalname' => 'categories'));
- ?>
-</div> \ No newline at end of file
+<p>
+ <?php echo elgg_echo('categories:explanation'); ?>
+</p>
+<?php
+echo elgg_view('input/tags', array('value' => $categories, 'internalname' => 'categories'));