Exemple #1
0
 protected static function getElementClass($attributes, $default)
 {
     if ($attributes['formtype'] == 'text') {
         $class = formInput::factory($attributes['name'], $default);
         $class->addAttribute('type', 'text');
         return $class;
     }
     // formSelect, formCheckbox, formTextarea, ..
     $class = 'form' . ucfirst($attributes['formtype']);
     return new $class($attributes['name'], $default);
 }
    $inputSort = formInput::factory('sort', $table->getSql()->num() + 1);
    $inputSort->addAttribute('type', 'text');
    $inputSort->addClass('input-sm');
    $table->addRow()->addCell($inputSort->get())->addCell($inputName->get())->addCell($buttonSubmit->get());
}
if ($table->numSql()) {
    while ($table->isNext()) {
        if ($action == 'edit' && $table->get('id') == $id && dyn::get('user')->hasPerm('media[category][edit]')) {
            $inputName = formInput::factory('name', $table->get('name'));
            $inputName->addAttribute('type', 'text');
            $inputName->addClass('input-sm');
            $inputName->autofocus();
            $inputSort = formInput::factory('sort', $table->get('sort'));
            $inputSort->addAttribute('type', 'text');
            $inputSort->addClass('input-sm');
            $inputHidden = formInput::factory('id', $table->get('id'));
            $inputHidden->addAttribute('type', 'hidden');
            $table->addRow()->addCell($inputSort->get())->addCell($inputName->get())->addCell($inputHidden->get() . $buttonSubmit->get());
        } else {
            $edit = '';
            $delete = '';
            if (dyn::get('user')->hasPerm('media[category][edit]')) {
                $edit = '<a href="' . url::backend('media', ['subpage' => 'category', 'action' => 'edit', 'id' => $table->get('id'), 'pid' => $pid]) . '" class="btn btn-sm  btn-default fa fa-pencil-square-o"></a>';
            }
            if (dyn::get('user')->hasPerm('media[category][delete]')) {
                $delete = '<a href="' . url::backend('media', ['subpage' => 'category', 'action' => 'delete', 'id' => $table->get('id'), 'pid' => $pid]) . '" class="btn btn-sm btn-danger fa fa-trash-o delete"></a>';
            }
            $table->addRow(array('data-id' => $table->get('id')))->addCell('<i class="fa fa-sort"></i>')->addCell('<a href="' . url::backend('media', ['subpage' => 'category', 'pid' => $table->get('id')]) . '">' . $table->get('name') . '</a>')->addCell('<span class="btn-group">' . $edit . $delete . '</span>');
        }
        $table->next();
    }
if ($action == 'export') {
    export::exportTables();
}
$DB = dyn::get('DB');
$prefix = strlen($DB['prefix']);
$table = table::factory();
$table->addCollsLayout('*, 215');
$table->addRow()->addCell(lang::get('name'))->addCell(lang::get('exports'));
$table->addSection('tbody');
$table->setSql("SHOW TABLES IN " . sql::$DB_datenbank . " LIKE '" . dyn::get('DB')["prefix"] . "%'");
if ($table->numSql()) {
    while ($table->isNext()) {
        $name = $table->get("Tables_in_" . sql::$DB_datenbank . " (" . dyn::get('DB')["prefix"] . "%)");
        $name = substr($name, $prefix);
        $inputCheckbox = formInput::factory('export[' . $name . ']', $name);
        $inputCheckbox->addAttribute('type', 'checkbox');
        $inputCheckbox->addClass('input-sm');
        $inputCheckbox->autofocus();
        $table->addRow()->addCell($name)->addCell($inputCheckbox->get());
        $table->next();
    }
}
?>
<form action="index.php" method="post">
<div class="row">
		<div class="col-lg-12">
			<div class="panel panel-default">
				<div class="panel-heading">
					<h3 class="panel-title"><?php 
echo lang::get('sqlexport');