/** * */ public function addCaptionFile($ps_filepath, $pn_locale_id, $pa_options = null) { if (!$this->getPrimaryKey()) { return null; } $t_caption = new ca_object_representation_captions(); if ($t_caption->load(array('representation_id' => $this->getPrimaryKey(), 'locale_id' => $pn_locale_id))) { return null; } $t_caption->setMode(ACCESS_WRITE); $t_caption->set('representation_id', $this->getPrimaryKey()); $va_tmp = explode("/", $ps_filepath); $t_caption->set('caption_file', $ps_filepath, array('original_filename' => caGetOption('originalFilename', $pa_options, array_pop($va_tmp)))); $t_caption->set('locale_id', $pn_locale_id); $t_caption->insert(); if ($t_caption->numErrors()) { $this->errors = array_merge($this->errors, $t_caption->errors); return false; } return $t_caption; }