Exemple #1
0
/**
 * List all forms for the dynamic objects dialog.
 */
function form_list_all()
{
    $res = form\Form::query('id, title')->order('title asc')->fetch_assoc('id', 'title');
    $out = array();
    foreach ($res as $k => $v) {
        $out[] = (object) array('key' => $k, 'value' => $v);
    }
    return $out;
}
Exemple #2
0
<?php

/**
 * Admin page where you can edit forms, view results, and create new forms.
 */
$page->layout = 'admin';
if (!User::require_admin()) {
    $this->redirect('/admin');
}
require_once 'apps/form/lib/Functions.php';
$page->title = 'Forms';
$lock = new Lock();
$forms = form\Form::query()->order('title asc')->fetch_orig();
foreach ($forms as $k => $form) {
    $forms[$k]->locked = $lock->exists('Form', $form->id);
}
echo $tpl->render('form/admin', array('forms' => $forms));