/** * 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) { $context = CampTemplate::singleton()->context(); if (!$context->article->defined()) { return array(); } if (!$context->language->defined()) { $languageId = $context->publication->default_language->number; } else { $languageId = $context->language->number; } $contextBox = new ContextBox(null, $context->article->number); $p_parameters['context_box'] = $contextBox->getId(); $p_parameters['article'] = $context->article->number; $BoxArticlesList = ContextBoxArticle::GetList($p_parameters, $this->m_order, $p_start, $p_limit, $p_count); $preview = $context->preview; $metaBoxArticlesList = array(); foreach ($BoxArticlesList as $articleNo) { $article = new MetaArticle($languageId, $articleNo); if ($article->defined() && ($preview || $article->is_published)) { $metaBoxArticlesList[] = $article; } } return $metaBoxArticlesList; }
public static function OnArticleCopy($origArticle, $destArticle) { global $g_ado_db; $contextBox = new ContextBox(null, $destArticle); $sql = 'SELECT ca.fk_article_no as article_number FROM context_boxes cb, context_articles ca WHERE cb.id = ca.fk_context_id AND cb.fk_article_no = ' . $origArticle; $rows = $g_ado_db->GetAll($sql); foreach ($rows as $row) { $sql = 'INSERT IGNORE INTO context_articles (fk_context_id, fk_article_no) ' . 'VALUES (' . $contextBox->getId() . ', ' . $row['article_number'] . ')'; $g_ado_db->Execute($sql); } }
if (!array_key_exists('body', $return)) { $return['date'] = $articleObj->getCreationDate(); } $return['code'] = 200; return $return; break; case 'context_box_load_list': $return = array(); $items = array(); $articleId = $f_params['articleId']; if (!is_numeric($articleId)) { $articleIdArray = explode('_', $articleId); $articleId = $articleIdArray[1]; } $contextBoxObj = new ContextBox(null, $articleId); $contextId = $contextBoxObj->getId(); $contextArticleIds = $contextBoxObj->getArticlesList(); foreach ($contextArticleIds as $contextArticleId) { $articleObj = new Article($f_language_selected, $contextArticleId); $item['title'] = $articleObj->getTitle(); $item['articleId'] = 'article_' . $contextArticleId; $item['date'] = $articleObj->getCreationDate(); $item['status'] = $articleObj->getWorkflowDisplayString(); $items[] = $item; } $return['items'] = $items; $return['code'] = 200; return $return; break; } if ($f_target == 'art_ofp') {