Inheritance: extends DatabaseObject
Example #1
0
 /**
  * Creates the list of objects. Sets the parameter $p_hasNextElements to
  * true if this list is limited and elements still exist in the original
  * list (from which this was truncated) after the last element of this
  * list.
  *
  * @param int $p_start
  * @param int $p_limit
  * @param array $p_parameters
  * @param int &$p_count
  * @return array
  */
 protected function CreateList($p_start = 0, $p_limit = 0, array $p_parameters, &$p_count)
 {
     $articleTopicsList = ArticleTopic::GetList($this->m_constraints, $this->m_order, $p_start, $p_limit, $p_count);
     $metaTopicsList = array();
     foreach ($articleTopicsList as $topic) {
         $metaTopicsList[] = new MetaTopic($topic);
     }
     return $metaTopicsList;
 }
 /**
  * Creates the list of objects. Sets the parameter $p_hasNextElements to
  * true if this list is limited and elements still exist in the original
  * list (from which this was truncated) after the last element of this
  * list.
  *
  * @param  int   $p_start
  * @param  int   $p_limit
  * @param  array $p_parameters
  * @param  int   &$p_count
  * @return array
  */
 protected function CreateList($p_start = 0, $p_limit = 0, array $p_parameters, &$p_count)
 {
     $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
     $cacheKey = $cacheService->getCacheKey(array('ArticleTopicsList', implode('-', $this->m_constraints), implode('-', $this->m_order), $p_start, $p_limit, $p_count), 'article');
     if ($cacheService->contains($cacheKey)) {
         $metaTopicsList = $cacheService->fetch($cacheKey);
     } else {
         $articleTopicsList = ArticleTopic::GetList($this->m_constraints, $this->m_order, $p_start, $p_limit, $p_count);
         $metaTopicsList = array();
         foreach ($articleTopicsList as $topic) {
             $metaTopicsList[] = new MetaTopic($topic);
         }
         $cacheService->save($cacheKey, $metaTopicsList);
     }
     return $metaTopicsList;
 }
Example #3
0
    /**
     * Delete article from database.  This will
     * only delete one specific translation of the article.
     *
     * @return boolean
     */
    public function delete()
    {
        // It is an optimization to put these here because in most cases
        // you dont need these files.
        require_once($GLOBALS['g_campsiteDir'].'/classes/ArticleImage.php');
        require_once($GLOBALS['g_campsiteDir'].'/classes/ArticleTopic.php');
        require_once($GLOBALS['g_campsiteDir'].'/classes/ArticleIndex.php');
        require_once($GLOBALS['g_campsiteDir'].'/classes/ArticleAttachment.php');
        require_once($GLOBALS['g_campsiteDir'].'/classes/ArticleComment.php');
        require_once($GLOBALS['g_campsiteDir'].'/classes/ArticlePublish.php');

        // Delete scheduled publishing
        ArticlePublish::OnArticleDelete($this->m_data['Number'], $this->m_data['IdLanguage']);

        // Delete Article Comments
        ArticleComment::OnArticleDelete($this->m_data['Number'], $this->m_data['IdLanguage']);

        // is this the last translation?
        if (count($this->getLanguages()) <= 1) {
            // Delete image pointers
            ArticleImage::OnArticleDelete($this->m_data['Number']);

            // Delete topics pointers
            ArticleTopic::OnArticleDelete($this->m_data['Number']);

            // Delete file pointers
            ArticleAttachment::OnArticleDelete($this->m_data['Number']);

            // Delete indexes
            ArticleIndex::OnArticleDelete($this->getPublicationId(), $this->getIssueNumber(),
                $this->getSectionNumber(), $this->getLanguageId(), $this->getArticleNumber());
        }

        // geo-map processing
        // is this the last translation?
        if (count($this->getLanguages()) <= 1) {
            // unlink the article-map pointers
            Geo_Map::OnArticleDelete($this->m_data['Number']);
        }
        else {
            // removing non-last translation of the map poi contents
            Geo_Map::OnLanguageDelete($this->m_data['Number'], $this->m_data['IdLanguage']);
        }

        // Delete row from article type table.
        $articleData = new ArticleData($this->m_data['Type'],
            $this->m_data['Number'],
            $this->m_data['IdLanguage']);
        $articleData->delete();

        $tmpObj = clone $this; // for log
        $tmpData = $this->m_data;
        $tmpData['languageName'] = $this->getLanguageName();
        // Delete row from Articles table.
        $deleted = parent::delete();

        if ($deleted) {
            if (function_exists("camp_load_translation_strings")) {
                camp_load_translation_strings("api");
            }
            Log::ArticleMessage($tmpObj, getGS('Article deleted.'), null, 32);
        }
        $this->m_cacheUpdate = true;
        return $deleted;
    } // fn delete
Example #4
0
 /**
  * Returns an article topics list based on the given parameters.
  *
  * @param array   $p_parameters
  *                              An array of ComparisonOperation objects
  * @param string  $p_order
  *                              An array of columns and directions to order by
  * @param integer $p_start
  *                              The record number to start the list
  * @param integer $p_limit
  *                              The offset. How many records from $p_start will be retrieved.
  * @param integer $p_count
  *                              The total count of the elements; this count is computed without
  *                              applying the start ($p_start) and limit parameters ($p_limit)
  *
  * @return array $articleTopicsList
  *               An array of Topic objects
  */
 public static function GetList(array $p_parameters, $p_order = null, $p_start = 0, $p_limit = 0, &$p_count, $p_skipCache = false)
 {
     global $g_ado_db;
     if (!$p_skipCache && CampCache::IsEnabled()) {
         $paramsArray['parameters'] = serialize($p_parameters);
         $paramsArray['order'] = is_null($p_order) ? 'null' : $p_order;
         $paramsArray['start'] = $p_start;
         $paramsArray['limit'] = $p_limit;
         $cacheListObj = new CampCacheList($paramsArray, __METHOD__);
         $articleTopicsList = $cacheListObj->fetchFromCache();
         if ($articleTopicsList !== false && is_array($articleTopicsList)) {
             return $articleTopicsList;
         }
     }
     $selectClauseObj = new SQLSelectClause();
     $countClauseObj = new SQLSelectClause();
     $rootTopicIds = array();
     // processes the parameters
     $hasArticleNr = false;
     foreach ($p_parameters as $parameter) {
         $comparisonOperation = self::ProcessListParameters($parameter);
         if (sizeof($comparisonOperation) < 1) {
             break;
         }
         if (strpos($comparisonOperation['left'], 'NrArticle') !== false) {
             $hasArticleNr = true;
         }
         if (strpos($comparisonOperation['left'], 'RootTopic') !== false) {
             $rootTopicIds[] = (int) $comparisonOperation['right'];
             continue;
         }
         $whereCondition = $g_ado_db->escapeOperation($comparisonOperation);
         $selectClauseObj->addWhere($whereCondition);
         $countClauseObj->addWhere($whereCondition);
     }
     // validates whether article number was given
     if ($hasArticleNr === false) {
         CampTemplate::singleton()->trigger_error("missed parameter Article Number in statement list_article_topics");
         return array();
     }
     if (count($rootTopicIds) > 0) {
         $subtopicsQuery = Topic::BuildSubtopicsQueryWithoutDepth($rootTopicIds);
         $whereCondition = 'TopicId IN (' . $subtopicsQuery->buildQuery() . ')';
         $selectClauseObj->addWhere($whereCondition);
         $countClauseObj->addWhere($whereCondition);
     }
     // sets the main table and columns to be fetched
     $tmpArticleTopic = new ArticleTopic();
     $selectClauseObj->setTable($tmpArticleTopic->getDbTableName());
     $selectClauseObj->addColumn('TopicId');
     $countClauseObj->setTable($tmpArticleTopic->getDbTableName());
     $countClauseObj->addColumn('COUNT(*)');
     unset($tmpArticleTopic);
     if (!is_array($p_order)) {
         $p_order = array();
     }
     // sets the order condition if any
     foreach ($p_order as $orderColumn => $orderDirection) {
         $selectClauseObj->addOrderBy($orderColumn . ' ' . $orderDirection);
     }
     // sets the limit
     $selectClauseObj->setLimit($p_start, $p_limit);
     // builds the query and executes it
     $selectQuery = $selectClauseObj->buildQuery();
     $topics = $g_ado_db->GetAll($selectQuery);
     if (is_array($topics)) {
         $countQuery = $countClauseObj->buildQuery();
         $p_count = $g_ado_db->GetOne($countQuery);
         // builds the array of topic objects
         $articleTopicsList = array();
         foreach ($topics as $topic) {
             $articleTopicsList[] = $topic['TopicId'];
         }
     } else {
         $articleTopicsList = array();
         $p_count = 0;
     }
     if (!$p_skipCache && CampCache::IsEnabled()) {
         $cacheListObj->storeInCache($articleTopicsList);
     }
     return $articleTopicsList;
 }
Example #5
0
 public function has_topic($p_topicName) {
     $topic = new Topic($p_topicName);
     if (!$topic->exists()) {
         $this->trigger_invalid_value_error('has_topic', $p_topicName);
         return null;
     }
     $articleTopics = $this->getContentCache('article_topics');
     if (is_null($articleTopics)) {
         $articleTopics = ArticleTopic::GetArticleTopics($this->m_dbObject->getArticleNumber());
         $this->setContentCache('article_topics', $articleTopics);
     }
     foreach ($articleTopics as $articleTopic) {
         if ($articleTopic->getTopicId() == $topic->getTopicId()) {
             return (int)true;
         }
     }
     return (int)false;
 }
Example #6
0
// delete
foreach ($articleTopics as $topic) {
    if (!in_array($topic->getTopicId(), $f_topic_ids)) {
        ArticleTopic::RemoveTopicFromArticle($topic->getTopicId(), $f_article_number);
    } else {
        unset($f_topic_ids[array_search($topic->getTopicId(), $f_topic_ids)]);
    }
}

// insert rest
foreach ($f_topic_ids as $topicIdString) {
    // Verify topic exists
    $tmpTopic = new Topic($topicIdString);
    if ($tmpTopic->exists()) {
        ArticleTopic::AddTopicToArticle($topicIdString, $f_article_number);
    }
}

?>

<script type="text/javascript">
<?php if (!is_null($f_topic_ids)) { ?>
try {
    parent.$.fancybox.reload = true;
    parent.$.fancybox.message = '<?php putGS('Topics updated.'); ?>';
} catch (e) {}
<?php } ?>
parent.$.fancybox.close();
</script>
Example #7
0
 public function getSEOURLEnd(array $seoFields, $languageId)
 {
     $urlEnd = '';
     foreach ($seoFields as $field => $value) {
         switch ($field) {
             case 'name':
                 if ($text = trim($this->getName())) {
                     $urlEnd .= $urlEnd ? '-' . $text : $text;
                 }
                 break;
             case 'keywords':
                 if ($text = trim($this->getKeywords())) {
                     $urlEnd .= $urlEnd ? '-' . $text : $text;
                 }
                 break;
             case 'topics':
                 $articleTopics = ArticleTopic::GetArticleTopics($this->getArticleNumber());
                 foreach ($articleTopics as $topic) {
                     $urlEnd .= $urlEnd ? '-' . $topic->getName($languageId) : $topic->getName($languageId);
                 }
                 break;
         }
     }
     $urlEnd = preg_replace('/[\\\\,\\/\\.\\?"\\+&%:#]/', '', trim($urlEnd));
     $urlEnd = str_replace(' ', '-', $urlEnd) . '.htm';
     return $urlEnd;
 }
Example #8
0
}
if ($f_confirmed == 1) {
    // get a list of subtopics
    $deleteTopics = $deleteTopic->getSubtopics();
    // detach all subtopics from all articles
    foreach ($deleteTopics as $topic) {
        ArticleTopic::RemoveTopicFromArticles($topic->getTopicId());
    }
    // delete all subtopics
    foreach ($deleteTopics as $topic) {
        $topic->delete($f_topic_language_id);
    }
    $doDelete = true;
}
if ($doDelete) {
    ArticleTopic::RemoveTopicFromArticles($deleteTopic->getTopicId());
    $deleted = $deleteTopic->delete($f_topic_language_id);
    if ($deleted) {
        camp_html_add_msg(getGS("Topic was deleted."), "ok");
        camp_html_goto_page("/{$ADMIN}/topics/index.php");
    } else {
        $errorMsgs[] = getGS('The topic $1 could not be deleted.', '<B>' . $deleteTopic->getName($f_topic_language_id) . '</B>');
    }
}
$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Topics"), "/{$ADMIN}/topics/");
$crumbs[] = array(getGS("Deleting topic"), "");
echo camp_html_breadcrumbs($crumbs);
?>
Example #9
0
    $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;
}
$sectionObj = null;
$showComments = FALSE;
$showCommentControls = FALSE;
if ($f_publication_id > 0) {
    $publicationObj = new Publication($f_publication_id);
Example #10
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);
 }
Example #11
0
 /**
  * Get seo string
  *
  * @param object $article
  * @param array $fields
  * @return string
  */
 public function getSeo($article, array $fields)
 {
     $seo = array();
     foreach ($fields as $field => $value) {
         switch ($field) {
             case 'name':
                 $seo[] = trim($article->getName());
                 break;
             case 'keywords':
                 $seo[] = trim($article->getKeywords());
                 break;
             case 'topics':
                 $articleTopics = \ArticleTopic::GetArticleTopics($article->getNumber());
                 if (is_array($articleTopics)) {
                     foreach ($articleTopics as $topic) {
                         $seo[] = trim($topic->getName($article->getLanguageId()));
                     }
                 }
                 break;
         }
     }
     $seo = trim(implode('-', array_filter($seo)), '-');
     $seo = preg_replace('/[\\\\,\\/\\.\\?"\\+&%:#]/', '', $seo);
     if (strlen($seo) > 0) {
         $seo = str_replace(' ', '-', $seo) . '.htm';
     }
     return $this->encode($seo);
 }
Example #12
0
	camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), null, true);
	exit;
}

if (!$g_user->hasPermission('AttachTopicToArticle')) {
	camp_html_display_error(getGS("You do not have the right to detach topics from articles."), null, true);
	exit;
}

$articleObj = new Article($f_language_selected, $f_article_number);
if (!$articleObj->exists()) {
	camp_html_display_error(getGS('Article does not exist.'), null, true);
	exit;
}
$topicObj = new Topic($f_topic_id);
if (!$topicObj->exists()) {
	camp_html_display_error(getGS('Topic does not exist.'), null, true);
	exit;
}

ArticleTopic::RemoveTopicFromArticle($f_topic_id, $f_article_number);
$topicName = $topicObj->getName($f_language_selected);
if (empty($topicName)) {
	$topicName = $topicObj->getName(1);
}
camp_html_add_msg(getGS("The topic '$1' has been removed from article.", $topicName), "ok");
$url = camp_html_article_url($articleObj, $f_language_id, "edit.php");
camp_html_goto_page($url);

?>
Example #13
0
if (!$g_user->hasPermission('ManageTopics')) {
	camp_html_display_error(getGS("You do not have the right to delete topics."));
	exit;
}

$f_topic_language_id = Input::Get('f_topic_language_id', 'int', 0);
$f_topic_delete_id = Input::Get('f_topic_delete_id', 'int', 0);
$errorMsgs = array();
$doDelete = true;
$deleteTopic = new Topic($f_topic_delete_id);
if (($deleteTopic->getNumTranslations() == 1) && $deleteTopic->hasSubtopics()) {
	$doDelete = false;
	$errorMsgs[] = getGS('This topic has subtopics, therefore it cannot be deleted.');
}
$numArticles = count(ArticleTopic::GetArticlesWithTopic($f_topic_delete_id));
if ($numArticles > 0) {
	$doDelete = false;
	$errorMsgs[] = getGS('There are $1 articles using the topic.', $numArticles);
}

if ($doDelete) {
	$deleted = $deleteTopic->delete($f_topic_language_id);
	if ($deleted) {
	    camp_html_add_msg(getGS("Topic was deleted."), "ok");
		camp_html_goto_page("/$ADMIN/topics/index.php");
	}
	else {
		$errorMsgs[] = getGS('The topic $1 could not be deleted.','<B>'.$deleteTopic->getName($f_topic_language_id).'</B>');
	}
}
Example #14
0
 public function has_topic($p_topicName)
 {
     $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
     $cacheKey = $cacheService->getCacheKey(array('has_topic', $this->m_dbObject->getArticleNumber(), $p_topicName), 'article');
     if ($cacheService->contains($cacheKey)) {
         $exists = $cacheService->fetch($cacheKey);
     } else {
         $exists = (int) false;
         $em = \Zend_Registry::get('container')->getService('em');
         $repository = $em->getRepository('Newscoop\\NewscoopBundle\\Entity\\Topic');
         $context = CampTemplate::singleton()->context();
         $locale = $context->language->code;
         $topic = $repository->getTopicByIdOrName($p_topicName, $locale)->getOneOrNullResult();
         if (!$topic) {
             $this->trigger_invalid_value_error('has_topic', $p_topicName);
             return null;
         }
         $articleTopics = ArticleTopic::GetArticleTopics($this->m_dbObject->getArticleNumber());
         foreach ($articleTopics as $articleTopic) {
             if ($articleTopic->getTopicId() == $topic->getTopicId()) {
                 $exists = (int) true;
             }
         }
         $cacheService->save($cacheKey, $exists);
     }
     return $exists;
 }
Example #15
0
	/**
	 * Process item
	 * @param Article $article
	 * @return array
	 */
	public function processItem(Article $article)
	{
		global $g_user, $Campsite;

		$articleLinkParams = '?f_publication_id=' . $article->getPublicationId()
		. '&amp;f_issue_number=' . $article->getIssueNumber() . '&amp;f_section_number=' . $article->getSectionNumber()
		. '&amp;f_article_number=' . $article->getArticleNumber() . '&amp;f_language_id=' . $article->getLanguageId()
		. '&amp;f_language_selected=' . $article->getLanguageId();
		$articleLink = $Campsite['WEBSITE_URL'].'/admin/articles/edit.php' . $articleLinkParams;
		$previewLink = $Campsite['WEBSITE_URL'].'/admin/articles/preview.php' . $articleLinkParams;

		$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 = getGS('The article has been locked by $1 ($2) $3 hour(s) and $4 minute(s) ago.',
				htmlspecialchars($lockUser->getRealName()),
				htmlspecialchars($lockUser->getUserName()),
				$timeDiff['hours'], $timeDiff['minutes']);
			} else {
				$lockInfo = getGS('The article has been locked by $1 ($2) $3 minute(s) ago.',
				htmlspecialchars($lockUser->getRealName()),
				htmlspecialchars($lockUser->getUserName()),
				$timeDiff['minutes']);
			}
			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() ? getGS('Yes') : getGS('No');
		$onSectionPage = $article->onSectionPage() ? getGS('Yes') : getGS('No');

		$imagesNo = (int) ArticleImage::GetImagesByArticleNumber($article->getArticleNumber(), true);
		$topicsNo = (int) ArticleTopic::GetArticleTopics($article->getArticleNumber(), true);
		$commentsNo = '';
		if ($article->commentsEnabled()) {
			$commentsNo = (int) ArticleComment::GetArticleComments($article->getArticleNumber(), $article->getLanguageId(), null, true);
		} 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,
		getGS('Edit'), $article->getName() . " ({$article->getLanguageName()})",
		$article->getName() . (empty($_REQUEST['language']) ? " ({$language->getCode()})" : '')),
		$tmpArticleType->getDisplayName(),
		$tmpUser->getRealName(),
		$tmpAuthor->getName(),
		$article->getWorkflowStatus(),
		$onFrontPage,
		$onSectionPage,
		$imagesNo,
		$topicsNo,
		$commentsNo,
		(int) $article->getReads(),
		Geo_Map::GetArticleMapId($article) != NULL ? getGS('Yes') : getGS('No'),
		(int) sizeof(Geo_Map::GetLocationsByArticle($article)),
		$article->getCreationDate(),
		$article->getPublishDate(),
		$article->getLastModified(),
		);
	}