/** * * Get photos tags list * @return array */ public function tags() { $photo_tag_model = new photosTagModel(); $cloud = $photo_tag_model->getCloud(); foreach ($cloud as &$tag) { $tag['name'] = photosPhoto::escape($tag['name']); } unset($tag); return $cloud; }
public function execute() { if (!$this->getRights('upload')) { throw new waRightsException(_w("You don't have sufficient access rights")); } $groups_model = new waGroupModel(); $this->view->assign('groups', $groups_model->getNames()); $photo_tag_model = new photosTagModel(); $cloud = $photo_tag_model->getCloud('name'); $this->view->assign('cloud', $cloud); }
public function execute() { if ($this->getRights('upload')) { $this->executeAction('upload_dialog', new photosUploadAction()); } $album_model = new photosAlbumModel(); $albums = $album_model->getAlbums(); $top_level_albums_count = 0; foreach ($albums as $a) { if (!$a['parent_id']) { $top_level_albums_count++; } } /** * Extend photo toolbar in photo-page * Add extra item to toolbar * @event backend_photo_toolbar * @return array[string][string]string $return[%plugin_id%]['edit_menu'] Extra item for edit_menu in photo_toolbar * @return array[string][string]string $return[%plugin_id%]['share_menu'] Extra item for edit_menu in photo_toolbar */ $this->view->assign('backend_photo_toolbar', wa()->event('backend_photo_toolbar')); $tree = new photosViewTree($albums); $this->view->assign('albums', $tree->display()); $this->view->assign('albums_count', count($albums)); $this->view->assign('top_level_albums_count', $top_level_albums_count); $this->view->assign('app_albums', self::getAppAlbums()); $collection = new photosCollection(); $collection_rated = new photosCollection('search/rate>0'); $this->view->assign('count', $collection->count()); $this->view->assign('rated_count', $collection_rated->count()); $this->view->assign('last_login_datetime', $this->getConfig()->getLastLoginTime()); /** * Extend sidebar * Add extra item to sidebar * @event backend_sidebar * @return array[string][string]string $return[%plugin_id%]['menu'] Extra item for menu in sidebar * @return array[string][string]string $return[%plugin_id%]['section'] Extra section in sidebar */ $this->view->assign('backend_sidebar', wa()->event('backend_sidebar')); /** * Include plugins js and css * @event backend_assets * @return array[string]string $return[%plugin_id%] Extra head tag content */ $this->view->assign('backend_assets', wa()->event('backend_assets')); $photo_tag_model = new photosTagModel(); $this->view->assign('cloud', $photo_tag_model->getCloud()); $this->view->assign('popular_tags', $photo_tag_model->popularTags()); $this->view->assign('rights', array('upload' => $this->getRights('upload'), 'edit' => $this->getRights('edit'))); $config = $this->getConfig(); $this->view->assign('big_size', $config->getSize('big')); $this->view->assign('sidebar_width', $config->getSidebarWidth()); }
public function execute() { $id = waRequest::get('id', null, waRequest::TYPE_INT); $album_model = new photosAlbumModel(); $album = $album_model->getById($id); if (!$album) { throw new waException(_w("Unknown album"), 404); } $album_right_model = new photosAlbumRightsModel(); if (!$album_right_model->checkRights($album, true)) { throw new waException(_w("You don't have sufficient access rights"), 403); } if ($album['type'] == photosAlbumModel::TYPE_DYNAMIC && $album['conditions']) { $album['conditions'] = photosCollection::parseConditions($album['conditions']); } if (!$album['conditions']) { $album['conditions'] = array(); } $absolute_full_url = photosFrontendAlbum::getLink($album); if ($absolute_full_url) { $pos = strrpos($absolute_full_url, $album['url']); $full_base_url = $pos !== false ? rtrim(substr($absolute_full_url, 0, $pos), '/') . '/' : ''; $album['full_base_url'] = $full_base_url; } $this->view->assign('album', $album); if ($album['parent_id']) { $this->view->assign('parent', $album_model->getById($album['parent_id'])); } $collection = new photosCollection('album/' . $id); $photos_count = $collection->count(); $this->view->assign('photos_count', $photos_count); $album_params_model = new photosAlbumParamsModel(); $this->view->assign('params', $album_params_model->get($id)); $groups_model = new waGroupModel(); $groups = $groups_model->getAll('id', true); $rights = $album_right_model->getByField('album_id', $id, 'group_id'); $photo_tag_model = new photosTagModel(); $cloud = $photo_tag_model->getCloud('name'); if (!empty($album['conditions']['tag'][1])) { foreach ($album['conditions']['tag'][1] as $tag_name) { $cloud[$tag_name]['checked'] = true; } } $this->view->assign('rights', $rights); $this->view->assign('groups', $groups); $this->view->assign('cloud', $cloud); }
public function execute() { if (!$this->getRights('upload')) { throw new waRightsException(_w("You don't have sufficient access rights")); } $parent_id = waRequest::get('parent_id', 0, waRequest::TYPE_INT); $parent = null; if ($parent_id) { $album_model = new photosAlbumModel(); $parent = $album_model->getById($parent_id); } $this->view->assign('parent', $parent); $groups_model = new waGroupModel(); $this->view->assign('groups', $groups_model->getNames()); $photo_tag_model = new photosTagModel(); $cloud = $photo_tag_model->getCloud('name'); $this->view->assign('cloud', $cloud); }
public function execute() { $photo_id = waRequest::post('photo_id', array(), waRequest::TYPE_ARRAY_INT); $one_photo = waRequest::post('one_photo', 0, waRequest::TYPE_INT); $tags = waRequest::post('tags', '', waRequest::TYPE_STRING_TRIM); $tags = $tags ? explode(',', $tags) : array(); $delete_tags = waRequest::post('delete_tags', array(), waRequest::TYPE_ARRAY_INT); $tag_model = new photosTagModel(); $photo_tag_model = new photosPhotoTagsModel(); $photo_rights_model = new photosPhotoRightsModel(); $allowed_photo_id = $photo_rights_model->filterAllowedPhotoIds($photo_id, true); $denied_photo_id = array_values(array_diff($photo_id, $allowed_photo_id)); if ($allowed_photo_id) { if ($one_photo) { $allowed_photo_id = $allowed_photo_id[0]; $photo_tag_model->set($allowed_photo_id, $tags); $photo_model = new photosPhotoModel(); if ($parent_id = $photo_model->getStackParentId($allowed_photo_id)) { $this->response['parent_id'] = $parent_id; } } else { if ($delete_tags) { $photo_tag_model->delete($allowed_photo_id, $delete_tags); } $photo_tag_model->assign($allowed_photo_id, $tag_model->getIds($tags, true)); } $allowed_photo_id = (array) $allowed_photo_id; $tags = $photo_tag_model->getTags($allowed_photo_id); if (!$tags && $allowed_photo_id) { $tags = array_fill_keys($allowed_photo_id, array()); } $this->response['tags'] = $tags; } if ($denied_photo_id) { $this->response['alert_msg'] = photosPhoto::sprintf_wplural("The operation was not performed to %d photo (%%s)", "The operation was not performed to %d photos (%%s)", count($denied_photo_id), _w("out of %d selected", "out of %d selected", count($photo_id))) . ', ' . _w("because you don't have sufficient access rights") . '.'; } $this->response['cloud'] = $tag_model->getCloud(); }