コード例 #1
0
ファイル: print.php プロジェクト: rair/yacs
    //
    // title
    $section = Skin::build_block(i18n::s('Files'), 'title');
    // list files by date (default) or by title (option :files_by_title:)
    if (preg_match('/\\bfiles_by_title\\b/i', $item['options'])) {
        $items = Files::list_by_title_for_anchor('category:' . $item['id'], 0, 300, 'category:' . $item['id']);
    } else {
        $items = Files::list_by_date_for_anchor('category:' . $item['id'], 0, 300, 'category:' . $item['id']);
    }
    // actually render the html for the section
    if ($items) {
        $context['text'] .= $section . Skin::build_list($items, 'decorated');
    }
    //
    // the links section
    //
    // title
    $section = Skin::build_block(i18n::s('See also'), 'title');
    // list links by date (default) or by title (option :links_by_title:)
    if (preg_match('/\\blinks_by_title\\b/i', $item['options'])) {
        $items = Links::list_by_title_for_anchor('category:' . $item['id'], 0, 50);
    } else {
        $items = Links::list_by_date_for_anchor('category:' . $item['id'], 0, 50);
    }
    // actually render the html
    if ($items) {
        $context['text'] .= $section . Skin::build_list($items, 'decorated');
    }
}
// render the skin
render_skin();
コード例 #2
0
ファイル: view.php プロジェクト: rair/yacs
 // links attached to this article
 //
 // the list of related links if not at another follow-up page
 if (!$zoom_type || $zoom_type == 'links') {
     // build a complete box
     $box = array('bar' => array(), 'text' => '');
     // a navigation bar for these links
     if ($count = Links::count_for_anchor('article:' . $item['id'])) {
         $attachments_count += $count;
         if ($count > 20) {
             $box['bar'] += array('_count' => sprintf(i18n::ns('%d link', '%d links', $count), $count));
         }
         // list links by date (default) or by title (option links_by_title)
         $offset = ($zoom_index - 1) * LINKS_PER_PAGE;
         if (Articles::has_option('links_by_title', $anchor, $item)) {
             $items = Links::list_by_title_for_anchor('article:' . $item['id'], $offset, LINKS_PER_PAGE);
         } else {
             $items = Links::list_by_date_for_anchor('article:' . $item['id'], $offset, LINKS_PER_PAGE);
         }
         // actually render the html
         if (is_array($items)) {
             $box['text'] .= Skin::build_list($items, 'decorated');
         } elseif (is_string($items)) {
             $box['text'] .= $items;
         }
         // navigation commands for links
         $home = Articles::get_permalink($item);
         $prefix = Articles::get_url($item['id'], 'navigate', 'links');
         $box['bar'] += Skin::navigate($home, $prefix, $count, LINKS_PER_PAGE, $zoom_index);
         // new links are allowed
         if ($cur_article->allows('creation', 'link')) {
コード例 #3
0
ファイル: view_as_tabs.php プロジェクト: rair/yacs
    }
}
// the list of related links if not at another follow-up page
if (!$zoom_type || $zoom_type == 'links') {
    // build a complete box
    $box = array('bar' => array(), 'text' => '');
    // count the number of links in this section
    if ($count = Links::count_for_anchor('section:' . $item['id'])) {
        $attachments_count += $count;
        if ($count > 20) {
            $box['bar'] += array('_count' => sprintf(i18n::ns('%d link', '%d links', $count), $count));
        }
        // list links by date (default) or by title (option 'links_by_title')
        $offset = ($zoom_index - 1) * LINKS_PER_PAGE;
        if (preg_match('/\\blinks_by_title\\b/i', $item['options'])) {
            $items = Links::list_by_title_for_anchor('section:' . $item['id'], $offset, LINKS_PER_PAGE, 'no_anchor');
        } else {
            $items = Links::list_by_date_for_anchor('section:' . $item['id'], $offset, LINKS_PER_PAGE, 'no_anchor');
        }
        // actually render the html
        if (is_array($items)) {
            $box['text'] .= Skin::build_list($items, 'rows');
        } elseif (is_string($items)) {
            $box['text'] .= $items;
        }
        // navigation commands for links
        $home = Sections::get_permalink($item);
        $prefix = Sections::get_url($item['id'], 'navigate', 'links');
        $box['bar'] = array_merge($box['bar'], Skin::navigate($home, $prefix, $count, LINKS_PER_PAGE, $zoom_index));
    }
    // new links are allowed -- check option 'with_links'
コード例 #4
0
ファイル: fetch_as_msword.php プロジェクト: rair/yacs
 //
 // attached comments
 //
 // list immutable comments by date
 $items = Comments::list_by_date_for_anchor('article:' . $item['id'], 0, 500, 'excerpt');
 // actually list items
 if ($items) {
     $context['text'] .= Skin::build_box(i18n::s('Comments'), utf8::to_unicode($items));
 }
 //
 // related links
 //
 // list links by date (default) or by title (option :links_by_title:)
 $items = array();
 if (Articles::has_option('links_by_title', $anchor, $item)) {
     $items = Links::list_by_title_for_anchor('article:' . $item['id'], 0, 50, 'compact');
 } else {
     $items = Links::list_by_date_for_anchor('article:' . $item['id'], 0, 50, 'compact');
 }
 // actually list items
 if (count($items)) {
     $context['text'] .= Skin::build_box(i18n::s('See also'), utf8::to_unicode(Skin::build_list($items, 'compact')));
 }
 //
 // page suffix
 //
 // link to the original page
 $context['text'] .= '<p>' . sprintf(i18n::s('The original page is located at %s'), Skin::build_link(Articles::get_permalink($item), Articles::get_permalink($item))) . "</p>\n";
 // insert anchor suffix
 if (is_object($anchor)) {
     $context['text'] .= $anchor->get_suffix();
コード例 #5
0
 /**
  * list categories
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // we return plain text
     $text = '';
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // one box per category
         $box['title'] = '';
         $box['text'] = '';
         // use the title to label the link
         $box['title'] = Skin::strip($item['title'], 50);
         // list related categories, if any
         if ($items = Categories::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'compact')) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label, 'category') . '</li>' . "\n";
             }
         }
         // info on related sections
         $items =& Members::list_sections_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
         if ($items) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label, 'section') . '</li>' . "\n";
             }
         }
         // info on related articles
         if (isset($item['options']) && preg_match('/\\barticles_by_title\\b/i', $item['options'])) {
             $items =& Members::list_articles_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
         } else {
             $items =& Members::list_articles_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
         }
         if ($items) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label, 'article') . '</li>' . "\n";
             }
         }
         // info on related files
         if (isset($item['options']) && preg_match('/\\bfiles_by_title\\b/i', $item['options'])) {
             $items = Files::list_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'category:' . $item['id']);
         } else {
             $items = Files::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'category:' . $item['id']);
         }
         if ($items) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label, 'file') . '</li>' . "\n";
             }
         }
         // info on related comments
         include_once $context['path_to_root'] . 'comments/comments.php';
         if ($items = Comments::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'compact')) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label, 'comment') . '</li>' . "\n";
             }
         }
         // info on related links
         include_once $context['path_to_root'] . 'links/links.php';
         if (isset($item['options']) && preg_match('/\\blinks_by_title\\b/i', $item['options'])) {
             $items = Links::list_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
         } else {
             $items = Links::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
         }
         if ($items) {
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $label = $label[1];
                 }
                 $box['text'] .= '<li>' . Skin::build_link($url, $label) . '</li>' . "\n";
             }
         }
         // add a direct link to the category
         if (Surfer::is_associate()) {
             $box['title'] .= '&nbsp;' . Skin::build_link(Categories::get_permalink($item), MORE_IMG, 'basic');
         }
         // make a full list
         if ($box['text']) {
             $box['text'] = '<ul>' . $box['text'] . '</ul>' . "\n";
         }
         // always make a box, to let associates visit the category
         $text .= Skin::build_box($box['title'], $box['text']);
     }
     // end of processing
     SQL::free($result);
     return $text;
 }
コード例 #6
0
ファイル: print.php プロジェクト: rair/yacs
    //
    // title
    $section = Skin::build_block(i18n::s('Files'), 'title');
    // list files by date
    $items = Files::list_by_date_for_anchor('user:'******'id'], 0, 50, 'compact');
    // actually render the html for the section
    if ($items) {
        $context['text'] .= $section . Skin::build_list($items, 'compact');
    }
    //
    // the links section
    //
    // title
    $section = Skin::build_block(i18n::s('See also'), 'title');
    // list links by date
    if (preg_match('/\\blinks_by_title\\b/i', $item['options'])) {
        $items = Links::list_by_title_for_anchor('user:'******'id'], 0, 20, 'no_author');
    } else {
        $items = Links::list_by_date_for_anchor('user:'******'id'], 0, 20, 'no_author');
    }
    // actually render the html
    if ($items) {
        $context['text'] .= $section . Skin::build_list($items, 'compact');
    }
    // list pages attached to this user
    if ($items =& Articles::list_for_user_by('edition', $item['id'], 0, 50, 'compact')) {
        $context['text'] .= Skin::build_box(i18n::s('Pages'), Skin::build_list($items, 'compact'));
    }
}
// render the skin
render_skin();
コード例 #7
0
 /**
  * list sections
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // the maximum number of items per section
     if (!defined('MAXIMUM_ITEMS_PER_SECTION')) {
         define('MAXIMUM_ITEMS_PER_SECTION', 100);
     }
     // we return plain text
     $text = '';
     // process all items in the list
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     $family = '';
     while ($item = SQL::fetch($result)) {
         // change the family
         if ($item['family'] != $family) {
             $family = $item['family'];
             // show the family
             $text .= '<h2><span>' . $family . '&nbsp;</span></h2>' . "\n";
         }
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'section:' . $item['id']);
         // get the main anchor
         $anchor = Anchors::get($item['anchor']);
         // one box per section
         $box = array('title' => '', 'text' => '');
         // box content
         $elements = array();
         // use the title to label the link
         if (is_object($overlay)) {
             $box['title'] .= Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $box['title'] .= Codes::beautify_title($item['title']);
         }
         $details = array();
         // info on related articles
         if (preg_match('/\\barticles_by_([a-z_]+)\\b/i', $item['options'], $matches)) {
             $order = $matches[1];
         } else {
             $order = 'edition';
         }
         $items =& Articles::list_for_anchor_by($order, 'section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact');
         if (@count($items)) {
             // mention the number of items in folded title
             $details[] = sprintf(i18n::ns('%d page', '%d pages', count($items)), count($items));
             // add one link per item
             foreach ($items as $url => $label) {
                 $prefix = $suffix = '';
                 if (is_array($label)) {
                     $prefix = $label[0];
                     $suffix = $label[2];
                     $label = $label[1];
                 }
                 $elements[] = $prefix . Skin::build_link($url, $label, 'article') . $suffix;
             }
         }
         // info on related files
         if (Sections::has_option('files_by', $anchor, $item) == 'title') {
             $items = Files::list_by_title_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact');
         } else {
             $items = Files::list_by_date_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact');
         }
         if ($items) {
             // mention the number of sections in folded title
             $details[] = sprintf(i18n::ns('%d file', '%d files', count($items)), count($items));
             // add one link per item
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $prefix = $label[0];
                     $suffix = $label[2];
                     $label = $label[1];
                 }
                 $elements[] = $prefix . Skin::build_link($url, $label, 'file') . $suffix;
             }
         }
         // info on related comments
         if ($items = Comments::list_by_date_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact', TRUE)) {
             // mention the number of sections in folded title
             $details[] = sprintf(i18n::ns('%d comment', '%d comments', count($items)), count($items));
             // add one link per item
             foreach ($items as $url => $label) {
                 $prefix = $suffix = '';
                 if (is_array($label)) {
                     $prefix = $label[0];
                     $suffix = $label[2];
                     $label = $label[1];
                 }
                 $elements[] = $prefix . Skin::build_link($url, $label, 'comment') . $suffix;
             }
         }
         // info on related links
         if (Sections::has_option('links_by_title', $anchor, $item)) {
             $items = Links::list_by_title_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact');
         } else {
             $items = Links::list_by_date_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact');
         }
         if ($items) {
             // mention the number of sections in folded title
             $details[] = sprintf(i18n::ns('%d link', '%d links', count($items)), count($items));
             // add one link per item
             foreach ($items as $url => $label) {
                 $prefix = $suffix = '';
                 if (is_array($label)) {
                     $prefix = $label[0];
                     $suffix = $label[2];
                     $label = $label[1];
                 }
                 $elements[] = $prefix . Skin::build_link($url, $label) . $suffix;
             }
         }
         // list related sections, if any
         if ($items =& Sections::list_by_title_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact')) {
             // mention the number of sections in folded title
             $details[] = sprintf(i18n::ns('%d section', '%d sections', count($items)), count($items));
             // add one link per item
             foreach ($items as $url => $label) {
                 $prefix = $suffix = '';
                 if (is_array($label)) {
                     $prefix = $label[0];
                     $suffix = $label[2];
                     $label = $label[1];
                 }
                 $elements[] = $prefix . Skin::build_link($url, $label, 'section') . $suffix;
             }
         }
         // signal continuing sections
         if (count($elements) > MAXIMUM_ITEMS_PER_SECTION) {
             $elements[] = Skin::build_link(Sections::get_permalink($item), i18n::s('More pages') . MORE_IMG, 'basic');
         } else {
             $elements[] = Skin::build_link(Sections::get_permalink($item), i18n::s('View the section'), 'shortcut');
         }
         // complement title
         if (count($details)) {
             $box['title'] .= ' <span class="details">(' . join(', ', $details) . ')</span>';
         }
         // insert introduction, if any
         if ($item['introduction']) {
             $box['text'] .= Codes::beautify_introduction($item['introduction']);
         }
         // make a full list
         if (count($elements)) {
             $box['text'] .= '<ul><li>' . implode('</li>' . "\n" . '<li>', $elements) . '</li></ul>' . "\n";
         }
         // if we have an icon for this section, use it
         if (isset($item['thumbnail_url']) && $item['thumbnail_url']) {
             // adjust the class
             $class = '';
             if (isset($context['classes_for_thumbnail_images'])) {
                 $class = 'class="' . $context['classes_for_thumbnail_images'] . '" ';
             }
             // build the complete HTML element
             $icon = '<img src="' . $item['thumbnail_url'] . '" alt="" title="' . encode_field(Codes::beautify_title($item['title'])) . '" ' . $class . '/>';
             // make it clickable
             $link = Skin::build_link(Sections::get_permalink($item), $icon, 'basic');
             // put this aside
             $box['text'] = '<table class="decorated"><tr>' . '<td class="image">' . $link . '</td>' . '<td class="content">' . $box['text'] . '</td>' . '</tr></table>';
         }
         // always make a box
         $text .= Skin::build_box($box['title'], $box['text'], 'folded');
     }
     // end of processing
     SQL::free($result);
     return $text;
 }
コード例 #8
0
ファイル: layout_as_accordion.php プロジェクト: rair/yacs
 /**
  * list pages
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // allow for multiple calls
     static $accordion_id;
     if (!isset($accordion_id)) {
         $accordion_id = 1;
     } else {
         $accordion_id++;
     }
     // empty list
     if (!SQL::count($result)) {
         $output = array();
         return $output;
     }
     // the maximum number of items per article
     if (!defined('MAXIMUM_ITEMS_PER_ACCORDION')) {
         define('MAXIMUM_ITEMS_PER_ACCORDION', 100);
     }
     // we return plain text
     $text = '';
     // type of listed object
     $items_type = $this->listed_type;
     // process all items in the list
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     $family = '';
     while ($item = SQL::fetch($result)) {
         // get the object interface, this may load parent and overlay
         $entity = new $items_type($item);
         // change the family (layout of sections)
         if (isset($item['family']) && $item['family'] != $family) {
             $family = $item['family'];
             // show the family
             $text .= '<h2><span>' . $family . '&nbsp;</span></h2>' . "\n";
         }
         // one box per page
         $box = array('title' => '', 'text' => '');
         // signal entity to be published
         if (isset($item['publish_date']) && ($item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S'))) {
             $box['title'] .= DRAFT_FLAG;
         }
         // signal entity to be activated
         if (isset($item['activation_date']) && $item['activation_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
             $box['title'] .= DRAFT_FLAG;
         }
         // signal restricted and private entity
         if ($item['active'] == 'N') {
             $box['title'] .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $box['title'] .= RESTRICTED_FLAG;
         }
         // use the title to label the link
         if (is_object($entity->overlay)) {
             $box['title'] .= Codes::beautify_title($entity->overlay->get_text('title', $item));
         } else {
             $box['title'] .= Codes::beautify_title($item['title']);
         }
         // box content
         $elements = array();
         // complement the title with interesting details
         $details = array();
         // info on related article, only for sections
         if ($items_type == 'section') {
             if (preg_match('/\\barticles_by_([a-z_]+)\\b/i', $item['options'], $matches)) {
                 $order = $matches[1];
             } else {
                 $order = 'edition';
             }
             $items =& Articles::list_for_anchor_by($order, $entity->get_reference(), 0, MAXIMUM_ITEMS_PER_ACCORDION + 1, 'compact');
             if (@count($items)) {
                 // mention the number of items in folded title
                 $details[] = sprintf(i18n::ns('%d page', '%d pages', count($items)), count($items));
                 // add one link per item
                 foreach ($items as $url => $label) {
                     $prefix = $suffix = '';
                     if (is_array($label)) {
                         $prefix = $label[0];
                         $suffix = $label[2];
                         $label = $label[1];
                     }
                     $elements[] = $prefix . Skin::build_link($url, $label, 'article') . $suffix;
                 }
             }
         }
         // info on related files
         if ($entity->has_option('files_by') == 'title') {
             $items = Files::list_by_title_for_anchor($entity->get_reference(), 0, MAXIMUM_ITEMS_PER_ACCORDION + 1, 'compact');
         } else {
             $items = Files::list_by_date_for_anchor($entity->get_reference(), 0, MAXIMUM_ITEMS_PER_ACCORDION + 1, 'compact');
         }
         if ($items) {
             // mention the number of items in folded title
             $details[] = sprintf(i18n::ns('%d file', '%d files', count($items)), count($items));
             // add one link per item
             foreach ($items as $url => $label) {
                 if (is_array($label)) {
                     $prefix = $label[0];
                     $suffix = $label[2];
                     $label = $label[1];
                 }
                 $elements[] = $prefix . Skin::build_link($url, $label, 'file') . $suffix;
             }
         }
         // info on related comments
         if ($items = Comments::list_by_date_for_anchor($entity->get_reference(), 0, MAXIMUM_ITEMS_PER_ACCORDION + 1, 'compact', TRUE)) {
             // mention the number of items in folded title
             $details[] = sprintf(i18n::ns('%d comment', '%d comments', count($items)), count($items));
             // add one link per item
             foreach ($items as $url => $label) {
                 $prefix = $suffix = '';
                 if (is_array($label)) {
                     $prefix = $label[0];
                     $suffix = rtrim(Codes::strip(' ' . $label[2]), '- ');
                     $label = $label[1];
                 }
                 $elements[] = $prefix . Skin::build_link($url, $label, 'comment') . $suffix;
             }
         }
         // info on related links
         if ($entity->has_option('links_by_title')) {
             $items = Links::list_by_title_for_anchor($entity->get_reference(), 0, MAXIMUM_ITEMS_PER_ACCORDION + 1, 'compact');
         } else {
             $items = Links::list_by_date_for_anchor($entity->get_reference(), 0, MAXIMUM_ITEMS_PER_ACCORDION + 1, 'compact');
         }
         if ($items) {
             // mention the number of items in folded title
             $details[] = sprintf(i18n::ns('%d link', '%d links', count($items)), count($items));
             // add one link per item
             foreach ($items as $url => $label) {
                 $prefix = $suffix = '';
                 if (is_array($label)) {
                     $prefix = $label[0];
                     $suffix = $label[2];
                     $label = $label[1];
                 }
                 $elements[] = $prefix . Skin::build_link($url, $label) . $suffix;
             }
         }
         // list related sub-sections, if any
         if ($items_type == 'section') {
             if ($items =& Sections::list_by_title_for_anchor($entity->get_reference(), 0, MAXIMUM_ITEMS_PER_ACCORDION + 1, 'compact')) {
                 // mention the number of sections in folded title
                 $details[] = sprintf(i18n::ns('%d section', '%d sections', count($items)), count($items));
                 // add one link per item
                 foreach ($items as $url => $label) {
                     $prefix = $suffix = '';
                     if (is_array($label)) {
                         $prefix = $label[0];
                         $suffix = $label[2];
                         $label = $label[1];
                     }
                     $elements[] = $prefix . Skin::build_link($url, $label, 'section') . $suffix;
                 }
             }
         }
         // a link to the page
         $permalink = $entity->get_permalink($item);
         $elements[] = Skin::build_link($permalink, sprintf(i18n::s('View the %s'), $items_type) . MORE_IMG, 'shortcut');
         // complement title
         if (count($details)) {
             $box['title'] .= ' <span class="details">(' . join(', ', $details) . ')</span>';
         }
         // insert introduction, if any
         if (is_object($entity->overlay)) {
             $box['text'] .= Skin::build_block($entity->overlay->get_text('introduction', $item), 'introduction');
         } elseif (trim($item['introduction'])) {
             $box['text'] .= Skin::build_block($item['introduction'], 'introduction');
         } else {
             // insert overlay data, if any
             if (is_object($entity->overlay)) {
                 $box['text'] .= $entity->overlay->get_text('box', $item);
             }
             // the content of this box
             $box['text'] .= Codes::beautify($item['description'], $item['options']);
         }
         // make a full list
         if (count($elements)) {
             $box['text'] .= Skin::finalize_list($elements, 'compact');
         }
         // display all tags
         if ($item['tags']) {
             $box['text'] .= ' <p class="tags" style="margin-bottom: 0">' . Skin::build_tags($item['tags'], $entity->get_reference()) . '</p>';
         }
         // if we have an icon for this page, use it
         if (isset($item['thumbnail_url']) && $item['thumbnail_url']) {
             // adjust the class
             $class = '';
             if (isset($context['classes_for_thumbnail_images'])) {
                 $class = 'class="' . $context['classes_for_thumbnail_images'] . '" ';
             }
             // build the complete HTML element
             $icon = '<img src="' . $item['thumbnail_url'] . '" alt="" title="' . encode_field(Codes::beautify_title($item['title'])) . '" ' . $class . '/>';
             // make it clickable
             $link = Skin::build_link($permalink, $icon, 'basic');
             // put this aside
             $box['text'] = '<table class="decorated"><tr>' . '<td class="image">' . $link . '</td>' . '<td class="content">' . $box['text'] . '</td>' . '</tr></table>';
         }
         // always make a box
         $text .= $this->build_accordion_box($box['title'], $box['text'], 'accordion_' . $accordion_id);
     }
     // we have bounded styles and scripts
     $this->load_scripts_n_styles();
     // end of processing
     SQL::free($result);
     return $text;
 }
コード例 #9
0
ファイル: print.php プロジェクト: rair/yacs
    $items = Comments::list_by_date_for_anchor('section:' . $item['id'], 0, $items_per_page, $layout);
    // actually render the html
    if (is_array($items)) {
        $box['text'] .= Skin::build_list($items, 'rows');
    } elseif (is_string($items)) {
        $box['text'] .= $items;
    }
    // build a box
    if ($box['text']) {
        $context['text'] .= Skin::build_box('', $box['text']);
    }
    //
    // related link
    //
    // list links by date (default) or by title (option :links_by_title:)
    if (preg_match('/\\blinks_by_title\\b/i', $item['options'])) {
        $items = Links::list_by_title_for_anchor('section:' . $item['id'], 0, 70);
    } else {
        $items = Links::list_by_date_for_anchor('section:' . $item['id'], 0, 70);
    }
    // actually render the html
    if ($items) {
        $context['text'] .= Skin::build_box(i18n::s('Links'), Skin::build_list($items, 'decorated'));
    }
    // insert anchor suffix
    if (is_object($anchor)) {
        $context['text'] .= $anchor->get_suffix();
    }
}
// render the skin
render_skin();
コード例 #10
0
ファイル: view.php プロジェクト: rair/yacs
 //
 // links attached to this category
 //
 // the list of related links if not at another follow-up page
 if (!$zoom_type || $zoom_type == 'links') {
     // build a complete box
     $box = array('bar' => array(), 'text' => '');
     // count the number of links in this category
     if ($count = Links::count_for_anchor('category:' . $item['id'])) {
         if ($count > 20) {
             $box['bar'] = array('_count' => sprintf(i18n::ns('%d link', '%d links', $count), $count));
         }
         // list items by date (default) or by title (option 'links_by_title')
         $offset = ($zoom_index - 1) * LINKS_PER_PAGE;
         if (isset($item['options']) && preg_match('/\\blinks_by_title\\b/i', $item['options'])) {
             $items = Links::list_by_title_for_anchor('category:' . $item['id'], $offset, LINKS_PER_PAGE);
         } else {
             $items = Links::list_by_date_for_anchor('category:' . $item['id'], $offset, LINKS_PER_PAGE);
         }
         if (is_array($items)) {
             $box['text'] .= Skin::build_list($items, 'decorated');
         }
         // navigation commands for links
         $home = Categories::get_permalink($item);
         $prefix = Categories::get_url($item['id'], 'navigate', 'links');
         $box['bar'] = array_merge($box['bar'], Skin::navigate($home, $prefix, $count, LINKS_PER_PAGE, $zoom_index));
     }
     // the command to post a new link
     if (Links::allow_creation($item, $anchor, 'category')) {
         Skin::define_img('LINKS_ADD_IMG', 'links/add.gif');
         $url = 'links/edit.php?anchor=' . urlencode('category:' . $item['id']);