/** * Fill data for a list item * * @param $type * @param $item * @param null $filter * @return array|null */ public function process_list_item($type, $item, $filter = null) { global $OUTPUT; // Hardwired filter to force only a subset of projects and datasets if (strcmp($type, "Project") == 0 || strcmp($type, "Dataset") == 0) { foreach ($this->item_black_list as $pattern) { if (preg_match("/^{$pattern}\$/", $item->name)) { return null; } } } $thumbnail_height = 95; $thumbnail_width = 95; $itemObj = array('image_id' => $item->id, 'title' => "Undefined", 'source' => $item->id, 'license' => "unknown", 'children' => array()); if (strcmp($type, "ProjectRoot") == 0) { $itemObj["title"] = get_string('projects', 'repository_omero'); $itemObj["path"] = PathUtils::build_project_list_url(); $itemObj["thumbnail"] = $OUTPUT->pix_url(file_folder_icon(64))->out(true); } else { if (strcmp($type, "TagRoot") == 0) { $itemObj["title"] = get_string('tags', 'repository_omero'); $itemObj["path"] = PathUtils::build_annotation_list_url(); $itemObj["thumbnail"] = $this->file_icon("tagset", 64); } else { if (strcmp($type, "TagSet") == 0) { $itemObj["title"] = get_string('tagset', 'repository_omero') . $item->value; $itemObj["path"] = PathUtils::build_tagset_deatails_url($item->id); $itemObj["thumbnail"] = $this->file_icon("tagset", 64); } else { if (strcmp($type, "Tag") == 0) { $itemObj["title"] = $item->value . ": " . $item->description . " [id:" . $item->id . "]"; $itemObj["path"] = PathUtils::build_tag_detail_url($item->id); $itemObj["thumbnail"] = $this->file_icon("tag", 64); } else { if (strcmp($type, "Project") == 0) { $itemObj["title"] = $item->name . " [id:" . $item->id . "]"; $itemObj["path"] = PathUtils::build_project_detail_url($item->id); $itemObj["thumbnail"] = $OUTPUT->pix_url(file_folder_icon(64))->out(true); } else { if (strcmp($type, "Dataset") == 0) { $itemObj["title"] = $item->name . " [id:" . $item->id . "]"; $itemObj["path"] = PathUtils::build_dataset_detail_url($item->id); $itemObj["thumbnail"] = $OUTPUT->pix_url(file_folder_icon(64))->out(true); } else { if (strcmp($type, "Image") == 0) { // replace image ID with the ID of the higher resolution image of the series $image_source = isset($item->high_resolution_image) ? $item->high_resolution_image : $item->id; $image_thumbnail = PathUtils::build_image_thumbnail_url($item->id, $item->lastUpdate, $thumbnail_height, $thumbnail_width); $itemObj['source'] = $image_source; $itemObj["title"] = $item->name . " [id:" . $image_source . "]"; $itemObj["author"] = $item->author; $itemObj["path"] = PathUtils::build_image_detail_url($item->id); $itemObj["thumbnail"] = $image_thumbnail; $itemObj["url"] = $image_thumbnail; $itemObj["date"] = $item->importTime; $itemObj["datecreated"] = $item->creationTime; $itemObj["datemodified"] = $item->lastUpdate; $itemObj['children'] = null; $itemObj["image_width"] = $item->width; $itemObj["image_height"] = $item->height; $itemObj['thumbnail_height'] = $thumbnail_height; $itemObj['thumbnail_width'] = $thumbnail_width; } else { throw new RuntimeException("Unknown data type"); } } } } } } } $itemObj["icon"] = $itemObj["thumbnail"]; return $itemObj; }