Location: PHPKode > projects > MyPhpMoney > myphpmoney_2.0/public_html/style/dynamique.php
<?php
/**
 * $Id: dynamique.php 409 2007-04-07 13:47:50Z hpfn $
 *
 * Author     : courou&#64;users.sourceforge.net
 * Website    : http://allreponse.ath.cx
 *
 * Support    : http://sourceforge.net/projects/myphpmoney/
 * CVS        : http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/myphpmoney/
 */
?>

<script type="text/javascript">
// <![CDATA[
<!--

<?php
/**
 * Contruct the value for the select array account.php
 */

if (isset($sess_pid) && $sess_pid != '' && !defined('__DOC__')) {
     if (!defined('__OPTION_CONFIG__')) {
	     if (isset($_POST['MODIF_ACCOUNT']) && isset($_POST['ID'])) {
		     $_POST['MODIF_ACCOUNT'] = SQL_Clean($_POST['MODIF_ACCOUNT']);
		     $_POST['ID'] = SQL_Clean($_POST['ID']);
		     $_POST['T_TIERS'] = SQL_JsTiers($_POST['MODIF_ACCOUNT'],$_POST['ID']);
        }
        $_POST['TID']  = isset($_POST['ID']) ? $_POST['ID'] : SQL_IdAccount('');

/**
 * DEBUT ARRAY JAVASCRIPT
 */
     echo " var First = new Array() \n";

     // Add courou 27/10/2002 for display the virement only 2 account create
     // Variable sert egalement au fichier account
     if (SQL_CountThird(__PART_ID__) == 1) {
      $_MPM['other'] = "AND CATID <> ".__PART_ID__;
     }

     // Add courou 23/03/2003 for Opening of account
     if (isset($_POST['MODIF_ACCOUNT']) && is_array($_POST['MODIF_ACCOUNT'])) {
      $_MPM['other_open'] = '';
     } else {
      $_MPM['other_open'] = "AND CATID <> ".__OPEN_PART__;
     }

       $db->query (
          "SELECT DISTINCT CAT,CATID
          FROM ".$_MPM['table'][0]."
          WHERE USERID='$sess_pid'
          AND CAT <> ''
          ".$_MPM['other_open']." ".$_MPM['other']."
          ORDER BY CAT ASC"
       );


     $TID2 = SQL_SearchIdThird(0,'',SQL_NameAccount($_POST['TID']));

     $i=0;
      while ($db->next_record()) {
          echo "\n\t First[$i] = new Entry(\"('".$db->f('CATID')."')\", \"('".$tools->Reduit_chaine($tools->add_slashes($db->f('CAT')),__LENGTH_PART_THIRD__,0)."')\") \n\n";
          echo " var Second".$db->f('CATID')." = new Array() \n";

     $other_db->query (
          "SELECT THIRDID,CATID,THIRD FROM ".$_MPM['table'][4]."
          WHERE CATID='".$db->f('CATID')."' AND USERID='$sess_pid'
          AND THIRDID <> '".$TID2."' ORDER BY THIRD ASC"
     );

       $j=0;
         while ($other_db->next_record()) {
           $ID_CATEGORIE = $other_db->f('CATID');
           echo "\t Second".$other_db->f('CATID')."[$j] = new Entry(\"('".$other_db->f('THIRDID')."')\", \"('".$tools->Reduit_chaine($tools->add_slashes($other_db->f('THIRD')),__LENGTH_PART_THIRD__,0)."')\") \n";
          $j++;
         } // end of while $other_db

          if (isset($ID_CATEGORIE) && $ID_CATEGORIE != __PART_ID__ && $ID_CATEGORIE != __OPEN_PART__) {
                  echo "\t Second".$ID_CATEGORIE."[$j] = new Entry(\"('".__ANOTHER_ACCOUNT__."')\", \"('".$_VAR['ACCOUNT_ANOTHER']." ".$_VAR['LANG_ACCOUNT_6']."')\") \n";
          } else {
                  echo " \n";
          }
     $i++;
     } // end of while $db

echo "\t First[$i]  = new Entry(\"('".__ANOTHER_ACCOUNT__."')\", \"('".$_VAR['ACCOUNT_ANOTHER']." ".$_VAR['LANG_ACCOUNT_5']."')\") \n\n";
echo " var Second".__ANOTHER_ACCOUNT__." = new Array() \n";

/**
 * FIN ARRAY JAVASCRIPT
 */
?>
// Display the another select menu
// @param CurrentForm   le document form
// @param Selected      la valeur de la selection
function PopulateSecond(CurrentForm,Selected) {
      if (Selected != 0) {
          var SelectedArray = eval('Second' + Selected)
          while (SelectedArray.length < CurrentForm.tiers.options.length) {
               CurrentForm.tiers.options[(CurrentForm.tiers.options.length - 1)] = null;
          }

          var Exist = false;
          for (var i=0; i<SelectedArray.length; i++) {
               eval('CurrentForm.tiers.options[i]=' + 'new Option' + SelectedArray[i].Name);
               eval('CurrentForm.tiers.options[i].value=' + SelectedArray[i].ID);

               // Select the element if existing else selected the first element
               if (CurrentForm.tiers.options[i].selected == false && eval('CurrentForm.tiers.options[i].value=' + SelectedArray[i].ID) == '<?php if (isset($_POST['T_TIERS']) && $_POST['T_TIERS']) echo $_POST['T_TIERS']; ?>') {
                         CurrentForm.tiers.options[i].selected = true;
                Exist = true;
               } else if (Exist == false && CurrentForm.tiers.options[i].selected == false) {
                         CurrentForm.tiers.options[0].selected = true;
               }
          } // end of for i
      } else {
          Selected = CurrentForm.cat.options[CurrentForm.cat.selectedIndex - 1].value;
          CurrentForm.cat.selectedIndex = CurrentForm.cat.selectedIndex - 1;
          var SelectedArray = eval('Second' + Selected)

          // show the layer for add the news third and part
          if (SelectedArray.length == 0) {
            show('container1'); hide('container2');
          }

          while (SelectedArray.length < CurrentForm.tiers.options.length) {
               CurrentForm.tiers.options[(CurrentForm.tiers.options.length - 1)] = null;
          }

          for (var i=0; i < SelectedArray.length; i++) {
               eval('CurrentForm.tiers.options[i]=' + 'new Option' + SelectedArray[i].Name);
               eval('CurrentForm.tiers.options[i].value=' + SelectedArray[i].ID);
          }
      }
} // end function PopulateSecond

<?php

} else { // end of else __OPTION_CONFIG__ (option.php)

   // FOR NOTICE ERROR ALL APPLICATION (DIRECTORY DUMP)
   if (!isset($_MPM['DirDump'])) $_MPM['DirDump'] = MPM_is_dir($_MPM['dir_dump'],md5($sess_pid));
?>

// THE TEMPLATES -- CHOICE FOR THE LAYER DISPLAY -- FILE OPTION
// @param nContenu      le contenu qui doit etre afficher
function Check_layer(nContenu) {
var Contenu = '';
     <?php if ($_MPM['DirDump'] && $OPTION_CONFIG != 0) { ?>
     if ((!opera) && (nContenu >=0 && nContenu <= 60)) {
          document.forms["form1"].P_FILE[0].checked=false;
          document.forms["form1"].P_FILE[1].checked=false;
          document.forms["form1"].P_FILE[2].checked=false;
     }
     <?php } ?>

     switch(+nContenu) {
                case 0 : // AUTOMATIQUE DUMP
                         document.forms["form1"].P_PASS.checked=false;
                         document.forms["form1"].LANG_ADD.checked=false;
<?php if ($OPTION_CONFIG != 1) { ?>
                         def(); scroll_bas();
                         Contenu+= MiseJour;
                         document.forms["form"].CHAMPS_HIDDEN.value='1';
                         sleep(1000000); document.forms["form"].submit();
<?php } ?>
                    break;
                case 1 : // STOP THE AUTOMATIQUE DUMP
                         def(); scroll_bas();
                         document.forms["form1"].P_PASS.checked=false;
                         document.forms["form1"].LANG_ADD.checked=false;
                         Contenu+= MiseJour;
                         document.forms["form"].CHAMPS_HIDDEN.value='2';
                         sleep(1000000); document.forms["form"].submit();
                    break;
                case 2 : // ACTIVE DELETE AUTOMATIQUE
                         document.forms["form1"].P_PASS.checked=false;
                         document.forms["form1"].LANG_ADD.checked=false;
<?php if ($OPTION_CONFIG == 0) { ?>
                         def(); scroll_bas();
                         document.forms["form"].SAUV_AUTO[0].checked=false;
                         document.forms["form"].SAUV_AUTO[1].checked=true;
                         Contenu+= '<?php XHTML_DisplayHr($_VAR['MESSAGE_HT_ACCESS'][3]); ?>';
<?php } else { ?>
                         document.forms["form"].SAUV_AUTO[0].checked=true;
                         document.forms["form"].SAUV_AUTO[1].checked=false;
     <?php if ($OPTION_SAUV_AUTO != 1) { ?>
                         def(); scroll_bas();
                         Contenu+= MiseJour;
                         document.forms["form"].CHAMPS_HIDDEN.value='3';
                         sleep(1000000); document.forms["form"].submit();
     <?php } ?>
<?php } ?>
                    break;
                case 3 : // STOP DELETE AUTOMATIQUE
                         document.forms["form1"].P_PASS.checked=false;
                         document.forms["form1"].LANG_ADD.checked=false;
<?php if ($_MPM['DirDump'] && $OPTION_CONFIG != 0) { ?>
                         def(); scroll_bas();
                         Contenu+= MiseJour;
                         document.forms["form"].CHAMPS_HIDDEN.value='4';
                         sleep(1000000); document.forms["form"].submit();
<?php } ?>
                    break;
                case 4 : // START CHECK APPLICATION
                         document.forms["form1"].P_PASS.checked=false;
                         document.forms["form1"].LANG_ADD.checked=false;
<?php if ($OPTION_NEW_APPLI != 1) { ?>
                         def(); scroll_bas();
                         Contenu+= MiseJour;
                         document.forms["form"].CHAMPS_HIDDEN.value='5';
                         sleep(1000000); document.forms["form"].submit();
<?php } ?>
                    break;
                case 5 : // STOP CHECK APPLICATION
                         document.forms["form1"].P_PASS.checked=false;
                         document.forms["form1"].LANG_ADD.checked=false;
<?php if ($OPTION_NEW_APPLI != 0) { ?>
                         def(); scroll_bas();
                         Contenu+= MiseJour;
                         document.forms["form"].CHAMPS_HIDDEN.value='6';
                         sleep(1000000); document.forms["form"].submit();
<?php } ?>
                    break;
                case 50 : // MODIFIED THE PASSWORD
                         def(); scroll_bas();
                         document.forms["form1"].P_PASS.checked=true;
                         document.forms["form1"].LANG_ADD.checked=false;
                         Contenu+= '<?php XHTML_DisplayHr($_VAR['MESSAGE_HT_ACCESS'][4]); ?>\n';
                         <?php
                          $_MPM['BeginMixed'] = array
                          (
                              'SELF_OP'           => $_MPM['http'][7],
                              'CHOIX_PASSWD'      => $_VAR['CHOIX_PASS_2'],
                              'CHOIX_OPT_PASS_1'  => $_VAR['CHOIX_OPT_PASS_1'],
                              'CHOIX_OPT_PASS_2'  => $_VAR['CHOIX_OPT_PASS_2']
                         );
                         ?>
                         Contenu+= '<?php XHTML_SetFile('form_option_password.tpl',$_MPM['BeginMixed'],2); ?>\n';
                    break;
                case 55 : // ADD THE LANGUAGE
                Largeur=screen.availWidth / 3;
                         def(); scroll_bas();
                         document.forms["form1"].P_PASS.checked=false;
                         document.forms["form1"].LANG_ADD.checked=true;
                         Contenu+= '<?php XHTML_DisplayHr($_VAR['MESSAGE_HT_ACCESS'][15]); ?>';
                         Contenu+= '<?php if (isset($_MPM['lang_verif_id'])) echo XHTML_DisplayLanguage($_MPM['lang_verif_id']); ?>';
                    break;
<?php if ($_MPM['DirDump'] && $OPTION_CONFIG != 0) { ?>
                case 100 : // DOWNLOAD THE DUMP
                         def(); scroll_bas();
                         document.forms["form1"].P_PASS.checked=false;
                         document.forms["form1"].LANG_ADD.checked=false;
                         Contenu+= '<?php XHTML_DisplayHr($_VAR['MESSAGE_HT_ACCESS'][7]); ?>';
                         Contenu+= '<?php XHTML_ListDir($_MPM['dir_dump'],'telecharger',1,'','','1','');?>';
                    break;
                case 101 : // INSERT INTO THE DUMP
                         def(); scroll_bas();
                         document.forms["form1"].P_PASS.checked=false;
                         document.forms["form1"].LANG_ADD.checked=false;
                         Contenu+= '<?php XHTML_DisplayHr($_VAR['MESSAGE_HT_ACCESS'][8]); ?>';
                         Contenu+= '<?php XHTML_ListDir($_MPM['dir_dump'],'OPT',2,'','','1','');?>\n';
                    break;
                case 102 : // DELETE THE DUMP
                         def(); scroll_bas();
                         document.forms["form1"].P_PASS.checked=false;
                         document.forms["form1"].LANG_ADD.checked=false;
                         Contenu+= '<?php XHTML_DisplayHr($_VAR['MESSAGE_HT_ACCESS'][9]); ?>';
                         Contenu+= '<?php XHTML_ListDir($_MPM['dir_dump'],'OPT',3,'[]','S','3',' multiple="multiple"');?>';
                    break;
<?php } ?>
          }
     return Contenu;
}

// For the button cancel in option
function Vide_option() {
          document.forms["form1"].P_PASS.checked=false;
          document.forms["form1"].LANG_ADD.checked=false;
<?php
   if ($_MPM['DirDump'] && $OPTION_CONFIG != 0) { ?>
     if (!opera) {
          document.forms["form1"].P_FILE[0].checked=false;
          document.forms["form1"].P_FILE[1].checked=false;
          document.forms["form1"].P_FILE[2].checked=false;
     }
<?php } ?>
def(); scroll_haut();
}

<?php
     }  // end of if (isset($sess_pid) && $sess_pid != '' && !defined('__DOC__'))
} // end of !__OPTION_CONFIG__
?>

//-->
// ]]>
</script>
Return current item: MyPhpMoney