当前位置: 首页>>代码示例>>PHP>>正文


PHP category::display_category_checkbox方法代码示例

本文整理汇总了PHP中category::display_category_checkbox方法的典型用法代码示例。如果您正苦于以下问题:PHP category::display_category_checkbox方法的具体用法?PHP category::display_category_checkbox怎么用?PHP category::display_category_checkbox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在category的用法示例。


在下文中一共展示了category::display_category_checkbox方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: form_tree

 /**
  * Display category tree with input checkboxes for forms
  * 
  * @param string $form_field form field name
  * @param array $selected_categories Categories that should be already selected
  * @param int $columns number of columns to display
  * @param bool $enable_parents Can parent categoires be select
  * @param bool $show_hidden Show hidden categories
  */
 public static function form_tree($form_field, array $selected_categories = array(), $columns = 1, $enable_parents = FALSE, $show_hidden = FALSE)
 {
     $category_data = self::get_category_tree_data(FALSE, $show_hidden);
     $html = '';
     // Validate columns
     $columns = (int) $columns;
     if ($columns == 0) {
         $columns = 1;
     }
     $categories_total = count($category_data);
     // Format categories for column display.
     // Column number
     $this_col = 1;
     // Maximum number of elements per column
     $maxper_col = round($categories_total / $columns);
     // start the first column
     $html .= "\n" . '<ul class="category-column category-column-' . $this_col . '" id="category-column-' . $this_col . '">' . "\n";
     $i = 1;
     // Element Count
     foreach ($category_data as $category) {
         // Display parent category.
         $html .= "\n\t" . '<li title="' . $category['category_description'] . '">';
         $html .= "\n\t\t" . category::display_category_checkbox($category, $selected_categories, $form_field, $enable_parents) . "\n";
         // Display child categories.
         if (count($category['children']) > 0) {
             $html .= "\t\t<ul>";
             foreach ($category['children'] as $child) {
                 $html .= "\n\t\t\t" . '<li title="' . $child['category_description'] . '">' . "\n";
                 $html .= category::display_category_checkbox($child, $selected_categories, $form_field, $enable_parents);
                 $html .= "\n\t\t\t" . '</li>' . "\r\n";
             }
             $html .= "\t\t" . '</ul>' . "\r\n";
         }
         $html .= "\t</li>\n";
         // If this is the last element of a column, close the UL
         if ($i % $maxper_col == 0 and $i > 0 or $i == $categories_total) {
             $html .= "</ul>\n";
             $this_col++;
             if ($i < $categories_total) {
                 $html .= '<ul class="category-column category-column-' . $this_col . '" id="category-column-' . $this_col . '">';
             }
         }
         $i++;
     }
     return $html;
 }
开发者ID:niiyatii,项目名称:crowdmap,代码行数:55,代码来源:category.php

示例2: tree

 /**
  * 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>';
         $html .= category::display_category_checkbox($category, $selected_categories, $form_field, $enable_parents);
         // Display child categories.
         if ($category->children->count() > 0) {
             $html .= '<ul>';
             foreach ($category->children as $child) {
                 $html .= '<li>';
                 $html .= category::display_category_checkbox($child, $selected_categories, $form_field, $enable_parents);
             }
             $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;
 }
开发者ID:kjgarza,项目名称:thrasos,代码行数:46,代码来源:category.php

示例3: tree

 /**
  * Display category tree with input checkboxes.
  */
 public static function tree($categories, $hide_children = TRUE, 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 title="' . $category->category_description . '">';
         $html .= category::display_category_checkbox($category, $selected_categories, $form_field, $enable_parents);
         // Visible Child Count
         $vis_child_count = 0;
         foreach ($category->children as $child) {
             // If we don't want to show a category's hidden children
             if ($hide_children == TRUE) {
                 $child_visible = $child->category_visible;
                 if ($child_visible) {
                     // Increment Visible Child count
                     ++$vis_child_count;
                 }
             } else {
                 ++$vis_child_count;
             }
         }
         // Display child categories.
         if ($category->children->count() > 0 and $vis_child_count > 0) {
             $html .= '<ul>';
             foreach ($category->children as $child) {
                 if ($hide_children) {
                     $child_visible = $child->category_visible;
                     if ($child_visible) {
                         $html .= '<li>';
                         $html .= category::display_category_checkbox($child, $selected_categories, $form_field, $enable_parents);
                     }
                 } else {
                     $html .= '<li title="' . $child->category_description . '">';
                     $html .= category::display_category_checkbox($child, $selected_categories, $form_field, $enable_parents);
                 }
             }
             $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;
 }
开发者ID:nemmy,项目名称:Ushahidi_Web,代码行数:68,代码来源:category.php

示例4: foreach

$user_categories = Kohana::config('pps.user_categories');
foreach ($categories as $category)
{
 if (in_array($category->category_title, $user_categories))
 {
   foreach ($category->children as $child)
   {
     echo '<li>'.category::display_category_checkbox($child, $selected_categories, 'incident_category').'</li>';
   }
 }
}
*/
// we display all categories
foreach ($categories as $category) {
    if ($category->category_visible) {
        echo '<li>' . category::display_category_checkbox($category, $selected_categories, 'incident_category') . '</li>';
    }
}
?>
</ul>
					</div>
				</div>
				<?php 
// Action::report_form - Runs right after the report categories
Event::run('ushahidi_action.report_form');
?>
                
                
                
                
                		<?php 
开发者ID:rmarianski,项目名称:pps-theme,代码行数:31,代码来源:reports_submit.php

示例5: implode

    echo 'in ' . implode(', ', $category_titles) . ' - ';
}
// echo $pagination_stats;
?>
</h1>
<form method="GET" action="<?php 
echo url::site('reports');
?>
">
<ul style="display:none;">
<span style="font-weight: bold; display:">Filter by</span>
<?php 
// XXX just to move forward
$user_categories = array();
foreach ($user_categories as $visible_category) {
    echo '<li style="list-style: none; display: inline; padding: 0 5px">' . category::display_category_checkbox($visible_category, $selected_categories, 'c') . '</li>';
}
?>
<!--
<span style="font-weight: bold; margin-left: 1em">Borough</span>
<select name="b">
   <option value="any">Any</option>
   <option value="Queens" <?php 
if (isset($_GET['b']) and $_GET['b'] == "Queens") {
    ?>
selected="true"<?php 
}
?>
>Queens</option>
   <option value="Brooklyn" <?php 
if (isset($_GET['b']) and $_GET['b'] == "Brooklyn") {
开发者ID:rmarianski,项目名称:pps-theme,代码行数:31,代码来源:reports.php

示例6: pseudo_tree_checkboxes

 /**
  * Display category tree with input checkboxes.
  * The is called "pseudo_tree" because the tree is generated based on naming convention.
  * For example "1. Category One", "1a. Category One A".
  * This is a stopgap solution for Haiti instance.
  * @todo: Category hierarchy should really be defined in the database.
  */
 public static function pseudo_tree_checkboxes(array $categories, array $selected_categories, $form_field, $columns = 1)
 {
     $html = '';
     // Validate columns
     $columns = (int) $columns;
     if ($columns == 0) {
         $columns = 1;
     }
     $categories_total = count($categories);
     // Organize categories into a hierarchical array.
     $sorted_categories = category::generate_pseudo_tree($categories);
     // Format categories for column display.
     $this_col = 1;
     // column number
     $maxper_col = round(count($sorted_categories) / $columns);
     // Maximum number of elements per column
     $i = 1;
     // Element Count
     foreach ($sorted_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>';
         $html .= category::display_category_checkbox($category, $selected_categories, $form_field);
         // Display child categories.
         if (!empty($category['children']) && is_array($category['children'])) {
             $html .= '<ul>';
             foreach ($category['children'] as $child_category) {
                 $html .= '<li>';
                 $html .= category::display_category_checkbox($child_category, $selected_categories, $form_field);
             }
             $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;
 }
开发者ID:ushahidi,项目名称:Ushahidi_Haiti,代码行数:52,代码来源:category.php


注:本文中的category::display_category_checkbox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。