Exemplo n.º 1
0
 /**
  * @param Subscription $subscription
  * @param IssueEntity $issue
  */
 public function __construct(Subscription $subscription, IssueEntity $issue)
 {
     $this->subscription = $subscription;
     $this->subscription->addIssue($this);
     $this->issueNumber = $issue->getNumber();
     $this->issue = $issue;
     $this->noticeSent = 'N';
     $this->paidDays = 0;
 }
Exemplo n.º 2
0
 public function it_gets_the_latest_issue_for_current_publication(Issue $issue, Publication $publication)
 {
     $pub = new Publication();
     $pub->setId(1);
     $issue = new Issue(1, $pub);
     $issue->setWorkflowStatus('Y');
     $publication->getIssues()->willReturn(new ArrayCollection(array($issue)));
     $this->getLatestPublishedIssue()->shouldReturn($issue);
 }
Exemplo n.º 3
0
 /**
  * Get name
  *
  * @return string
  */
 public function getName()
 {
     if ($this->subscription->getPublication() === null) {
         return '';
     }
     return $this->issue->getName();
 }
 /**
  * Provides the Output Settings Issue for the provided issue and output
  *
  * @param Issue|int $issue
  * 		The issue to be searched, not null, not empty.
  * @param Output|int|string $output
  * 		The output to be searched, not null, not empty.
  *
  * @return array Newscoop\Entity\Output\OutputSettingsIssue
  * 		The Output Setting, NULL if no Output Setting could be found for the provided issue.
  */
 public function findByIssueAndOutput($issue, $output)
 {
     /** Get the id if an Output object is supplied */
     /* @var $output Output */
     $outputId = $output;
     if ($output instanceof Output) {
         $outputId = $output->getId();
     }
     /** Get the id if an Issue object is supplied */
     /* @var $issue Issue */
     $issueId = $issue;
     if ($issue instanceof Issue) {
         $issueId = $issue->getId();
     }
     $em = $this->getManager();
     $repository = $em->getRepository($this->entityClassName);
     $resources = $repository->findBy(array('issue' => $issueId, 'output' => $outputId));
     if (!empty($resources)) {
         return $resources[0];
     }
     return NULL;
 }
Exemplo n.º 5
0
 /**
  * Finds output for issue by issue and output
  *
  * @param Issue  $issue  Issue object
  * @param Output $output Output object
  *
  * @return string|null
  */
 public function findByIssueAndOutput($issue, $output)
 {
     $outputId = $output;
     if ($output instanceof Output) {
         $outputId = $output->getId();
     }
     $issueId = $issue;
     if ($issue instanceof Issue) {
         $issueId = $issue->getId();
     }
     $resources = $this->em->getRepository('Newscoop\\Entity\\Output\\OutputSettingsIssue')->findBy(array('issue' => $issueId, 'output' => $outputId));
     if (!empty($resources)) {
         return $resources[0];
     }
     return null;
 }
 /**
  * Get the page for error
  *      to be used as a template.
  *
  * @param Issue|Int $issue
  *      The issue object or the id of the issue for whom the template is needed.
  * @param Output|int|string $output
  *      The object Output, the id or the Name of the Output for whom the template is needed.
  *
  * @return string
  *      The full path of the template.
  */
 public function getErrorPage($issue, $output)
 {
     /* @var $issue Issue */
     $issueId = $issue;
     if ($issue instanceof Issue) {
         $issueId = $issue->getId();
     } else {
         $issue = $this->getIssueService()->getById($issueId);
     }
     $publicationId = $issue->getPublicationId();
     $outputId = $output;
     if ($output instanceof Output) {
         $outputId = $output->getId();
     }
     $em = $this->getManager();
     $q = $em->createQueryBuilder();
     $q->select(array('oi', 'ot'))->from(OutputSettingsTheme::NAME, 'ot')->from(OutputSettingsIssue::NAME_1, 'oi')->where('ot.themePath = oi.themePath')->andWhere('ot.publication = :publication')->andWhere('ot.output = :output')->andWhere('oi.output = :output')->andWhere('oi.issue = :issue')->setParameter('output', $outputId)->setParameter('issue', $issueId)->setParameter('publication', $publicationId);
     $results = $q->getQuery()->getResult();
     if (count($results) < 2) {
         return '';
     }
     /* @var $outputSettingTheme OutputSettingsTheme */
     list(, $outputSettingTheme) = each($results);
     /* @var $outputSettingIssue OutputSettingsIssue */
     list(, $outputSettingIssue) = each($results);
     if (!is_null($resource = $outputSettingIssue->getErrorPage())) {
         return $this->getResourceFullPath($resource);
     }
     return $this->getResourceFullPath($outputSettingTheme->getErrorPage());
 }
Exemplo n.º 7
0
 public function getShortName()
 {
     $this->__load();
     return parent::getShortName();
 }