Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 119... Línea 119...
119
                    $userbuttons = array(
119
                    $userbuttons = array(
120
                        'messages' => array(
120
                        'messages' => array(
121
                            'buttontype' => 'message',
121
                            'buttontype' => 'message',
122
                            'title' => get_string('message', 'message'),
122
                            'title' => get_string('message', 'message'),
123
                            'url' => new moodle_url('/message/index.php', array('id' => $user->id)),
123
                            'url' => new moodle_url('/message/index.php', array('id' => $user->id)),
124
                            'image' => 'message',
124
                            'image' => 't/message',
125
                            'linkattributes' => \core_message\helper::messageuser_link_params($user->id),
125
                            'linkattributes' => \core_message\helper::messageuser_link_params($user->id),
126
                            'page' => $this->page
126
                            'page' => $this->page
127
                        )
127
                        )
128
                    );
128
                    );
Línea 129... Línea 129...
129
 
129
 
-
 
130
                    if ($USER->id != $user->id) {
130
                    if ($USER->id != $user->id) {
131
                        $cancreatecontact = \core_message\api::can_create_contact($USER->id, $user->id);
131
                        $iscontact = \core_message\api::is_contact($USER->id, $user->id);
132
                        $iscontact = \core_message\api::is_contact($USER->id, $user->id);
132
                        $isrequested = \core_message\api::get_contact_requests_between_users($USER->id, $user->id);
133
                        $isrequested = \core_message\api::get_contact_requests_between_users($USER->id, $user->id);
133
                        $contacturlaction = '';
134
                        $contacturlaction = '';
134
                        $linkattributes = \core_message\helper::togglecontact_link_params(
135
                        $linkattributes = \core_message\helper::togglecontact_link_params(
Línea 138... Línea 139...
138
                            !empty($isrequested),
139
                            !empty($isrequested),
139
                        );
140
                        );
140
                        // If the user is not a contact.
141
                        // If the user is not a contact.
141
                        if (!$iscontact) {
142
                        if (!$iscontact) {
142
                            if ($isrequested) {
143
                            if ($isrequested) {
-
 
144
                                // Set it to true if a request has been sent.
-
 
145
                                $cancreatecontact = true;
-
 
146
 
143
                                // We just need the first request.
147
                                // We just need the first request.
144
                                $requests = array_shift($isrequested);
148
                                $requests = array_shift($isrequested);
145
                                if ($requests->userid == $USER->id) {
149
                                if ($requests->userid == $USER->id) {
146
                                    // If the user has requested to be a contact.
150
                                    // If the user has requested to be a contact.
147
                                    $contacttitle = 'contactrequestsent';
151
                                    $contacttitle = 'contactrequestsent';
Línea 156... Línea 160...
156
                            } else {
160
                            } else {
157
                                // If the user is not a contact and has not requested to be a contact.
161
                                // If the user is not a contact and has not requested to be a contact.
158
                                $contacttitle = 'addtoyourcontacts';
162
                                $contacttitle = 'addtoyourcontacts';
159
                                $contacturlaction = 'addcontact';
163
                                $contacturlaction = 'addcontact';
160
                            }
164
                            }
161
                            $contactimage = 'addcontact';
165
                            $contactimage = 't/addcontact';
162
                        } else {
166
                        } else {
163
                            // If the user is a contact.
167
                            // If the user is a contact.
164
                            $contacttitle = 'removefromyourcontacts';
168
                            $contacttitle = 'removefromyourcontacts';
165
                            $contacturlaction = 'removecontact';
169
                            $contacturlaction = 'removecontact';
166
                            $contactimage = 'removecontact';
170
                            $contactimage = 't/removecontact';
167
                        }
171
                        }
-
 
172
                        if ($cancreatecontact) {
168
                        $userbuttons['togglecontact'] = array(
173
                            $userbuttons['togglecontact'] = array(
169
                                'buttontype' => 'togglecontact',
174
                                'buttontype' => 'togglecontact',
170
                                'title' => get_string($contacttitle, 'message'),
175
                                'title' => get_string($contacttitle, 'message'),
171
                                'url' => new moodle_url('/message/index.php', array(
176
                                'url' => new moodle_url('/message/index.php', array(
172
                                        'user1' => $USER->id,
177
                                        'user1' => $USER->id,
173
                                        'user2' => $user->id,
178
                                        'user2' => $user->id,
Línea 176... Línea 181...
176
                                ),
181
                                ),
177
                                'image' => $contactimage,
182
                                'image' => $contactimage,
178
                                'linkattributes' => $linkattributes,
183
                                'linkattributes' => $linkattributes,
179
                                'page' => $this->page
184
                                'page' => $this->page
180
                            );
185
                            );
-
 
186
                        }
181
                    }
187
                    }
Línea 182... Línea 188...
182
 
188
 
183
                    $this->page->requires->string_for_js('changesmadereallygoaway', 'moodle');
189
                    $this->page->requires->string_for_js('changesmadereallygoaway', 'moodle');
184
                }
190
                }
Línea 209... Línea 215...
209
                    $prefix = get_string('modulename', $this->page->activityname);
215
                    $prefix = get_string('modulename', $this->page->activityname);
210
                }
216
                }
211
            }
217
            }
212
        }
218
        }
Línea 213... Línea -...
213
 
-
 
214
        // Return the heading wrapped in an sr-only element so it is only visible to screen-readers.
-
 
215
        if (!empty($this->page->layout_options['nocontextheader'])) {
-
 
216
            return html_writer::div($heading, 'sr-only');
-
 
217
        }
-
 
218
 
219
 
219
        $contextheader = new \context_header($heading, $headinglevel, $imagedata, $userbuttons, $prefix);
220
        $contextheader = new \context_header($heading, $headinglevel, $imagedata, $userbuttons, $prefix);
220
        return $this->render($contextheader);
221
        return $this->render($contextheader);
Línea 221... Línea 222...
221
    }
222
    }