Exemplo n.º 1
0
 /**
  * Render comments in nested view
  * Danger: Recursive!
  *
  * @param integer $comment_id Always "0" when called by client.
  * @param boolean $admin_view
  *
  * @return void
  */
 public function renderNestView($comment_id = 0, $admin_view = false)
 {
     $xot = new XoopsObjectTree($this->comments, 'id', 'pid', 'rootid');
     $tree = $xot->getTree();
     $image = false != $this->useIcons ? $this->getTitleIcon($tree[$comment_id]['obj']->getVar('icon')) : '';
     $title = $tree[$comment_id]['obj']->getVar('title');
     if (false != $admin_view) {
         $text = $tree[$comment_id]['obj']->getVar('text') . '<div style="text-align:right; margin-top: 2px; margin-bottom: 0px; margin-right: 2px;">' . _MD_COMMENTS_STATUS . ': ' . $this->statusText[$tree[$comment_id]['obj']->getVar('status')] . '<br />IP: <span style="font-weight: bold;">' . $tree[$comment_id]['obj']->getVar('ip') . '</span></div>';
     } else {
         // skip this comment if it is not active and continue on processing its child comments instead
         if (Comments::STATUS_ACTIVE != $tree[$comment_id]['obj']->getVar('status')) {
             // if there are any child comments, display them as root comments
             if (isset($tree[$comment_id]['child']) && !empty($tree[$comment_id]['child'])) {
                 foreach ($tree[$comment_id]['child'] as $child_id) {
                     $this->renderNestView($child_id, $admin_view);
                 }
             }
             return;
         } else {
             $text = $tree[$comment_id]['obj']->getVar('text');
         }
     }
     $replies = array();
     $this->renderNestReplies($tree, $comment_id, $replies, 25, $admin_view);
     $this->tpl->append('comments', array('pid' => $tree[$comment_id]['obj']->getVar('pid'), 'id' => $tree[$comment_id]['obj']->getVar('id'), 'itemid' => $tree[$comment_id]['obj']->getVar('itemid'), 'rootid' => $tree[$comment_id]['obj']->getVar('rootid'), 'image' => $image, 'title' => $title, 'text' => $text, 'date_posted' => XoopsLocale::formatTimestamp($tree[$comment_id]['obj']->getVar('created'), 'm'), 'date_modified' => XoopsLocale::formatTimestamp($tree[$comment_id]['obj']->getVar('modified'), 'm'), 'poster' => $this->getPosterArray($tree[$comment_id]['obj']->getVar('uid')), 'replies' => $replies));
 }
Exemplo n.º 2
0
     // Category Select form
     $param = array('imgcat_id' => $imgcat_id, 'target' => null);
     $form = $helper->getForm($param, 'category_imagemanager');
     $xoopsTpl->assign('form_category', $form->render());
     if ($imgcat_id > 0) {
         $imgcount = $helper->getHandlerImages()->countByCategory($imgcat_id);
         $images = $helper->getHandlerImages()->getByCategory($imgcat_id, $start, $helper->getConfig('images_pager'), true);
         $category = $helper->getHandlerCategories()->get($imgcat_id);
         foreach (array_keys($images) as $i) {
             if ($category->getVar('imgcat_storetype') === 'db') {
                 $src = $helper->url("image.php?id=" . $images[$i]->getVar('image_id'));
             } else {
                 $xoops_uploads_url = \XoopsBaseConfig::get('uploads-url');
                 $src = $xoops_uploads_url . '/' . $images[$i]->getVar('image_name');
             }
             $xoopsTpl->append('images', array('id' => $images[$i]->getVar('image_id'), 'nicename' => $images[$i]->getVar('image_nicename'), 'mimetype' => $images[$i]->getVar('image_mimetype'), 'src' => $src));
         }
     }
     break;
 case 'upload':
     $category = $helper->getHandlerCategories()->get($imgcat_id);
     if ($imgcat_id > 0 && is_object($category)) {
         $perm_handler = $xoops->getHandlerGroupPermission();
         if ($perm_handler->checkRight('imgcat_write', $imgcat_id, $groups)) {
             $xoops->simpleHeader();
             $xoopsTpl = new XoopsTpl();
             $obj = $helper->getHandlerImages()->create();
             $obj->setVar('imgcat_id', $imgcat_id);
             $form = $helper->getForm(array('obj' => $obj, 'target' => null), 'image_imagemanager');
             $xoopsTpl->assign('form', $form->render());
         }
Exemplo n.º 3
0
    $tpl->assign('channel_lastbuild', XoopsLocale::formatTimestamp(time(), 'rss'));
    $tpl->assign('channel_webmaster', $xoops->getConfig('adminmail'));
    $tpl->assign('channel_editor', $xoops->getConfig('adminmail'));
    if ($categoryid != -1) {
        $channel_category .= " > " . $categoryObj->getVar('name');
    }
    $tpl->assign('channel_category', htmlspecialchars($channel_category));
    $tpl->assign('channel_generator', $publisher->getModule()->getVar('name'));
    $tpl->assign('channel_language', XoopsLocale::getLangCode());
    $tpl->assign('image_url', \XoopsBaseConfig::get('url') . '/images/logo.gif');
    $dimention = getimagesize(\XoopsBaseConfig::get('root-path') . '/images/logo.gif');
    if (empty($dimention[0])) {
        $width = 140;
        $height = 140;
    } else {
        $width = $dimention[0] > 140 ? 140 : $dimention[0];
        $dimention[1] = $dimention[1] * $width / $dimention[0];
        $height = $dimention[1] > 140 ? $dimention[1] * $dimention[0] / 140 : $dimention[1];
    }
    $tpl->assign('image_width', $width);
    $tpl->assign('image_height', $height);
    $sarray = $publisher->getItemHandler()->getAllPublished(10, 0, $categoryid);
    if (is_array($sarray)) {
        $count = $sarray;
        /* @var $item PublisherItem */
        foreach ($sarray as $item) {
            $tpl->append('items', array('title' => htmlspecialchars($item->title(), ENT_QUOTES), 'link' => $item->getItemUrl(), 'guid' => $item->getItemUrl(), 'pubdate' => XoopsLocale::formatTimestamp($item->getVar('datesub'), 'rss'), 'description' => htmlspecialchars($item->getBlockSummary(300, true), ENT_QUOTES)));
        }
    }
}
$tpl->display('module:publisher/publisher_rss.tpl');
Exemplo n.º 4
0
         $imgcount = $helper->getHandlerImages()->countByCategory($imgcat_id);
         $images = $helper->getHandlerImages()->getByCategory($imgcat_id, $start, $helper->getConfig('images_pager'), true);
         $category = $helper->getHandlerCategories()->get($imgcat_id);
         foreach (array_keys($images) as $i) {
             if ($category->getVar('imgcat_storetype') === 'db') {
                 $lcode = '[img align=left id=' . $images[$i]->getVar('image_id') . ']' . $images[$i]->getVar('image_nicename') . '[/img]';
                 $code = '[img align=center id=' . $images[$i]->getVar('image_id') . ']' . $images[$i]->getVar('image_nicename') . '[/img]';
                 $rcode = '[img align=right id=' . $images[$i]->getVar('image_id') . ']' . $images[$i]->getVar('image_nicename') . '[/img]';
                 $src = $helper->url("image.php?id=" . $images[$i]->getVar('image_id'));
             } else {
                 $lcode = '[img align=left]' . \XoopsBaseConfig::get('uploads-url') . '/' . $images[$i]->getVar('image_name') . '[/img]';
                 $code = '[img align=center]' . \XoopsBaseConfig::get('uploads-url') . '/' . $images[$i]->getVar('image_name') . '[/img]';
                 $rcode = '[img align=right]' . \XoopsBaseConfig::get('uploads-url') . '/' . $images[$i]->getVar('image_name') . '[/img]';
                 $src = \XoopsBaseConfig::get('uploads-url') . '/' . $images[$i]->getVar('image_name');
             }
             $xoopsTpl->append('images', array('id' => $images[$i]->getVar('image_id'), 'nicename' => $images[$i]->getVar('image_nicename'), 'mimetype' => $images[$i]->getVar('image_mimetype'), 'src' => $src, 'lxcode' => $lcode, 'xcode' => $code, 'rxcode' => $rcode));
         }
     }
     break;
 case 'upload':
     $category = $helper->getHandlerCategories()->get($imgcat_id);
     if ($imgcat_id > 0 && is_object($category)) {
         $perm_handler = $xoops->getHandlerGroupPermission();
         if ($perm_handler->checkRight('imgcat_write', $imgcat_id, $groups)) {
             $xoops->simpleHeader();
             $xoopsTpl = new XoopsTpl();
             $obj = $helper->getHandlerImages()->create();
             $obj->setVar('imgcat_id', $imgcat_id);
             $form = $helper->getForm(array('obj' => $obj, 'target' => $target), 'image_imagemanager');
             $xoopsTpl->assign('form', $form->render());
         }