Beispiel #1
0
<?php

include '../init.php';
require_once SROOT . 'articleService.class.php';
require_once SROOT . 'categoryService.class.php';
$as = new ArticleService();
$as->staticIndex();
$cs = new CategoryService();
$cs->staticCategoryJs();
$cList = $cs->getAll();
foreach ($cList as $row) {
    $as->staticArticleList($row);
}
$aList = $as->getAll(1);
foreach ($aList as $row) {
    $as->staticArticle($row['id']);
}
<?php

include 'init.php';
include SROOT . 'categoryService.class.php';
include SROOT . 'articleService.class.php';
$method = v('method');
if (!$method) {
    send_result(0, "request does not have method parame");
}
$service = new CategoryService();
if ($method == 'delete') {
    if (v('id')) {
        $service->delete(v('id'));
        $service->staticCategoryJs();
        forward('category_list.php');
    } else {
        send_result(0, 'request does not have id parame');
    }
} else {
    if ($method == 'add') {
        if (v('name') && v('description')) {
            $service->insert(v('name'), v('description'));
            $service->staticCategoryJs();
            forward('category_list.php');
        } else {
            send_result(0, 'request does not have name or description parames');
        }
    } else {
        if ($method == 'update') {
            if (v('id') && v('name') && v('description')) {
                if ($service->update(v('id'), v('name'), v('description'))) {