Subversion Repositories oidplus

Rev

Rev 999 | Rev 1005 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 999 Rev 1000
Line 1144... Line 1144...
1144
        }
1144
        }
1145
 
1145
 
1146
        public function implementsFeature($id) {
1146
        public function implementsFeature($id) {
1147
                if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.1') return true; // oobeEntry, oobeRequested()
1147
                if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.1') return true; // oobeEntry, oobeRequested()
1148
                // Important: Do NOT 1.3.6.1.4.1.37476.2.5.2.3.7 because our getAlternativesForQuery() is the one that calls others!
1148
                // Important: Do NOT 1.3.6.1.4.1.37476.2.5.2.3.7 because our getAlternativesForQuery() is the one that calls others!
-
 
1149
                if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.8') return true; // getNotifications()
1149
                return false;
1150
                return false;
1150
        }
1151
        }
1151
 
1152
 
1152
        public function oobeRequested(): bool {
1153
        public function oobeRequested(): bool {
1153
                // Interface 1.3.6.1.4.1.37476.2.5.2.3.1
1154
                // Interface 1.3.6.1.4.1.37476.2.5.2.3.1
Line 1201... Line 1202...
1201
                }
1202
                }
1202
 
1203
 
1203
                echo ' <font color="red"><b>'.$msg.'</b></font>';
1204
                echo ' <font color="red"><b>'.$msg.'</b></font>';
1204
        }
1205
        }
1205
 
1206
 
-
 
1207
        public function getNotifications($user=null): array {
-
 
1208
                // Interface 1.3.6.1.4.1.37476.2.5.2.3.8
-
 
1209
                $notifications = array();
-
 
1210
                $res = OIDplus::db()->query("select id, title from ###objects order by id");
-
 
1211
                if ($res->any()) {
-
 
1212
                        $is_admin_logged_in = OIDplus::authUtils()->isAdminLoggedIn(); // run just once, for performance
-
 
1213
                        while ($row = $res->fetch_array()) {
-
 
1214
                                if (empty($row['title'])) {
-
 
1215
                                        if ($user === 'admin') {
-
 
1216
                                                $accept = $is_admin_logged_in;
-
 
1217
                                        } else {
-
 
1218
                                                $accept = false;
-
 
1219
                                                if ($obj = OIDplusObject::parse($row['id'])) {
-
 
1220
                                                        if ($obj->userHasWriteRights($user)) {
-
 
1221
                                                                $accept = true;
-
 
1222
                                                        }
-
 
1223
                                                }
-
 
1224
                                        }
-
 
1225
 
-
 
1226
                                        if ($accept) {
-
 
1227
                                                $notifications[] = array('WARN', _L('Object %1 has no title.', '<a '.OIDplus::gui()->link($row['id']).'>'.$row['id'].'</a>'));
-
 
1228
                                        }
-
 
1229
                                }
-
 
1230
                        }
-
 
1231
                }
-
 
1232
                return $notifications;
-
 
1233
        }
-
 
1234
 
1206
}
1235
}