function populate(int $control_id, &$control)
 {
     if ($control == null) {
         $start_date = date("d.m.Y", $this->db->f('start_date'));
         $end_date = date("d.m.Y", $this->db->f('end_date'));
         $control = new controller_control((int) $control_id);
         $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($start_date);
         $control->set_end_date($end_date);
         $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_control_area_name($this->unmarshal($this->db->f('control_area_name', true), 'string'));
         $control->set_equipment_type_id($this->unmarshal($this->db->f('equipment_type_id'), 'int'));
         $control->set_equipment_id($this->unmarshal($this->db->f('equipment_id'), 'int'));
         $control->set_location_code($this->unmarshal($this->db->f('location_code', true), 'string'));
         $control->set_location_id($this->unmarshal($this->db->f('location_id'), 'string'));
         $control->set_repeat_type($this->unmarshal($this->db->f('repeat_type'), 'int'));
         $control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval'), 'int'));
     }
     return $control;
 }
 /**
  * Get single control
  * 
  * @param	$id	id of the control to return
  * @return a controller_control object
  */
 function get_single($id)
 {
     $id = (int) $id;
     $joins .= " {$this->left_join} controller_procedure ON (c.procedure_id = controller_procedure.id)";
     $joins .= " {$this->left_join} fm_responsibility_role ON (c.responsibility_id = fm_responsibility_role.id)";
     $sql = "SELECT c.*, controller_procedure.title AS procedure_name, fm_responsibility_role.name AS responsibility_name ";
     $sql .= "FROM controller_control c {$joins} ";
     $sql .= "WHERE c.id = " . $id;
     $this->db->query($sql, __LINE__, __FILE__);
     $this->db->next_record();
     $control = new controller_control((int) $id);
     $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_responsibility_name($this->unmarshal($this->db->f('responsibility_name', true), 'string'));
     $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_type_label($control->get_repeat_type());
     $control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval'), 'int'));
     $category = execMethod('phpgwapi.categories.return_single', $this->unmarshal($this->db->f('control_area_id'), 'int'));
     $control->set_control_area_name($category[0]['name']);
     return $control;
 }