Exemplo n.º 1
0
/**
 * View helper for formating category hierarchies as a form with checkboxes with ul/li
 * 
 */
function renderCheckboxItem($itemArr, $categoriesArr, $memberCategoryIdArr)
{
    $id = $itemArr['child_id'];
    $out = "<span class='category_name'>";
    $checked = '';
    if (in_array($id, $memberCategoryIdArr)) {
        $checked = ' checked';
    }
    //$out.= {{ Form::checkbox('category_id[]', $id, $bool) }}
    $out .= "<input type='checkbox' name='category_id[]' value='{$id}' {$checked}>";
    $out .= $categoriesArr[$id]['display_name'];
    $out .= "</span>";
    if (isset($itemArr['children'])) {
        $out .= "<ul class='category_ul'>";
        foreach ($itemArr['children'] as $child) {
            $out .= "<li>" . renderCheckboxItem($child, $categoriesArr, $memberCategoryIdArr) . "</li>";
        }
        $out .= "</ul>";
    }
    return $out;
}
Exemplo n.º 2
0

<br>
<a href='javascript:void(0);' onclick='history.go(-1);'>&laquo;Back</a>
&nbsp; &#183; &nbsp; 
<a href='/members/uncategorized'>Uncategorized Members</a>
&nbsp; &#183; &nbsp;
{!! link_to_route('members.create', 'Add a Member&raquo;') !!}

</div>

<div class='right_col' style='margin-top:0px;margin-left:500px;'>

<?php 
foreach ($parentChildArr as $itemArr) {
    echo renderCheckboxItem($itemArr, $categoriesArr, $memberCategoryIdArr);
}
?>
 

</div>

<style>
    #member > label{
        width:100px;
    }
    ul.form-group label {
        margin-left:-30px;
        width:130px;
    }
</style>