Search in sources :

Example 91 with QuestionItemView

use of org.olat.modules.qpool.QuestionItemView in project OpenOLAT by OpenOLAT.

the class ItemListMySharesController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (selectLink == source) {
        Set<Integer> selections = getItemsTable().getMultiSelectedIndex();
        if (!selections.isEmpty()) {
            List<QuestionItemView> items = getItemViews(selections);
            fireEvent(ureq, new QItemViewEvent("select-item", items));
        }
    } else if (myShareEl == source) {
        String selectedKey = myShareEl.getSelectedKey();
        if (selectedKey != null && selectedKey.length() > 4) {
            String key = selectedKey.substring(4);
            if (StringHelper.isLong(key)) {
                Long resourceKey = Long.parseLong(key);
                if (selectedKey.startsWith("pool")) {
                    doSelectPool(ureq, resourceKey);
                } else if (selectedKey.startsWith("grou")) {
                    doSelectBusinessGroup(ureq, resourceKey);
                }
            }
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : QItemViewEvent(org.olat.modules.qpool.ui.events.QItemViewEvent) QuestionItemView(org.olat.modules.qpool.QuestionItemView)

Example 92 with QuestionItemView

use of org.olat.modules.qpool.QuestionItemView in project OpenOLAT by OpenOLAT.

the class ItemListMyListsController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (selectLink == source) {
        Set<Integer> selections = getItemsTable().getMultiSelectedIndex();
        if (!selections.isEmpty()) {
            List<QuestionItemView> items = getItemViews(selections);
            fireEvent(ureq, new QItemViewEvent("select-item", items));
        }
    } else if (myListEl == source) {
        String selectedCollKey = myListEl.getSelectedKey();
        if (StringHelper.isLong(selectedCollKey)) {
            Long collectionKey = Long.parseLong(selectedCollKey);
            doSelectCollection(ureq, collectionKey);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : QItemViewEvent(org.olat.modules.qpool.ui.events.QItemViewEvent) QuestionItemView(org.olat.modules.qpool.QuestionItemView)

Example 93 with QuestionItemView

use of org.olat.modules.qpool.QuestionItemView in project openolat by klemens.

the class QuestionItemDetailsController method reloadData.

private void reloadData(UserRequest ureq) {
    Long itemKey = metadatasCtrl.getItem().getKey();
    QuestionItemView itemView = itemSource.getItemWithoutRestrictions(itemKey);
    if (itemView != null) {
        qItemSecurityCallback.setQuestionItemView(itemView);
        initTools();
        setCommentsController(ureq);
        QuestionItem reloadedItem = qpoolService.loadItemById(itemView.getKey());
        metadatasCtrl.setItem(reloadedItem, qItemSecurityCallback);
        reviewActionCtrl.setSecurityCallback(qItemSecurityCallback);
        setQuestionController(ureq, reloadedItem, qItemSecurityCallback);
    }
}
Also used : QuestionItemView(org.olat.modules.qpool.QuestionItemView) QuestionItem(org.olat.modules.qpool.QuestionItem)

Example 94 with QuestionItemView

use of org.olat.modules.qpool.QuestionItemView in project openolat by klemens.

the class AbstractItemListController method reload.

@Override
public List<ItemRow> reload(List<ItemRow> rows) {
    List<Long> itemToReload = new ArrayList<>();
    for (ItemRow row : rows) {
        itemToReload.add(row.getKey());
    }
    List<QuestionItemView> reloadedItems = itemsSource.getItems(itemToReload);
    List<ItemRow> reloadedRows = new ArrayList<>(reloadedItems.size());
    List<ResourceLicense> licenses = licenseService.loadLicenses(reloadedItems);
    for (QuestionItemView item : reloadedItems) {
        ItemRow reloadedRow = forgeRow(item, licenses);
        reloadedRows.add(reloadedRow);
    }
    return reloadedRows;
}
Also used : ArrayList(java.util.ArrayList) QuestionItemView(org.olat.modules.qpool.QuestionItemView) ResourceLicense(org.olat.core.commons.services.license.ResourceLicense)

Example 95 with QuestionItemView

use of org.olat.modules.qpool.QuestionItemView in project openolat by klemens.

the class AbstractItemListController method getRows.

@Override
public ResultInfos<ItemRow> getRows(String query, List<FlexiTableFilter> filters, List<String> condQueries, int firstResult, int maxResults, SortKey... orderBy) {
    ResultInfos<QuestionItemView> items = itemsSource.getItems(query, condQueries, firstResult, maxResults, orderBy);
    List<ItemRow> rows = new ArrayList<>(items.getObjects().size());
    List<ResourceLicense> licenses = licenseService.loadLicenses(items.getObjects());
    for (QuestionItemView item : items.getObjects()) {
        ItemRow row = forgeRow(item, licenses);
        rows.add(row);
    }
    return new DefaultResultInfos<>(items.getNextFirstResult(), items.getCorrectedRowCount(), rows);
}
Also used : DefaultResultInfos(org.olat.core.commons.persistence.DefaultResultInfos) ArrayList(java.util.ArrayList) QuestionItemView(org.olat.modules.qpool.QuestionItemView) ResourceLicense(org.olat.core.commons.services.license.ResourceLicense)

Aggregations

QuestionItemView (org.olat.modules.qpool.QuestionItemView)118 Test (org.junit.Test)78 QuestionItem (org.olat.modules.qpool.QuestionItem)76 Identity (org.olat.core.id.Identity)72 SearchQuestionItemParams (org.olat.modules.qpool.model.SearchQuestionItemParams)62 ArrayList (java.util.ArrayList)34 QItemType (org.olat.modules.qpool.model.QItemType)18 BusinessGroup (org.olat.group.BusinessGroup)16 QuestionItemImpl (org.olat.modules.qpool.model.QuestionItemImpl)14 ItemWrapper (org.olat.modules.qpool.model.ItemWrapper)12 QItemViewEvent (org.olat.modules.qpool.ui.events.QItemViewEvent)12 SortKey (org.olat.core.commons.persistence.SortKey)10 MarkImpl (org.olat.core.commons.services.mark.impl.MarkImpl)10 Pool (org.olat.modules.qpool.Pool)10 QuestionItemCollection (org.olat.modules.qpool.QuestionItemCollection)10 Taxonomy (org.olat.modules.taxonomy.Taxonomy)8 TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)8 SecurityGroupMembershipImpl (org.olat.basesecurity.SecurityGroupMembershipImpl)6 QuestionItemShort (org.olat.modules.qpool.QuestionItemShort)6 OLATResource (org.olat.resource.OLATResource)6