示例#1
0
 function formconverter($tabform = array(), $tabparam = array())
 {
     $form = array();
     foreach ($tabform as $idform => $contentform) {
         if ($idform == 'lineform') {
             foreach ($tabform['lineform'] as $contentlineform) {
                 $form['lineform'][] = array();
                 $form['lineform'][count($form['lineform']) - 1]['label'] = "";
                 if (isset($contentlineform['label'])) {
                     $form['lineform'][count($form['lineform']) - 1]['label'] = $contentlineform['label'];
                 }
                 $form['lineform'][count($form['lineform']) - 1]['hiddenlabel'] = "";
                 if (isset($contentlineform['champs']) && strstr($contentlineform['champs'], "hidden") !== false) {
                     $contentlineform['hiddenlabel'] = "on";
                 }
                 if (isset($contentlineform['hiddenlabel'])) {
                     $form['lineform'][count($form['lineform']) - 1]['hiddenlabel'] = $contentlineform['hiddenlabel'];
                 }
                 $form['lineform'][count($form['lineform']) - 1]['name'] = "";
                 if (isset($contentlineform['name'])) {
                     $form['lineform'][count($form['lineform']) - 1]['name'] = $contentlineform['name'];
                 }
                 $form['lineform'][count($form['lineform']) - 1]['default'] = "";
                 if (isset($contentlineform['default']) && strtolower($contentlineform['default']) == "null") {
                     $contentlineform['default'] = "";
                 }
                 if (isset($contentlineform['default'])) {
                     $form['lineform'][count($form['lineform']) - 1]['default'] = $contentlineform['default'];
                 }
                 $form['lineform'][count($form['lineform']) - 1]['suggestlist'] = "";
                 if (isset($contentlineform['suggestlist'])) {
                     $form['lineform'][count($form['lineform']) - 1]['suggestlist'] = $contentlineform['suggestlist'];
                 }
                 //$instanceTpl=new Tp($this->conf,$this->log);
                 //$tpl=$instanceTpl->tpselected;
                 $tpl = new TemplateSmarty();
                 //load css and js for case
                 $tpl->remplir_template("css", $this->getCssForm("champs." . $contentlineform['champs']));
                 $tpl->remplir_template("js", $this->getJsForm("champs." . $contentlineform['champs']));
                 //custom code to prepare champs input (charger une liste de suggestions par exemple)
                 if (file_exists($this->chemin_pratiklib_form . "customform/champs." . $contentlineform['champs'] . ".php")) {
                     include $this->chemin_pratiklib_form . "customform/champs." . $contentlineform['champs'] . ".php";
                 } else {
                     $this->log->pushtolog("Fichier introuvable : " . $this->chemin_pratiklib_form . "customform/champs." . $contentlineform['champs'] . ".php");
                 }
                 $tpl->remplir_template("lineform", $contentlineform);
                 //tpl du champs
                 $chemin_tpl_champs = $this->chemin_pratiklib_form . "template/champs." . $contentlineform['champs'] . ".tpl";
                 if (!file_exists($chemin_tpl_champs)) {
                     $chemin_tpl_champs = $this->chemin_pratiklib_form . "template/champs.text.tpl";
                 }
                 //set chemin form
                 $tpl->remplir_template("cheminform", $chemin_tpl_champs);
                 $form['lineform'][count($form['lineform']) - 1]['champs'] = $tpl->get_template($this->chemin_pratiklib_form . "form.tpl");
             }
         } else {
             //$instanceTpl=new Tp($this->conf,$this->log);
             //$tpl=$instanceTpl->tpselected;
             $tpl = new TemplateSmarty();
             //load css and js for case
             $tpl->remplir_template("css", $this->getCssForm("form." . $idform));
             $tpl->remplir_template("js", $this->getJsForm("form." . $idform));
             //load other params
             foreach ($tabparam as $idparam => $contentparam) {
                 $tpl->remplir_template($idparam, $contentparam);
             }
             //custom code to prepare champs input (charger une liste de suggestions par exemple)
             if (file_exists($this->chemin_pratiklib_form . "customform/form." . $idform . ".php")) {
                 include $this->chemin_pratiklib_form . "customform/form." . $idform . ".php";
             } else {
                 $this->log->pushtolog("Fichier introuvable : " . $this->chemin_pratiklib_form . "customform/form." . $idform . ".php");
             }
             //tpl de l'elmt form
             $form[$idform] = "";
             if ($contentform == true) {
                 //cas avec structure de base de form.tpl
                 $chemin_tpl_champs = $this->chemin_pratiklib_form . "template/form." . $idform . ".tpl";
                 if (!file_exists($chemin_tpl_champs)) {
                     //cas de balises ouvrante et fermante (sans structure de base form.tpl)
                     $chemin_tpl_champs = $this->chemin_pratiklib_form . "template/form." . $idform . "__open.tpl";
                     if (!file_exists($chemin_tpl_champs)) {
                         $chemin_tpl_champs = $this->chemin_pratiklib_form . "template/form.none.tpl";
                     } else {
                         //custom code to prepare champs input for open and close (charger une liste de suggestions par exemple)
                         if (file_exists($this->chemin_pratiklib_form . "customform/form." . $idform . "__open.php")) {
                             include $this->chemin_pratiklib_form . "customform/form." . $idform . "__open.php";
                         } else {
                             $this->log->pushtolog("Fichier introuvable : " . $this->chemin_pratiklib_form . "customform/form." . $idform . "__open.php");
                         }
                         //tpl open
                         $form[$idform . "__open"] = $tpl->get_template($chemin_tpl_champs);
                         //custom code to prepare champs input for open and close (charger une liste de suggestions par exemple)
                         if (file_exists($this->chemin_pratiklib_form . "customform/form." . $idform . "__close.php")) {
                             include $this->chemin_pratiklib_form . "customform/form." . $idform . "__close.php";
                         } else {
                             $this->log->pushtolog("Fichier introuvable : " . $this->chemin_pratiklib_form . "customform/form." . $idform . "__close.php");
                         }
                         //tpl close
                         $chemin_tpl_champs = $this->chemin_pratiklib_form . "template/form." . $idform . "__close.tpl";
                         $form[$idform . "__close"] = "";
                         if (file_exists($chemin_tpl_champs)) {
                             $form[$idform . "__close"] = $tpl->get_template($chemin_tpl_champs);
                         }
                         //tpl none for secure
                         $chemin_tpl_champs = $this->chemin_pratiklib_form . "template/form.none.tpl";
                         $form[$idform] = "";
                         if (file_exists($chemin_tpl_champs)) {
                             $form[$idform] = $tpl->get_template($chemin_tpl_champs);
                         }
                         continue;
                     }
                 }
                 //set chemin form
                 $tpl->remplir_template("cheminform", $chemin_tpl_champs);
                 $form[$idform] = $tpl->get_template($this->chemin_pratiklib_form . "form.tpl");
             }
         }
     }
     return $form;
 }
示例#2
0
    }
    while (!file_exists("package/" . $deploypage . "/conf.form.xml") && isset($tabpackagetodeploy[++$cptpackagecour]['name'])) {
        $deploypage = $tabpackagetodeploy[$cptpackagecour]['name'];
    }
    $deploypagetpl = "conf.form";
}
if (isset($_POST['codename']) && array_search($_POST['codename'], $tabstep) !== false) {
    $deploypage = $_POST['codename'];
    $deploypagetpl = $deploypage;
}
if ($cptpackagecour >= count($tabpackagetodeploy)) {
    $deploypage = "deployment";
    $deploypagetpl = $deploypage;
}
//tp
$tpl = new TemplateSmarty();
//get tpl page
$tpl->remplir_template("deploypage", $deploypagetpl);
//title
$tpl->remplir_template("maintitle", "RoDKoDRoK System");
//subtitle
if ($deploypage == "startdeploy") {
    $tpl->remplir_template("mainsubtitle", "Start deployment");
} else {
    if ($deploypage == "deployment") {
        $tpl->remplir_template("mainsubtitle", "End deployment");
    } else {
        if ($deploypage == "downloadstep") {
            $tpl->remplir_template("mainsubtitle", "Download all packages from RoDKoDRoK.com");
        } else {
            $tpl->remplir_template("mainsubtitle", "Package " . $deploypage);