Giter Club home page Giter Club logo

zf2-module-modal's Introduction

zf2-module-modal

ZF2 Simple module modal

Created for Testapic

Introduction

This module is a Zend Framework 2 module to generate some simple and custom modals.

Alt text

Configuration

  1. ZF2 Version 2.3.4
  2. Semantic UI 1.8.1

Installation

You have to put Semantic UI at "/public/css/" and don't forget to set your css framwork link.

If you want to include a css framwork $headlink->prependStylesheet('/css/dist/semantic.min.css');

Usage

  1. Controller The modal variable contains the data to generate modal view.

Override Mode Mandatory : confirmAction

    $modal = array(
        "id" => "Something",
        'url_redir' => $this->getRequest()->getUri()->getPath(),
	'url_confirm' => 'PATH_OF_CONFIRM_VIEW',
        'title' => "Title",
        'flash' => array("Sentence 1"),
        'content' => "Display something",
        'btn' => array("confirm" => "Ok", "noconfirm" => "Fermer"),
    );

Custom Mode Mandatory : infoAction, confirmAction

    $modal = array(
        "id" => "Something",
        'url_redir' => $this->getRequest()->getUri()->getPath(),
        'url_info' => 'PATH_OF_INFO_VIEW',
        'url_confirm' => 'PATH_OF_CONFIRM_VIEW',
    );

View

    <a href="#" class="smodal" data-modal='<?= $this->modallink(array("id" => 1), $this->modal) ?>'>
        Display modal
    </a>
  1. infoAction If 'url_info' isn't set, '/ui/modal/info' will be called by defaut.
  • Generate a modal
    public function infoAction() {
        $modal = new ModalController($this, 'PATH_OF_INFO_VIEW');
        $data = array(); // Data ready to be used in infoAction variable named $page
        $modal->setTitle("Title");
        $modal->setData($data);
        $modal->setButton($modal->data->btn);
        return $modal->render();
    }
  • View of action infoAction (info.phtml)
<?php
  $page = (object) $this->layout()->child_page;
?>
<?= $this->translate("Souhaîtez-vous vraiment effectuer cette action sur l'élement ?"); ?>
  1. confirmAction If 'url_confirm' isn't set, '/ui/modal/confirm' will be called by default.
  • Generate a modal
    public function confirmAction() {
        $modal = new ModalController($this, 'PATH_OF_CONFIRM_VIEW');
        $modal->setFlashMessenger("L'action a bien été éffectuée");
        // Add some queries
        $modal->setTitle("Title");
        return $modal->render();
    }
  • View of action infoAction (info.phtml)
<?php
  $page = (object) $this->layout()->child_page;
?>
<div class="ui grid">
    <div class="column">
        <div class="ui red large message">
            <?php echo $this->translate($page->string); ?>
        </div>
    </div>
</div>

zf2-module-modal's People

Contributors

arnaud-zg avatar

Watchers

 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.