示例#1
0
 /**
  * @covers Xoops\Form\TableForm::render
  */
 public function testRender()
 {
     $value = $this->object->render();
     $this->assertTrue(is_string($value));
     $this->assertTrue(false !== strpos($value, '<form'));
     $this->assertTrue(false !== strpos($value, 'name="name"'));
     $this->assertTrue(false !== strpos($value, 'id="name"'));
     $this->assertTrue(false !== strpos($value, 'action="action"'));
     $this->assertTrue(false !== strpos($value, 'method="post"'));
     $this->assertTrue(false !== strpos($value, '</form>'));
 }
示例#2
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)
{
示例#3
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) {