コード例 #1
0
 /**
  * Display category tree with input checkboxes.
  */
 public static function tree($categories, array $selected_categories, $form_field, $columns = 1, $enable_parents = false)
 {
     $html = '';
     // Validate columns
     $columns = (int) $columns;
     if ($columns == 0) {
         $columns = 1;
     }
     $categories_total = $categories->count();
     // Format categories for column display.
     $this_col = 1;
     // column number
     $maxper_col = round($categories_total / $columns);
     // Maximum number of elements per column
     $i = 1;
     // Element Count
     foreach ($categories as $category) {
         // If this is the first element of a column, start a new UL
         if ($i == 1) {
             $html .= '<ul id="category-column-' . $this_col . '">';
         }
         // Display parent category.
         $html .= '<li style="width:100%;">';
         $html .= groups_category::display_category_checkbox($category, $selected_categories, $form_field, $enable_parents);
         if (!$category->category_visible) {
             $html .= " - " . Kohana::lang("simplegroups.not_visible");
         }
         // Display child categories.
         if ($category->children->count() > 0) {
             $html .= '<ul>';
             foreach ($category->children as $child) {
                 $html .= '<li>';
                 $html .= groups_category::display_category_checkbox($child, $selected_categories, $form_field);
                 if (!$child->category_visible) {
                     $html .= " - " . Kohana::lang("simplegroups.not_visible");
                 }
             }
             $html .= '</ul>';
         }
         $i++;
         // If this is the last element of a column, close the UL
         if ($i > $maxper_col || $i == $categories_total) {
             $html .= '</ul>';
             $i = 1;
             $this_col++;
         }
     }
     return $html;
 }
コード例 #2
0
			<?php 
echo $group_name . " " . Kohana::lang('simplegroups.group') . " " . Kohana::lang('ui_main.categories');
?>
 : 
		</h4>
		<?php 
print $new_category_toggle_js;
?>
		<!--category_add form goes here-->
		<div class="message_category">
			<?php 
print form::open(NULL, array('id' => 'message_categories', 'name' => 'message_categories'));
$selected_categories = array();
$selected_categories = $message_category;
$columns = 2;
echo groups_category::tree($categories, $selected_categories, 'incident_category', $columns);
print form::close();
?>
			 
		</div>		
	</div>
	<div class="btns">
		<ul>
			<li>
				<a href="#" onclick="saveCategories(<?php 
echo $message->id;
?>
); return false; " class="btn_save"><?php 
echo Kohana::lang('simplegroups.save');
?>
</a>
コード例 #3
0
		<?php 
echo Kohana::lang('ui_main.clear');
?>
	</a>
	<a class="f-title" href="#"><?php 
echo Kohana::lang('simplegroups.groups_plain');
?>
</a>
</h3>
<div class="f-simpleGroups-box">
	<ul class="filter-list fl-simpleGroups">
		<li>
			<?php 
echo $group_name . " ";
print form::checkbox('simple_group_filter_checkbox', $group_id, TRUE, "onchange='simpleGroupsFilterToggle(" . $group_id . ");'");
?>
		</li>
		<li>
			<?php 
echo $group_name . " " . Kohana::lang('ui_main.categories');
?>
:
			<br/>
			<?php 
echo groups_category::tree($group_categories, $selected_group_categories, 'simple_group_category', 2, true);
?>
		</li>
	</ul>
	
	
</div>