Announcement

Collapse
No announcement yet.

Calendar's categories - how to predetermine which categories are checked?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calendar's categories - how to predetermine which categories are checked?

    All categories of the calendar are checked by default and all events will show up in the calendar.
    Can categories be select during onLoad or onScriptInit?

  • #2
    This is the right question, in the right place.
    I am also very interested in this, but I have not yet managed to find out.

    Maybe very few users use a calendar and nobody knows the solution.

    Comment


    • #3
      to activate category at startup - onscriptinitcalendar event
      HTML Code:
      ?>
      <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
      <script>
          $( document ).ready(function() {
              filterCategory('EFF');
              filterCategory('SCNULLCAT');
          });
      </script>
      <?php

      Comment


      • #4
        Thank you very much nonkelmike for this solution.

        Now I can progress and start exploring how each user will only show his categories.

        Comment


        • #5
          Since there is no onFooter event in the calendar app I think it's the only way to solve this.

          Use the inspector to get your correct parameter to use in the filterCategory function

          Comment


          • #6
            I will research a little and when I find a solution I will publish it here.

            Comment


            • #7
              OK, as I said, I will continue to explore this, because I need a little different solution.

              The given solution from nonkelmike is very good for a calendar used by everyone.
              And on the basis of his solution, a new solution was created.

              But I needed a solution for an individual user, that is, a calendar based on the user.
              Therefore, I added new field in the user table named id_speciality field in which by double select I add the individual of the categories in the calendar, which I do not want to display as "checked"
              For example:
              the user has the following values in the id_speciality table: 30; 31; 34; 37
              These categories will be "unchecked" when the calendar is displayed
              The solution code is as follows:

              //************************************************** ************************************************** **************************************

              $check_sql = "SELECT name_user, id_speciality FROM user WHERE id_user = " . [var_user];
              sc_lookup(rs, $check_sql);

              if (isset({rs[0][0]})) // Row found
              {
              $disp_name = {rs[0][0]};
              $filter_category = {rs[0][1]};
              }
              else{
              $disp_name = "";
              $filter_category = "";
              }

              echo "<span style='font-size: 18px;font-weight: bold;'>".{lang_tbl_event}.": ".$disp_name."</span>";

              // ************************************************** ************************************************** **************************************

              $result = explode(";",$filter_category);

              // var_dump($result); // ***** Check if result is OK *****

              ?>

              <script src="<?php echo sc_url_library('sys', 'jquery-3.2.0', 'jquery-3.2.0.min.js'); ?>"></script>

              <script>

              $( document ).ready(function() {

              <?php foreach ($result as $key => $value) { ?>
              var val = "<?php echo $value ?>";
              filterCategory(val);
              <?php } ?>

              });

              </script>

              <?php
              // ************************************************** ************************************************** **************************************

              Now I think that this topic is solved in all possible ways and uses.

              Comment

              Working...
              X