Beispiel #1
0
 function handleSearch($p)
 {
     $list = UserList::getUsers($p['q']);
     echo '<h2>Showing users matching <u>' . $p['q'] . '</u>';
     echo ' (' . count($list) . ' hits)</h2>';
     $dt = new YuiDatatable();
     $dt->addColumn('id', 'Username', 'link', 'u/profile/', 'name');
     $dt->addColumn('time_last_active', 'Last active');
     $dt->setDataSource($list);
     echo $dt->render();
 }
Beispiel #2
0
//TODO: ability to delete userdata field
//TODO: abiltiy to mark a userdata field as required at registration (such as email)
namespace cd;

$session->requireSuperAdmin();
switch ($this->owner) {
    case 'list':
        echo '<h1>Existing userdata fields</h1>';
        $list = UserDataField::getAll();
        $dt = new YuiDatatable();
        $dt->addColumn('id', 'Name', 'link', 'a/userdata/edit/', 'name');
        $dt->addColumn('label', 'Label');
        $dt->addColumn('type', 'Type', 'array', UserDataField::getTypes());
        $dt->setDataSource($list);
        echo $dt->render();
        echo '<br/>';
        echo '&raquo; ' . ahref('a/userdata/new', 'Create new field');
        break;
    case 'new':
        function newSubmit($p)
        {
            $f = new UserDataField();
            $f->name = $p['name'];
            $f->type = $p['type'];
            $f->label = $p['label'];
            $f->id = $f->store();
            if ($f->type == UserDataField::RADIO) {
                js_redirect('a/userdata/edit/' . $f->id);
            } else {
                js_redirect('a/userdata/list');