use of org.olat.modules.portfolio.model.BinderPageUsage in project OpenOLAT by OpenOLAT.
the class MediaDAO method usedInBinders.
public List<BinderPageUsage> usedInBinders(MediaLight media) {
StringBuilder sb = new StringBuilder();
sb.append("select binder.key, binder.title, page.key, page.title, page.status").append(" from pfpage as page").append(" inner join page.body as pageBody").append(" inner join pageBody.parts as bodyPart").append(" left join page.section as section").append(" left join section.binder as binder").append(" where bodyPart.media.key=:mediaKey");
List<Object[]> objects = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Object[].class).setParameter("mediaKey", media.getKey()).getResultList();
List<BinderPageUsage> usage = new ArrayList<>(objects.size());
for (Object[] object : objects) {
Long binderKey = (Long) object[0];
String binderTitle = (String) object[1];
Long pageKey = (Long) object[2];
String pageTitle = (String) object[3];
String pageStatus = (String) object[4];
usage.add(new BinderPageUsage(binderKey, binderTitle, pageKey, pageTitle, pageStatus));
}
return usage;
}
use of org.olat.modules.portfolio.model.BinderPageUsage in project openolat by klemens.
the class MediaDAO method usedInBinders.
public List<BinderPageUsage> usedInBinders(MediaLight media) {
StringBuilder sb = new StringBuilder();
sb.append("select binder.key, binder.title, page.key, page.title, page.status").append(" from pfpage as page").append(" inner join page.body as pageBody").append(" inner join pageBody.parts as bodyPart").append(" left join page.section as section").append(" left join section.binder as binder").append(" where bodyPart.media.key=:mediaKey");
List<Object[]> objects = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Object[].class).setParameter("mediaKey", media.getKey()).getResultList();
List<BinderPageUsage> usage = new ArrayList<>(objects.size());
for (Object[] object : objects) {
Long binderKey = (Long) object[0];
String binderTitle = (String) object[1];
Long pageKey = (Long) object[2];
String pageTitle = (String) object[3];
String pageStatus = (String) object[4];
usage.add(new BinderPageUsage(binderKey, binderTitle, pageKey, pageTitle, pageStatus));
}
return usage;
}
use of org.olat.modules.portfolio.model.BinderPageUsage in project openolat by klemens.
the class MediaDetailsController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source instanceof FormLink) {
FormLink link = (FormLink) source;
String cmd = link.getCmd();
Object uobject = link.getUserObject();
if ("binder".equals(cmd)) {
if (uobject instanceof BinderPageUsage) {
String businessPath = "[Binder:" + ((BinderPageUsage) uobject).getBinderKey() + "]";
NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
}
} else if ("page".equals(cmd)) {
if (uobject instanceof BinderPageUsage) {
// http://localhost:8081/auth/HomeSite/720898/PortfolioV2/0/MyPages/0/Entry/89
String businessPath = "[HomeSite:" + getIdentity().getKey() + "][PortfolioV2:0][MyPages:0][Entry:" + ((BinderPageUsage) uobject).getPageKey() + "]";
NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
}
}
}
super.formInnerEvent(ureq, source, event);
}
Aggregations