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


PHP Forms::readonly方法代码示例

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


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

示例1: plugin__record_column_edit

function plugin__record_column_edit($name, $value, $options)
{
    if ($options['col_name'] == 'password' && $options['table'] == BLACKBIRD_USERS_TABLE) {
        $options['type'] = 'password';
        Forms::text($name, '', $options);
    }
    if ($options['col_name'] == 'user_id' && $options['table'] == BLACKBIRD_TABLE_PREFIX . 'history') {
        $q = $options['db']->query("SELECT email FROM " . BLACKBIRD_USERS_TABLE . " WHERE id = '{$value}'");
        Forms::readonly($name, $q['email'], $options);
    }
    if ($options['col_name'] == 'groups' && $options['table'] == BLACKBIRD_USERS_TABLE) {
        $q = $options['db']->query("SELECT id,name FROM " . BLACKBIRD_TABLE_PREFIX . "groups ORDER BY name");
        $r = '<ul>';
        $q_links = $options['db']->query("SELECT * FROM " . BLACKBIRD_TABLE_PREFIX . "users__groups WHERE user_id = '{$options['id']}'");
        foreach ($q as $group) {
            $v = '';
            if (is_array($q_links)) {
                $tA = Utils::checkArray($q_links, array('group_id' => $group['id']));
                if (is_array($tA)) {
                    $v = 'Y';
                }
            }
            $r .= '<li>' . Forms::checkboxBasic('group_' . $group['id'], $v, array('class' => 'checkbox noparse', 'label' => $group['name'])) . '</li>';
        }
        $r .= '</ul>';
        $options['label'] = "Groups";
        Forms::buildElement($name, $r, $options);
        Forms::hidden($name, '', array('omit_id' => true));
    }
    if ($options['col_name'] == 'tables' && $options['table'] == BLACKBIRD_TABLE_PREFIX . 'groups') {
        $q = $options['db']->query("SHOW TABLE STATUS");
        $tA = explode(',', $value);
        $privA = array('select', 'insert', 'update', 'delete');
        $tableA = array();
        //loop her and throw out system tables
        $tlen = strlen(BLACKBIRD_TABLE_PREFIX);
        foreach ($q as $table) {
            //if pattern fails add to list
            if (substr($table['Name'], 0, $tlen) != BLACKBIRD_TABLE_PREFIX) {
                $tableA[] = $table['Name'];
            }
        }
        //
        $tA = _ControllerFront::getRoute();
        if (isset($tA['id'])) {
            $group_id = $tA['id'];
            $q_permissions = $options['db']->query("SELECT * FROM " . BLACKBIRD_TABLE_PREFIX . "permissions WHERE group_id = '{$group_id}' ORDER BY table_name");
        } else {
            $q_permissions = null;
        }
        $r = '<div id="bb_group_permissions">';
        $r .= '<p>All permissions - <a href="#" id="matrix_on">ON</a>&nbsp;|&nbsp;<a href="#" id="matrix_off">OFF</a></p>';
        $r .= '<table id="matrix">
		<tr><th>Table Name</th>';
        foreach ($privA as $priv) {
            $r .= '<th><a href="#" title="' . $priv . '" class="checktoggle column">' . ucfirst($priv) . '</a></th>';
        }
        $r .= '</tr>';
        /*
        $r .= '<tr><th></th>';
        
        foreach($privA as $priv){
        	//$r .= '<th><input type="button" title="'.$priv.'" class="checktoggle column" value="col" /></th>';
        }
        
        $r .= '</tr>';
        */
        foreach ($tableA as $table) {
            //used to rely upon a private comment to hide, no longer, just don't show any blackbird tables here
            $r .= '<tr>';
            $r .= '<td><a href="#" title="' . $table . '" class="checktoggle row" >' . Utils::formatHumanReadable($table) . '</a></td>';
            $tA = array();
            if (is_array($q_permissions)) {
                $tA = Utils::checkArray($q_permissions, array('table_name' => $table));
            }
            foreach ($privA as $priv) {
                $v = '';
                if (isset($tA[$priv . '_priv'])) {
                    if ($tA[$priv . '_priv'] == '1') {
                        $v = 'Y';
                    }
                }
                $r .= '<td>' . Forms::checkboxBasic('table_' . $table . '_' . $priv, $v, array('class' => 'checkbox noparse col_' . $priv . ' row_' . $table, 'label' => '')) . '</td>';
            }
            $r .= '</tr>';
        }
        $r .= '</table></div>';
        $options['label'] = "Tables";
        Forms::buildElement($name, $r, $options);
        Forms::hidden($name, '', array('omit_id' => true));
    }
    return true;
}
开发者ID:xdev,项目名称:blackbird,代码行数:93,代码来源:record_column_edit.php


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