$table->setSql('SELECT * FROM ' . sql::table('media') . ' WHERE `category` = ' . $catId); $table->addRow()->addCell()->addCell()->addCell(lang::get('title'))->addCell(lang::get('file_type'))->addCell(lang::get('action')); $table->addCollsLayout('20, 50,*,100,110'); $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">
if (!$catId) { $sql = sql::factory(); $sql->query('SELECT id FROM ' . sql::table('media_cat') . ' ORDER BY id LIMIT 1')->result(); $catId = $sql->get('id'); } type::addSession('media_cat', $catId); $table = table::factory(['class' => ['media-table']]); $table->setSql('SELECT * FROM ' . sql::table('media') . ' WHERE `category` = ' . $catId); $table->addRow()->addCell()->addCell(lang::get('title'))->addCell(lang::get('file_type'))->addCell(lang::get('action')); $table->addCollsLayout('50,*,100,250'); $table->addSection('tbody'); if ($table->numSql()) { while ($table->isNext()) { $media = new media($table->getSql()); $select = '<button data-id="' . $table->get('id') . '" data-name="' . $table->get('filename') . '" data-loading-text="' . lang::get('selected') . '" class="btn btn-sm btn-warning dyn-media-select">' . lang::get('select') . '</button>'; $table->addRow()->addCell($media->getIcon())->addCell($media->get('title'))->addCell($media->getExtension())->addCell('<span class="btn-group">' . $select . '</span>'); $table->next(); } } else { $table->addRow()->addCell(lang::get('no_entries'), ['colspan' => 4]); } ?> <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'); ?> </h3> <?php