Пример #1
0
$table->setSql('SELECT * FROM ' . sql::table('media_cat') . ' WHERE pid = ' . $pid . ' ORDER BY sort ASC');
if (in_array($action, ['edit', 'add']) && dyn::get('user')->hasPerm('media[category][edit]')) {
    echo '<form method="post" action="index.php">';
    $inputHidden = formInput::factory('action', 'save-' . $action);
    $inputHidden->addAttribute('type', 'hidden');
    echo $inputHidden->get();
    $inputHidden = formInput::factory('page', 'media');
    $inputHidden->addAttribute('type', 'hidden');
    echo $inputHidden->get();
    $inputHidden = formInput::factory('subpage', 'category');
    $inputHidden->addAttribute('type', 'hidden');
    echo $inputHidden->get();
    $inputHidden = formInput::factory('pid', $pid);
    $inputHidden->addAttribute('type', 'hidden');
    echo $inputHidden->get();
    $buttonSubmit = formButton::factory('save', lang::get('category_save'));
    $buttonSubmit->addAttribute('type', 'submit');
    $buttonSubmit->addClass('btn-sm');
    $buttonSubmit->addClass('btn-default');
}
if ($action == 'add' && dyn::get('user')->hasPerm('media[category][edit]')) {
    $inputName = formInput::factory('name', '');
    $inputName->addAttribute('type', 'text');
    $inputName->addClass('input-sm');
    $inputName->autofocus();
    $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()) {
Пример #2
0
    $table->addSection('tbody');
    if ($table->numSql()) {
        while ($table->isNext()) {
            $media = new media($table->getSql());
            if (dyn::get('user')->hasPerm('media[edit]')) {
                $edit = '<a href="' . url::backend('media', ['subpage' => 'files', 'action' => 'edit', 'id' => $table->get('id')]) . '" class="btn btn-sm btn-default fa fa-pencil-square-o"></a>';
            }
            if (dyn::get('user')->hasPerm('media[delete]')) {
                $delete = '<a href="' . url::backend('media', ['subpage' => 'files', 'action' => 'delete', 'id' => $table->get('id')]) . '" class="btn btn-sm btn-danger fa fa-trash-o delete"></a>';
            }
            $checkbox = formCheckbox::factory('file[]', 0);
            $checkbox->add($media->get('id'), '');
            $table->addRow()->addCell($checkbox->get())->addCell($media->getIcon())->addCell($media->get('title'))->addCell($media->getExtension())->addCell('<span class="btn-group">' . $edit . $delete . '</span>');
            $table->next();
        }
        $button = formButton::factory('submit', lang::get('delete'));
        $button->addClass('btn');
        $button->addClass('btn-sm');
        $button->addClass('btn-default');
        $table->addRow(['class' => 'active'])->addCell('', ['colspan' => 4])->addCell($button->get());
    } else {
        $table->addRow()->addCell(lang::get('no_entries'), ['colspan' => 5]);
    }
    ?>
	
	<div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title pull-left"><?php 
    echo lang::get('media');