function setFromMap($map)
 {
     // normalize map
     $m = array('period' => false, 'startDate' => false, 'endDate' => false, 'startTime' => false, 'endTime' => false);
     $map = owa_lib::array_intersect_key($map, $m);
     // set default period if necessary
     if (empty($map['period']) && empty($map['startDate'])) {
         $this->is_default_period = true;
         $period = $this->getDefaultReportingPeriod();
     } elseif (empty($map['period']) && !empty($map['startDate']) && !empty($map['endDate'])) {
         $period = 'date_range';
     } else {
         $period = $map['period'];
     }
     //validate period value
     $valid = $this->isValid($period);
     if ($valid) {
         $this->period = $period;
     } else {
         $this->period = $this->getDefaultReportingPeriod();
         owa_coreAPI::debug("{$period} is not a valid period. Defaulting to default.");
     }
     $this->_setDates($map);
     $this->_setLabel($period);
     $this->_setDifferences();
 }
 /**
  * Sets properties that are needed to maintain state across most 
  * report and widget requests. This is used by many template functions.
  *
  */
 function _setLinkState()
 {
     // array of params to check
     $p = $this->get('params');
     // control array - will check for these params. If they exist it will return.
     $sp = array('period' => null, 'startDate' => null, 'endDate' => null, 'siteId' => null, 'startTime' => null, 'endTime' => null);
     // result array
     $link_params = array();
     if (!empty($p)) {
         $link_params = owa_lib::array_intersect_key($p, $sp);
     }
     // needed for forwards compatability with
     if (array_key_exists('site_id', $link_params) && !array_key_exists('siteId', $link_params)) {
         $link_params['siteId'] = $link_params['site_id'];
     }
     $this->t->caller_params['link_state'] = $link_params;
     $this->body->caller_params['link_state'] = $link_params;
     if (!empty($this->subview)) {
         $this->subview->body->caller_params['link_state'] = $link_params;
     }
 }