The followings are the available columns in table '{{article_type}}':
Inheritance: extends CActiveRecord
 public function beforeRender()
 {
     $articlesParams = array();
     foreach ((array) \ArticleType::GetArticleTypes(true) as $one_art_type_name) {
         $one_art_type = new \ArticleType($one_art_type_name);
         if ($one_art_type->getFilterStatus()) {
             $articlesParams[] = new ComparisonOperation('type', new Operator('not', 'string'), $one_art_type->getTypeName());
         }
     }
     $articlesOrders = array(array('field' => 'bylastupdate', 'dir' => 'desc'));
     $this->items = Article::GetList($articlesParams, $articlesOrders, 0, self::LIMIT, $count = 0);
 }
Example #2
0
	/**
	 * Gets the translation for a given language; default language is the
	 * session language.  If no translation is set for that language, we
	 * return the dbTableName.
     *
	 * @param int p_lang
	 *
	 * @return string
	 */
	public function getDisplayName($p_lang = 0)
	{
		if (!$p_lang) {
			$lang = camp_session_get('LoginLanguageId', 1);
		} else {
			$lang = $p_lang;
		}
		$aObj = new ArticleType($this->m_articleTypeName);
		$translations = $aObj->getTranslations();
		if (!isset($translations[$lang])) return substr($aObj->getTableName(), 1);
		return $translations[$lang];

	} // fn getDisplayName
	/**
	 * Rename the article type field.
	 *
	 * @param string p_newName
	 *
	 */
	public function rename($p_newName)
	{
		global $g_ado_db;
		if (!$this->exists() || !ArticleType::isValidFieldName($p_newName)) {
			return 0;
		}

		$types = self::DatabaseTypes(null, $this->m_precision);

		$queryStr = "ALTER TABLE `X". $this->m_data['type_name']."` CHANGE COLUMN `"
		. $this->getName() ."` `F$p_newName` ". $types[$this->getType()];
		$success = $g_ado_db->Execute($queryStr);

		if ($success) {
			if ($this->getType() == self::TYPE_TOPIC) {
				$query = "UPDATE TopicFields SET FieldName = '" . $g_ado_db->escape($p_newName)
				. "' WHERE RootTopicId = " . $this->getTopicTypeRootElement();
				$g_ado_db->Execute($query);
			}

			$fieldName = $this->m_data['field_name'];
			$this->setProperty('field_name', $p_newName);

			if (function_exists("camp_load_translation_strings")) {
				camp_load_translation_strings("api");
			}
			$logText = getGS('The article type field "$1" has been renamed to "$2".',
			$fieldName, $p_newName);
			Log::Message($logText, null, 62);
		}
	} // fn rename
 /**
  * Get options
  *
  * @return array
  */
 public function getOptions()
 {
     $types = \ArticleType::GetArticleTypes($p_includeHidden = false);
     $options = array();
     foreach ($types as $type) {
         $options[$type] = $type;
     }
     return $options;
 }
Example #5
0
 /**
  * Rename the article type field.
  *
  * @param string p_newName
  *
  */
 public function rename($p_newName)
 {
     global $g_ado_db;
     if (!$this->exists() || !ArticleType::isValidFieldName($p_newName)) {
         return 0;
     }
     $types = self::DatabaseTypes(null, $this->m_precision);
     $oldFieldName = $this->m_data['field_name'];
     $queryStr = "ALTER TABLE `X" . $this->m_data['type_name'] . "` CHANGE COLUMN `" . $this->getName() . "` `F{$p_newName}` " . $types[$this->getType()];
     $success = $g_ado_db->Execute($queryStr);
     if ($success) {
         if ($this->getType() == self::TYPE_TOPIC) {
             $query = "UPDATE TopicFields SET FieldName = " . $g_ado_db->escape($p_newName) . " WHERE RootTopicId = " . $this->getTopicTypeRootElement();
             $g_ado_db->Execute($query);
         }
         $fieldName = $this->m_data['field_name'];
         $this->setProperty('field_name', $p_newName);
         if ($this->getType() == self::TYPE_COMPLEX_DATE) {
             $em = Zend_Registry::get('container')->getService('em');
             $repo = $em->getRepository('Newscoop\\Entity\\ArticleDatetime');
             $repo->renameField($this->m_data['type_name'], array('old' => $oldFieldName, 'new' => $p_newName));
         }
     }
 }
Example #6
0
    <td><?php 
echo $form->textField($model, 'tilte', array('class' => 'text', 'maxlength' => 255));
?>
</td>
  </tr>
    <tr>
    <th>游戏:</th>
    <td><?php 
echo $form->dropDownList($model, 'gid', Games::model()->getGamesAllShow(), array('class' => 'select'));
?>
</td>
  </tr>
  <tr>
    <th>栏目:</th>
     <td><?php 
echo $form->dropDownList($model, 'tid', CHtml::listData(ArticleType::model()->findAll(), 'id', 'typename'), array('class' => 'select'));
?>
</td>
  </tr>
  <tr>
    <th>关键字:</th>
    <td><?php 
echo $form->textField($model, 'keywords', array('size' => 50, 'maxlength' => 50, 'class' => 'text'));
?>
</td>
  </tr>
    <tr>
    <th>描述:</th>
    <td><?php 
echo $form->textArea($model, 'description', array('class' => 'textarea'));
?>
Example #7
0
<?php

camp_load_translation_strings("article_types");
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;
}
$articleTypes = ArticleType::GetArticleTypes();
$f_src = trim(Input::get('f_src'));
$f_dest = trim(Input::get('f_dest'));
$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>
<FORM NAME="dialog" METHOD="POST" ACTION="/<?php 
echo $ADMIN;
?>
/article_types/merge2.php">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" CLASS="box_table">
<TR>
	<TD COLSPAN="2">
		<b><?php 
putGS("Merge Article Types: Step \$1 of \$2", "1", "3");
?>
</b>
Example #8
0
<?php 
include "_login.php";
?>

<div id="list">
<div id="list_left">
      <h1>
      	<?php 
echo CHtml::link('918首页>>', array('site/index'));
?>
      	<?php 
$getGamesName = Games::model()->getGamesName($_GET['id']);
echo CHtml::link($getGamesName[0] . '>>', array('article/index', 'id' => $_GET['id']));
?>
      	<div style="color:#FC8D03;"><?php 
echo ArticleType::model()->getArticleTypeName($_GET['tid']);
?>
</div>
      </h1>
      <style>
      	#list_left h1{
      		padding-left:20px;
			margin:0;
			line-height:47px;
		}
		#list_left h1 a{
			padding:0 ;
			margin:0;
			float:left;
		}
      </style>
Example #9
0
    <td><?php 
echo $form->textField($model, 'tilte', array('class' => 'text', 'maxlength' => 255));
?>
</td>
  </tr>
    <tr>
    <th>游戏:</th>
    <td><?php 
echo $form->dropDownList($model, 'gid', Games::model()->getGamesAllShow(), array('class' => 'select'));
?>
</td>
  </tr>
  <tr>
    <th>栏目:</th>
    <td><?php 
echo $form->dropDownList($model, 'tid', ArticleType::model()->getArticleType(), array('class' => 'select'));
?>
</td>
  </tr>
  <tr>
    <th>关键字:</th>
    <td><?php 
echo $form->textField($model, 'keywords', array('size' => 50, 'maxlength' => 50, 'class' => 'text'));
?>
</td>
  </tr>
    <tr>
    <th>描述:</th>
    <td><?php 
echo $form->textArea($model, 'description', array('class' => 'textarea'));
?>
Example #10
0
    public function testIsValidFieldName()
	{
		$this->assertTrue(ArticleType::IsValidFieldName('_a'));
		$this->assertTrue(ArticleType::IsValidFieldName('az'));
		$this->assertTrue(ArticleType::IsValidFieldName('a_'));
		$this->assertFalse(ArticleType::IsValidFieldName(''));
		$this->assertFalse(ArticleType::IsValidFieldName('_'));
		$this->assertFalse(ArticleType::IsValidFieldName('2'));
		$this->assertFalse(ArticleType::IsValidFieldName('_2'));
		$this->assertFalse(ArticleType::IsValidFieldName('2_'));
		$this->assertFalse(ArticleType::IsValidFieldName('a2'));
		$this->assertFalse(ArticleType::IsValidFieldName('a '));
	}
Example #11
0
 protected function getCommentsEnabled()
 {
     $publicationObj = new Publication($this->m_dbObject->getProperty('IdPublication'));
     $articleTypeObj = new ArticleType($this->m_dbObject->getProperty('Type'));
     return $publicationObj->commentsEnabled()
     && $articleTypeObj->commentsEnabled()
     && $this->m_dbObject->commentsEnabled();
 }
Example #12
0
<!--
#side_right input{
	width:40px;
}
#side_right select{
	width:60px;
}
-->
</style>
<div id="side_right">
<h2><strong>文章管理</strong></h2>
<h3><span class="title">管理文章</span><span class="manage"><a href="javascript:void(0)"><img src="<?php 
echo Yii::app()->request->baseUrl;
?>
/system/images/delete.jpg" /></a></span></h3>

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'user-grid', 'dataProvider' => $model->search(), 'selectableRows' => 2, 'filter' => $model, 'template' => '{items}{pager}', 'cssFile' => false, 'pager' => array('class' => 'CLinkPager', 'cssFile' => false, 'header' => ''), 'columns' => array(array('class' => 'CCheckBoxColumn', 'name' => 'id'), 'id', array('name' => 'tilte', 'type' => 'raw', 'value' => 'CHtml::link($data->tilte,array(update,id=>$data->id))'), array('name' => 'gid', 'filter' => CHtml::listData(Games::model()->findAll(), 'id', 'gname'), 'value' => '$data->gameName->gname'), array('name' => 'tid', 'filter' => CHtml::listData(ArticleType::model()->findAll(), 'id', 'typename'), 'value' => '$data->articleType->typename'), array('name' => 'create_time', 'value' => 'date("Y-m-d",$data->create_time)'), array('name' => 'up_time', 'value' => 'date("Y-m-d",$data->up_time)'), array('name' => 'display', 'filter' => Yii::app()->params['display'], 'value' => 'Article::model()->getArticleDisplay($data->display)'), array('header' => '编辑', 'class' => 'CButtonColumn', 'htmlOptions' => array()))));
?>

<?php 
$this->widget('CLinkPager', array('pages' => $pages, 'header' => '', 'firstPageLabel' => '首页', 'lastPageLabel' => '末页', 'prevPageLabel' => '上一页', 'nextPageLabel' => '下一页', 'cssFile' => false, 'footer' => ''));
?>
</div>
<!---------------side_right end---------------->
<?php 
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('user-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>
</div><!-- search-form -->

Example #13
0
<?php

require_once $GLOBALS['g_campsiteDir'] . '/classes/Log.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Article.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/ArticleType.php';
$translator = \Zend_Registry::get('container')->getService('translator');
if (!SecurityToken::isValid()) {
    camp_html_display_error($translator->trans('Invalid security token!'));
    exit;
}
$f_articleTypeName = Input::Get('f_article_type');
$f_filter = Input::Get('f_filter');
$errorMsgs = array();
$res = \ArticleType::SetTypeFilter($f_articleTypeName, $f_filter);
camp_html_goto_page("/{$ADMIN}/article_types/");
Example #14
0
      <td align="right"><?php 
echo $translator->trans("Article Type", array(), 'articles');
?>
:</td>
      <td>
        <select name="f_article_type" id="f_article_type" class="input_select" alt="select" emsg="<?php 
echo $translator->trans('You must select an article type.', array(), 'articles');
?>
">
        <option value=""><?php 
echo $translator->trans('---Select article type---', array(), 'articles');
?>
</option>
        <?php 
foreach ($articleTypes as $article_type) {
    $articleType = new ArticleType($article_type);
    camp_html_select_option($articleType->getTypeName(), $f_article_type, $articleType->getTypeName());
}
?>
        </select>
      </td>
    </tr>
    <tr>
      <td align="right"><?php 
echo $translator->trans("Language");
?>
:</td>
      <td>
        <select name="f_article_language_id" id="f_article_language_id" class="input_select" alt="select" emsg="<?php 
echo $translator->trans('You must select an article language.', array(), 'articles');
?>
Example #15
0
	private static function ReadArticleTypes()
	{
		if (is_null(self::$s_articleTypes)) {
            require_once($GLOBALS['g_campsiteDir'].'/classes/ArticleType.php');
			$articleTypes = ArticleType::GetArticleTypes(true);
			self::$s_articleTypes = array();
			foreach ($articleTypes as $articleType) {
				self::$s_articleTypes[strtolower($articleType)] = $articleType;
			}
		}
	}
Example #16
0
 /**
  * Process item
  * @param  Article $article
  * @return array
  */
 public function processItem($article)
 {
     global $g_user, $Campsite;
     $translator = \Zend_Registry::get('container')->getService('translator');
     $editorService = \Zend_Registry::get('container')->getService('newscoop.editor');
     $articleLink = $editorService->getLink($article);
     $articleLinkParams = $editorService->getLinkParameters($article);
     $articleLinkParamsTranslate = $articleLinkParams . '&amp;f_action=translate&amp;f_action_workflow=' . $article->getWorkflowStatus() . '&amp;f_article_code=' . $article->getArticleNumber() . '_' . $article->getLanguageId();
     $previewLink = $Campsite['WEBSITE_URL'] . '/admin/articles/preview.php' . $editorService->getLinkParameters($article);
     $htmlPreviewLink = '<a href="' . $previewLink . '" target="_blank" title="' . $translator->trans('Preview') . '">' . $translator->trans('Preview') . '</a>';
     $translateLink = $Campsite['WEBSITE_URL'] . '/admin/articles/translate.php' . $articleLinkParamsTranslate;
     $htmlTranslateLink = '<a href="' . $translateLink . '" target="_blank" title="' . $translator->trans('Translate') . '">' . $translator->trans('Translate') . '</a>';
     $lockInfo = '';
     $lockHighlight = false;
     $timeDiff = camp_time_diff_str($article->getLockTime());
     if ($article->isLocked() && $timeDiff['days'] <= 0) {
         $lockUser = new User($article->getLockedByUser());
         if ($timeDiff['hours'] > 0) {
             $lockInfo = $translator->trans('The article has been locked by $1 ($2) $3 hour(s) and $4 minute(s) ago.', array('$1' => htmlspecialchars($lockUser->getRealName()), '$2' => htmlspecialchars($lockUser->getUserName()), '$3' => $timeDiff['hours'], '$4' => $timeDiff['minutes']), 'articles');
         } else {
             $lockInfo = $translator->trans('The article has been locked by $1 ($2) $3 minute(s) ago.', array('$1' => htmlspecialchars($lockUser->getRealName()), '$2' => htmlspecialchars($lockUser->getUserName()), '$3' => $timeDiff['minutes']), 'articles');
         }
         if ($article->getLockedByUser() != $g_user->getUserId()) {
             $lockHighlight = true;
         }
     }
     $tmpUser = new User($article->getCreatorId());
     $tmpArticleType = new ArticleType($article->getType());
     $tmpAuthor = new Author();
     $articleAuthors = ArticleAuthor::GetAuthorsByArticle($article->getArticleNumber(), $article->getLanguageId());
     foreach ((array) $articleAuthors as $author) {
         if (strtolower($author->getAuthorType()->getName()) == 'author') {
             $tmpAuthor = $author;
             break;
         }
     }
     if (!$tmpAuthor->exists() && isset($articleAuthors[0])) {
         $tmpAuthor = $articleAuthors[0];
     }
     $onFrontPage = $article->onFrontPage() ? $translator->trans('Yes') : $translator->trans('No');
     $onSectionPage = $article->onSectionPage() ? $translator->trans('Yes') : $translator->trans('No');
     $imagesNo = (int) ArticleImage::GetImagesByArticleNumber($article->getArticleNumber(), true);
     $topicsNo = (int) ArticleTopic::GetArticleTopics($article->getArticleNumber(), true);
     $commentsNo = '';
     if ($article->commentsEnabled()) {
         global $controller;
         $repositoryComments = $controller->getHelper('entity')->getRepository('Newscoop\\Entity\\Comment');
         $filter = array('thread' => $article->getArticleNumber(), 'language' => $article->getLanguageId());
         $params = array('sFilter' => $filter);
         $commentsNo = $repositoryComments->getCount($params);
     } else {
         $commentsNo = 'No';
     }
     // get language code
     $language = new Language($article->getLanguageId());
     return array($article->getArticleNumber(), $article->getLanguageId(), $article->getOrder(), sprintf('%s <a href="%s" title="%s %s">%s</a>', $article->isLocked() ? '<span class="ui-icon ui-icon-locked' . (!$lockHighlight ? ' current-user' : '') . '" title="' . $lockInfo . '"></span>' : '', $articleLink, $translator->trans('Edit'), htmlspecialchars($article->getName() . " ({$article->getLanguageName()})"), htmlspecialchars($article->getName() . (empty($_REQUEST['language']) ? " ({$language->getCode()})" : ''))), htmlspecialchars($article->getSection()->getName()), $article->getWebcode(), htmlspecialchars($tmpArticleType->getDisplayName()), htmlspecialchars($tmpUser->getRealName()), htmlspecialchars($tmpAuthor->getName()), $article->getWorkflowStatus(), $onFrontPage, $onSectionPage, $imagesNo, $topicsNo, $commentsNo, (int) $article->getReads(), Geo_Map::GetArticleMapId($article) != null ? $translator->trans('Yes') : $translator->trans('No'), (int) sizeof(Geo_Map::GetLocationsByArticle($article)), $article->getCreationDate(), $article->getPublishDate(), $article->getLastModified(), $htmlPreviewLink, $htmlTranslateLink);
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = ArticleType::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #18
0
}
// detect if blogger can edit
$userIsBlogger = false;
$blogService = \Zend_Registry::get('container')->getService('blog');
if ($blogService->isBlogger($g_user)) {
    $userIsBlogger = true;
    $userSection = $blogService->getSection($g_user);
    if (empty($userSection) || $userSection->getSectionId() != $articleObj->getSection()->getSectionId()) {
        camp_html_display_error(getGS("You're not allowed to edit article."));
        exit;
    }
}
$articleData = $articleObj->getArticleData();
// Get article type fields.
$dbColumns = $articleData->getUserDefinedColumns(FALSE, TRUE);
$articleType = new ArticleType($articleObj->getType());
$articleImages = ArticleImage::GetImagesByArticleNumber($f_article_number);
$lockUserObj = new User($articleObj->getLockedByUser());
$articleCreator = new User($articleObj->getCreatorId());
$articleEvents = ArticlePublish::GetArticleEvents($f_article_number, $f_language_selected, TRUE);
$articleTopics = ArticleTopic::GetArticleTopics($f_article_number);
$articleFiles = ArticleAttachment::GetAttachmentsByArticleNumber($f_article_number, $f_language_selected);
$articleLanguages = $articleObj->getLanguages();
// Create displayable "last modified" time.
$lastModified = strtotime($articleObj->getLastModified());
$today = getdate();
$savedOn = getdate($lastModified);
$savedToday = true;
if ($today['year'] != $savedOn['year'] || $today['mon'] != $savedOn['mon'] || $today['mday'] != $savedOn['mday']) {
    $savedToday = FALSE;
}
Example #19
0
$correct = true;
$created = false;
//$topicParent = new Topic($f_topic_parent_id);
//$Path = camp_topic_path($topicParent, $f_topic_language_id);

$errorMsgs = array();


if ($f_type_language_id <= 0) {
	$correct = false;
	$errorMsgs[] = getGS('You must choose a language for the article type.');
}

if ($correct) {
	// Translate existing type
	$type = new ArticleType($f_type_id);
	$created = $type->setName($f_type_language_id, $f_type_translation_name);
	if ($created) {
		camp_html_goto_page("/$ADMIN/article_types/index.php");
	}
	else {
		$errorMsgs[] = getGS('The translation could not be added.');
	}
}

$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Article Types"), "/$ADMIN/article_types/");
$crumbs[] = array(getGS("Adding new article type"), "");

echo camp_html_breadcrumbs($crumbs);
Example #20
0
$f_section_number = Input::Get('f_section_number', 'int', 0);
$f_language_id = Input::Get('f_language_id', 'int', 1);
$articleId = Input::Get('f_article_number', 'int', 1);
if (isset($_SESSION['f_language_selected'])) {
    $f_old_language_selected = (int) $_SESSION['f_language_selected'];
} else {
    $f_old_language_selected = 0;
}
$f_language_selected = (int) camp_session_get('f_language_selected', 0);
$article_language_use = $f_language_selected;
if (empty($article_language_use)) {
    $article_language_use = $f_language_id;
}
$article = new Article($article_language_use, $articleId);
$article_type_name = $article->getType();
$article_type = new ArticleType($article_type_name);
$article_type_columns = $article_type->getUserDefinedColumns();
//var_dump($article_type_columns);
?>
<script src="<?php 
echo $Campsite['WEBSITE_URL'];
?>
/js/jquery/calendar/fullcalendar.min.js" type="text/javascript"></script>
<script type="text/javascript">

$.fn.serializeObject = function()
{
    var o = {};
    var a = this.serializeArray();
    $.each(a, function() {
        if (o[this.name] !== undefined) {
Example #21
0
        echo $allArticleTypes[0];
        ?>
">
                    <?php 
        $tmpAT = new ArticleType($allArticleTypes[0]);
        echo $tmpAT->getDisplayName($f_article_language);
    } else {
        ?>
    				<SELECT NAME="f_article_type" class="input_select" alt="select" emsg="<?php 
        echo $translator->trans('You must fill in the $1 field.', array('$1' => $translator->trans('Article Type', array(), 'articles')));
        ?>
">
	   		      	<option></option>
		  		    <?php 
        foreach ($allArticleTypes as $tmpType) {
            $tmpAT = new ArticleType($tmpType);
            camp_html_select_option($tmpType, $f_article_type, $tmpAT->getDisplayName($f_article_language));
        }
        ?>
				    </SELECT>
               <?php 
    }
    ?>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" ><?php 
    echo $translator->trans("Language");
    ?>
:</TD>
			<TD>
Example #22
0
<?php

camp_load_translation_strings("article_types");
require_once $GLOBALS['g_campsiteDir'] . '/classes/ArticleType.php';
// Check permissions
if (!$g_user->hasPermission('ManageArticleTypes')) {
    camp_html_display_error(getGS("You do not have the right to add article types."));
    exit;
}
$articleTypes = ArticleType::GetArticleTypes(true);
$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Article Types"), "/{$ADMIN}/article_types/");
$crumbs[] = array(getGS("Add new article type"), "");
echo camp_html_breadcrumbs($crumbs);
include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php";
?>
<P>
<FORM NAME="dialog" METHOD="POST" ACTION="/<?php 
echo $ADMIN;
?>
/article_types/do_add.php" onsubmit="return <?php 
camp_html_fvalidate();
?>
;">
<?php 
echo SecurityToken::FormParameter();
?>

<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" CLASS="box_table">
<TR>
Example #23
0
if ($ok && $f_action == 'Merge') {
	if (!SecurityToken::isValid()) {
		camp_html_display_error(getGS('Invalid security token!'));
		exit;
	}

	$res = ArticleType::merge($f_src, $f_dest, $f_src_c);
    if (!$res) {
        $errMsgs[] = getGS("Merge failed.");
        $ok = false;
    }
    if ($ok) {
    	$f_delete = Input::get('f_delete', 'checkbox', 0);
        if ($f_delete) {
            // delete the source article type
            $at = new ArticleType($f_src);
            $at->delete();
        }

        camp_html_goto_page("/$ADMIN/article_types/");
        exit(0);
    }
}


//
// Otherwise, we are in preview mode, so render up a preview
//
if ($ok) {
    //
    // calculate where this article is in relation to all the articles of the src type
Example #24
0
 public function getArticleTypeName($id)
 {
     $ArticleTypeName = ArticleType::model()->findByAttributes(array('id' => $id));
     return $ArticleTypeName->typename;
 }
Example #25
0
 /**
  * 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
Example #26
0
<TR class="table_list_header">
	<TD ALIGN="LEFT" VALIGN="TOP"><B><?php putGS("Template Type Name"); ?></B></TD>
	<TD ALIGN="LEFT" VALIGN="TOP"><B><?php putGS("Fields"); ?></B></TD>
	<TD ALIGN="LEFT" VALIGN="TOP"><B><?php putGS("Display Name"); ?></B></TD>
	<TD ALIGN="LEFT" VALIGN="TOP"><B><?php putGS("Translate"); ?></B></TD>
	<TD ALIGN="LEFT" VALIGN="TOP"><B><?php putGS("Show/Hide"); ?></B></TD>
	<TD ALIGN="LEFT" VALIGN="TOP"><B><?php putGS("Comments enabled?"); ?></B></TD>
	<?php  if ($g_user->hasPermission("DeleteArticleTypes")) { ?>
	<TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Delete"); ?></B></TD>
	<?php  } ?>
</TR>
<?php
$color = 0;
$i = 0;
foreach ($articleTypes as $articleType) {
	$currentArticleType = new ArticleType($articleType);
	if ($currentArticleType->getStatus() == 'hidden') {
		$hideShowText = getGS('show');
		$hideShowStatus = 'show';
		$hideShowImage = "is_hidden.png";
	} else {
		$hideShowText = getGS('hide');
		$hideShowStatus = 'hide';
		$hideShowImage = "is_shown.png";
	}

	if ($currentArticleType->commentsEnabled()) {
		$commentChangeText = getGS('deactivate');
		$commentImage = "is_shown.png";
	} else {
		$commentChangeText = getGS('activate');
Example #27
0
require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/ArticleType.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Translation.php';
$translator = \Zend_Registry::get('container')->getService('translator');
$request = \Zend_Registry::get('container')->get('request');
$locale = $request->getLocale();
if (!Saas::singleton()->hasPermission('ManageArticleTypes')) {
    camp_html_display_error($translator->trans("You do not have the right to manage article types.", array(), 'article_type_fields'));
    exit;
}
$articleTypeName = Input::Get('f_article_type');
// return value is sorted by language
$allLanguages = Language::GetLanguages(null, null, null, array(), array(), true);
$lang = Language::GetLanguageByCode($locale);
$languageObj = new Language($lang->getLanguageId());
$articleType = new ArticleType($articleTypeName);
$fields = $articleType->getUserDefinedColumns(null, true, true);
$crumbs = array();
$crumbs[] = array($translator->trans("Configure"), "");
$crumbs[] = array($translator->trans("Article Types"), "/{$ADMIN}/article_types/");
$crumbs[] = array($articleTypeName, "");
$crumbs[] = array($translator->trans("Article type fields", array(), 'article_type_fields'), "");
echo camp_html_breadcrumbs($crumbs);
$row_rank = 0;
if ($g_user->hasPermission("ManageArticleTypes")) {
    include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php";
    ?>
<script>
var field_ids = new Array;
var allShown = 0;
</script>
Example #28
0
}
$articleTypeName = Input::Get('f_article_type');
$fieldName = trim(Input::Get('f_field_name'));
$showInEditor = Input::Get('f_show_in_editor', 'int', 0);
$fieldType = trim(Input::Get('f_article_field_type'));
$rootTopicId = Input::Get('f_root_topic_id', 'int', 0);
$isContent = Input::Get('f_is_content');
$precision = Input::Get('f_precision');
$editorSize = Input::Get('f_editor_size');
$editorSizeCustom = Input::Get('f_editor_size_custom');
$maxsize = Input::Get('f_maxsize');
$eventColor = Input::Get('f_event_color');
$field = new ArticleTypeField($articleTypeName, $fieldName);
$correct = true;
$errorMsgs = array();
if (!ArticleType::IsValidFieldName($fieldName)) {
    $errorMsgs[] = $translator->trans('The $1  must not be void and may only contain letters and underscore (_) character.', array('$1' => $translator->trans('Name')), 'article_type_fields');
    $correct = false;
}
if ($field->exists()) {
    $errorMsgs[] = $translator->trans('The field $1 already exists.', array('$1' => '<B>' . urlencode($fieldName) . '</B>'), 'article_type_fields');
    $correct = false;
}
$validTypes = array_keys(ArticleTypeField::DatabaseTypes());
if (!in_array($fieldType, $validTypes)) {
    $errorMsgs[] = $translator->trans('Invalid field type.', array(), 'article_type_fields');
    $correct = false;
}
$article = new MetaArticle();
if ($article->has_property($fieldName) || method_exists($article, $fieldName)) {
    $correct = false;
Example #29
0
echo ArticleType::model()->getArticleTypeName($model->tid);
?>
-></a><b class="cl"><?php 
echo $model->tilte;
?>
</b></h1>-->
      <h1>
      	<?php 
echo CHtml::link('918首页>>', array('site/index'));
?>
      	<?php 
$getGamesName = Games::model()->getGamesName($model->gid);
echo CHtml::link($getGamesName[0] . '>>', array('article/index', 'id' => $model->gid));
?>
      	<?php 
echo CHtml::link(ArticleType::model()->getArticleTypeName($model->tid) . '>>', array('article/list', 'id' => $model->gid, 'tid' => $model->tid));
?>
      	<div style="color:#FC8D03;"><?php 
echo $model->tilte;
?>
</div>
      </h1>
      <style>
      	#meirong h1{
      		padding:0;
			margin:0;
			line-height:47px;
		}
		#meirong h1 a{
			padding:0 ;
			margin:0;
Example #30
0
$articleTypeName = Input::Get('f_article_type');
$f_oldName = Input::Get('f_old_field_name');
$f_name = Input::Get('f_new_field_name');

if ($f_oldName == $f_name) {
   	camp_html_goto_page("/$ADMIN/article_types/fields/?f_article_type=". urlencode($articleTypeName));
}
$correct = true;
$created = false;

$errorMsgs = array();
if (empty($f_name)) {
    $correct = false;
    $errorMsgs[] = getGS('You must fill in the $1 field.','<B>'.getGS('Name').'</B>');
} else {
	$valid = ArticleType::IsValidFieldName($f_name);
	if (!$valid) {
		$correct = false;
		$errorMsgs[] = getGS('The $1 field may only contain letters and underscore (_) character.', '<B>' . getGS('Name') . '</B>');
    }

    if ($correct) {
    	$old_articleTypeField = new ArticleTypeField($articleTypeName, $f_oldName);
    	if (!$old_articleTypeField->exists()) {
		    $correct = false;
		    $errorMsgs[] = getGS('The field $1 does not exist.', '<B>'.htmlspecialchars($f_oldName).'</B>');
		}
    }

	if ($correct) {
		$articleTypeField = new ArticleTypeField($articleTypeName, $f_name);