Exemplo n.º 1
0
 public function run()
 {
     $pages = array();
     foreach ($this->loadMultiple() as $schedule) {
         //Check the day of the week before releasing page
         $day = strtolower(date("l"));
         if (!$schedule->{$day}) {
             continue;
         }
         //Get the schedules arc id
         $arcId = $schedule->arcId;
         //Get the next node to release
         $options = array('where' => 'arc_id = ? and is_active = 0', 'orderBy' => 'page_number ASC', 'limit 1', 'data' => array($arcId));
         $node = new \ATPComic\Model\Node();
         $nodes = $node->loadMultiple($options);
         $node = count($nodes) > 0 ? $nodes[0] : null;
         //If there are no more pages, then skip this arc
         if (is_null($node)) {
             continue;
         }
         //Release the page
         $page = $node->page;
         $page->isActive = 1;
         $page->postDate = date('Y-m-d H:i:s');
         $page->save();
         $pages[] = $page;
     }
     return $pages;
 }
Exemplo n.º 2
0
 public function getPageNodes()
 {
     if (is_null($this->_pageNodes)) {
         $options = array('where' => 'arc_id = ? and is_active=1', 'orderBy' => 'page_number ASC', 'data' => array($this->id));
         $node = new \ATPComic\Model\Node();
         $this->_pageNodes = $node->loadMultiple($options);
     }
     return $this->_pageNodes;
 }