Inheritance: extends Prezent\Doctrine\Translatable\Entity\AbstractTranslatable, implements Ojs\JournalBundle\Entity\JournalItemInterface, use trait Ojs\CoreBundle\Entity\GenericEntityTrait, use trait Ojs\CoreBundle\Entity\AnalyticsTrait
コード例 #1
0
 public function fileStatsOfArticle(Article $article)
 {
     $files = $article->getArticleFiles();
     foreach ($files as $file) {
         //@todo github.com/okulbilisim/ojs/issues/572
     }
 }
コード例 #2
0
 /**
  * article view event log
  * @param Request $request
  * @param $article
  */
 private function articleViewLog(Request $request, Article $article)
 {
     $entity = new ArticleEventLog();
     $em = $this->getDoctrine()->getManager();
     $entity->setArticleId($article->getId());
     $entity->setEventInfo(ArticleEventLogParams::$ARTICLE_VIEW);
     $entity->setIp($request->getClientIp());
     $em->persist($entity);
     $em->flush();
 }
コード例 #3
0
 /**
  * @param Article $article New article entity
  * @param array $row Supp file row from the source database
  * @param integer $oldArticleId Old ID of the article
  * @param string $oldJournalSlug Slug of the article's journal
  */
 public function importSupFile(Article $article, $row, $oldArticleId, $oldJournalSlug)
 {
     $settings = $this->getSettings($row["supp_id"]);
     if (empty($settings)) {
         return;
     }
     $accessor = PropertyAccess::createPropertyAccessor();
     $code = $article->getJournal()->getMandatoryLang()->getCode();
     $settings = empty($settings[$code]) ? current($settings) : $settings[$code];
     $fileFormat = "imported/supplementary/%s/%s.%s";
     $extension = !empty($row["file_type"]) ? $accessor->getValue(FileHelper::$mimeToExtMap, "[" . $row["file_type"] . "]") : "";
     $filename = sprintf($fileFormat, $oldArticleId, $row["file_id"], $extension);
     $keywords = mb_substr($accessor->getValue($settings, "[subject]"), 0, 255);
     $file = new ArticleFile();
     $file->setVersion(0);
     $file->setLangCode($code);
     $file->setFile($filename);
     $file->setArticle($article);
     $file->setKeywords($keywords);
     $file->setType(ArticleFileParams::SUPPLEMENTARY_FILE);
     $file->setTitle($accessor->getValue($settings, "[title]"));
     $file->setDescription($accessor->getValue($settings, "[description]"));
     $history = $this->em->getRepository(FileHistory::class)->findOneBy(["fileName" => $filename]);
     if (!$history) {
         $history = new FileHistory();
         $history->setFileName($filename);
         $history->setType("articlefiles");
         $history->setOriginalName($row["original_file_name"]);
         $this->em->persist($history);
     }
     $source = sprintf("%s/article/downloadSuppFile/%s/%s", $oldJournalSlug, $oldArticleId, $row["supp_id"]);
     $target = sprintf("/../web/uploads/articlefiles/%s", $filename);
     $download = new PendingDownload();
     $download->setSource($source);
     $download->setTarget($target);
     $this->em->persist($file);
     $this->em->persist($download);
 }
コード例 #4
0
ファイル: ArticleControllerTest.php プロジェクト: ojs/ojs
 public function testDelete()
 {
     $em = $this->em;
     $journal = $em->getRepository('OjsJournalBundle:Journal')->find('1');
     $entity = new Article();
     $entity->setCurrentLocale($this->locale);
     $entity->setAnonymous(false);
     $entity->setTitle('Article Title Delete');
     $entity->setStatus(1);
     $entity->setJournal($journal);
     $em->persist($entity);
     $em->flush();
     $id = $entity->getId();
     $this->logIn();
     $client = $this->client;
     $token = $this->generateToken('ojs_journal_article' . $id);
     $client->request('DELETE', '/journal/1/article/' . $id . '/delete', array('_token' => $token));
     $this->assertStatusCode(302, $client);
 }
コード例 #5
0
ファイル: NumeratorHelper.php プロジェクト: beyzakokcan/ojs
 public static function numerateArticle(Article $article, ObjectManager $entityManager)
 {
     $journal = $article->getJournal();
     if ($article->getNumerator() === null) {
         try {
             $numerator = $entityManager->getRepository('OjsJournalBundle:Numerator')->getArticleNumerator($journal);
             $last = $numerator->getLast() + 1;
             $numerator->setLast($last);
             $article->setNumerator($last);
         } catch (NoResultException $exception) {
             $numerator = new Numerator();
             $numerator->setJournal($journal);
             $numerator->setType('article');
             $numerator->setLast(1);
             $article->setNumerator(1);
         }
         $entityManager->persist($article);
         $entityManager->persist($numerator);
         $entityManager->flush();
     }
 }
コード例 #6
0
 /**
  * Deletes a ArticleFile entity.
  *
  * @param  Request          $request
  * @param  ArticleFile      $articleFile
  * @param  Article          $article
  * @return RedirectResponse
  */
 public function deleteAction(Request $request, ArticleFile $articleFile, Article $article)
 {
     $journal = $this->get('ojs.journal_service')->getSelectedJournal();
     $em = $this->getDoctrine()->getManager();
     if (!$this->isGranted('EDIT', $journal, 'articles')) {
         throw new AccessDeniedException("You not authorized for this page!");
     }
     if ($articleFile->getArticle() !== $article) {
         $this->throw404IfNotFound($articleFile);
     }
     $csrf = $this->get('security.csrf.token_manager');
     $token = $csrf->getToken('ojs_journal_article_file' . $articleFile->getId());
     if ($token != $request->get('_token')) {
         throw new TokenNotFoundException("Token Not Found!");
     }
     $em->remove($articleFile);
     $em->flush();
     $this->successFlashBag('successful.remove');
     return $this->redirectToRoute('ojs_journal_article_file_index', ['articleId' => $article->getId(), 'journalId' => $journal->getId()]);
 }
コード例 #7
0
ファイル: ArticleController.php プロジェクト: ojs/ojs
 /**
  * Deletes an article entity
  *
  * @param  Request          $request
  * @param  Article          $article
  * @return RedirectResponse
  */
 public function deleteAction(Request $request, Article $article)
 {
     $journal = $this->get('ojs.journal_service')->getSelectedJournal();
     $em = $this->getDoctrine()->getManager();
     if (!$this->isGranted('EDIT', $journal, 'articles')) {
         throw new AccessDeniedException("You not authorized for this page!");
     }
     /** @var $dispatcher EventDispatcherInterface */
     $dispatcher = $this->get('event_dispatcher');
     $csrf = $this->get('security.csrf.token_manager');
     $token = $csrf->getToken('ojs_journal_article' . $article->getId());
     if ($token != $request->get('_token')) {
         throw new TokenNotFoundException("Token Not Found!");
     }
     $event = new JournalItemEvent($article);
     $dispatcher->dispatch(ArticleEvents::PRE_DELETE, $event);
     /** @var Article $article */
     $article = $event->getItem();
     $article->getCitations()->clear();
     $article->getLanguages()->clear();
     $this->get('ojs_core.delete.service')->check($event->getItem());
     $em->remove($event->getItem());
     $em->flush();
     $this->successFlashBag('successful.remove');
     $event = new JournalEvent($journal);
     $dispatcher->dispatch(ArticleEvents::POST_DELETE, $event);
     if ($event->getResponse()) {
         return $event->getResponse();
     }
     return $this->redirectToRoute('ojs_journal_article_index', ['journalId' => $journal->getId()]);
 }
コード例 #8
0
ファイル: ShortLinkController.php プロジェクト: ojs/ojs
 public function articleIdAction(Article $article)
 {
     return $this->redirectToRoute('ojs_article_page', ['slug' => $article->getJournal()->getSlug(), 'article_id' => $article->getId(), 'issue_id' => $article->getIssue()->getId()]);
 }
コード例 #9
0
ファイル: ArticleAuthor.php プロジェクト: necatikartal/ojs
 /**
  *
  * @return integer
  */
 public function getArticleId()
 {
     return $this->article ? $this->article->getId() : false;
 }
コード例 #10
0
 /**
  * @param  Request                   $request
  * @return RedirectResponse|Response
  */
 public function newAction(Request $request)
 {
     if ($this->submissionsNotAllowed()) {
         return $this->respondAsNotAllowed();
     }
     $journal = $this->get('ojs.journal_service')->getSelectedJournal();
     $em = $this->getDoctrine()->getManager();
     $session = $this->get('session');
     if (!$session->has('submissionFiles')) {
         return $this->redirectToRoute('ojs_journal_submission_start', array('journalId' => $journal->getId()));
     }
     $defaultCountryId = $this->container->getParameter('country_id');
     $defaultCountry = $em->getRepository('OkulBilisimLocationBundle:Country')->find($defaultCountryId);
     /** @var User $user */
     $user = $this->getUser();
     if (!$journal) {
         return $this->redirect($this->generateUrl('ojs_journal_user_register_list'));
     }
     $article = new Article();
     $articleAuthor = new ArticleAuthor();
     $author = new Author();
     $author->setUser($user)->setFirstName($user->getFirstName())->setLastName($user->getLastName())->setEmail($user->getEmail())->setAddress($user->getAddress());
     if ($defaultCountry) {
         $author->setCountry($defaultCountry);
     }
     $articleAuthor->setAuthor($author);
     $article->setSubmitterUser($user)->setStatus(ArticleStatuses::STATUS_NOT_SUBMITTED)->setJournal($journal)->addArticleFile(new ArticleFile())->addArticleAuthor($articleAuthor);
     $locales = [];
     $submissionLangObjects = $journal->getLanguages();
     foreach ($submissionLangObjects as $submissionLangObject) {
         $locales[] = $submissionLangObject->getCode();
     }
     $defaultLocale = $journal->getMandatoryLang()->getCode();
     $article->setCurrentLocale($defaultLocale);
     $form = $this->createCreateForm($article, $journal, $locales, $defaultLocale);
     $form->handleRequest($request);
     if ($request->isMethod('POST')) {
         $k = 0;
         foreach ($article->getArticleAuthors() as $f_articleAuthor) {
             $f_articleAuthor->setAuthorOrder($k);
             $f_articleAuthor->setArticle($article);
             $k++;
         }
         $citationCounter = 0;
         foreach ($article->getCitations() as $f_citations) {
             $f_citations->setOrderNum($citationCounter);
             $citationCounter++;
         }
         foreach ($article->getArticleFiles() as $f_articleFile) {
             $f_articleFile->setArticle($article);
             $f_articleFile->setVersion(0);
         }
         $journalSubmissionFiles = $em->getRepository('OjsJournalBundle:JournalSubmissionFile')->findBy(['visible' => true, 'locale' => $request->getLocale()]);
         foreach ($session->get('submissionFiles') as $fileKey => $submissionFile) {
             if (!is_null($submissionFile)) {
                 /** @var JournalSubmissionFile $journalEqualFile */
                 $journalEqualFile = $journalSubmissionFiles[$fileKey];
                 $articleSubmissionFile = new ArticleSubmissionFile();
                 $articleSubmissionFile->setTitle($journalEqualFile->getTitle())->setDetail($journalEqualFile->getDetail())->setLocale($journalEqualFile->getLocale())->setRequired($journalEqualFile->getRequired())->setFile($submissionFile)->setArticle($article);
                 $em->persist($articleSubmissionFile);
             }
         }
         $em->persist($article);
         $em->flush();
         return $this->redirectToRoute('ojs_journal_submission_preview', array('journalId' => $journal->getId(), 'articleId' => $article->getId()));
     }
     return $this->render('OjsJournalBundle:ArticleSubmission:new.html.twig', array('article' => $article, 'journal' => $journal, 'form' => $form->createView()));
 }
コード例 #11
0
ファイル: SamplesCommand.php プロジェクト: beyzakokcan/ojs
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('Creating sample data...');
     $em = $this->getContainer()->get('doctrine')->getManager();
     $manipulator = $this->getContainer()->get('fos_user.util.user_manipulator');
     $manipulator->create('sample_author', 'author', '*****@*****.**', false, false);
     $user = $em->getRepository('OjsUserBundle:User')->findOneBy(['username' => 'sample_author']);
     $announcement = new AdminAnnouncement();
     $announcement->setTitle('We are online!');
     $announcement->setContent('We are now online and accepting submissions!');
     $em->persist($announcement);
     $em->flush();
     $post = new AdminPost();
     $post->setCurrentLocale('en');
     $post->setTitle('Welcome to OJS!');
     $post->setSlug('Welcome to OJS!');
     $post->setContent('Hello! We are now online and waiting for your submissions. ' . 'Our readers will be able to follow you and read your work ' . 'right after it gets published!');
     $em->persist($post);
     $em->flush();
     $publisherTypes = ['University', 'Government', 'Association', 'Foundation', 'Hospital', 'Chamber', 'Private'];
     foreach ($publisherTypes as $typeName) {
         $publisherType = new PublisherTypes();
         $publisherType->setCurrentLocale('en');
         $publisherType->setName($typeName);
         $em->persist($publisherType);
     }
     $em->flush();
     $slug = $this->getContainer()->getParameter('defaultPublisherSlug');
     $publisherType = $em->getRepository('OjsJournalBundle:PublisherTypes')->find(1);
     $publisher = new Publisher();
     $publisher->setCurrentLocale('en');
     $publisher->setName('OJS');
     $publisher->setSlug($slug);
     $publisher->setEmail('*****@*****.**');
     $publisher->setAddress('First Avenue, Exampletown');
     $publisher->setPhone('+908501234567');
     $publisher->setVerified(1);
     $publisher->setStatus(PublisherStatuses::STATUS_COMPLETE);
     $publisher->setPublisherType($publisherType);
     $em->persist($publisher);
     $em->flush();
     $subject1 = new Subject();
     $subject1->setCurrentLocale('en');
     $subject1->setSubject('Computer Science');
     $subject1->setTags('computer, science');
     $subject2 = new Subject();
     $subject2->setCurrentLocale('en');
     $subject2->setSubject('Journalism');
     $subject2->setTags('journalism');
     $em->persist($subject1);
     $em->persist($subject2);
     $em->flush();
     $language1 = new Lang();
     $language1->setCurrentLocale('en');
     $language1->setName('English');
     $language1->setCode('en');
     $language1->setRtl(false);
     $language2 = new Lang();
     $language2->setCurrentLocale('tr');
     $language2->setName('Türkçe');
     $language2->setCode('tr');
     $language2->setRtl(false);
     $em->persist($language1);
     $em->persist($language2);
     $em->flush();
     $articleTypes = [['Case Report', 'Olgu Sunumu'], ['Research papers', 'Araştırma Makalesi'], ['Translation', 'Çeviri'], ['Note', 'Not'], ['Letter', 'Editöre Mektup'], ['Review Articles', 'Derleme'], ['Book review', 'Kitap İncelemesi'], ['Correction', 'Düzeltme'], ['Editorial', 'Editoryal'], ['Short Communication', 'Kısa Bildiri'], ['Meeting abstract', 'Toplantı Özetleri'], ['Conference Paper', 'Konferans Bildirisi'], ['Biography', 'Biyografi'], ['Bibliography', 'Bibliyografi'], ['News', 'Haber'], ['Report', 'Rapor'], ['Legislation Review', 'Yasa İncelemesi'], ['Decision Review', 'Karar İncelemesi'], ['Art and Literature', 'Sanat ve Edebiyat'], ['Other', 'Diğer']];
     foreach ($articleTypes as $typeNames) {
         $type = new ArticleTypes();
         $type->setCurrentLocale('en');
         $type->setName($typeNames[0]);
         $type->setCurrentLocale('tr');
         $type->setName($typeNames[1]);
         $em->persist($type);
     }
     $em->flush();
     $contactTypes = ['Journal Contact', 'Primary Contact', 'Technical Contact', 'Author Support', 'Subscription Support', 'Publisher Support', 'Submission Support', 'Advertising', 'Media', 'Editor', 'Co-Editor'];
     foreach ($contactTypes as $typeName) {
         $type = new ContactTypes();
         $type->setCurrentLocale('en');
         $type->setName($typeName);
         $em->persist($type);
     }
     $em->flush();
     $journal = new Journal();
     $journal->setCurrentLocale('en');
     $journal->setPublisher($publisher);
     $journal->setTitle('Introduction to OJS');
     $journal->setSubtitle('How to use OJS');
     $journal->setDescription('A journal about OJS');
     $journal->setTitleAbbr('INTROJS');
     $journal->setUrl('http://ojs.io');
     $journal->setSlug('intro');
     $journal->addSubject($subject1);
     $journal->addSubject($subject2);
     $journal->addLanguage($language1);
     $journal->addLanguage($language2);
     $journal->setMandatoryLang($language2);
     $journal->setFounded(new \DateTime('now'));
     $journal->setIssn('1234-5679');
     $journal->setEissn('1234-5679');
     $journal->setStatus(JournalStatuses::STATUS_PUBLISHED);
     $journal->setPublished(1);
     $em->persist($journal);
     $em->flush();
     $this->createDemoFiles();
     $issueFile = new IssueFile();
     $issueFile->setCurrentLocale('en');
     $issueFile->setTitle('Demo File');
     $issueFile->setDescription('A file');
     $issueFile->setFile('issue.txt');
     $issueFile->setLangCode('en');
     $issueFile->setType(0);
     $issueFile->setVersion(0);
     $issueFile->setUpdatedBy($user->getUsername());
     $issueFileHistory = new FileHistory();
     $issueFileHistory->setFileName('issue.txt');
     $issueFileHistory->setOriginalName('issue.txt');
     $issueFileHistory->setType('issuefiles');
     $em->persist($issueFile);
     $em->persist($issueFileHistory);
     $em->flush();
     $issue = new Issue();
     $issue->setCurrentLocale('en');
     $issue->setJournal($journal);
     $issue->setTitle('First Issue: Hello OJS!');
     $issue->setDescription('First issue of the journal');
     $issue->setNumber(1);
     $issue->setVolume(1);
     $issue->setYear(2015);
     $issue->setSpecial(1);
     $issue->setDatePublished(new \DateTime('now'));
     $issue->setTags('first, guide, tutorial');
     $issue->setDatePublished(new \DateTime('now'));
     $issue->addIssueFile($issueFile);
     $em->persist($issue);
     $em->flush();
     $section = new Section();
     $section->setCurrentLocale('en');
     $section->setJournal($journal);
     $section->setTitle('Tutorials');
     $section->setHideTitle(0);
     $section->setAllowIndex(1);
     $em->persist($section);
     $em->flush();
     $citation1 = new Citation();
     $citation1->setCurrentLocale('en');
     $citation1->setRaw('The Matrix [Motion picture]. (2001). Warner Bros. Pictures.');
     $citation1->setOrderNum(0);
     $em->persist($citation1);
     $em->flush();
     $articleFile = new ArticleFile();
     $articleFile->setCurrentLocale('en');
     $articleFile->setTitle('Demo File');
     $articleFile->setDescription('A file');
     $articleFile->setFile('article.txt');
     $articleFile->setLangCode('en');
     $articleFile->setType(0);
     $articleFile->setVersion(0);
     $articleFile->setUpdatedBy($user->getUsername());
     $articleFileHistory = new FileHistory();
     $articleFileHistory->setFileName('article.txt');
     $articleFileHistory->setOriginalName('article.txt');
     $articleFileHistory->setType('articlefiles');
     $em->persist($articleFile);
     $em->persist($articleFileHistory);
     $em->flush();
     $author = new Author();
     $author->setCurrentLocale('en');
     $author->setTitle('Dr.');
     $author->setFirstName('John');
     $author->setLastName('Doe');
     $author->setEmail('*****@*****.**');
     $em->persist($author);
     $em->flush();
     $article1 = new Article();
     $article1->setCurrentLocale('en');
     $article1->setJournal($journal);
     $article1->setSection($section);
     $article1->setIssue($issue);
     $article1->setTitle('Getting Started with OJS');
     $article1->setAbstract('A tutorial about using OJS');
     $article1->setSubjects('OJS');
     $article1->setKeywords('ojs, intro, starting');
     $article1->setDoi('10.5281/zenodo.14791');
     $article1->setSubmissionDate(new \DateTime('now'));
     $article1->setPubdate(new \DateTime('now'));
     $article1->setAnonymous(0);
     $article1->setFirstPage(1);
     $article1->setLastPage(5);
     $article1->setStatus(ArticleStatuses::STATUS_PUBLISHED);
     $article1->addCitation($citation1);
     $article1->addArticleFile($articleFile);
     $em->persist($article1);
     $em->flush();
     $articleAuthor = new ArticleAuthor();
     $articleAuthor->setAuthor($author);
     $articleAuthor->setArticle($article1);
     $articleAuthor->setAuthorOrder(0);
     $em->persist($articleAuthor);
     $em->flush();
     $checklistItems = [['The title page should include necessary information.', "<ul>\n                    <li>The name(s) of the author(s)</li>\n                     <li>A concise and informative title</li>\n                     <li>The affiliation(s) of the author(s)</li>\n                     <li>The e-mail address, telephone number of the corresponding author </li>\n                 </ul>"], ['Manuscript must be approved.', 'All authors must have read and approved the most recent version of the manuscript.'], ['Manuscript must be <i>spell checked</i>.', 'The most recent version of the manuscript must be spell checked.']];
     foreach ($checklistItems as $checklistItem) {
         $label = $checklistItem[0];
         $detail = $checklistItem[1];
         $item = new SubmissionChecklist();
         $item->setLabel($label);
         $item->setDetail($detail);
         $item->setLocale('en');
         $item->setJournal($journal);
         $em->persist($item);
     }
     $em->flush();
     $periods = ['Monthly', 'Bimonthly', 'Quarterly', 'Triquarterly', 'Biannually', 'Annually', 'Spring', 'Summer', 'Fall', 'Winter'];
     foreach ($periods as $period) {
         $journalPeriod = new Period();
         $journalPeriod->setCurrentLocale('en');
         $journalPeriod->setPeriod($period);
         $em->persist($journalPeriod);
     }
     $em->flush();
 }
コード例 #12
0
 /**
  * @param  Request $request
  * @return JsonResponse
  */
 private function step1Control(Request $request)
 {
     $user = $this->getUser();
     $em = $this->getDoctrine()->getManager();
     /** @var Journal $selectedJournal */
     $selectedJournal = $this->get("ojs.journal_service")->getSelectedJournal();
     $competingInterestFile = new File();
     $competingInterestFile->setName('Competing Interest File');
     $competingInterestFile->setSize($request->get('competing_interest_file_size'));
     $competingInterestFile->setMimeType($request->get('competing_interest_file_mime_type'));
     $competingInterestFile->setPath($request->get('competing_interest_file'));
     $competingInterestFile->setTranslatableLocale($request->getDefaultLocale());
     $em->persist($competingInterestFile);
     $em->flush();
     $article = new Article();
     $article->setJournal($selectedJournal);
     $article->setSubmitterId($user->getId());
     $article->setSetupStatus(0);
     $article->setTitle('');
     $article->setTranslatableLocale($request->getDefaultLocale());
     $article->setCompetingInterestFile($competingInterestFile);
     $em->persist($article);
     $em->flush();
     $articleSubmission = new ArticleSubmissionProgress();
     $articleSubmission->setArticle($article);
     $articleSubmission->setUser($user);
     $articleSubmission->setJournal($selectedJournal);
     $articleSubmission->setChecklist(json_encode($request->get('checklistItems')));
     $articleSubmission->setSubmitted(false);
     $articleSubmission->setCurrentStep(2);
     $em->persist($articleSubmission);
     $em->flush();
     return new JsonResponse(['success' => "1", 'resumeLink' => $this->generateUrl('article_submission_resume', ['submissionId' => $articleSubmission->getId()]) . '#2']);
 }
コード例 #13
0
ファイル: SamplesCommand.php プロジェクト: hasantayyar/ojs
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('Creating sample data...');
     $em = $this->getContainer()->get('doctrine')->getManager();
     $manipulator = $this->getContainer()->get('fos_user.util.user_manipulator');
     $manipulator->create('sample_author', 'author', '*****@*****.**', false, false);
     $announcement = new AdminAnnouncement();
     $announcement->setTitle('We are online!');
     $announcement->setContent('We are now online and accepting submissions!');
     $em->persist($announcement);
     $em->flush();
     $post = new AdminPost();
     $post->setCurrentLocale('en');
     $post->setTitle('Welcome to OJS!');
     $post->setSlug('Welcome to OJS!');
     $post->setContent('Hello! We are now online and waiting for your submissions. ' . 'Our readers will be able to follow you and read your work ' . 'right after it gets published!');
     $em->persist($post);
     $em->flush();
     $slug = $this->getContainer()->getParameter('defaultPublisherSlug');
     $publisher = new Publisher();
     $publisher->setCurrentLocale('en');
     $publisher->setName('OJS');
     $publisher->setSlug($slug);
     $publisher->setVerified(1);
     $publisher->setStatus(1);
     $em->persist($publisher);
     $em->flush();
     $subject1 = new Subject();
     $subject1->setCurrentLocale('en');
     $subject1->setSubject('Computer Science');
     $subject2 = new Subject();
     $subject2->setCurrentLocale('en');
     $subject2->setSubject('Journalism');
     $em->persist($subject1);
     $em->persist($subject2);
     $em->flush();
     $language1 = new Lang();
     $language1->setCurrentLocale('en');
     $language1->setName('English');
     $language1->setCode('en');
     $language1->setRtl(0);
     $language2 = new Lang();
     $language2->setCurrentLocale('tr');
     $language2->setName('Türkçe');
     $language2->setCode('tr');
     $language2->setRtl(0);
     $em->persist($language1);
     $em->persist($language2);
     $em->flush();
     $articleTypes = ['Research', 'Analysis', 'Clinical Review', 'Practice', 'Research Methods and Reporting', 'Christmas Issue', 'Editorials', 'Blogs', 'Case Reports', 'Letters (rapid responses)', 'Obituaries', 'Personal Views', 'Fillers', 'Minerva Pictures', 'Endgames', 'What Your Patient is Thinking'];
     foreach ($articleTypes as $typeName) {
         $type = new ArticleTypes();
         $type->setCurrentLocale('en');
         $type->setName($typeName);
         $em->persist($type);
     }
     $em->flush();
     $contactTypes = ['Journal Contact', 'Primary Contact', 'Technical Contact', 'Author Support', 'Subscription Support', 'Publisher Support', 'Submission Support', 'Advertising', 'Media'];
     foreach ($contactTypes as $typeName) {
         $type = new ContactTypes();
         $type->setCurrentLocale('en');
         $type->setName($typeName);
         $em->persist($type);
     }
     $em->flush();
     $journal = new Journal();
     $journal->setCurrentLocale('en');
     $journal->setPublisher($publisher);
     $journal->setTitle('Introduction to OJS');
     $journal->setSubtitle('How to use OJS');
     $journal->setTitleAbbr('INTROJS');
     $journal->setUrl('http://ojs.io');
     $journal->setSlug('intro');
     $journal->addSubject($subject1);
     $journal->addSubject($subject2);
     $journal->setMandatoryLang($language2);
     $em->persist($journal);
     $em->flush();
     $issue = new Issue();
     $issue->setCurrentLocale('en');
     $issue->setJournal($journal);
     $issue->setTitle('First Issue: Hello OJS!');
     $issue->setNumber(1);
     $issue->setVolume(1);
     $issue->setYear(2015);
     $issue->setSpecial(1);
     $issue->setTags('fisrt, guide, tutorial');
     $issue->setDatePublished(new \DateTime('now'));
     $em->persist($issue);
     $em->flush();
     $section = new Section();
     $section->setCurrentLocale('en');
     $section->setJournal($journal);
     $section->setTitle('Tutorials');
     $section->setHideTitle(0);
     $section->setAllowIndex(1);
     $em->persist($section);
     $em->flush();
     $citation1 = new Citation();
     $citation1->setCurrentLocale('en');
     $citation1->setRaw('The Matrix [Motion picture]. (2001). Warner Bros. Pictures.');
     $em->persist($citation1);
     $em->flush();
     $article1 = new Article();
     $article1->setCurrentLocale('en');
     $article1->setJournal($journal);
     $article1->setSection($section);
     $article1->setIssue($issue);
     $article1->setTitle('Getting Started with OJS');
     $article1->setKeywords('ojs, intro, starting');
     $article1->setDoi('10.5281/zenodo.14791');
     $article1->setPubdate(new \DateTime('now'));
     $article1->setIsAnonymous(0);
     $article1->setFirstPage(1);
     $article1->setLastPage(5);
     $article1->setStatus(3);
     $article1->addCitation($citation1);
     $em->persist($article1);
     $em->flush();
 }
コード例 #14
0
ファイル: ArticleService.php プロジェクト: hasantayyar/ojs
 /**
  * @param  Article       $article
  * @return ArticleFile[]
  */
 public function getFullTextFiles(Article $article)
 {
     /** @var ArticleFileRepository $repo */
     $repo = $this->em->getRepository('OjsJournalBundle:ArticleFile');
     $files = $repo->getArticleFullTextFiles($article->getId());
     return $files;
 }
コード例 #15
0
ファイル: ArticleController.php プロジェクト: ulakjira/ojs
 /**
  * Deletes an article entity
  *
  * @param  Request          $request
  * @param  Article          $article
  * @return RedirectResponse
  */
 public function deleteAction(Request $request, Article $article)
 {
     $journal = $this->get('ojs.journal_service')->getSelectedJournal();
     $em = $this->getDoctrine()->getManager();
     if (!$this->isGranted('EDIT', $journal, 'articles')) {
         throw new AccessDeniedException("You not authorized for this page!");
     }
     /** @var $dispatcher EventDispatcherInterface */
     $dispatcher = $this->get('event_dispatcher');
     $csrf = $this->get('security.csrf.token_manager');
     $token = $csrf->getToken('ojs_journal_article' . $article->getId());
     if ($token != $request->get('_token')) {
         throw new TokenNotFoundException("Token Not Found!");
     }
     $em->remove($article);
     $em->flush();
     $this->successFlashBag('successful.remove');
     $event = new JournalEvent($request, $journal, $this->getUser(), 'delete');
     $dispatcher->dispatch(JournalMailEvents::JOURNAL_ARTICLE_CHANGE, $event);
     return $this->redirect($this->generateUrl('ojs_journal_article_index', ['journalId' => $journal->getId()]));
 }
コード例 #16
0
 /**
  * Imports citations of the given article.
  * @param int $oldArticleId Old article's ID
  * @param Article $article  Newly imported Article's entity
  */
 public function importCitations($oldArticleId, $article)
 {
     $this->consoleOutput->writeln("Reading citations...");
     $citationSql = "SELECT * FROM citations WHERE assoc_id = :id";
     $citationStatement = $this->dbalConnection->prepare($citationSql);
     $citationStatement->bindValue('id', $oldArticleId);
     $citationStatement->execute();
     $orderCounter = 0;
     $citations = $citationStatement->fetchAll();
     foreach ($citations as $pkpCitation) {
         $citation = new Citation();
         $citation->setRaw(!empty($pkpCitation['raw_citation']) ? $pkpCitation['raw_citation'] : '-');
         $citation->setOrderNum(!empty($pkpCitation['seq']) ? $pkpCitation['seq'] : $orderCounter);
         $article->addCitation($citation);
         $orderCounter++;
     }
 }
コード例 #17
0
ファイル: ArticleAuthor.php プロジェクト: hasantayyar/ojs
 /**
  *
  * @param  Article $article
  * @return $this
  */
 public function setArticle(Article $article)
 {
     $this->article = $article;
     $article->addArticleAuthor($this);
     return $this;
 }
コード例 #18
0
ファイル: ArticleFileController.php プロジェクト: ojs/ojs
 /**
  * Creates a form to edit a ArticleFile entity.
  * @param ArticleFile $entity The entity
  * @param Journal $journal
  * @param Article $article
  * @return Form The form
  */
 private function createEditForm(ArticleFile $entity, Journal $journal, Article $article)
 {
     $form = $this->createForm(new ArticleFileType(), $entity, ['action' => $this->generateUrl('ojs_journal_article_file_update', ['id' => $entity->getId(), 'journalId' => $journal->getId(), 'articleId' => $article->getId()]), 'method' => 'PUT']);
     return $form;
 }
コード例 #19
0
ファイル: ArticleService.php プロジェクト: necatikartal/ojs
 /**
  *
  * @param  Article $article
  * @return string
  */
 public function generateUrl(Article $article)
 {
     $journalUrl = $this->journalService->generateUrl($article->getJournal());
     return $journalUrl . '/' . $article->getSlug();
 }