add_context(ZP_IMAGE);
                printCustomSizedImage(sprintf(gettext('View the album %s'), $albumname), $size);
                rem_context(ZP_IMAGE | ZP_ALBUM);
                echo '</a>';
            } else {
                echo '<a href="' . html_encode(getImageURL()) . '" title="' . sprintf(gettext('View %s'), $imagename) . '">';
                printCustomSizedImage(sprintf(gettext('View %s'), $imagename), $size);
                rem_context(ZP_IMAGE | ZP_ALBUM);
                echo '</a>';
            }
        } else {
            ?>
			<span style="background:red;color:black;">
				<?php 
            printf(gettext('<code>zenpageAlbumImage()</code> did not find the image %1$s:%2$s'), $albumname, $imagename);
            ?>
			</span>
			<?php 
        }
    } else {
        ?>
		<span style="background:red;color:black;">
			<?php 
        printf(gettext('<code>zenpageAlbumImage()</code> did not find the album %1$s'), $albumname);
        ?>
		</span>
		<?php 
    }
}
Zenpage::expiry();
Exemplo n.º 2
0
 /**
  * Returns a list of News Titlelinks found in the search
  *
  * @param int $articles_per_page The number of articles to get
  * @param bool $published placeholder for consistent parameter list
  * @param bool $ignorepagination ignore pagination
  * @param string $sorttype field to sort on
  * @param string $sortdirection sort order
  *
  * @return array
  */
 function getArticles($articles_per_page = 0, $published = NULL, $ignorepagination = false, $sorttype = NULL, $sortdirection = NULL)
 {
     $articles = $this->getSearchArticles($sorttype, $sortdirection);
     if (empty($articles)) {
         return array();
     } else {
         if ($ignorepagination || !$articles_per_page) {
             return $articles;
         }
         return array_slice($articles, Zenpage::getOffset($articles_per_page), $articles_per_page);
     }
 }
/**
 * Prints the nested list for pages and categories
 *
 * @param string $listtype 'cats-checkboxlist' for a fake nested checkbock list of categories for the news article edit/add page
 * 												'cats-sortablelist' for a sortable nested list of categories for the admin categories page
 * 												'pages-sortablelist' for a sortable nested list of pages for the admin pages page
 * @param int $articleid Only for $listtype = 'cats-checkboxlist': For ID of the news article if the categories an existing articles is assigned to shall be shown, empty if this is a new article to be added.
 * @param string $option Only for $listtype = 'cats-checkboxlist': "all" to show all categories if creating a new article without categories assigned, empty if editing an existing article that already has categories assigned.
 * @return string | bool
 */
function printNestedItemsList($listtype = 'cats-sortablelist', $articleid = '', $option = '', $class = 'nestedItem')
{
    global $_zp_zenpage;
    switch ($listtype) {
        case 'cats-checkboxlist':
        default:
            $ulclass = "";
            break;
        case 'cats-sortablelist':
        case 'pages-sortablelist':
            $ulclass = " class=\"page-list\"";
            break;
    }
    switch ($listtype) {
        case 'cats-checkboxlist':
        case 'cats-sortablelist':
            //Without this the order is incorrect until the 2nd page reload…
            $_zp_zenpage = new Zenpage();
            $items = $_zp_zenpage->getAllCategories(false);
            break;
        case 'pages-sortablelist':
            $items = $_zp_zenpage->getPages(false);
            break;
        default:
            $items = array();
            break;
    }
    $indent = 1;
    $open = array(1 => 0);
    $rslt = false;
    foreach ($items as $item) {
        switch ($listtype) {
            case 'cats-checkboxlist':
            case 'cats-sortablelist':
                $itemobj = new ZenpageCategory($item['titlelink']);
                $ismypage = $itemobj->isMyItem(ZENPAGE_NEWS_RIGHTS);
                break;
            case 'pages-sortablelist':
                $itemobj = new ZenpagePage($item['titlelink']);
                $ismypage = $itemobj->isMyItem(ZENPAGE_PAGES_RIGHTS);
                break;
        }
        $itemsortorder = $itemobj->getSortOrder();
        $itemid = $itemobj->getID();
        if ($ismypage) {
            $order = explode('-', $itemsortorder);
            $level = max(1, count($order));
            if ($toodeep = $level > 1 && $order[$level - 1] === '') {
                $rslt = true;
            }
            if ($level > $indent) {
                echo "\n" . str_pad("\t", $indent, "\t") . "<ul" . $ulclass . ">\n";
                $indent++;
                $open[$indent] = 0;
            } else {
                if ($level < $indent) {
                    while ($indent > $level) {
                        $open[$indent]--;
                        $indent--;
                        echo "</li>\n" . str_pad("\t", $indent, "\t") . "</ul>\n";
                    }
                } else {
                    // indent == level
                    if ($open[$indent]) {
                        echo str_pad("\t", $indent, "\t") . "</li>\n";
                        $open[$indent]--;
                    } else {
                        echo "\n";
                    }
                }
            }
            if ($open[$indent]) {
                echo str_pad("\t", $indent, "\t") . "</li>\n";
                $open[$indent]--;
            }
            switch ($listtype) {
                case 'cats-checkboxlist':
                    echo "<li>\n";
                    printCategoryCheckboxListEntry($itemobj, $articleid, $option, $class);
                    break;
                case 'cats-sortablelist':
                    echo str_pad("\t", $indent - 1, "\t") . "<li id=\"id_" . $itemid . "\">";
                    printCategoryListSortableTable($itemobj, $toodeep);
                    break;
                case 'pages-sortablelist':
                    echo str_pad("\t", $indent - 1, "\t") . "<li id=\"id_" . $itemid . "\">";
                    printPagesListTable($itemobj, $toodeep);
                    break;
            }
            $open[$indent]++;
        }
    }
    while ($indent > 1) {
        echo "</li>\n";
        $open[$indent]--;
        $indent--;
        echo str_pad("\t", $indent, "\t") . "</ul>";
    }
    if ($open[$indent]) {
        echo "</li>\n";
    } else {
        echo "\n";
    }
    return $rslt;
}
Exemplo n.º 4
0
        $articles_page = sanitize_numeric($_GET['articles_page']);
    }
}
// Basic setup for the global for the current admin page first
if (!isset($_GET['subpage'])) {
    $subpage = 0;
} else {
    $subpage = sanitize_numeric($_GET['subpage']);
}
if ($articles_page) {
    $total = ceil($articles / $articles_page);
    //Needed check if we really have articles for page x or not otherwise we are just on page 1
    if ($total <= $subpage) {
        $subpage = 0;
    }
    $offset = Zenpage::getOffset($articles_page);
    $list = array();
    foreach ($result as $article) {
        $list[] = $article[$sortorder];
    }
    if ($sortorder == 'date') {
        $rangeset = getPageSelector($list, $articles_page, 'dateDiff');
    } else {
        $rangeset = getPageSelector($list, $articles_page);
    }
    $options = array_merge(array('page' => 'news', 'tab' => 'articles'), getNewsAdminOption(array('category' => 0, 'date' => 0, 'published' => 0, 'sortorder' => 0, 'articles_page' => 1)));
    $result = array_slice($result, $offset, $articles_page);
} else {
    $rangeset = $options = array();
}
?>