예제 #1
0
function createAllFiles()
{
    $filePath = __DIR__ . '/../modules/v1/controllers';
    //获取目录的文件夹地址
    $filesnames = scandir($filePath);
    $ret = array();
    //遍历所有文件
    foreach ($filesnames as $name) {
        if (strstr($name, '.php', $name) === false) {
            //只处理php
            continue;
        }
        $className = str_replace('Controller.php', '', $name);
        $funcs = createFile($filePath . '/' . $name, $className);
        if (empty($funcs)) {
            continue;
        }
        $ret[] = $funcs;
    }
    echoTable($ret);
}
            } else {
                echo "<tr>";
            }
            if ($feed[$row]["voted"] == 1) {
                echo "<td class=checked><input class=check type=checkbox id=check_" . $feed[$row]["type"] . $feed[$row]["id"] . " checked=true /></td>";
            } else {
                echo "<td class=checked><input class=check type=checkbox id=check_" . $feed[$row]["type"] . $feed[$row]["id"] . " /></td>";
            }
            echo "<td class=feed>" . $feed[$row]["text"] . "</td>";
            if ($feed[$row]["type"] == 'Q' && $feed[$row]["answered"] == 1 || $feed[$row]["type"] == 'F' && $feed[$row]["isread"] == 1) {
                echo "<td class=answered>Yes</td>";
            } else {
                echo "<td class=answered>No</td>";
            }
            //echo "<td class=answered>".$feed[$row]["answered"]."</td>";
            echo "</tr>";
        }
    }
    echo "</table>";
}
if (isset($_POST['sid']) && isset($_POST['filter']) && isset($_POST['sort']) && isset($_POST['uid'])) {
    $sid = $_POST['sid'];
    $filter = $_POST['filter'];
    $sort = $_POST['sort'];
    $uid = $_POST['uid'];
    $feed = getQuestions($sid, $filter, $sort, $uid);
    echoTable($feed);
}
?>
	
}
function echoTable($rows)
{
    // Prints out the feed data in a nice html format
    echo "<table id=feedTable>";
    for ($row = 0; $row < 200; $row++) {
        if (!empty($rows[$row])) {
            if ($rows[$row]["type"] == "Q") {
                echo "<tr class=alt>";
            } else {
                echo "<tr>";
            }
            echo "<td class=votes>" . $rows[$row]["votes"] . "</td>";
            echo "<td class=feed>" . $rows[$row]["text"] . "</td>";
            if ($rows[$row]["answered"] == 1 || $rows[$row]["isread"] == 1) {
                echo "<td class=checked><input class=check type=checkbox id=check_" . $rows[$row]["type"] . $rows[$row]["id"] . " checked=true /></td>";
            } else {
                echo "<td class=checked><input class=check type=checkbox id=check_" . $rows[$row]["type"] . $rows[$row]["id"] . "/></td>";
            }
            echo "</tr>";
        }
    }
    echo "</table>";
}
if (isset($_POST['sid']) && isset($_POST['filter']) && isset($_POST['sort'])) {
    $sid = $_POST['sid'];
    $filter = $_POST['filter'];
    $sort = $_POST['sort'];
    $rows = getQuestions($sid, $filter, $sort);
    echoTable($rows);
}