/** * Return the number of articles of the given type. * @param string $p_type * Article Type * @return int */ public static function GetNumArticlesOfType($p_type) { $articleType = new ArticleType($p_type); if (!$articleType->exists()) { return false; } return $articleType->getNumArticles(); } // fn GetNumArticlesOfType
require_once $GLOBALS['g_campsiteDir'] . '/classes/ArticleType.php'; require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php'; // Check permissions if (!$g_user->hasPermission('ManageArticleTypes')) { camp_html_display_error(getGS("You do not have the right to merge article types.")); exit; } $f_src = trim(Input::get('f_src')); $f_dest = trim(Input::get('f_dest')); $errorMsgs = array(); if ($f_src == $f_dest) { $errorMsgs[] = getGS("You cannot merge the same type into itself."); } $src = new ArticleType($f_src); $dest = new ArticleType($f_dest); $srcNumArticles = $src->getNumArticles(); if ($srcNumArticles <= 0) { $errorMsgs[] = getGS("The source article type (\$1) does not have any articles.", $f_src); } if (count($errorMsgs)) { $crumbs = array(); $crumbs[] = array(getGS("Configure"), ""); $crumbs[] = array(getGS("Article Types"), "/{$ADMIN}/article_types/"); $crumbs[] = array(getGS("Merge article type"), ""); echo camp_html_breadcrumbs($crumbs); ?> <P> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box"> <TR> <TD COLSPAN="2"> <B> <?php
</TR> </TABLE> <!-- END Article Content --> </TD></TR></TABLE> </TD> </TR> <TR> <TD> <INPUT TYPE="CHECKBOX" NAME="f_delete"><?php putGS("Delete the source article type ($1) when finished.", $src->getDisplayName()); ?> </TD> <TD> <b><?php putGS('Clicking "Merge" will merge ($1) article(s).', $src->getNumArticles()); ?></b> </TD> <TR> <TD COLSPAN="2"> <DIV ALIGN="CENTER"> <?php foreach ($dest->getUserDefinedColumns(null, true, true) as $destColumn) { ?> <INPUT TYPE="HIDDEN" NAME="f_src_<?php print $destColumn->getPrintName(); ?>" VALUE="<?php print $f_src_c[$destColumn->getPrintName()]; ?>"> <?php } ?> <INPUT TYPE="HIDDEN" NAME="f_cur_preview" VALUE="<?php $curPreview->getArticleNumber(); ?>"> <INPUT TYPE="HIDDEN" NAME="f_action" VALUE=""> <INPUT TYPE="submit" class="button" NAME="Ok" ONCLICK="dialog.f_action.value='Step2'" VALUE="<?php putGS('Back to Step 2'); ?>"> <INPUT TYPE="submit" class="button" NAME="Ok" ONCLICK="dialog.f_action.value='Merge'" VALUE="<?php putGS('Merge!'); ?>"> </DIV> </TD>
</TD></TR></TABLE> </TD> </TR> <TR> <TD> <INPUT TYPE="CHECKBOX" NAME="f_delete"><?php echo $translator->trans("Delete the source article type (\$1) when finished.", array('$1' => $src->getDisplayName()), 'article_types'); ?> </TD> <TD> <b><?php echo $translator->trans('Clicking "Merge" will merge ($1) article(s).', array('$1' => $src->getNumArticles()), 'article_types'); ?> </b> </TD> <TR> <TD COLSPAN="2"> <DIV ALIGN="CENTER"> <?php foreach ($dest->getUserDefinedColumns(null, true, true) as $destColumn) { ?> <INPUT TYPE="HIDDEN" NAME="f_src_<?php print $destColumn->getPrintName(); ?> " VALUE="<?php print $f_src_c[$destColumn->getPrintName()];