protected function loadData() { $tag_list = new PinholeTagList($this->app, $this->tag->name, true); $photos = $tag_list->getPhotos(); $order_array = array(); $class_name = SwatDBClassMap::get('PinholeImageSet'); $set = new $class_name(); $set->setDatabase($this->app->db); $set->instance = $this->app->getInstance(); $set->loadByShortname('photos'); $thumb = $set->getDimensionByShortname('thumb'); foreach ($photos as $photo) { $image = new SwatImageDisplay(); $image->image = $photo->getUri('thumb', '../'); $image->width = $photo->getWidth('thumb'); $image->height = $photo->getHeight('thumb'); $image->occupy_width = $thumb->max_width; $image->occupy_height = $thumb->max_height; ob_start(); $image->display(); $order_array[$photo->id] = ob_get_clean(); } $order_widget = $this->ui->getWidget('order'); $order_widget->width = '580px'; $order_widget->height = '400px'; $order_widget->addOptionsByArray($order_array, 'text/xml'); $sql = sprintf('select sum(displayorder) from PinholePhotoTagBinding where tag = %s', $this->app->db->quote($this->tag->id, 'integer')); $sum = SwatDB::queryOne($this->app->db, $sql, 'integer'); $options_list = $this->ui->getWidget('options'); $options_list->value = $sum == 0 ? 'auto' : 'custom'; }
protected function getTableModel(SwatView $view) { $tag_list = new PinholeTagList($this->app, $this->tag->name, true); $photos = $tag_list->getPhotos(); $store = new SwatTableStore(); foreach ($photos as $photo) { $ds = new SwatDetailsStore(); $ds->photo = $photo; $ds->class_name = $this->getTileClasses($photo); $store->add($ds); } return $store; }