示例#1
0
 /**
  * Gets all categories
  * @param bool $visible TRUE for published and unprotected
  * @param string $sorttype NULL for the standard order as sorted on the backend, "title", "id", "popular", "random"
  * @param bool $sortdirection TRUE for ascending or FALSE for descending order
  * @return array
  */
 function getAllCategories($visible = true, $sorttype = NULL, $sortdirection = NULL)
 {
     $structure = $this->getCategoryStructure();
     if (is_null($sortdirection)) {
         $sortdirection = $this->sortdirection;
     }
     switch ($sorttype) {
         case "id":
             $sortorder = "id";
             break;
         case "title":
             $sortorder = "title";
             break;
         case "popular":
             $sortorder = 'hitcounter';
             break;
         case "random":
             $sortorder = 'random';
             break;
         default:
             $sortorder = "sort_order";
             break;
     }
     if ($visible) {
         foreach ($structure as $key => $cat) {
             $catobj = new ZenpageCategory($cat['titlelink']);
             if ($catobj->getShow() || $catobj->isMyItem(LIST_RIGHTS)) {
                 $structure[$key]['show'] = 1;
             } else {
                 unset($structure[$key]);
             }
         }
     }
     if (!is_null($sorttype) || !is_null($sortdirection)) {
         if ($sorttype == 'random') {
             shuffle($structure);
         } else {
             //sortMultiArray descending = true
             if ($sortdirection) {
                 $sortdir = false;
             } else {
                 $sortdir = true;
             }
             $structure = sortMultiArray($structure, $sortorder, $sortdir, true, false, false);
         }
     }
     return $structure;
 }
/**
 * returns an array of how many pages, articles, categories and news or pages comments we got.
 *
 * @param string $option What the statistic should be shown of: "news", "pages", "categories"
 */
function getNewsPagesStatistic($option)
{
    global $_zp_zenpage;
    switch ($option) {
        case "news":
            $items = $_zp_zenpage->getNewsArticles();
            $type = gettext("Articles");
            break;
        case "pages":
            $items = $_zp_zenpage->getPages(false);
            $type = gettext("Pages");
            break;
        case "categories":
            $type = gettext("Categories");
            $cats = $_zp_zenpage->getAllCategories(false);
            $total = count($cats);
            $unpub = 0;
            break;
    }
    if ($option == "news" or $option == "pages") {
        $total = count($items);
        $pub = 0;
        foreach ($items as $item) {
            switch ($option) {
                case "news":
                    $itemobj = new ZenpageNews($item['titlelink']);
                    break;
                case "pages":
                    $itemobj = new ZenpagePage($item['titlelink']);
                    break;
                case "categories":
                    $itemobj = new ZenpageCategory($item['titlelink']);
                    break;
            }
            $show = $itemobj->getShow();
            if ($show == 1) {
                $pub++;
            }
        }
        //echo " (un-published: ";
        $unpub = $total - $pub;
    }
    return array($total, $type, $unpub);
}
示例#3
0
if (count($publish_images_list) > 0) {
    echo sprintf(ngettext('%u album with unpublished images', '%u albums with unpublished images', $c), $c);
} else {
    echo gettext('No images meet the criteria.');
}
?>
				</fieldset>
				<?php 
if (class_exists('Zenpage')) {
    $visible = $report == 'categories';
    $items = $_zp_zenpage->getAllCategories(false);
    $output = '';
    $c = 0;
    foreach ($items as $key => $item) {
        $itemobj = new ZenpageCategory($item['titlelink']);
        if (!$itemobj->getShow()) {
            $c++;
            $output .= '<li><label><input type="checkbox" name="' . $item['titlelink'] . '" value="' . $item['titlelink'] . '" class="catcheck" />' . $itemobj->getTitle() . '</label><a href="' . html_encode($itemobj->getLink()) . '" title="' . html_encode($itemobj->getTitle()) . '"> (' . gettext('View') . ')</a></li>';
        }
    }
    ?>
					<br class="clearall" />
					<fieldset class="smallbox">
						<legend><?php 
    reveal('catbox', $visible);
    echo gettext('Categories not published');
    ?>
</legend>
						<?php 
    if ($output) {
        echo sprintf(ngettext('%u unpublished category', '%u unpublished categories', $c), $c);
示例#4
0
						</div>
						<?php 
    } else {
        if (is_AdminEditPage('newsarticle')) {
            ?>
							<h1><?php 
            echo gettext('Edit Article:');
            ?>
 <em><?php 
            checkForEmptyTitle($result->getTitle(), 'news', false);
            ?>
</em></h1>
							<?php 
            if ($result->getDatetime() >= date('Y-m-d H:i:s')) {
                echo '<small><strong id="scheduldedpublishing">' . gettext('(Article scheduled for publishing)') . '</strong></small>';
                if ($result->getShow() != 1) {
                    echo '<p class="scheduledate"><small>' . gettext('<strong>Note:</strong> Scheduled publishing is not active unless the article is also set to <em>published</em>') . '</small></p>';
                }
            }
            if ($result->inProtectedCategory()) {
                echo '<p class="notebox">' . gettext('<strong>Note:</strong> This article belongs to a password protected category.') . '</p>';
            }
        }
        if (is_AdminEditPage('newscategory')) {
            ?>
							<h1><?php 
            echo gettext('Edit Category:');
            ?>
 <em><?php 
            checkForEmptyTitle($result->getTitle(), 'category', false);
            ?>