Beispiel #1
0
<?php

/**
 * Block add form.
 */
$page->layout = 'admin';
if (!User::require_admin()) {
    $this->redirect('/admin');
}
$f = new Form('post', 'blocks/add');
$f->verify_csrf = false;
if ($f->submit()) {
    $b = new Block($_POST);
    $b->put();
    Versions::add($b);
    if (!$b->error) {
        $this->add_notification('Block added.');
        $this->hook('blocks/add', $_POST);
        if (isset($_GET['return'])) {
            $this->redirect($_GET['return']);
        }
        $this->redirect('/blocks/admin');
    }
    $page->title = i18n_get('An Error Occurred');
    echo i18n_get('Error Message') . ': ' . $b->error;
} else {
    $b = new Block();
    $b->id = $_GET['id'];
    $b->access = 'public';
    $b->yes_no = array('yes' => i18n_get('Yes'), 'no' => i18n_get('No'));
    $b->failed = $f->failed;
Beispiel #2
0
    $res->success = false;
    $res->error = __('Authorization required.');
    echo json_encode($res);
    return;
}
$error = false;
$o = new Block($_GET['id']);
if ($o->error) {
    $error = $o->error;
} else {
    foreach ($_POST as $k => $v) {
        if ($k != $o->key && isset($o->data[$k])) {
            $o->{$k} = $v;
        }
    }
    if (!$o->put()) {
        $error = $o->error;
    } else {
        Versions::add($o);
        $_POST['id'] = $_GET['id'];
        $this->hook('blocks/edit', $_POST);
    }
}
$res = new StdClass();
if ($error) {
    $res->success = false;
    $res->error = $error;
} else {
    $res->success = true;
    $res->data = $_GET['id'];
}
    {
        // Extend the list query to filter by the qualification id
        if ($this->jobId) {
            $query->where('job_id', $this->jobId);
        }
    }
}
?>


This is a the update.htm view relative to the Qualifications controller:



<?php 
Block::put('breadcrumb');
?>
    <ul>
        <li><a href="<?php 
echo Backend::url('gatto/jobs/qualifications');
?>
">Qualifications</a></li>
        <li><?php 
echo e($this->pageTitle);
?>
</li>
    </ul>
<?php 
Block::endPut();
?>