owner_guid; $owner = get_user($owner_guid); $display_count = 5; global $CONFIG; // make sure is this admin widget $admins = get_entities_from_metadata('admin', '', 'user'); if (in_array($owner, $admins)) $is_admin = true; // check that widget owner and viewer has at least moderator role if (($owner->roles == "moderator" || $owner->roles == "editor" || $is_admin) && isModerator()) { if ($owner->roles == "moderator") { $owner_subjects = $owner->subjects; if (is_string($owner_subjects)) { $owner_subjects = array($owner_subjects); } } // get all pending resources $localids = waramu_getModerationQueue(); $ids = array(); $count = 0; $au = buildAppUser(get_loggedin_user()); foreach ($localids as $rid) { try { $obj = waramu_getResource($au, $rid); } catch (Exception $e) { continue; } $obj_subjects = $obj->getCurriculumSubjects(); // admin has to see all pending resources if ($is_admin && isadminloggedin()) { if ($count < 5) $ids[] = $rid; $count++; } else { // moderator can see only those resources where he is resource subject(s) moderator if (is_array($obj_subjects) && count($obj_subjects) > 0) { foreach ($owner_subjects as $subject) { if (in_array($subject, $obj_subjects) && isModerator($obj_subjects)) { if ($count < 5) $ids[] = $rid; $count++; break; } } // and editor see's resources, where subject isn't marked } else if ($owner->roles == "editor" && isEditor()) { if ($count < 5) $ids[] = $rid; $count++; } } } echo waramu_list_resources($ids, false, false); if ($count > 5 && ($owner == get_loggedin_user())) { $url = $CONFIG->wwwroot . "pg/waramu/moderate"; /*translation:more...*/ echo("
"); } } else { /*translation:This widget works only for moderators*/ echo elgg_echo("koolielu:widget_for_mods"); } ?>