예제 #1
0
파일: team.php 프로젝트: davidaq/coopdev
<?php

$data = array();
$data['list'] = array();
$list =& $data['list'];
foreach (data_list('user') as $k => $v) {
    if (data_exists($k . '/info')) {
        $item = json_decode(data_read($k . '/info'), true);
        if (file_exists("data/user/{$v}/avatar.jpg")) {
            $item['avatar'] = BASE . "data/user/{$v}/avatar.jpg";
        } else {
            $item['avatar'] = BASE . 'res/images/default-avatar.jpg';
        }
        $item['o'] = iconv('utf-8', 'gbk', $item['name']);
        $list[] = $item;
    }
}
function sortFunc($a, $b)
{
    return strcmp($b['o'], $a['o']);
}
usort($list, 'sortFunc');
die(tpl('team', $data));
예제 #2
0
파일: crud.php 프로젝트: rp349/BuildAModule
function data_administration_page($options)
{
    // Used to create links in the other functions.
    $options['path'] = $_GET['path'];
    $content = '';
    if (isset($_REQUEST['action'])) {
        switch ($_REQUEST['action']) {
            case 'delete':
                data_delete($options, $_GET['id']);
                break;
            case 'edit_form':
            case 'add_form':
                $content .= data_add_edit_form(isset($_GET['id']) ? $_GET['id'] : '', $options);
                break;
            case 'add_item':
            case 'edit_item':
                $content .= data_add_edit_form_process($_POST, $options);
                break;
        }
    }
    // If we didn't specify what we wanted to display, show the list of data.
    if ($content == '') {
        $content = data_list($options);
    }
    return $content;
}
예제 #3
0
파일: ticket.php 프로젝트: davidaq/coopdev
        $item = json_decode(data_read($k), true);
        $item['content'] = $item['content'][0];
        $item['id'] = $v;
        $ret[] = $item;
        $c++;
        if ($c >= 10) {
            break;
        }
    }
    die(json_encode($ret));
} elseif (isset($_POST['rmtag'])) {
    data_remove('ticket/tag/' . base64_encode($_POST['rmtag']));
    die;
} elseif (isset($_GET['id'])) {
    if (!data_exists('ticket/t_' . $_GET['id'])) {
        die(tpl('404', array('hehe' => '123')));
    }
    $tags = data_list('ticket/tag');
    foreach ($tags as &$v) {
        $v = base64_decode($v);
    }
    $item = json_decode(data_read('ticket/t_' . $_GET['id']), true);
    $item['id'] = $_GET['id'];
    die(tpl('show-ticket', array('tags' => $tags, 'ticket' => $item)));
} else {
    $tags = data_list('ticket/tag');
    foreach ($tags as &$v) {
        $v = base64_decode($v);
    }
    die(tpl('ticket', array('tags' => $tags)));
}
예제 #4
0
파일: wiki.php 프로젝트: davidaq/coopdev
$title = $path[count($path) - 1];
if (!isset($title[0])) {
    $title = LANG('Wiki');
}
$childs = data_list("wiki/{$query}", 'wiki_');
foreach ($childs as $k => &$v) {
    $v = array('path' => substr(str_replace('/wiki_', '/', $k), 5), 'name' => $v, 'child' => array(), 'active' => false);
}
if (isset($qpath)) {
    if (isset($qpath[1])) {
        unset($qpath[count($qpath) - 1]);
        $parent = implode('/', $qpath);
    } else {
        $parent = '';
    }
    $index = data_list("wiki/{$parent}", 'wiki_');
    foreach ($index as $k => &$v) {
        $v = array('path' => substr(str_replace('/wiki_', '/', $k), 5), 'name' => $v, 'child' => array(), 'active' => false);
        if ($v['path'] == $pquery) {
            $v['child'] = $childs;
            $v['active'] = true;
        }
    }
    if (isset($parent[0])) {
        $name = substr($qpath[count($qpath) - 1], 5);
        $index = array(array('path' => substr(str_replace('/wiki_', '/', $parent), 5), 'name' => $name, 'child' => $index, 'active' => false));
    }
} else {
    $index = $childs;
}
$content = data_read("wiki/{$query}/content");