protected function processDBData() { parent::processDBData(); if ($this->ui->getWidget('photo_time_zone')->value !== null && $this->ui->getWidget('camera_time_zone')->value !== null) { $num = $this->adjustTimeZone(); } else { $num = $this->addDateParts(); } $message = new SwatMessage(sprintf(Pinhole::ngettext('One photo has been updated.', '%s photos have been updated.', $num), SwatString::numberFormat($num))); $this->app->messages->add($message); if (isset($this->app->memcache)) { $this->app->memcache->flushNs('photos'); } }
protected function processDBData() { parent::processDBData(); $tags = $this->ui->getWidget('dst_tag')->getSelectedTagArray(); $dst_tag = new PinholeTagDataObject(); $dst_tag->setDatabase($this->app->db); $dst_tag->loadByName(key($tags), $this->app->getInstance()); // delete intersection tagged photos $sql = sprintf('delete from pinholephototagbinding where tag = %s and photo in (select photo from pinholephototagbinding where pinholephototagbinding.tag = %s)', $this->app->db->quote($this->source_tag->id, 'integer'), $this->app->db->quote($dst_tag->id, 'integer')); SwatDB::exec($this->app->db, $sql); // add source_tagged photos to dst_tagged photos $sql = sprintf('insert into pinholephototagbinding (photo, tag) select pinholephototagbinding.photo, %s from pinholephototagbinding where tag = %s', $this->app->db->quote($dst_tag->id, 'integer'), $this->app->db->quote($this->source_tag->id, 'integer')); SwatDB::exec($this->app->db, $sql); // delete source_tag $this->source_tag->delete(); $this->app->messages->add(new SwatMessage(sprintf(Pinhole::_('“%s” has been merged into “%s”'), $this->source_tag->title, $dst_tag->title))); }