Exemplo n.º 1
0
/**
 * Breadcrumbs for the Perfectum Theme
 *
 * @version 1.0
 * @since   1.0
 * @author  Daniel Noel-Davies
 *
 * @param   array  $block       Array of block values
 *
 */
function block_pagination($block)
{
    // Get instances...
    $objPage = coreObj::getPage();
    $objTPL = coreObj::getTPL();
    $breadcrumbs = $objPage->getOptions('breadcrumbs');
    $length = sizeOf($breadcrumbs);
    // Check we have breadcrumbs to work with
    if (!empty($breadcrumbs)) {
        return false;
    }
    // Give this block a handle
    $objTPl->set_filenames(array('perfectum_breadcrumbs', Page::$THEME_ROOT . 'breadcrumbs.tpl'));
    // Loop through breadcrumbs and assign the array values to each template block
    foreach ($breadcrumbs as $index => $crumb) {
        if ($index < $length) {
            $objTPL->assign_block_vars('crumb', array('URL' => $crumb['url'], 'TITLE' => $crumb['name']));
            // If this is the last crumb, make it un-clickable
        } else {
            $objTPL->assign_block_vars('crumb', array('TITLE' => $crumb['name']));
        }
    }
    // Return the block's contents
    return $objTPL->get_html('perfectum_breadcrumbs');
}
Exemplo n.º 2
0
 /**
  * Outputs a comment wrapped in template for ajax purposes
  *
  * @version     1.0
  * @since       0.8.0
  */
 function getLastComment($id)
 {
     $objTPL = coreObj::getTPL();
     $objSQL = coreObj::getDBO();
     $objUser = coreObj::getUser();
     $objTime = coreObj::getTime();
     //set the template for the comments
     $objTPL->set_filenames(array('ajComments' => 'modules/core/template/comments/ajaxComments.tpl'));
     $commentQuery = $objSQL->queryBuilder()->select('*')->from('#__comments')->where('id', '=', $id)->limit(1)->build();
     $comments = $objSQL->fetchAll($commentQuery);
     if (is_array($comments) && count($comments) > 0) {
         $objTPL->assign_block_vars('comment', array('ID' => $comments['id'], 'cID' => 'comment-' . $comments['id'], 'ROW' => $i % 2 ? 'row_color2' : 'row_color1', 'ALT_ROW' => $i % 2 ? 'row_color1' : 'row_color2', 'AUTHOR' => $objUser->profile($comments['author']), 'POSTED' => $objTime->mk_time($comments['timestamp']), 'POST' => contentParse($comments['comment'])));
         if (User::$IS_ADMIN || User::$IS_MOD || User::$IS_ONLINE && ($objUser->get('id') == $comments['author'] || $objUser->get('id') == $this->author_id)) {
             $objTPL->assign_block_vars('comment.functions', array('URL' => $this->aURL[0] . '?mode=deleteComment&id=' . $comments['id']));
         }
     }
     $this->objTPL->parse('ajComments', false);
     return $this->objTPL->get_html('ajComments');
 }