Пример #1
0
function store_action($usrid, $act, $desc, $url)
{
    $query = "insert into logs (user_id, ins_dt, act_id, descr, url) values (" . $usrid . ",sysdate()," . $act . ",'" . $desc . "','" . $url . "')";
    doInsert($query);
}
Пример #2
0
<?php

require_once "../../../includes/initialize.php";
$action = isset($_GET['action']) && $_GET['action'] != '' ? $_GET['action'] : '';
switch ($action) {
    case 'add':
        doInsert();
        break;
    case 'edit':
        doEdit();
        break;
    case 'delete':
        doDelete();
        break;
    case 'assign':
        doAssignsubj();
        break;
    case 'delsubj':
        doDelsubj();
        break;
    case 'enroll':
        doEnroll();
        break;
    case 'delsy':
        doDelsy();
        break;
}
function doInsert()
{
    if (isset($_POST['save'])) {
        $NAME = $_POST['name'];
Пример #3
0
    $activities = Pepys\Activity::with('media', 'media.type')->orderBy('date', 'asc')->orderBy('order', 'asc')->get();
    return respond($response, true, array('activities' => $activities->toArray()));
});
$app->get('/activities/{id}', function (Request $request, Response $response) {
    $id = $request->getAttribute('id');
    $activity = Pepys\Activity::with('media', 'media.type')->where('id', '=', $id)->first();
    return respond($response, true, array('activity' => $activity->toArray()));
});
$app->post('/activities', function (Request $request, Response $response) {
    if (!hasValidAccessToken($request)) {
        return respond($response, false, 'Must supply valid access_token');
    }
    try {
        $id = doInsert('Pepys\\Activity', $request, array('media_id', 'date'), array('comment'), function ($obj) {
            // Apply the correct order to the activity
            $max = Pepys\Activity::where('date', '=', $obj->date)->max('order');
            $obj->order = $max + 1;
            return $obj;
        });
    } catch (Exception $e) {
        return respond($response, false, $e->getMessage());
    }
    return respond($response, true, array('id' => $id));
});
$app->post('/activities/{id}', function (Request $request, Response $response) {
    if (!hasValidAccessToken($request)) {
        return respond($response, false, 'Must supply valid access_token');
    }
    $id = $request->getAttribute('id');
    $activity = Pepys\Activity::where('id', '=', $id)->first();
    try {
        populateModelFromRequest($activity, $request);