cloneCalendar() static public method

Duplicate all segments from a calendar to his clone
static public cloneCalendar ( $oldid, $newid )
$oldid
$newid
 /** Clone a calendar to another entity : name is updated
  *
  * @param $options array of new values to set
  **/
 function duplicate($options = array())
 {
     if (is_array($options) && count($options)) {
         foreach ($options as $key => $val) {
             if (isset($this->fields[$key])) {
                 $this->fields[$key] = $val;
             }
         }
     }
     $input = $this->fields;
     $oldID = $input['id'];
     unset($input['id']);
     if ($newID = $this->add($input)) {
         Calendar_Holiday::cloneCalendar($oldID, $newID);
         CalendarSegment::cloneCalendar($oldID, $newID);
         $this->updateDurationCache($newID);
         return true;
     }
     return false;
 }
 /** Clone a calendar to another entity : name is updated
  * @param $options array of new values to set
  **/
 function duplicate($options = array())
 {
     if (is_array($options) && count($options)) {
         foreach ($options as $key => $val) {
             if (isset($this->fields[$key])) {
                 $this->fields[$key] = $val;
             }
         }
     }
     $input = $this->fields;
     $oldID = $input['id'];
     unset($input['id']);
     $newID = $this->add($input);
     $calhol = new Calendar_Holiday();
     $calhol->cloneCalendar($oldID, $newID);
     $calseg = new CalendarSegment();
     $calseg->cloneCalendar($oldID, $newID);
     $this->updateDurationCache($newID);
 }