32 private $steps=[
"forward" => [ [
"toggle on",
"Engineering",
"Forward" ],[
"settings",
"Conf",
"Database configuration" ],[
"database",
"Connexion",
"Database connexion" ],[
"sticky note",
"Models",
"Models generation" ],[
"lightning",
"Cache",
"Models cache generation" ] ],
"reverse" => [ [
"toggle off",
"Engineering",
"Reverse" ],[
"sticky note",
"Models",
"Models configuration/implementation" ],[
"lightning",
"Cache",
"Models cache generation" ],[
"database plus",
"Database",
"Database creation" ] ] ];
36 $stepper=$this->jquery->semantic()->htmlStep(
"stepper");
37 $stepper->setStartStep(1);
41 for($index=0; $index < $count; $index++) {
43 $step=$stepper->addStep($step);
45 $step->addClass(
"_noStep")->getOnClick($this->
_getAdminFiles()->getAdminBaseRoute() .
"/_changeEngineering/" . $this->engineering .
"/" . $completed,
"#stepper", [
"jqueryDone" =>
"replaceWith",
"hasLoader" =>
false ]);
47 $step->setProperty(
"data-ajax", $index);
50 $stepper->setActiveStep($this->activeStep);
53 $this->jquery->getOnClick(
".step:not(._noStep)", $this->
_getAdminFiles()->getAdminBaseRoute() .
"/_loadModelStep/" . $this->engineering .
"/",
"#models-main", [
"attr" =>
"data-ajax" ]);
62 $this->engineering=
"forward";
63 if ($oldEngineering ===
"forward") {
64 $this->engineering=
"reverse";
68 if ($completed !==
"completed")
69 $this->jquery->get($this->
_getAdminFiles()->getAdminBaseRoute() .
"/_loadModelStep/" . $this->engineering .
"/" . $this->activeStep,
"#models-main");
70 echo $this->jquery->compile($this->view);
80 return end($this->steps);
85 $nextIndex=$this->activeStep + 1;
86 if ($nextIndex < \
sizeof(
$steps))
94 if (isset($newStep)) {
96 if ($newStep !== @$_SESSION[
"step"]) {
97 if (isset($_SESSION[
"step"])) {
98 $oldStep=$_SESSION[
"step"];
99 $this->jquery->execAtLast(
'$("#item-' . $oldStep .
'.step").removeClass("active");');
102 $this->jquery->execAtLast(
'$("#item-' . $newStep .
'.step").addClass("active");');
103 $this->activeStep=$newStep;
104 $_SESSION[
"step"]=$newStep;
109 echo $this->jquery->compile($this->view);
113 $yumlContent=
"[User|«pk» id:int(11);name:varchar(11)],[Groupe|«pk» id:int(11);name:varchar(11)],[User]0..*-0..*[Groupe]";
114 $bt=$this->jquery->semantic()->htmlButton(
"bt-gen",
"Generate models",
"green fluid");
115 $bt->postOnClick($this->
_getAdminFiles()->getAdminBaseRoute() .
"/_generateFromYuml",
"{code:$('#yuml-code').val()}",
"#stepper", [
"attr" =>
"",
"jqueryDone" =>
"replaceWith" ]);
116 $menu=$this->
_yumlMenu(
"/_updateYumlDiagram",
"{refresh:'true',code:$('#yuml-code').val()}",
"#diag-class");
117 $this->jquery->exec(
'$("#modelsMessages-success").hide()',
true);
118 $menu->compile($this->jquery, $this->view);
119 $form=$this->jquery->semantic()->htmlForm(
"frm-yuml-code");
120 $textarea=$form->addTextarea(
"yuml-code",
"Yuml code", \str_replace(
",",
",\n", $yumlContent .
""));
121 $textarea->getField()->setProperty(
"rows", 20);
122 $diagram=$this->_getYumlImage(
"plain", $yumlContent);
123 $this->jquery->execAtLast(
'$("#yuml-tab .item").tab();');
124 $this->jquery->compile($this->view);
125 $this->loadView($this->
_getAdminFiles()->getViewYumlReverse(), [
"diagram" => $diagram ]);
132 $yumlGen->initYuml($_POST[
"code"]);
134 $yumlGen->create($config);
142 $type=$_POST[
"type"];
143 $size=$_POST[
"size"];
144 $yumlContent=$_POST[
"code"];
145 echo $this->_getYumlImage($type . $size, $yumlContent);
146 echo $this->jquery->compile();
150 private function _yumlMenu($url=
"/_updateDiagram", $params=
"{}", $responseElement=
"#diag-class", $type=
"plain", $size=
";scale:100") {
151 $params=JsUtils::_implodeParams([
"$('#frmProperties').serialize()",$params ]);
152 $menu=
new HtmlMenu(
"menu-diagram");
153 $ddScruffy=
new HtmlDropdown(
"ddScruffy", $type, [
"nofunky" =>
"Boring",
"plain" =>
"Plain",
"scruffy" =>
"Scruffy" ],
true);
154 $ddScruffy->setValue(
"plain")->asSelect(
"type");
155 $this->jquery->postOn(
"change",
"#type", $this->
_getAdminFiles()->getAdminBaseRoute() . $url, $params, $responseElement, [
"ajaxTransition" =>
"random",
"attr" =>
"" ]);
156 $menu->addItem($ddScruffy);
157 $ddSize=
new HtmlDropdown(
"ddSize", $size, [
";scale:180" =>
"Huge",
";scale:120" =>
"Big",
";scale:100" =>
"Normal",
";scale:80" =>
"Small",
";scale:60" =>
"Tiny" ],
true);
158 $ddSize->asSelect(
"size");
159 $this->jquery->postOn(
"change",
"#size", $this->
_getAdminFiles()->getAdminBaseRoute() . $url, $params, $responseElement, [
"ajaxTransition" =>
"random",
"attr" =>
"" ]);
160 $menu->wrap(
"<form id='frmProperties' name='frmProperties'>",
"</form>");
161 $menu->addItem($ddSize);
167 return $this->
displayMessages($type, $messagesToDisplay, $step[2], $step[0]);
static isPost()
Returns true if the request is sent by the POST method.
_loadModelStep($engineering=null, $newStep=null)
_yumlMenu($url="/_updateDiagram", $params="{}", $responseElement="#diag-class", $type="plain", $size=";scale:100")
displayMessages($type, $messagesToDisplay, $header="", $icon="")
displayModelsMessages($type, $messagesToDisplay)
_changeEngineering($oldEngineering, $completed=null)