PHP Classes

PHP Editable Text Field: Create page fields with values that users can edit

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 84 All time: 10,053 This week: 73Up
Version License PHP version Categories
editable-fields 1.0.0Custom (specified...5HTML, Databases, Data types, AJAX
Description 

Author

This package can create page fields with values that users can edit.

It can create a structure of fields of several different types displayed on a Web page and make them editable, so users can click on them and change their values.

Applications can generate HTML to render with JavaScript code to make the fields appear and react when the users click on the editable fields and make changes.

The values changes on the fields can be submitted to the server so that the PHP server-side script saves those changes.

Picture of Matous Nemec
Name: Matous Nemec <contact>
Classes: 8 packages by
Country: Czech Republic Czech Republic
Innovation award
Innovation award
Nominee: 2x

Example

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
      integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

<link rel="stylesheet" href="../vendor/mesour/components/public/DateTimePicker/bootstrap-datetimepicker.min.css">

<?php

define
('SRC_DIR', __DIR__ . '/../src/');

require_once
__DIR__ . '/../vendor/autoload.php';

\
Tracy\Debugger::enable(\Tracy\Debugger::DEVELOPMENT, __DIR__ . '/log');
\
Tracy\Debugger::$strictMode = true;

$loader = new Nette\Loaders\RobotLoader;
$loader->addDirectory(SRC_DIR);
$loader->setCacheStorage(new Nette\Caching\Storages\FileStorage(__DIR__ . '/tmp'));
$loader->register();

?>

<hr>

<div class="container">
    <h2>Without settings</h2>

    <?php

    $application
= new \Mesour\UI\Application('mesourApp');

   
$application->setRequest($_REQUEST);

   
$application->run();

   
$editable = new \Mesour\UI\Editable('editableTest', $application);

   
$structure = new \Mesour\Editable\Structures\DataElementStructure();

   
$structure->addText('name');

   
$structure->addNumber('amount')
        ->
setDecimalPoint(',')
        ->
setThousandSeparator('.')
        ->
setDecimals(2)
        ->
setUnit('EUR');

   
$structure->addDate('last_login')
        ->
setFormat('Y-m-d H:i:s');

   
$structure->addEnum('role')
        ->
addValue('admin', 'Admin')
        ->
addValue('moderator', 'Moderator');

   
$structure->addBool('has_pro');

   
$editable->setDataStructure($structure);

    echo
$editable->render();

   
?>


    <div class="jumbotron">

        <p data-editable="name">-</p>
        <p data-editable="amount">100 EUR</p>
        <p data-editable="last_login">2016-01-01 20:00:00</p>
        <p data-editable="role" data-value="admin">Admin</p>
        <p data-editable="has_pro" data-value="1">Yes</p>

    </div>

</div>

<hr>

<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>

<!-- Latest compiled and minified JavaScript -->
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"
        integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS"
        crossorigin="anonymous"></script>

<script src="../vendor/mesour/components/public/DateTimePicker/moment.min.js"></script>
<script src="../vendor/mesour/components/public/DateTimePicker/bootstrap-datetimepicker.min.js"></script>

<script src="../vendor/mesour/components/public/mesour.components.min.js"></script>

<script src="../vendor/mesour/modal/public/mesour.modal.min.js"></script>

<script src="../public/mesour.editable.min.js"></script>

<script>
    $(function () {
        var COMPONENT_NAME = 'mesourApp-editableTest';

        $('[data-editable]').on('click', function (e) {
            if (e.ctrlKey) {
                e.preventDefault();

                var $this = $(this),
                    name = $this.attr('data-editable'),
                    value = $this.attr('data-value');

                mesour.editable.getComponent(COMPONENT_NAME).edit(name, $this, null, value);
            }
        });
    });
</script>


Details

Mesour Editable

Install

  • With Composer

    composer require mesour/editable

  • Or download source from GitHub

Tests

Before first run, create config.local.php file. Can use config.php as template.

Run command vendor/bin/tester tests/ -s -c tests/php.ini --colors

Code style

Run command vendor/bin/phpcs --standard=ruleset.xml --extensions=php,phpt --encoding=utf-8 --tab-width=4 -sp src tests


  Files folder image Files (63)  
File Role Description
Files folder imagedocs (1 file)
Files folder imageexamples (3 files)
Files folder imagesrc (1 directory)
Files folder imagetests (4 files, 1 directory)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file license.md Lic. License text
Accessible without login Plain text file package.json Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file ruleset.xml Data Auxiliary data

  Files folder image Files (63)  /  docs  
File Role Description
  Accessible without login Plain text file localisation.md Data Auxiliary data

  Files folder image Files (63)  /  examples  
File Role Description
  Accessible without login Plain text file db.sql Data Auxiliary data
  Accessible without login Plain text file index.php Example Example script
  Accessible without login Plain text file without_identifier.php Example Example script

  Files folder image Files (63)  /  src  
File Role Description
Files folder imageMesour (2 directories)

  Files folder image Files (63)  /  src  /  Mesour  
File Role Description
Files folder imageEditable (3 files, 2 directories)
Files folder imageUI (1 file)

  Files folder image Files (63)  /  src  /  Mesour  /  Editable  
File Role Description
Files folder imageRules (4 files)
Files folder imageStructures (4 files, 1 directory)
  Plain text file exceptions.php Class Class source
  Plain text file PermissionsChecker.php Class Class source
  Plain text file Reference.php Class Class source

  Files folder image Files (63)  /  src  /  Mesour  /  Editable  /  Rules  
File Role Description
  Plain text file IValidated.php Class Class source
  Plain text file Rule.php Class Class source
  Plain text file RuleHelper.php Class Class source
  Plain text file RuleType.php Class Class source

  Files folder image Files (63)  /  src  /  Mesour  /  Editable  /  Structures  
File Role Description
Files folder imageFields (19 files)
  Plain text file DataElementStructure.php Class Class source
  Plain text file DataStructure.php Class Class source
  Plain text file IDataElementStructure.php Class Class source
  Plain text file IDataStructure.php Class Class source

  Files folder image Files (63)  /  src  /  Mesour  /  Editable  /  Structures  /  Fields  
File Role Description
  Plain text file BaseElementField.php Class Class source
  Plain text file BaseField.php Class Class source
  Plain text file BoolField.php Class Class source
  Plain text file CustomData.php Class Class source
  Plain text file CustomField.php Class Class source
  Plain text file DateField.php Class Class source
  Plain text file EnumField.php Class Class source
  Plain text file ICustomData.php Class Class source
  Plain text file IManyToManyField.php Class Class source
  Plain text file IStructureElementField.php Class Class source
  Plain text file IStructureField.php Class Class source
  Plain text file IValidatedField.php Class Class source
  Plain text file ManyToManyField.php Class Class source
  Plain text file ManyToOneField.php Class Class source
  Plain text file NumberField.php Class Class source
  Plain text file OneToManyField.php Class Class source
  Plain text file OneToOneField.php Class Class source
  Plain text file TextField.php Class Class source
  Plain text file ValidatedField.php Class Class source

  Files folder image Files (63)  /  src  /  Mesour  /  UI  
File Role Description
  Plain text file Editable.php Class Class source

  Files folder image Files (63)  /  tests  
File Role Description
Files folder imageMesour (1 directory)
  Accessible without login Plain text file bootstrap.php Example Example script
  Accessible without login Plain text file config.php Aux. Auxiliary script
  Accessible without login Plain text file php.ini Data Auxiliary data
  Accessible without login Plain text file php.travis.ini Data Auxiliary data

  Files folder image Files (63)  /  tests  /  Mesour  
File Role Description
Files folder imageEditableTests (4 files, 2 directories)

  Files folder image Files (63)  /  tests  /  Mesour  /  EditableTests  
File Role Description
Files folder imagedata (2 files)
Files folder imageHandlers (12 files)
  Plain text file BaseTestCase.php Class Class source
  Plain text file DefaultTest.phpt Class Class source
  Plain text file TestTranslator.php Class Class source
  Plain text file TranslatorTest.phpt Class Class source

  Files folder image Files (63)  /  tests  /  Mesour  /  EditableTests  /  data  
File Role Description
  Accessible without login HTML file DefaultTestOutput.html Doc. Documentation
  Accessible without login HTML file TranslatorTestOutput.html Doc. Documentation

  Files folder image Files (63)  /  tests  /  Mesour  /  EditableTests  /  Handlers  
File Role Description
  Plain text file AttachDisabledTest.phpt Class Class source
  Plain text file AttachNoPermissionTest.phpt Class Class source
  Plain text file AttachTest.phpt Class Class source
  Plain text file CreateDisabledTest.phpt Class Class source
  Plain text file CreateNoPermissionTest.phpt Class Class source
  Plain text file CreateTest.phpt Class Class source
  Plain text file ManyToOneEditCurrentEditTest.phpt Class Class source
  Plain text file RemoveDisabledTest.phpt Class Class source
  Plain text file RemoveNoPermissionTest.phpt Class Class source
  Plain text file SimpleEditDisabledTest.phpt Class Class source
  Plain text file SimpleEditNoPermissionTest.phpt Class Class source
  Plain text file SimpleEditTest.phpt Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:84
This week:0
All time:10,053
This week:73Up