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


PHP FormContainer::output_row_cells方法代码示例

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


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

示例1: retrieve_single_permissions_row

/**
 * @param int $gid
 * @param int $fid
 *
 * @return string
 */
function retrieve_single_permissions_row($gid, $fid)
{
    global $mybb, $lang, $cache, $db;
    $query = $db->simple_select("usergroups", "*", "gid='{$gid}'");
    $usergroup = $db->fetch_array($query);
    $query = $db->simple_select("forums", "*", "fid='{$fid}'");
    $forum_data = $db->fetch_array($query);
    $query = $db->simple_select("forumpermissions", "*", "fid='{$fid}'");
    while ($existing = $db->fetch_array($query)) {
        $existing_permissions[$existing['gid']] = $existing;
    }
    $cached_forum_perms = $cache->read("forumpermissions");
    $field_list = array('canview' => $lang->permissions_canview, 'canpostthreads' => $lang->permissions_canpostthreads, 'canpostreplys' => $lang->permissions_canpostreplys, 'canpostpolls' => $lang->permissions_canpostpolls);
    $field_list2 = array('canview' => $lang->perm_drag_canview, 'canpostthreads' => $lang->perm_drag_canpostthreads, 'canpostreplys' => $lang->perm_drag_canpostreplys, 'canpostpolls' => $lang->perm_drag_canpostpolls);
    $form = new Form('', '', "", 0, "", true);
    $form_container = new FormContainer();
    $perms = array();
    if (is_array($existing_permissions) && $existing_permissions[$usergroup['gid']]) {
        $perms = $existing_permissions[$usergroup['gid']];
        $default_checked = false;
    } elseif (is_array($cached_forum_perms) && $cached_forum_perms[$forum_data['fid']][$usergroup['gid']]) {
        $perms = $cached_forum_perms[$forum_data['fid']][$usergroup['gid']];
        $default_checked = true;
    } else {
        if (is_array($cached_forum_perms) && $cached_forum_perms[$forum_data['pid']][$usergroup['gid']]) {
            $perms = $cached_forum_perms[$forum_data['pid']][$usergroup['gid']];
            $default_checked = true;
        }
    }
    if (!$perms) {
        $perms = $usergroup;
        $default_checked = true;
    }
    foreach ($field_list as $forum_permission => $forum_perm_title) {
        if ($perms[$forum_permission] == 1) {
            $perms_checked[$forum_permission] = 1;
        } else {
            $perms_checked[$forum_permission] = 0;
        }
    }
    $usergroup['title'] = htmlspecialchars_uni($usergroup['title']);
    if ($default_checked == 1) {
        $inherited_text = $lang->inherited_permission;
    } else {
        $inherited_text = $lang->custom_permission;
    }
    $form_container->output_cell("<strong>{$usergroup['title']}</strong> <small style=\"vertical-align: middle;\">({$inherited_text})</small>");
    $field_select = "<div class=\"quick_perm_fields\">\n";
    $field_select .= "<div class=\"enabled\"><div class=\"fields_title\">{$lang->enabled}</div><ul id=\"fields_enabled_{$usergroup['gid']}\">\n";
    foreach ($perms_checked as $perm => $value) {
        if ($value == 1) {
            $field_select .= "<li id=\"field-{$perm}\">{$field_list2[$perm]}</li>";
        }
    }
    $field_select .= "</ul></div>\n";
    $field_select .= "<div class=\"disabled\"><div class=\"fields_title\">{$lang->disabled}</div><ul id=\"fields_disabled_{$usergroup['gid']}\">\n";
    foreach ($perms_checked as $perm => $value) {
        if ($value == 0) {
            $field_select .= "<li id=\"field-{$perm}\">{$field_list2[$perm]}</li>";
        }
    }
    $field_select .= "</ul></div></div>\n";
    $field_select .= $form->generate_hidden_field("fields_" . $usergroup['gid'], @implode(",", @array_keys($perms_checked, 1)), array('id' => 'fields_' . $usergroup['gid']));
    $field_select = str_replace("\n", "", $field_select);
    foreach ($field_list as $forum_permission => $permission_title) {
        $field_options[$forum_permission] = $permission_title;
    }
    $form_container->output_cell($field_select, array('colspan' => 2));
    if (!$default_checked) {
        $form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=permissions&amp;pid={$perms['pid']}\" onclick=\"MyBB.popupWindow('index.php?module=forum-management&action=permissions&pid={$perms['pid']}&ajax=1', null, true); return false;\">{$lang->edit_permissions}</a>", array("class" => "align_center"));
        $form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=clear_permission&amp;pid={$perms['pid']}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_clear_custom_permission}')\">{$lang->clear_custom_perms}</a>", array("class" => "align_center"));
    } else {
        $form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=permissions&amp;gid={$usergroup['gid']}&amp;fid={$fid}\"  onclick=\"MyBB.popupWindow('index.php?module=forum-management&action=permissions&gid={$usergroup['gid']}&fid={$fid}&ajax=1', null, true); return false;\">{$lang->set_custom_perms}</a>", array("class" => "align_center", "colspan" => 2));
    }
    $form_container->construct_row();
    return $form_container->output_row_cells(0, true);
}
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:83,代码来源:management.php


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