Urlaubsmodus Teil1

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Urlaubsmodus Teil1

      In den Settings habe ich eingetragen das der Urlaubsmodus minimum 7 Tage geht.

      Das wird beim aktivieren auch eingetragen.

      Nun möchte ich aber, das man nach 3 Tagen den Urlaubsmodus beenden kann und dann aber 5 Tage warten muss um diesen wieder zu aktivieren.

      meine class.ShowSettingsPage.php sieht so aus :
      siehe anhang

      class.ShowSettingsPage.php.txt

      in den tpl files ist der Eintrag für die Checkbox zum Urlaubsmodus bearbeitet worden.


      PHP Source Code

      1. 'canVacationDisbaled' => $USER['urlaubs_until'] > TIMESTAMP + 259200,


      dieser Code soll dafür sein, das in der settings.vacation.tpl die Checkbox erst nach 3 Tagen aktiv sein soll


      HTML Source Code

      1. <span>{$LNG.op_vacation_mode_active_message} {$vacationUntil}</span>
      2. <div class="clear" style="margin-bottom:10px;"></div>
      3. <input style="float:left; margin:5px 6px 0 0;" id="vacationID" name="vacation" type="checkbox" value="1" {if !$canVacationDisbaled}disabled{/if}>
      4. <label for="vacationID" class="left_label" style="width:auto;">{$LNG.op_end_vacation_mode}</label>
      5. <div class="clear"></div>

      das wäre der Code für die Checkbox .......leider bleibt dieser aber so, das ich den Urlaubsmodus jederzeit beenden kann.

      Ändere ich den Code in der php auf

      PHP Source Code

      1. 'canVacationDisbaled' => $USER['urlaubs_until'] < TIMESTAMP,

      ab, dann ich die Checkbox nicht aktiv und bleibt auch bis zum ende des Urlaubsmodus inaktiv.

      Genaus so möchte ich damit verfahren das nach einem vorzeitigen Urlaubsabbruch dieser erst wieder nach 5 Tagen aktiviert kann.

      Wer kann da helfen ?

      Danke schonmal im vorraus
    • Danter14 wrote:

      Hi, this is very simple you can add a column in the users table. then when canceling add time + 5 × 24 * 60 * 60
      when I cancel the vacationmode I do this :

      PHP Source Code

      1. private function sendVacation()
      2. {
      3. global $USER, $PLANET, $CONF, $LNG;
      4. $delete = HTTP::_GP('delete', 0);
      5. $vacation = HTTP::_GP('vacation', 0);
      6. $SQL = "";
      7. if($vacation == 1 && $USER['urlaubs_until'] > TIMESTAMP + 259200) {
      8. $SQL .= "UPDATE ".USERS." SET
      9. urlaubs_modus = '0',
      10. urlaubs_until = ".(TIMESTAMP + 432000)."
      11. WHERE id = ".$USER['id'].";
      12. UPDATE ".PLANETS." SET
      13. last_update = ".TIMESTAMP.",
      14. energy_used = '10',
      15. energy = '10',
      16. metal_mine_porcent = '10',
      17. crystal_mine_porcent = '10',
      18. deuterium_sintetizer_porcent = '10',
      19. solar_plant_porcent = '10',
      20. fusion_plant_porcent = '10',
      21. solar_satelit_porcent = '10'
      22. WHERE id_owner = ".$USER["id"].";";
      23. }
      Display All

      set urlaubs_modus to 0 and set a new urlaubs_until time ........

      the problem is, that i have no clue how to disable the checkbox in the tpl .......
      as i discribet above it only works when i use this code :

      PHP Source Code

      1. 'canVacationDisbaled' => $USER['urlaubs_until'] < TIMESTAMP,
      so the checkbox is disabled until the vacation_mode ends .......

      but i whant that the vacation_mode can be disabled after 3 days and then they have to wait 5 days to aktivate them new
    • Addon new database

      SQL-Query

      1. ALTER TABLE `uni1_users`
      2. ADD `urlaubs_modus_att` int(11) unsigned NOT NULL DEFAULT '0';
      search

      PHP Source Code: class.ShowSettingsPage.php

      1. 'ref_active' => Config::get('ref_active'), // Line 90
      addon afte

      PHP Source Code: class.ShowSettingsPage.php

      1. 'blocage_MV' => ($USER['urlaubs_modus_att'] > TIMESTAMP) ? $USER['urlaubs_modus_att'] - TIMESTAMP : false,
      search

      Source Code: class.ShowSettingsPage.php

      1. if($vacation == 1 && $USER['urlaubs_until'] <= TIMESTAMP) {
      2. $SQL .= "UPDATE ".USERS." SET
      3. urlaubs_modus = '0',
      4. urlaubs_until = '0'
      Replace by

      SQL-Query: class.ShowSettingsPage.php

      1. UPDATE ".USERS." SET
      2. urlaubs_modus = '0',
      3. urlaubs_until = '0',
      4. urlaubs_modus_att = ".TIMESTAMP + (5*24*60*60)."

      .tpl

      Smarty-Template

      1. <input style="float:left; margin:5px 6px 0 0;" id="vacationID" name="vacation" type="checkbox" value="1">
      replace by

      Source Code

      1. {if !$blocage_MV}
      2. <input style="float:left; margin:5px 6px 0 0;" id="vacationID" name="vacation" type="checkbox" value="1">
      3. {else}
      4. <span class="countdown2" secs="{$blocage_MV}"></span>
      5. {/if}
      enjoy (Not TESTED)
      Open the forum of my own CMS here
    • Hello,

      Thats alot of code,
      I did this completly differently and in a much shorter way without changing database or creating new data.

      Example

      1) before you go into vacation mode: urlaubs_modus = 0 and urlaubs_until = 0 for example
      2) you are in vacation mode: urlaubs_modus = 1 and urlaubs_until = TIMESTAMP + time() to spend in vacation
      3) remove vacation mode: urlaubs_modus = 0 AND urlaubs_until = TIMESTAMP + time() before next allowed vacation.

      Why can you use it like that, you can make the verification on the urlaub_modus = (0,1) if answer is 0 and urlaubs_until > time(), then you have to wait before you can go into vmode, if answer is 1 and urlaubs_until > time(), then you have to wait before you can leave into vmode,

      This make you at the end a simple verification in the vmode function to check if answer (0,1) and apply correct error message query..
      Xterium: The Game
      War Of Alliance: The Game
      Antaris-Legacy: The Game
      Ogame RD: The Game - Coming Soon
      Erevolution: The Game - Coming Soon


      I do only fix 2moons default errors with the help of this forum. Dedicated support can be asked via email to support[@]xterium.space.
    • Thisishowwedoit wrote:

      Hello,

      Thats alot of code,
      I did this completly differently and in a much shorter way without changing database or creating new data.

      Example

      1) before you go into vacation mode: urlaubs_modus = 0 and urlaubs_until = 0 for example
      2) you are in vacation mode: urlaubs_modus = 1 and urlaubs_until = TIMESTAMP + time() to spend in vacation
      3) remove vacation mode: urlaubs_modus = 0 AND urlaubs_until = TIMESTAMP + time() before next allowed vacation.

      Why can you use it like that, you can make the verification on the urlaub_modus = (0,1) if answer is 0 and urlaubs_until > time(), then you have to wait before you can go into vmode, if answer is 1 and urlaubs_until > time(), then you have to wait before you can leave into vmode,

      This make you at the end a simple verification in the vmode function to check if answer (0,1) and apply correct error message query..
      that is what i have done .......

      the thing what i whant to konw is how can i dissable / enable the checkbox in settings.vacation.tpl and in settings.default.tpl ...... ?

      the code in settings.vacation.tpl is like this :

      HTML Source Code

      1. <div class="clear" style="margin-bottom:10px;"></div>
      2. <input style="float:left; margin:5px 6px 0 0;" id="vacationID" name="vacation" type="checkbox" value="1" {if !$canVacationDisabled}disabled{/if}>
      3. <label for="vacationID" class="left_label" style="width:auto;">{$LNG.op_end_vacation_mode}</label>
      4. <div class="clear"></div>


      and in ShowSettingsPage.php the line for canVacaationsDisabled looks like this :

      PHP Source Code

      1. 'canVacationDisabled' => $USER['urlaubs_until'] > TIMESTAMP + 259200,
      and this does not work ........
      the checkbox is aktiv so that i can disable the vacation .........

      ohter when i change the code for the canVacationDisabled to :

      PHP Source Code

      1. 'canVacationDisbaled' => $USER['urlaubs_until'] < TIMESTAMP,
      the checkbos is greyed and can not be used until the urlaubs_until time is reached

      you know what i mean ?
    • Hello

      If i understand, when you have to wait to go into vmode, or when u have to wait leave vmode, you want the check box disabled ?
      Xterium: The Game
      War Of Alliance: The Game
      Antaris-Legacy: The Game
      Ogame RD: The Game - Coming Soon
      Erevolution: The Game - Coming Soon


      I do only fix 2moons default errors with the help of this forum. Dedicated support can be asked via email to support[@]xterium.space.
    • Thisishowwedoit wrote:

      Hello

      If i understand, when you have to wait to go into vmode, or when u have to wait leave vmode, you want the check box disabled ?
      if vmode active i have to wait 3 days before i can deactivate vmode.
      if i have deactivate vmode i have to wait 5 days before i can activate vmode again

      this should be done with the checkbox in the tpl vmode active = wait time 3 days = checkbox greyed until the 3 days
      if vmode deactive =wait time 5 days = checkbox greyed until the 5 days ......
      the code for checking this i have posted above
    • 'is_greybox_active' => ($USER['urlaubs_modus'] == 0 && $USER['urlaubs_until'] > TIMESTAMP - 5 * 24 * 3600) || ($USER['urlaubs_modus'] == 1 && $USER['urlaubs_until'] > TIMESTAMP - 3 * 24 * 3600) ? "disabled" : "",

      This will work in with the data 2moons will provide, but u will need to slightly adapt your queries as you changed some codes..

      There are 2 straight stripes that are replaced with an icon --'
      Xterium: The Game
      War Of Alliance: The Game
      Antaris-Legacy: The Game
      Ogame RD: The Game - Coming Soon
      Erevolution: The Game - Coming Soon


      I do only fix 2moons default errors with the help of this forum. Dedicated support can be asked via email to support[@]xterium.space.
    • Thanks for help ......

      i got it working now .... but i use my own code :D

      In the tpls there is now shown how to long you have to wait for canceling the vmode or to activate it again



      this is the view from page.settings.vacation.tpl