Ejemplo n.º 1
0
 /**
  * Get controls with a control area
  *
  * @param $control_area_id  
  * @return array with controls as objects or arrays
  */
 function get_controls_by_control_area($control_area_id)
 {
     $control_area_id = (int) $control_area_id;
     $controls_array = array();
     $sql = "SELECT * FROM controller_control WHERE control_area_id={$control_area_id}";
     $this->db->query($sql);
     while ($this->db->next_record()) {
         $control = new controller_control($this->unmarshal($this->db->f('id'), 'int'));
         $control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
         $control->set_description($this->unmarshal($this->db->f('description', true), 'string'));
         $control->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
         $control->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
         $control->set_procedure_id($this->unmarshal($this->db->f('procedure_id'), 'int'));
         $control->set_procedure_name($this->unmarshal($this->db->f('procedure_name', true), 'string'));
         $control->set_requirement_id($this->unmarshal($this->db->f('requirement_id'), 'int'));
         $control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id'), 'int'));
         $control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id'), 'int'));
         $control->set_control_area_id($this->unmarshal($this->db->f('control_area_id'), 'int'));
         $control->set_repeat_type($this->unmarshal($this->db->f('repeat_type'), 'int'));
         $control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval'), 'int'));
         $controls_array[] = $control->toArray();
     }
     if (count($controls_array) > 0) {
         return $controls_array;
     } else {
         return null;
     }
 }