Rev 279 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 279 | Rev 281 | ||
---|---|---|---|
Line 76... | Line 76... | ||
76 | } |
76 | } |
77 | 77 | ||
78 | public function gui($id, &$out, &$handled) { |
78 | public function gui($id, &$out, &$handled) { |
79 | if (explode('$',$id)[0] == 'oidplus:edit_ra') { |
79 | if (explode('$',$id)[0] == 'oidplus:edit_ra') { |
80 | $handled = true; |
80 | $handled = true; |
81 | $out['title'] = 'Edit RA contact data'; |
- | |
82 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
- | |
83 | 81 | ||
84 | $ra_email = explode('$',$id)[1]; |
82 | $ra_email = explode('$',$id)[1]; |
85 | 83 | ||
- | 84 | $out['title'] = 'Edit RA contact data'; |
|
- | 85 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
|
- | 86 | ||
86 | if (!OIDplus::authUtils()::isRaLoggedIn($ra_email) && !OIDplus::authUtils()::isAdminLoggedIn()) { |
87 | if (!OIDplus::authUtils()::isRaLoggedIn($ra_email) && !OIDplus::authUtils()::isAdminLoggedIn()) { |
87 | $out['icon'] = 'img/error_big.png'; |
88 | $out['icon'] = 'img/error_big.png'; |
88 | $out['text'] = '<p>You need to <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> as the requested RA <b>'.htmlentities($ra_email).'</b>.</p>'; |
89 | $out['text'] = '<p>You need to <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> as the requested RA <b>'.htmlentities($ra_email).'</b>.</p>'; |
89 | } else { |
90 | return; |
- | 91 | } |
|
- | 92 | ||
90 | $out['text'] = '<p>Your email address: <b>'.htmlentities($ra_email).'</b>'; |
93 | $out['text'] = '<p>Your email address: <b>'.htmlentities($ra_email).'</b>'; |
91 | 94 | ||
92 | $res = OIDplus::db()->query("select * from ###ra where email = ?", array($ra_email)); |
95 | $res = OIDplus::db()->query("select * from ###ra where email = ?", array($ra_email)); |
93 | if ($res->num_rows() == 0) { |
96 | if ($res->num_rows() == 0) { |
94 | $out['icon'] = 'img/error_big.png'; |
97 | $out['icon'] = 'img/error_big.png'; |
95 | $out['text'] = 'RA <b>'.htmlentities($ra_email).'</b> does not exist'; |
98 | $out['text'] = 'RA <b>'.htmlentities($ra_email).'</b> does not exist'; |
96 | return $out; |
99 | return; |
97 | } |
100 | } |
98 | $row = $res->fetch_array(); |
101 | $row = $res->fetch_array(); |
99 | 102 | ||
100 | if (class_exists('OIDplusPageRaChangeEMail') && OIDplus::config()->getValue('allow_ra_email_change')) { |
103 | if (class_exists('OIDplusPageRaChangeEMail') && OIDplus::config()->getValue('allow_ra_email_change')) { |
101 | $out['text'] .= '<p><a '.OIDplus::gui()->link('oidplus:change_ra_email$'.$ra_email).'>Change email address</a></p>'; |
104 | $out['text'] .= '<p><a '.OIDplus::gui()->link('oidplus:change_ra_email$'.$ra_email).'>Change email address</a></p>'; |
Line 124... | Line 127... | ||
124 | </form><br><br>'; |
127 | </form><br><br>'; |
125 | 128 | ||
126 | $out['text'] .= '<p><a href="#" onclick="return deleteRa('.js_escape($ra_email).',\'oidplus:system\')">Delete profile</a> (objects stay active)</p>'; |
129 | $out['text'] .= '<p><a href="#" onclick="return deleteRa('.js_escape($ra_email).',\'oidplus:system\')">Delete profile</a> (objects stay active)</p>'; |
127 | } |
130 | } |
128 | } |
131 | } |
129 | } |
- | |
130 | 132 | ||
131 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
133 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
- | 134 | if (!$ra_email) return false; |
|
- | 135 | if (!OIDplus::authUtils()::isRaLoggedIn($ra_email) && !OIDplus::authUtils()::isAdminLoggedIn()) return false; |
|
- | 136 | ||
132 | if (file_exists(__DIR__.'/treeicon.png')) { |
137 | if (file_exists(__DIR__.'/treeicon.png')) { |
133 | $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png'; |
138 | $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png'; |
134 | } else { |
139 | } else { |
135 | $tree_icon = null; // default icon (folder) |
140 | $tree_icon = null; // default icon (folder) |
136 | } |
141 | } |