Example #1
0
 protected function saveDBData()
 {
     $values = $this->ui->getValues(array('title', 'visible', 'machine_tag'));
     $this->metadata->title = $values['title'];
     $this->metadata->visible = $values['visible'];
     $this->metadata->machine_tag = $values['machine_tag'];
     if ($this->metadata->id === null) {
         $this->metadata->shortname = $this->generateShortname($this->metadata->title);
     }
     $flush_cache = $this->metadata->isModified() && $this->metadata->id !== null;
     $this->metadata->save();
     if (isset($this->app->memcache) && $flush_cache) {
         $this->app->memcache->flushNs('photos');
     }
     $message = new SwatMessage(sprintf(Pinhole::_('ā€œ%sā€ has been saved.'), $this->metadata->title));
     $this->app->messages->add($message);
 }
Example #2
0
 /**
  * Whether or not a name-value pair is valid for this meta tag
  *
  * @param string $name the name.
  * @param string $value the value.
  *
  * @return boolean true if the name-value pair is valid for this meta tag
  *                  and false if the name-value pair is not valid for this
  *                  meta tag.
  */
 private function isValid($name, $value)
 {
     $valid = false;
     $class_name = SwatDBClassMap::get('PinholeMetaData');
     $this->meta_data = new $class_name();
     $this->meta_data->setDatabase($this->db);
     // ensure meta data object exists
     $valid = $this->meta_data->loadByShortname($name, $this->instance);
     return $valid;
 }