Change Calendar

2011-03-10
2013-06-19
  • Paul Chapman
    Paul Chapman
    2011-03-10

    Is there a plan to add a Change Calendar to iTop in the near future?

     
  • PMan
    PMan
    2011-12-05

    I am interested in this feature as well. A calendar or scheduler with recurring events, so that a maintenance schedule can be implemented. It does not have to have a calendar view (it would be nice, but is not necessary), just the ability to schedule work.

    An option would be to integrate or synchronize with something like webcalendar.

     
  • Brant Bady
    Brant Bady
    2012-01-18

    Have to say that ITOP is very full featured and we are quite excited about rolling it out into our organization, however the big missing feature we can see is a change management calendar.

    In fact we have prototyped some simple integration with alfresco, to replace the Documents feature in ITOP with an iframe window into Alfresco share where we can have individual calendar items for CI's, but we havent came up with a shared calendar that would be useful for managers to see all events for a particular day across all CI's or a class of CI's.

    Anyways, a fully featured shared calendar with alternative views of single or aggregated concerns for the purposes of change management would be a very welcome additionto ITOP, either built in or integrated in.

     
  • Chris R
    Chris R
    2013-02-13

    +1 for change management calendar

     
  • Chris R
    Chris R
    2013-06-19

    Here is a script that can be run with Webcalendar (http://www.k5n.us/webcalendar.php) to populate a calendar. It creates a file called schedule.ics that can be imported by the cron job.

    Does anyone know how to integrate a link to the calendar in itop?

    CRON

    */5 * * * * /usr/bin/php /var/www/html/web/web/webcalendar/get_ical.php >> /var/log/get_ical.log 2>&1
    */4 * * * * cd /var/www/html/web/web/webcalendar/tools && /usr/bin/php ./reload_remotes.php >/dev/null
    
    ###get_ical.php
    
    <?php
    # Connect to the database
    $host     = "localhost";
    $dbuser   = "root";
    $dbpasswd = "Password";
    $database = "itopdev";
    $connect  = mysql_connect($host, $dbuser, $dbpasswd) or die(mysql_error());
    mysql_select_db($database,$connect) or die(mysql_error());
    ?>
    
    <?php
    # Query the database and get the results
    $sql      = "SELECT * FROM `itopdev`.`view_Change` WHERE `start_date` IS NOT NULL ";
    $result   = mysql_query($sql);
    $nresult  = mysql_num_rows($result);
    ?>
    <?php
    $ics_contents  = "BEGIN:VCALENDAR\n";
    $ics_contents .= "VERSION:2.0\n";
    $ics_contents .= "PRODID:PHP\n";
    $ics_contents .= "METHOD:PUBLISH\n";
    $ics_contents .= "X-WR-CALNAME:Schedule\n";
    
    # Change the timezone as well daylight settings if need be
    $ics_contents .= "X-WR-TIMEZONE:America/New_York\n";
    $ics_contents .= "BEGIN:VTIMEZONE\n";
    $ics_contents .= "TZID:America/New_York\n";
    $ics_contents .= "BEGIN:DAYLIGHT\n";
    $ics_contents .= "TZOFFSETFROM:-0500\n";
    $ics_contents .= "TZOFFSETTO:-0400\n";
    $ics_contents .= "DTSTART:20070311T020000\n";
    $ics_contents .= "RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\n";
    $ics_contents .= "TZNAME:EDT\n";
    $ics_contents .= "END:DAYLIGHT\n";
    $ics_contents .= "BEGIN:STANDARD\n";
    $ics_contents .= "TZOFFSETFROM:-0400\n";
    $ics_contents .= "TZOFFSETTO:-0500\n";
    $ics_contents .= "DTSTART:20071104T020000\n";
    $ics_contents .= "RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\n";
    $ics_contents .= "TZNAME:EST\n";
    $ics_contents .= "END:STANDARD\n";
    $ics_contents .= "END:VTIMEZONE\n";
    ?>
    
    <?php
    while ($schedule_details = mysql_fetch_assoc($result)) {
      $id            = $schedule_details['id'];
    echo $schedule_details['start_date'];
    echo $schedule_details['end_date'];
    $starttime = new DateTime($schedule_details['start_date']);
    $endtime = new DateTime($schedule_details['end_date']);
      $start_date    = $starttime->format('Y-m-d');
      $start_time    = $starttime->format('H:i:s');
      $end_date      = $endtime->format('Y-m-d');
      $end_time      = $endtime->format('H:i:s');
      $category      = $schedule_details['title'];
      $name          = $schedule_details['friendlyname'];
      $location      = $schedule_details['agent_id_friendlyname'];
      $description   = $schedule_details['description'];
    
      # Remove '-' in $start_date and $end_date
      $estart_date   = str_replace("-", "", $start_date);
      $eend_date     = str_replace("-", "", $end_date);
    
      # Remove ':' in $start_time and $end_time
      $estart_time   = str_replace(":", "", $start_time);
      $eend_time     = str_replace(":", "", $end_time);
    
      # Replace some HTML tags
      $name          = str_replace("<br>", "\\n",   $name);
      $name          = str_replace("&amp;", "&",    $name);
      $name          = str_replace("&rarr;", "-->", $name);
      $name          = str_replace("&larr;", "<--", $name);
      $name          = str_replace(",", "\\,",      $name);
     $name          = str_replace(";", "\\;",      $name);
    
      $location      = str_replace("<br>", "\\n",   $location);
      $location      = str_replace("&amp;", "&",    $location);
      $location      = str_replace("&rarr;", "-->", $location);
      $location      = str_replace("&larr;", "<--", $location);
      $location      = str_replace(",", "\\,",      $location);
      $location      = str_replace(";", "\\;",      $location);
    
      $description   = str_replace("<br>", "\\n",   $description);
      $description   = str_replace("&amp;", "&",    $description);
      $description   = str_replace("&rarr;", "-->", $description);
      $description   = str_replace("&larr;", "<--", $description);
      $description   = str_replace("<em>", "",      $description);
      $description   = str_replace("</em>", "",     $description);
    
      # Change TZID if need be
      $ics_contents .= "BEGIN:VEVENT\n";
      $ics_contents .= "DTSTART:"     . $estart_date . "T". $estart_time . "\n";
       $ics_contents .= "DTEND:"       . $eend_date . "T". $eend_time .      "\n";
        $ics_contents .= "DTSTAMP:"     . date('Ymd') . "T". date('His') . "Z\n";
       $ics_contents .= "LOCATION:"    . $location . "\n";
       $ics_contents .= "DESCRIPTION:" . $description . "\n";
       $ics_contents .= "SUMMARY:"     . $name . "\n";
       $ics_contents .= "UID:"         . $id . "\n";
       $ics_contents .= "SEQUENCE:0\n";
       $ics_contents .= "END:VEVENT\n";
     }
     ?>
    
     <?php
     $ics_contents .= "END:VCALENDAR\n";
    
     # File to write the contents
     $ics_file   = '/var/www/html/web/web/webcalendar/schedule.ics';
    
     if (is_writable($ics_file)) {
      if (!$handle = fopen($ics_file, 'w')) {
         echo "Cannot open file ($ics_file)\n\n";
         exit;
       }
    
       # Write $ics_contents to opened file
       if (fwrite($handle, $ics_contents) === FALSE) {
         echo "Cannot write to file ($ics_file)\n\n";
         exit;
       }
    
       # echo "Success, wrote to <b>schedule.ics</b><br>\n\n";
    
       fclose($handle);
    
     } else {
        echo "The file <b>$ics_file</b> is not writable\n\n";
     }
     ?>
    
     
    Last edit: Chris R 2013-06-19