GetUnusedTemplateId() public static method

Get a free Template ID.
public static GetUnusedTemplateId ( integer $p_articleNumber )
$p_articleNumber integer
コード例 #1
0
ファイル: ArticleImage.php プロジェクト: alvsgithub/Newscoop
 /**
  * Link the given image with the given article.  The template ID
  * is the image's position in the template.
  *
  * @param int $p_imageId
  * @param int $p_articleNumber
  * @param int $p_templateId
  *		Optional.  If not specified, this will be the next highest number
  *		of the existing values.
  *
  * @return void
  */
 public static function AddImageToArticle($p_imageId, $p_articleNumber, $p_templateId = null)
 {
     global $g_ado_db;
     if (is_null($p_templateId)) {
         $p_templateId = ArticleImage::GetUnusedTemplateId($p_articleNumber);
     }
     $queryStr = 'INSERT IGNORE INTO ArticleImages(NrArticle, IdImage, Number)' . ' VALUES(' . $p_articleNumber . ', ' . $p_imageId . ', ' . $p_templateId . ')';
     $g_ado_db->Execute($queryStr);
     $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
     $cacheService->clearNamespace('article_image');
 }
コード例 #2
0
ファイル: ArticleImage.php プロジェクト: nidzix/Newscoop
 /**
  * Link the given image with the given article.  The template ID
  * is the image's position in the template.
  *
  * @param int $p_imageId
  * @param int $p_articleNumber
  * @param int $p_templateId
  *		Optional.  If not specified, this will be the next highest number
  *		of the existing values.
  *
  * @return void
  */
 public static function AddImageToArticle($p_imageId, $p_articleNumber, $p_templateId = null)
 {
     global $g_ado_db;
     if (is_null($p_templateId)) {
         $p_templateId = ArticleImage::GetUnusedTemplateId($p_articleNumber);
     }
     $queryStr = 'INSERT IGNORE INTO ArticleImages(NrArticle, IdImage, Number)' . ' VALUES(' . $p_articleNumber . ', ' . $p_imageId . ', ' . $p_templateId . ')';
     $g_ado_db->Execute($queryStr);
 }
コード例 #3
0
ファイル: add.php プロジェクト: sourcefabric/newscoop
$f_language_id = Input::Get('f_language_id', 'int', 0);
$f_language_selected = Input::Get('f_language_selected', 'int', 0);
$f_article_number = Input::Get('f_article_number', 'int', 0);
if (!Input::IsValid()) {
    camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())), $_SERVER['REQUEST_URI'], true);
    exit;
}
if (!is_writable($Campsite['IMAGE_DIRECTORY'])) {
    camp_html_add_msg($translator->trans("Unable to add new image.", array(), 'media_archive'));
    camp_html_add_msg(camp_get_error_message(CAMP_ERROR_WRITE_DIR, $Campsite['IMAGE_DIRECTORY']));
}
$articleObj = new Article($f_language_selected, $f_article_number);
$publicationObj = new Publication($f_publication_id);
$issueObj = new Issue($f_publication_id, $f_language_id, $f_issue_number);
$sectionObj = new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number);
$ImageTemplateId = ArticleImage::GetUnusedTemplateId($f_article_number);
$q_now = $g_ado_db->GetOne("SELECT LEFT(NOW(), 10)");
include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php";
camp_html_display_msgs();
?>

<form method="POST" action="/<?php 
echo $ADMIN;
?>
/media-archive/do_upload.php" enctype="multipart/form-data">
<?php 
echo SecurityToken::FormParameter();
?>
<input type="hidden" name="f_article_edit" value="1">
<input type="hidden" name="f_publication_id" value="<?php 
echo $f_publication_id;
コード例 #4
0
ファイル: ArticleImage.php プロジェクト: nistormihai/Newscoop
	/**
	 * Link the given image with the given article.  The template ID
	 * is the image's position in the template.
	 *
	 * @param int $p_imageId
	 * @param int $p_articleNumber
	 * @param int $p_templateId
	 *		Optional.  If not specified, this will be the next highest number
	 *		of the existing values.
	 *
	 * @return void
	 */
	public static function AddImageToArticle($p_imageId, $p_articleNumber,
	                                         $p_templateId = null)
	{
		global $g_ado_db;
		if (is_null($p_templateId)) {
			$p_templateId = ArticleImage::GetUnusedTemplateId($p_articleNumber);
		}
		$queryStr = 'INSERT IGNORE INTO ArticleImages(NrArticle, IdImage, Number)'
					.' VALUES('.$p_articleNumber.', '.$p_imageId.', '.$p_templateId.')';
		$g_ado_db->Execute($queryStr);
		if (function_exists("camp_load_translation_strings")) {
			camp_load_translation_strings("api");
		}
		$logtext = getGS('Image $1 linked to article $2', $p_imageId, $p_articleNumber);
		Log::Message($logtext, null, 41);
	} // fn AddImageToArticle