function __setBodyAdmin($data, $scheduleData)
    {
        $schoolyear = viewSchoolYear($data['school_year']);
        $mail_status = viewMailStatus($data['mail_status']);
        $route = viewBus($scheduleData['Schedule']['bus']);
        $type = viewType($this->data['Experience']['type']);
        $date = sprintf('%04d年%02d月%02d日', date('Y'), date('m'), date('d'));
        /*
         * @体験入学
         */
        $experience = formDate($scheduleData['Schedule']['day']) . ' ' . $scheduleData['Schedule']['name'] . ' ' . viewTime($scheduleData['Schedule']['time']);
        /*
         * @バス乗車地点
         */
        $optionsBus = busArray($scheduleData['Schedule']['bus']);
        if (is_numeric($this->data['Experience']['bus'])) {
            $bus = $optionsBus[$this->data['Experience']['bus']];
        } else {
            $bus = $this->data['Experience']['bus'];
        }
        /*
         * @体験授業
         */
        $open_campuses = array();
        $events = unserialize($data['event']);
        foreach ($events as $e) {
            $event = array_shift($e) . "    ";
            foreach ($e as $o) {
                $event .= " " . $o;
            }
            $open_campuses[] = $event;
        }
        $open_campus = implode("\n", $open_campuses);
        /*
         * @ご家族
         */
        if (!empty($data['family'])) {
            $family = implode(" ", $data['family']);
        }
        return <<<EOM
……………………………………………………………………………………………………
◎から体験入学申し込み
……………………………………………………………………………………………………

◎送信日
{$date}

◎キャリア
{$type}


◎登録番号
{$data['reg_num']}

◎氏名
{$data['name']}
{$data['furigana']}

◎メールアドレス
{$data['mail']}

◎住所
{$data['zip01']}-{$data['zip02']}
{$data['pref']}{$data['address01']}{$data['address02']}{$data['address03']}

◎生年月日
{$data["birthday"]}

◎電話番号
{$data['tel01']}-{$data['tel02']}-{$data['tel03']}

◎高校名
{$data['highschool']}高校
{$schoolyear}

◎体験入学
{$experience}

◎バス乗車地点
{$route}
{$bus}

◎体験授業
{$open_campus}

◎ご家族が参加される場合
{$family}

◎保護者説明会
{$data['briefing_session']}

EOM;
    }
Example #2
0
 if (!empty($_POST['paginas'])) {
     $g['post_id'] = $postedit['id'];
     $g['paginas'] = htmlspecialchars(mysql_real_escape_string($_POST['paginas']));
     update('pagers', $g, "post_id = '{$urledit}' ");
 }
 if (!empty($_POST['medidas'])) {
     $h['post_id'] = $postedit['id'];
     $h['measure'] = htmlspecialchars(mysql_real_escape_string($_POST['medidas']));
     update('measures', $h, "post_id = '{$urledit}' ");
 }
 if (!empty($_POST['papel_tipo'])) {
     $i['post_id'] = $postedit['id'];
     $i['paper_type'] = htmlspecialchars(mysql_real_escape_string($_POST['papel_tipo']));
     update('papers', $i, "post_id = '{$urledit}' ");
 }
 $f['data'] = formDate($f['date']);
 unset($f['date']);
 if ($postedit['titulo'] != $f['titulo']) {
     $f['url'] = setUri($f['titulo']);
     $readPostUri = read('posts', "WHERE url LIKE  '%{$f['url']}%' AND id != '{$urledit}'");
     if ($readPostUri) {
         $f['url'] = $f['url'] . '-' . count($readPostUri);
         $readPostUri = read('posts', "WHERE url = '{$f['url']}' AND id != '{$urledit}'");
         if ($readPostUri) {
             $f['url'] = $f['url'] . '_' . time();
         }
     }
 } else {
     $f['url'] = $postedit['url'];
 }
 if (!empty($_FILES['thumb']['tmp_name'])) {
Example #3
0
 function afficheForm($entite, $titre, $id, $event = null, $source = null)
 {
     include_once 'classes/materiel.class.php';
     include_once 'classes/fournisseur.class.php';
     //initialise disabled
     global $disabled;
     $disabled = '';
     $cnx = ouvresylob(1);
     //recup table pr chq entité
     switch ($entite) {
         case "contrat":
             $latable = "informix.zz_contratmat";
             $lajointure = "";
             $leschamps = "*";
             $lechamp = "id_contratmat";
             $obligatoires = array("num", "debut", "fin", "preavis", "ent");
             break;
         case "intervention":
             $latable = "informix.zz_inter";
             $lajointure = "";
             $leschamps = "id_inter as id,debut_inter as debut, fin_inter as fin, \r\n                        presta_inter as prestataire, intervenant_inter as intervenant,\r\n                        etat_inter, type_inter, \r\n                        periodicite_inter as periodicite, priorite_inter as priorite, \r\n                        domaine_inter as domaine, cout_inter as cout,\r\n                        detail_inter as detail, supp_inter as supp";
             $lechamp = "id_inter";
             $obligatoires = array("debut", "fin", "intervenant", "type_inter", "domaine");
             break;
         case "materiel":
             $latable = "informix.zz_materiel";
             $lajointure = " left join informix.zz_misservice on informix.zz_misservice.id_materiel = informix.zz_materiel.id_materiel\r\n                                left join informix.zz_destruction on informix.zz_destruction.id_materiel = informix.zz_materiel.id_materiel\r\n                                left join informix.bas_postrav on informix.bas_postrav.no_poste= informix.zz_materiel.id_posttrav";
             $leschamps = "informix.zz_materiel.id_materiel as id, sn_materiel as sn, desig_materiel as designation,\r\n                            zone_materiel as zonemateriel, famille_materiel as fammat, id_posttrav as poste,\r\n                            type_materiel as typemateriel, marq_materiel as marque_materiel, frn_materiel as fournisseur,\r\n                            dteha_materiel as achat, etat_materiel as etatmateriel, contrat_materiel as contratmat, \r\n                            informix.zz_materiel.usage_materiel as usagemateriel, dte_misservice, dte_destruction";
             $lechamp = "informix.zz_materiel.id_materiel";
             $obligatoires = array("designation", "zonemateriel", "fammat", "typemateriel", "etatmateriel", "dte_misservice");
             break;
         default:
             $latable = "informix.zz_" . $entite;
             $lechamp = "id_" . $entite;
             $obligatoires = array("");
             break;
     }
     //on recupere les champs de l'entite
     $sql = "select " . $leschamps . " from " . $latable;
     if ($lajointure != '') {
         $sql .= $lajointure;
     }
     if ($id != null) {
         //on a un id => recup entite pr modif
         $sql = $sql . " where " . $lechamp . " = " . $id . "";
     } else {
         $sql = $sql . " where 1=2";
         //recup dernier id renseigné
         $sql0 = "SELECT max(" . $lechamp . ") FROM " . $latable;
         //echo $sql0;
         $res = odbc_exec($cnx, $sql0) or die('Erreur : ' . $sql);
         if (odbc_result($res, 1) > 0) {
             $no = odbc_result($res, 1) + 1;
         } else {
             $no = 1;
         }
     }
     $result = odbc_exec($cnx, $sql) or die('Erreur : ' . $sql);
     $ncols = odbc_num_fields($result);
     for ($i = 0; $i < odbc_num_fields($result); $i++) {
         $champs[] = odbc_field_name($result, $i + 1);
         $typeChamp[] = odbc_field_type($result, $i + 1);
     }
     $nb_champs = odbc_num_fields($result);
     //initialise tableau de valeurs a vide
     $valeurs = array();
     for ($i = 0; $i < $nb_champs; $i++) {
         $valeurs[$i] = '';
     }
     //si id renseigné => on est en modif : on recup donnees table
     if ($id) {
         while (odbc_fetch_row($result)) {
             for ($i = 0; $i < $nb_champs; $i++) {
                 $valeurs[$i] = odbc_result($result, $i + 1);
             }
             //si etat = 3 on disabled
             if ($entite == 'intervention' and $valeurs[5] == 3 or $entite == 'materiel' and $valeurs[10] == 3) {
                 $disabled = 'disabled';
             }
         }
         $no = $id;
     } elseif (isset($_POST['id'])) {
         for ($i = 0; $i < $nb_champs; $i++) {
             if (isset($_POST[$champs[$i]]) and $_POST[$champs[$i]] != '') {
                 $valeurs[$i] = $_POST[$champs[$i]];
             }
         }
         $no = $_POST['id'];
         //on recup n° entite pr affichage
     } elseif (isset($_GET['materiel']) and $_GET['materiel'] != '') {
         for ($i = 0; $i < $nb_champs; $i++) {
             if (isset($_GET[$champs[$i]]) and $_GET[$champs[$i]] != '') {
                 $valeurs[$i] = utf8_decode($_GET[$champs[$i]]);
                 //on a encode pr passer en param ds calendar => on decode
             }
         }
     }
     //odbc_close($cnx);
     echo "<br>";
     echo "<div id='edit'>";
     echo "<TABLE align=center style=background:#fdf2db;color:#135356>\r\n                <TR>\r\n                    <TD colspan=6 style='background:#519085' width=1090 align=right>\r\n                        <a href='" . $entite . ".php' ><img border=0 src='images/list.png' title='Affichage liste'></a>\r\n                    </td>\r\n                </tr>\r\n            </table>";
     //affichage different pour materiel_infos
     if ($entite != 'materiel_infos') {
         //si contrat ou inter on doit recup liste materiels concernés
         if ($entite == "contrat" or $entite == "intervention") {
             $java = "onSubmit='javascript: soumettre_1liste(document.forms[0].choisi);'";
         } else {
             $java = "";
         }
         //affichage du formulaire
         echo "  <form name='" . $entite . "' " . $java . " action = 'edit_" . $entite . ".php' \r\n                    method='post' onfocus='trie(this," . $entite . ",2);');'>\r\n                        <TABLE align=center style=background:#fdf2db;color:#135356>\r\n                            <TR>\r\n                                <TD colspan = 6 style='background:#519085' width=1090>\r\n                                    <span>" . strtoupper(utf8_decode($titre)) . "</span>\r\n                                </TD>\r\n                            </TR>\r\n                            <tr><td colspan=6>&nbsp;</td></tr>\r\n                            <TR>\r\n                                <TD colspan = 6 align=center>\r\n                                    <font color=#135356 size=5><b>" . str_replace("MATERIEL", "ENTITE", strtoupper(utf8_decode(str_replace("informix.zz_", "", $entite)))) . " N°" . $no . "</b></font>\r\n                                </TD>\r\n                            </TR>\r\n                            <tr><td colspan=6>&nbsp;</td></tr>\r\n                            <TR>\r\n                                <TD></TD><TD></TD>\r\n                            </TR>";
     }
     //si form contrat ou inter on choisi le(s) materiel(s) concerné(s)
     if ($entite == 'contrat' or $entite == 'intervention') {
         afficheFiltre($entite);
         //liste materiel selectionné
         if ($id != '') {
             switch ($entite) {
                 case 'contrat':
                     $listemateriels = getMatContrat($id);
                     break;
                 case 'intervention':
                     $listemateriels = getMatInter($id);
                     break;
                 default:
                     break;
             }
         } else {
             $listemateriels = array();
         }
         echo "<tr><td colspan=6><table border=0 align=center><tr>   \r\n                                        <th>Entit&eacute;s disponibles </th><th></th><th></th><th>Entit&eacute;(s) concern&eacute;e(s) </th></tr><tr>\r\n                                        <td><select size = 10 style='width:300' name=dispo[] id=dispo " . $disabled . " multiple onDblClick='javascript: deplacer(this.form.dispo, this.form.choisi);'>";
         //contenu liste materiel dispo renseigné par script
         echo "                          </select></td>";
         echo "                      <td></td><td>\r\n                                            <input type=button " . $disabled . " value=Ajouter onclick='javascript: deplacer(this.form.dispo, this.form.choisi);'><br><br>\r\n                                            <input type=button " . $disabled . " value=Retirer onclick='javascript: deplacer(this.form.choisi, this.form.dispo);'>\r\n                                        </td>";
         echo "                      <td><select size = 10 style='width:300' class='obligatoire' name=choisi[] id=choisi " . $disabled . " multiple onDblClick='javascript: deplacer(this.form.choisi, this.form.dispo);'>";
         foreach ($listemateriels as $materiel) {
             echo "                          <option value ='" . $materiel . "' >" . $materiel . " - " . utf8_encode(getNomMat($materiel)) . "</option>";
         }
         echo "                          </select></td></tr></table>";
     }
     echo "          <TR><tr><td colspan=6>&nbsp;</td></tr>";
     //on boucle sur ts les champs de l'entite pour faire le formulaire
     for ($i = 0; $i < $nb_champs; $i++) {
         $champs[$i] = str_replace("_contratmat", "", $champs[$i]);
         if (in_array($champs[$i], $obligatoires)) {
             $classe = "class=obligatoire";
         } else {
             $classe = "";
         }
         $label = formatLabel($champs[$i]);
         //on cree les champs de formulaire selon leur type
         switch ($typeChamp[$i]) {
             case "INTEGER":
                 //int sylob
                 formInteger($champs[$i], $valeurs[$i], $disabled, $classe);
                 break;
             case "SERIAL":
                 //id
                 $id = $valeurs[$i];
                 //recupere l'id
                 echo "<input type=hidden name=id value='" . $id . "'>";
                 break;
             case "FLOAT":
                 //duree ou prix
                 if ($champs[$i] == "duree") {
                     echo "<td>" . $label . " </td><td><input type=text " . $disabled . " " . $classe . " name=" . $champs[$i] . " value = '" . $valeurs[$i] . "' onKeyPress='return chiffres(event);'> heure(s)</td>";
                 } else {
                     echo "<td>" . $label . " </td><td><input type=text " . $disabled . " " . $classe . " name=" . $champs[$i] . " value = '" . $valeurs[$i] . "' onKeyPress='return chiffres(event);'> &euro; HT</td>";
                 }
                 break;
             case "DATE":
                 //date sylob
                 formDate($champs[$i], $valeurs[$i], $disabled);
                 break;
             case "DATETIME YEAR TO MINUTE":
                 //date + heure sylob
                 if (isset($_GET['debut'])) {
                     //echo  $_GET['debut'];
                     formHeure($champs[$i], $_GET['debut'], $disabled);
                 } else {
                     //echo $valeurs[$i];
                     formHeure($champs[$i], $valeurs[$i], $disabled);
                 }
                 break;
             case "CHAR":
                 //char sylob
                 formChar($champs[$i], $valeurs[$i], $disabled, $classe);
                 break;
             case "VARCHAR":
                 //textarea
                 echo "</TR><TR><td>" . $label . " </td><td colspan=5><textarea " . $disabled . " name=" . $champs[$i] . " cols=50 rows=5>" . utf8_encode($valeurs[$i]) . "</textarea></td></TR><TR>";
                 break;
             default:
                 echo "pas traité :" . $champs[$i] . " - " . $typeChamp[$i];
                 break;
         }
         if ($i % 3 == 0) {
             echo "<tr><td colspan=6>&nbsp;</td></tr>";
         }
     }
     //si on vient du calendrier on recuperre source
     if (isset($source) and $source == "calendrier") {
         echo "<input type=hidden " . $disabled . " name=source value=" . $source . ">";
     }
     if ($entite != "materiel_infos") {
         echo "      </TR> \r\n                        <TR>\r\n                            <TD COLSPAN=6 align = center>\r\n                                <input type=button " . $disabled . " id=monform name=monform onclick=verifForm(this.form); value=Valider />\r\n                            </TD>\r\n                        </TR>\r\n                    </TABLE>               \r\n                </form>\r\n            </div>";
     }
 }