Example #1
0
File: Photo.php Project: Tirme/blog
 protected function register()
 {
     $album = Podm::type('select', ['label' => 'Album', 'column' => 'Name', 'options' => function () {
         $options = [];
         $model = Field::getModel('Album');
         $albums = $model->getAll();
         foreach ($albums as $album) {
             $options[$album->getId()] = $album->name;
         }
         return $options;
     }, 'index' => true, 'rules' => ['required']]);
     $photos = Podm::type('photos', ['label' => 'Upload Photos', 'column' => 'Photos', 'rules' => ['required']]);
     $this->add('album_id', $album)->add('photos', $photos)->setFormAttributes(['class' => 'PhotoForm']);
 }
Example #2
0
 /**
  * Update field in storage, sets hashes for field and it's model
  * @param Field $field
  */
 public function updateFieldSync($field)
 {
     $this->query('update [fields] set [hash] = %s where [name] = %s and [table] = %s', $field->getHash(), $field->getName(), $field->getModel()->GetTableName());
     $this->updateModelSync($field->getModel());
 }