Giter Site home page Giter Site logo

redaxo5_addon_mediasort's Introduction

Redaxo5 Addon Mediasort

Das Addon ermöglicht die Sortierung von Medien in einer Medien-Kategorie.

  • benoetigt ein Meta-Feld Namens med_priority, Typ text
  • Benötigt ein Modul, das die Bilder nach med_priority sortiert (noch nicht Teil des Addons)

Beispielmodul

Eingabe

<?php
$rex_media_category = (int)"REX_VALUE[1]";
$sel_media = new rex_media_category_select($check_perm = false);
$sel_media->setId('rex_file_category');
$sel_media->setName('REX_INPUT_VALUE[1]');
$sel_media->setSize(1);
$sel_media->setSelected($rex_media_category);
$sel_media->setAttribute('onchange', 'this.form.submit();');
$sel_media->setAttribute('class', 'selectpicker');
$sel_media->setAttribute('data-live-search', 'true');
$sel_media->show();
?>

Ausgabe

<?php
$files = rex_sql::factory()
	->setQuery("SELECT filename
    FROM `".rex::getTable('media')."`
    WHERE category_id=".intval("REX_VALUE[1]")."
    AND filetype IN ('image/jpeg', 'image/png', 'image/gif')
    ORDER BY LENGTH(med_priority), med_priority")
    ->getArray();

$files = array_map(function($row){
    return $row['filename'];
}, $files);
foreach ($files as $file) {
   echo '<img src="index.php?rex_media_type=rex_mediapool_preview&rex_media_file='.urlencode($file).'" />';
}
?>

Screenshots:

Drag and drop to sort

redaxo5_addon_mediasort's People

Contributors

akuehnis avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.