コード例 #1
0
ファイル: _action.php プロジェクト: sziszu/pefi
if ($todo == 'clean') {
    $_PEFI->view->content .= cleanlinks();
} elseif ($todo == 'generate') {
    $_PEFI->view->content .= linkOutput($db, $db_pref);
} elseif ($todo == 'publish') {
    $_PEFI->view->content .= publishlinks();
} else {
    include_once "{$_PEFI->path}/form/form.php";
    if ($todo == 'manage') {
        $answr = linking_link($_PEFI->db, $db_pref);
    } elseif ($todo == 'managesections') {
        $answr = linking_section($_PEFI->db, $db_pref);
    } elseif ($todo == 'managesubsections') {
        $answr = linking_ssection($_PEFI->db, $db_pref);
    }
    $form = new TableForm(array('label' => 'Edit ' . $answr['title'], 'elements' => $answr['elements'], 'table' => $answr['table'], 'lock' => $_PEFI->lock, 'credentials' => $_PEFI->crdntls, 'canDelete' => true, 'filter' => $_GET, 'decorator' => isset($_GET['json']) ? JsonDecorator::get() : HtmlDecorator::get()));
    $_PEFI->view->head = $_PEFI->form->head;
    $_PEFI->view->content = $form->handle($_SERVER['REQUEST_METHOD'], $_POST);
}
function linking_link($pdo, $db_pref)
{
    $elements = array(new PrimaryKeyElement(array('prop' => 'idLinking_link', 'label' => 'ID')), new ReferenceElement(array('prop' => 'linking_ssection', 'label' => 'Country', 'isFilterable' => true, 'isOrderable' => true, 'isDefOrder' => true, 'frgnTable' => new OneTableDB($pdo, $db_pref . 'linking_ssection', 'idLinking_ssection'), 'frgnDispCol' => 'code')), new TextElement(array('prop' => 'title', 'label' => 'Title')), new TextElement(array('prop' => 'url', 'label' => 'URL', 'isFilterable' => true)), new TextAreaElement(array('prop' => 'desc', 'label' => 'Description')), new TextElement(array('prop' => 'back_url', 'label' => 'BackURL', 'isFilterable' => true)), new TextElement(array('prop' => 'contact', 'label' => 'Contact', 'isFilterable' => true)), new DateElement(array('prop' => 'checked_time', 'label' => 'Checked on', 'isFilterable' => true, 'isOrderable' => true, 'defSearchOp' => '>=')), new BooleanElement(array('prop' => 'active', 'label' => 'Active', 'isFilterable' => true, 'defVal' => 1)), new IntegerElement(array('prop' => 'pagerank', 'label' => 'Pagerank', 'isFilterable' => true, 'isOrderable' => true, 'defVal' => 0)), new TextAreaElement(array('prop' => 'info', 'label' => 'Info')));
    return array('table' => new OneTableDB($pdo, $db_pref . 'linking_link', 'idLinking_link'), 'elements' => $elements, 'title' => 'Links');
}
function linking_section($pdo, $db_pref)
{
    $elements = array(new PrimaryKeyElement(array('prop' => 'idLinking_section', 'label' => 'ID')), new TextElement(array('prop' => 'code', 'label' => 'Name', 'isFilterable' => true, 'isOrderable' => true)));
    return array('table' => new OneTableDB($pdo, $db_pref . 'linking_section', 'idLinking_section'), 'elements' => $elements, 'title' => 'Sections');
}
function linking_ssection($pdo, $db_pref)
{
コード例 #2
0
ファイル: _action.php プロジェクト: sziszu/pefi
<?php

if (!$_PEFI->crdntls->can('edit_lock')) {
    redirect_to_login($_PEFI->route->page);
}
include_once "{$_PEFI->path}/form/form.php";
$elements = array(new PrimaryKeyElement(array('prop' => 'id', 'label' => 'ID', 'isOrderable' => true, 'isDefOrder' => true)), new TextElement(array('prop' => 'obj', 'label' => 'Obj', 'isFilterable' => true, 'isOrderable' => true)), new TextElement(array('prop' => 'csrf', 'label' => 'CSRF', 'isFilterable' => true)), new ReferenceElement(array('prop' => 'user', 'label' => 'User', 'isFilterable' => true, 'frgnTable' => new OneTableDB($_PEFI->db, "{$_PEFI->dbpref}user"), 'frgnDispCol' => 'name')), new TextElement(array('prop' => 'started', 'label' => 'Started Time')));
$form = new TableForm(array('label' => 'Edit Locks', 'elements' => $elements, 'table' => new OneTableDB($_PEFI->db, "{$_PEFI->dbpref}edit_lock"), 'lock' => $_PEFI->lock, 'credentials' => $_PEFI->crdntls, 'canDelete' => true, 'filter' => $_GET, 'decorator' => isset($_GET['json']) ? JsonDecorator::get() : HtmlDecorator::get()));
$_PEFI->view->head = $_PEFI->form->head;
$_PEFI->view->content = $form->handle($_SERVER['REQUEST_METHOD'], $_POST);
コード例 #3
0
ファイル: _action.php プロジェクト: sziszu/pefi
        $_SESSION['pefi_user'] = $user;
        // will redirect page
        redirect(isset($_GET['redirect_to']) ? $_GET['redirect_to'] : '');
    } else {
        $_PEFI->view->content .= get_form("Try again!");
    }
} elseif ($todo == 'logout') {
    unset($_SESSION['pefi_user']);
    redirect(isset($_GET['redirect_to']) ? $_GET['redirect_to'] : '');
} elseif (strpos($todo, 'manage') === 0) {
    if (!$_PEFI->crdntls->can('user', 'list')) {
        redirect_to_login($_PEFI->route->page);
    }
    include "{$_PEFI->path}/form/form.php";
    if ($todo == 'manage_pass') {
        $label = 'Manage User Passwords';
        $elements = array(new PrimaryKeyElement(array('prop' => 'id', 'label' => 'PrimKey', 'isOrderable' => true)), new TextElement(array('prop' => 'name', 'label' => 'User', 'isEditable' => false, 'isOrderable' => true, 'isDefOrder' => true, 'isFilterable' => true, 'isOrderable' => true, 'allowEmpty' => false)), new PasswordElement(array('prop' => 'pass', 'label' => 'Password', 'isListable' => false, 'allowEmpty' => false, 'defVal' => 'Abcd123!')));
    } else {
        $label = 'Manage Users';
        $elements = array(new PrimaryKeyElement(array('prop' => 'id', 'label' => 'PrimKey', 'isOrderable' => true)), new TextElement(array('prop' => 'name', 'label' => 'User', 'isOrderable' => true, 'isDefOrder' => true, 'isFilterable' => true, 'allowEmpty' => false)), new TextElement(array('prop' => 'lang', 'label' => 'Default Language', 'isFilterable' => true, 'isOrderable' => true, 'defSearchOp' => '=', 'allowEmpty' => false, 'defVal' => 'en')), new ScolonSepListGroupElement(array('prop' => 'perms', 'label' => 'Permissions', 'items' => getPerms(), 'isSearchMulti' => true)));
    }
    $form = new TableForm(array('label' => $label, 'elements' => $elements, 'table' => new OneTableDB($_PEFI->db, "{$_PEFI->dbpref}user"), 'lock' => $_PEFI->lock, 'logger' => new Logger(Logger::INFO, array(new FileLoggerOutput('_log/user.log'))), 'credentials' => $_PEFI->crdntls, 'canDelete' => true, 'filter' => $_GET, 'decorator' => isset($_GET['json']) ? JsonDecorator::get() : HtmlDecorator::get()));
    $_PEFI->view->head = $_PEFI->form->head;
    $_PEFI->view->head .= '<script type="text/javascript">PEFI.CRUD.edit_mode="popup";</script>';
    $_PEFI->view->content = $form->handle($_SERVER['REQUEST_METHOD'], $_POST);
} elseif ($_PEFI->user) {
    // will redirect page
    redirect();
} else {
    $_PEFI->view->content .= get_form();
}
コード例 #4
0
ファイル: _action.php プロジェクト: sziszu/pefi
} elseif ($todo === 'ifa') {
    if (array_key_exists('download', $_POST)) {
        if ($_POST['download'] === 'download') {
            echo $rsrvtns->downloadIFA($_POST['min'], '<br>');
            return;
        }
    } else {
        $elements = array(new PrimaryKeyElement(array('prop' => 'idIfa', 'label' => 'ID')), new IntegerElement(array('prop' => 'nr', 'label' => 'Nr', 'isOrderable' => true, 'isDefOrder' => true, 'defSortOrder' => 'DESC')), new TextElement(array('prop' => 'invoiced', 'label' => 'Szamla')), new DateElement(array('prop' => 'paymentDay', 'label' => 'Payment Day')), new TextElement(array('prop' => 'apartmentCode', 'label' => 'Ap Code')), new TextElement(array('prop' => 'famName', 'label' => 'Fam Name', 'isFilterable' => true)), new TextElement(array('prop' => 'firstName', 'label' => 'First Name', 'isFilterable' => true)), new TextElement(array('prop' => 'address', 'label' => 'Address')), new DateElement(array('prop' => 'dateFrom', 'label' => 'Date From')), new DateElement(array('prop' => 'dateTo', 'label' => 'Date To')), new IntegerElement(array('prop' => 'nrOfNights', 'label' => 'Nights')), new TextElement(array('prop' => 'balance', 'label' => 'Balance')), new FloatElement(array('prop' => 'euroHUFrate', 'label' => 'EurToHUF')), new FloatElement(array('prop' => 'price', 'label' => 'Price')), new IntegerElement(array('prop' => 'ifa', 'label' => 'IFA')));
        $form = new TableForm(array('elements' => $elements, 'label' => 'Editing IFA Table', 'table' => new OneTableDB($db, "{$db_pref}ifa", 'idIfa', $db_pref), 'lock' => $_PEFI->lock, 'credentials' => $_PEFI->crdntls, 'filter' => $_GET, 'filtPref' => $fp, 'step' => 15, 'canDelete' => true, 'decorator' => $json ? JsonDecorator::get() : HtmlDecorator::get()));
        $output = $form->handle($_SERVER['REQUEST_METHOD'], $_POST);
        $js_files[] = 'rsrv_ifa.js';
        $include = 'views/form.php';
    }
} elseif ($todo === 'config') {
    $elements = array(new PrimaryKeyElement(array('prop' => 'idConfig', 'label' => 'ID', 'isOrderable' => true, 'isDefOrder' => true)), new TextElement(array('prop' => 'name', 'label' => 'Name', 'isFilterable' => true)), new TextElement(array('prop' => 'group', 'label' => 'Group', 'isFilterable' => true)), new TextAreaElement(array('prop' => 'value', 'label' => 'Value')), new TextAreaElement(array('prop' => 'description', 'label' => 'Description')));
    $form = new TableForm(array('elements' => $elements, 'label' => 'Edit Config Table', 'table' => new OneTableDB($db, "{$db_pref}config", 'idConfig', $db_pref), 'lock' => $_PEFI->lock, 'credentials' => $_PEFI->crdntls, 'filter' => $_GET, 'filtPref' => $fp, 'canDelete' => true, 'decorator' => $json ? JsonDecorator::get() : HtmlDecorator::get()));
    $output = $form->handle($_SERVER['REQUEST_METHOD'], $_POST);
    $include = 'views/config.php';
} elseif ($todo === 'updatestatus' && $can->can('reservation')) {
    $output = $rsrvtns->updatestatus();
    $include = 'views/config.php';
} elseif ($todo === 'clearcache' && $can->can('reservation')) {
    $output = 'Cache was NOT rebuilt';
    if ($rsrvtns->cacheSmallTables(true)) {
        $output = 'Cache rebuilt';
    }
    $include = 'views/config.php';
} else {
    $include = 'views/index.php';
}
if ($json) {