Пример #1
0
 /**
  * Handle a generic error.
  * Shows a message and uses the context to determine how much additional information
  * to show (in the page title or the navigation bar).
  * @param $message
  * @param string $caption
  * @param int|\WEBCORE_OBJECT $context
  * @internal param string $msg
  */
 public function raise_error($message, $caption = '', $context = 0)
 {
     if (is_a($context, 'folder')) {
         $this->location->add_folder_link($context);
         $this->title->add_object($context);
     } else {
         $this->location->add_root_link();
         if (is_a($context, 'group')) {
             $this->location->append('Groups', 'view_groups.php');
         } elseif (is_a($context, 'user')) {
             $this->location->append('Users', 'view_users.php');
         }
     }
     if (!$caption) {
         $caption = $this->title->subject;
     }
     $this->title->subject = $caption;
     $this->location->append($this->title->subject, '', '{icons}/indicators/error');
     $this->start_display();
     ?>
 <div class="main-box">
   <div class="text-flow">
     <?php 
     $this->show_message($message);
     ?>
   <div>
 </div>
 <?php 
     $this->finish_display();
 }
Пример #2
0
    /**
     * Render the settings as HTML.
     */
    public function display()
    {
        if ($this->enabled && $this->file_name) {
            $title = $this->title->as_text();
            $url = new URL($this->page->resolve_file($this->file_name, Force_root_on));
            foreach ($this->formats as $format => $format_title) {
                foreach ($this->content_formats as $content => $content_texts) {
                    $url->replace_argument('format', $format);
                    $url->replace_argument('content', $content);
                    $content_title = $content_texts[0];
                    ?>
  <link rel="alternate" title="<?php 
                    echo $title;
                    ?>
 (<?php 
                    echo $format_title;
                    ?>
/<?php 
                    echo $content_title;
                    ?>
)" href="<?php 
                    echo $url->as_html();
                    ?>
" type="application/rss+xml">
<?php 
                }
            }
        }
    }