Created
July 29, 2017 07:52
-
-
Save cgi-caesar/a93d3acfdb37a232140cf33af0c1c5cc to your computer and use it in GitHub Desktop.
Add separate widget with Files available to users
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($user = Am_Di::getInstance()->auth->getUser()) { | |
if ($files = Am_Di::getInstance()->resourceAccessTable->getAllowedResources($user, ResourceAccess::FILE)) { | |
Am_Di::getInstance()->blocks->add(new Am_Block('member/main/left', 'Your Downloads', 'files', null, | |
function (Am_View $v) use ($files) { | |
$out = ''; | |
foreach ($files as $f) { | |
$out .= sprintf("<li>%s</li>\n", $f->renderLink()); | |
} | |
return sprintf('<ul class="am-widget-list">%s</ul>', $out); | |
})); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment