Esempio n. 1
0
function generatorItemAddingForm($fieldList, $suffix = '_add', $action = null)
{
    if (is_array($fieldList)) {
        echo '<form role="form" method="post" action="' . $action . '&count=' . count($fieldList) . '">';
        $cataOption = '';
        $cataObj = new Cores\Models\CataModel();
        $cataList = $cataObj->selectAll();
        if (is_array($cataList)) {
            foreach ($cataList as $key => $value) {
                if ($value->getParent() != '0' && $value->getChild() != 'second') {
                    $cataOption .= '<option value="' . $value->getCaid() . '">' . $value->getName() . '</option>';
                }
            }
        }
        echo '<div class="form-group">
                    <label>项目类别</label>
                    <select name="item_cata' . $suffix . '" class="form-control">
                        ' . $cataOption . '
                    </select>
                </div>';
        echo '<div class="form-group">
                    <label>项目主题</label>
                    <input placeholder="项目主题" value="" name="item_theme' . $suffix . '" class="form-control">
                </div>';
        foreach ($fieldList as $key => $value) {
            $type = $value->getType();
            $id = 'item_' . $value->getName() . $suffix;
            $name = $id;
            switch ($type) {
                case 'input':
                    echo input($value->getName(), $name, $id, $value->getTips());
                    break;
                case 'img':
                    echo img_($value->getName(), $name, $id, $value->getTips());
                case 'selector':
                    if ($type == 'selector') {
                        echo selector($value->getName(), $name, $id, $value->getTips(), $value->getSelectorCount());
                    }
                case 'range_':
                    if ($type == 'range_') {
                        echo range_($value->getName(), $name, $id, $value->getTips(), $value->getRangeFrom(), $value->getRangeTo(), $value->getRangeUnit());
                    }
                case 'textarea':
                    if ($type == 'textarea') {
                        echo textarea($value->getName(), $name, $id, $value->getTips());
                    }
                default:
                    break;
            }
        }
        echo '<button type="submit" class="btn btn-default">提交</button></form>';
    }
}
Esempio n. 2
0
<?php

define('BASEDIR', __DIR__);
require BASEDIR . '/Cores/Loader.php';
//njx_cata test
$cataObj = new Cores\Models\CataModel();
$allCataObj = $cataObj->selectAll();
print_r($allCataObj);
echo '<br>====================<br>';
//njx_comments test
$commentObj = new Cores\Models\CommentsModel();
$allCommentObj = $commentObj->selectAll();
print_r($allCommentObj);
echo '<br>====================<br>';
//njx_users test
$usersObj = new Cores\Models\UsersModel();
$allUserObj = $usersObj->selectAll();
print_r($allUserObj);
echo '<br>====================<br>';
//njx_items test
$itemsObj = new Cores\Models\ItemsModel();
$allItemObj = $itemsObj->selectAll();
print_r($allItemObj);
echo '<br>====================<br>';
//njx_remarks test
$remarksObj = new Cores\Models\RemarksModel();
$remarksObj = $remarksObj->selectAll();
print_r($remarksObj);
echo '<br>====================<br>';
//njx_fields test
$fieldsObj = new Cores\Models\FieldsModel();
Esempio n. 3
0
File: cata.php Progetto: shiyake/PHP
                        <div class="panel-heading">
                             已有分类页面
                        </div>
                        <div class="panel-body">
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                    <thead>
                                        <tr>
                                            <th>一级分类名称</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    <?php 
$cataMgr = new Cores\Models\CataModel();
$allCataObj = $cataMgr->selectAll();
if (is_array($allCataObj)) {
    foreach ($allCataObj as $key => $value) {
        if ($value->getParent() === '0') {
            echo '<tr class="odd gradeX">
                                                        <td>' . $value->getName() . '</td>
                                                        <td style="text-align:center">
                                                            <a ref="admin.php?v=' . $view . '&cata_to_view=' . $value->getCaid() . '" class="btn btn-primary btn-sm view_cata" data-toggle="modal" data-whatever="' . $value->getCaid() . '==' . $value->getName() . '" data-target=".modal-view-cata">详细</a>
                                                            <a href="admin.php?v=' . $view . '&cata_to_del=' . $value->getCaid() . '" class="btn btn-danger btn-sm">删除</a>
                                                        </td>
                                                    </tr>';
        }
    }
} else {
    echo '<tr class="odd gradeX">
                                                <td>暂无分类</td>