streams/Code/Widget/Photo_albums.php

32 lines
825 B
PHP
Raw Normal View History

2017-03-16 03:56:12 +00:00
<?php
2022-02-16 04:08:28 +00:00
namespace Code\Widget;
2017-03-16 03:56:12 +00:00
2020-03-04 02:00:20 +00:00
use App;
2022-02-16 04:08:28 +00:00
use Code\Lib\Channel;
2020-03-04 02:00:20 +00:00
2017-03-16 03:56:12 +00:00
require_once('include/photos.php');
2022-10-23 21:18:44 +00:00
class Photo_albums implements WidgetInterface
2021-12-02 23:02:31 +00:00
{
2017-03-16 03:56:12 +00:00
2022-10-24 03:39:49 +00:00
public function widget(array $arguments): string
2021-12-02 23:02:31 +00:00
{
2017-03-16 03:56:12 +00:00
2021-12-02 23:02:31 +00:00
if (!App::$profile['profile_uid']) {
return EMPTY_STR;
}
2017-03-16 03:56:12 +00:00
2022-01-25 01:26:12 +00:00
$channel = Channel::from_id(App::$profile['profile_uid']);
2017-03-16 03:56:12 +00:00
2021-12-02 23:02:31 +00:00
if ((!$channel) || (!perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_storage'))) {
return EMPTY_STR;
}
2017-03-16 03:56:12 +00:00
2022-10-24 03:39:49 +00:00
$sortkey = ((array_key_exists('sortkey', $arguments)) ? $arguments['sortkey'] : 'display_path');
$direction = ((array_key_exists('direction', $arguments)) ? $arguments['direction'] : 'asc');
2017-03-16 03:56:12 +00:00
2021-12-02 23:02:31 +00:00
return photos_album_widget($channel, App::get_observer(), $sortkey, $direction);
}
2017-03-16 03:56:12 +00:00
}