35 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" ] ] ];
39 $stepper=$this->jquery->semantic()->htmlStep(
"stepper");
40 $stepper->setStartStep(1);
44 for($index=0; $index < $count; $index++) {
46 $step=$stepper->addStep($step);
48 $step->addClass(
"_noStep")->getOnClick($this->
_getAdminFiles()->getAdminBaseRoute() .
"/_changeEngineering/" . $this->engineering .
"/" . $completed,
"#stepper", [
"jqueryDone" =>
"replaceWith",
"hasLoader" =>
false ]);
50 $step->setProperty(
"data-ajax", $index);
53 $stepper->setActiveStep($this->activeStep);
56 $this->jquery->getOnClick(
".step:not(._noStep)", $this->
_getAdminFiles()->getAdminBaseRoute() .
"/_loadModelStep/" . $this->engineering .
"/",
"#models-main", [
"attr" =>
"data-ajax" ]);
65 $this->engineering=
"forward";
66 if ($oldEngineering ===
"forward") {
67 $this->engineering=
"reverse";
71 if ($completed !==
"completed")
72 $this->jquery->get($this->
_getAdminFiles()->getAdminBaseRoute() .
"/_loadModelStep/" . $this->engineering .
"/" . $this->activeStep,
"#models-main");
73 echo $this->jquery->compile($this->view);
83 return end($this->steps);
88 $nextIndex=$this->activeStep + 1;
89 if ($nextIndex < \
sizeof(
$steps))
97 if (isset($newStep)) {
99 if ($newStep !== @$_SESSION[
"step"]) {
100 if (isset($_SESSION[
"step"])) {
101 $oldStep=$_SESSION[
"step"];
102 $this->jquery->execAtLast(
'$("#item-' . $oldStep .
'.step").removeClass("active");');
105 $this->jquery->execAtLast(
'$("#item-' . $newStep .
'.step").addClass("active");');
106 $this->activeStep=$newStep;
107 $_SESSION[
"step"]=$newStep;
112 echo $this->jquery->compile($this->view);
116 $yumlContent=
"[User|«pk» id:int(11);name:varchar(11)],[Groupe|«pk» id:int(11);name:varchar(11)],[User]0..*-0..*[Groupe]";
117 $bt=$this->jquery->semantic()->htmlButton(
"bt-gen",
"Generate models",
"green fluid");
118 $bt->postOnClick($this->
_getAdminFiles()->getAdminBaseRoute() .
"/_generateFromYuml",
"{code:$('#yuml-code').val()}",
"#stepper", [
"attr" =>
"",
"jqueryDone" =>
"replaceWith" ]);
119 $menu=$this->
_yumlMenu(
"/_updateYumlDiagram",
"{refresh:'true',code:$('#yuml-code').val()}",
"#diag-class");
120 $this->jquery->exec(
'$("#modelsMessages-success").hide()',
true);
121 $menu->compile($this->jquery, $this->view);
122 $form=$this->jquery->semantic()->htmlForm(
"frm-yuml-code");
123 $textarea=$form->addTextarea(
"yuml-code",
"Yuml code", \str_replace(
",",
",\n", $yumlContent .
""));
124 $textarea->getField()->setProperty(
"rows", 20);
125 $diagram=$this->_getYumlImage(
"plain", $yumlContent);
126 $this->jquery->execAtLast(
'$("#yuml-tab .item").tab();');
127 $this->jquery->compile($this->view);
128 $this->loadView($this->
_getAdminFiles()->getViewYumlReverse(), [
"diagram" => $diagram ]);
135 $yumlGen->initYuml($_POST[
"code"]);
137 $yumlGen->create($config);
145 $type=$_POST[
"type"];
146 $size=$_POST[
"size"];
147 $yumlContent=$_POST[
"code"];
148 echo $this->_getYumlImage($type . $size, $yumlContent);
149 echo $this->jquery->compile();
153 private function _yumlMenu($url=
"/_updateDiagram", $params=
"{}", $responseElement=
"#diag-class", $type=
"plain", $size=
";scale:100") {
154 $params=JsUtils::_implodeParams([
"$('#frmProperties').serialize()",$params ]);
155 $menu=
new HtmlMenu(
"menu-diagram");
156 $ddScruffy=
new HtmlDropdown(
"ddScruffy", $type, [
"nofunky" =>
"Boring",
"plain" =>
"Plain",
"scruffy" =>
"Scruffy" ],
true);
157 $ddScruffy->setValue(
"plain")->asSelect(
"type");
158 $this->jquery->postOn(
"change",
"#type", $this->
_getAdminFiles()->getAdminBaseRoute() . $url, $params, $responseElement, [
"ajaxTransition" =>
"random",
"attr" =>
"" ]);
159 $menu->addItem($ddScruffy);
160 $ddSize=
new HtmlDropdown(
"ddSize", $size, [
";scale:180" =>
"Huge",
";scale:120" =>
"Big",
";scale:100" =>
"Normal",
";scale:80" =>
"Small",
";scale:60" =>
"Tiny" ],
true);
161 $ddSize->asSelect(
"size");
162 $this->jquery->postOn(
"change",
"#size", $this->
_getAdminFiles()->getAdminBaseRoute() . $url, $params, $responseElement, [
"ajaxTransition" =>
"random",
"attr" =>
"" ]);
163 $menu->wrap(
"<form id='frmProperties' name='frmProperties'>",
"</form>");
164 $menu->addItem($ddSize);
170 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)