1. Go to this page and download the library: Download phpmv/php-mv-ui library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Phalcon\Mvc\Controller;
use Ajax\php\phalcon\JsUtils;
/**
* @property JsUtils $jquery
*/
class ExempleController extends Controller{
public function indexAction(){
$semantic=$this->jquery->semantic();
$button=$semantic->htmlButton("btTest","Test Button");
echo $button;
}
}
use Ajax\php\ci\JsUtils;
class XsUtils extends Ajax\php\ci\JsUtils{
public function __construct(){
parent::__construct(["semantic"=>true,"debug"=>false]);
}
}
$app->singleton(Ajax\php\laravel\JsUtils::class, function($app){
$result= new Ajax\php\laravel\JsUtils();
$result->semantic(new Ajax\Semantic());
return $result;
});
use Ajax\php\laravel\JsUtils;
class Controller extends BaseController{
use AuthorizesRequests, AuthorizesResources, DispatchesJobs, ValidatesRequests;
protected $jquery;
public function __construct(JsUtils $js){
$this->jquery = $js;
}
public function getJquery() {
return $this->jquery;
}
}
namespace app\controllers;
use yii\web\Controller;
use Ajax\php\yii\JsUtils;
class SiteController extends Controller{
protected $jquery;
public function __construct($id, $module,JsUtils $js){
parent::__construct($id, $module);
$this->jquery=$js;
}
}
use Symfony\Component\ClassLoader\Psr4ClassLoader;
x('Ajax\\', __DIR__.'/lib/phpmv/php-mv-ui/Ajax');
$loader->register();
namespace App\Services\semantic;
use Ajax\php\symfony\JquerySemantic;
class SemanticGui extends JquerySemantic{
}
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use App\Services\semantic\SemanticGui;
BarController extends AbstractController{
/**
* @var SemanticGui
*/
protected $gui;
public function loadViewWithAjaxButtonAction(){
$bt=$this->gui->semantic()->htmlButton('button1','a button');
$bt->getOnClick("/url",'#responseElement');
return $this->gui->renderView("barView.html.twig");
}
}
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Ajax\php\symfony\JsUtils;
use AppBundle\AppBundle;
/**
* @Route(service="app.default_controller")
*/
class DefaultController extends Controller{
/**
* @var Ajax\php\symfony\JsUtils
*/
protected $jquery;
public function __construct(ContainerInterface $container,JsUtils $js){
$this->container=$container;
$this->jquery= $js;
}
}
public function initialize(){
parent::initialize();
$this->loadComponent('RequestHandler');
$this->loadComponent('Flash');
$this->loadComponent('JsUtils',["semantic"=>true]);
}
/**
* @property Ajax\JsUtils $jquery
*/
class MyController{
}