/** * Updates the attachment titles. */ function convert_to_storage() { foreach ($this->attachments as $identifier => $copy) { $this->update_attachment_title($identifier, $this->title); } return parent::convert_to_storage(); }
/** * Updates the attachment titles. */ function convert_to_storage() { if ($this->_instance_mode === 'single' && !empty($this->title)) { foreach ($this->attachments as $identifier => $copy) { if ($copy->title === $this->title) { continue; } $this->update_attachment_title($identifier, $this->title); } } return parent::convert_to_storage(); }
/** * User-defined array sorting callback, used for sorting $attachments_info. * * See the usort() documentation for further details. * * @access protected * @param Array $a The first attachment info array. * @param Array $b The second attachment info array. * @return int A value according to the rules from strcmp(). */ static function _sort_attachments_info_callback($a, $b) { return midcom_helper_datamanager2_type_blobs::sort_attachments_cmp($a['object'], $b['object']); }
/** * User-defined array sorting callback, used for sorting $images. See the * usort() documentation for further details. * * @access protected * @param array $a The first image list. * @param array $b The second image list. * @return int A value according to the rules from strcmp(). * @todo compare based on metadata->score and filename (or title ???) */ function _sort_images_callback($a, $b) { // safety against broken images if (!empty($a['main']['object']) && !empty($b['main']['object'])) { $a_obj = $a['main']['object']; $b_obj = $b['main']['object']; } else { // Try to read the sort values from some other key if (is_array($a) && is_array($b)) { foreach ($a as $key => $data) { if (!empty($a[$key]['object']) && !empty($b[$key]['object'])) { $a_obj = $a[$key]['object']; $b_obj = $b[$key]['object']; } } } } if (empty($a_obj) && empty($b_obj)) { return 0; } return midcom_helper_datamanager2_type_blobs::sort_attachments_cmp($a_obj, $b_obj); }