/** * @brief Create a new attachement * * @param Database &$database reference to the database object * @param User &$current_user reference to the user which is logged in * @param Log &$log reference to the Log-object * @param object &$element @li the element on which the file will be attached * @li For supported elements see Attachement::check_values_validity() * @param integer $type_id the ID of the attachement type (see Attachement::set_type_id()) * @param string $filename the filename of the new attachement (see Attachement::set_filename()) * @param string $name the name of the new attachement (see Attachement::set_name()) * @param boolean $show_in_table the "show_in_table" attribute of the new filename (see Attachement::set_show_in_table()) * * @warning You have to supply the full path from filesystem root in $filename!! * For more details see Attachement::set_filename(). * * @retval Attachement the new attachement * * @throws Exception if (this combination of) values is not valid * @throws Exception if there was an error * * @see DBElement::add() */ public static function add(&$database, &$current_user, &$log, &$element, $type_id, $filename, $name = '', $show_in_table = false) { if (!is_object($element)) { throw new Exception('$element ist kein Objekt!'); } return parent::add($database, $current_user, $log, 'attachements', array('name' => $name, 'class_name' => get_class($element), 'element_id' => $element->get_id(), 'type_id' => $type_id, 'filename' => $filename, 'show_in_table' => $show_in_table)); }