Esempio n. 1
0
 private static function process(array $lines, $editionId, $startIndex)
 {
     $index = $startIndex;
     $topic = TopicService::getDefaultTopic();
     foreach ($lines as $line) {
         if (TopicImporter::isTopicLine($line)) {
             $topic = TopicImporter::getTopic(trim($line));
         } else {
             if (self::isSpecialArticle($line)) {
                 SpecialArticleImporter::importSingleArticle($line, $editionId, $index);
             } else {
                 CommonArticleImporter::importSingleArticle($line, $editionId, $index, $topic);
             }
             $index++;
         }
     }
 }
 private static function createArticle($line, $editionId, $index)
 {
     $articleName = self::getArticleName($line);
     if (!isset($articleName)) {
         throw new Exception("Can not find article name in line: " . $line);
     }
     $engName = self::getArticleEngName($line);
     $pages = self::getPages($line);
     $topic = TopicService::getDefaultTopic();
     $article = new stdClass();
     $article->topic_id = $topic->topic_id;
     $article->journal_edition_id = $editionId;
     $article->start_page = $pages->start;
     $article->end_page = $pages->end;
     $article->name = $articleName;
     $article->sort_order = $index;
     $article->name_eng = $engName;
     $article->content_file = self::generateContentFileName($index);
     return $article;
 }