Ejemplo n.º 1
0
 /**
  * provide a custom label
  *
  * @param string the target label (e.g., 'edit_title', 'item_name', 'item_names')
  * @param string the module that is invoking the anchor (e.g., 'comments')
  * @param string an optional title, if any
  * @return string the foreseen label
  */
 function get_label($id, $variant, $title = '')
 {
     global $context;
     throw new exception('function get_label() in sections/section.php has been obsoleted');
     // sanity check
     if (!isset($this->item['id'])) {
         return FALSE;
     }
     // a default title
     if (!$title) {
         $title = $this->get_title();
     }
     // strings for comments
     if ($variant == 'comments') {
         switch ($id) {
             // title for these
             case 'title':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Replies');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Notes');
                 }
                 return i18n::s('Comments');
                 // many comments
             // many comments
             case 'list_title':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Replies');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Notes');
                 }
                 return i18n::s('Comments');
                 // command to delete a comment
             // command to delete a comment
             case 'delete_command':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Yes, I want to delete this reply');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Yes, I want to delete this note');
                 }
                 return i18n::s('Yes, I want to delete this comment');
                 // page title to delete a comment
             // page title to delete a comment
             case 'delete_title':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Delete a reply');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Delete a note');
                 }
                 return i18n::s('Delete a comment');
                 // command to edit content
             // command to edit content
             case 'edit_command':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Edit the new reply');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Edit the new note');
                 }
                 return i18n::s('Edit the new comment');
                 // command to promote a comment
             // command to promote a comment
             case 'promote_command':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Yes, I want to turn this reply to an article');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Yes, I want to turn this note to an article');
                 }
                 return i18n::s('Yes, I want to turn this comment to an article');
                 // page title to promote a comment
             // page title to promote a comment
             case 'promote_title':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Promote a reply');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Promote a note');
                 }
                 return i18n::s('Promote a comment');
                 // command to view the thread
             // command to view the thread
             case 'thread_command':
                 return i18n::s('View the page');
                 // page title to modify a comment
             // page title to modify a comment
             case 'edit_title':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Update a reply');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Update a note');
                 }
                 return i18n::s('Edit a comment');
                 // page title to list comments
             // page title to list comments
             case 'list_title':
                 if ($this->has_layout('jive')) {
                     return sprintf(i18n::s('Replies: %s'), $title);
                 }
                 if ($this->has_layout('manual')) {
                     return sprintf(i18n::s('Notes: %s'), $title);
                 }
                 return sprintf(i18n::s('Discuss: %s'), $title);
                 // command to create a comment
             // command to create a comment
             case 'new_command':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Reply to this post');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Annotate this page');
                 }
                 return i18n::s('Post a comment');
                 // page title to create a comment
             // page title to create a comment
             case 'new_title':
                 if ($this->has_layout('jive')) {
                     return i18n::s('Reply to this post');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('Annotate this page');
                 }
                 return i18n::s('Post a comment');
                 // command to view content
             // command to view content
             case 'view_command':
                 if ($this->has_layout('jive')) {
                     return i18n::s('View the reply');
                 }
                 if ($this->has_layout('manual')) {
                     return i18n::s('View the note');
                 }
                 return i18n::s('View this comment');
                 // page title to view a comment
             // page title to view a comment
             case 'view_title':
                 if ($this->has_layout('jive')) {
                     return sprintf(i18n::s('Reply: %s'), $title);
                 }
                 if ($this->has_layout('manual')) {
                     return sprintf(i18n::s('Note: %s'), $title);
                 }
                 return $title;
         }
     }
     // fall-back on default behavior
     return parent::get_label($variant, $id, $title);
 }