コード例 #1
0
ファイル: api.php プロジェクト: smkkstudios/Directus
        $response = "Failed to log error. File pointer could not be initialized.";
        $app->getLog()->warn($response);
    }
    $response = @stream_get_contents($fp);
    if ($response === false) {
        $response = "Failed to log error. stream_get_contents failed.";
        $app->getLog()->warn($response);
    }
    $result = array('response' => $response);
    JsonView::render($result);
});
/**
 * UI COLLECTION
 */
$app->map("/{$v}/tables/:table/columns/:column/:ui/?", function ($table, $column, $ui) use($acl, $ZendDb, $params, $requestPayload, $app) {
    $TableGateway = new TableGateway($acl, 'directus_ui', $ZendDb);
    switch ($app->request()->getMethod()) {
        case "PUT":
        case "POST":
            $keys = array('table_name' => $table, 'column_name' => $column, 'ui_name' => $ui);
            $uis = to_name_value($requestPayload, $keys);
            $column_settings = array();
            foreach ($uis as $col) {
                $existing = $TableGateway->select(array('table_name' => $table, 'column_name' => $column, 'ui_name' => $ui, 'name' => $col['name']))->toArray();
                if (count($existing) > 0) {
                    $col['id'] = $existing[0]['id'];
                }
                array_push($column_settings, $col);
            }
            $TableGateway->updateCollection($column_settings);
    }
コード例 #2
0
ファイル: index.php プロジェクト: hyrmedia/directus
function getActiveFiles()
{
    global $ZendDb, $acl;
    $tableGateway = new TableGateway($acl, 'directus_files', $ZendDb);
    return $tableGateway->countActive();
}