function getList($page)
 {
     $lists = $this->db()->select($this->table->list);
     $total = $lists->copy()->count();
     $lists = $lists->limit(($page - 1) * 10, 10)->orderBy('idx', 'desc')->get();
     for ($i = 0, $loop = count($lists); $i < $loop; $i++) {
         $lists[$i]->name = $this->IM->getModule('member')->getMemberNickname($lists[$i]->midx, true, $lists[$i]->name);
         if ($lists[$i]->is_secret == 'TRUE') {
             $lists[$i]->name = false;
         }
     }
     $pagination = GetPagination($page, ceil($total / 10), 7, 'LEFT', '@Donation.getList');
     ob_start();
     $IM = $this->IM;
     $Module = $this;
     echo '<div id="ModuleDonationList">' . PHP_EOL;
     if (file_exists($this->Module->getPath() . '/views/' . $this->IM->language . '/list.php') == true) {
         include $this->Module->getPath() . '/views/' . $this->IM->language . '/list.php';
     } else {
         include $this->Module->getPath() . '/views/ko/list.php';
     }
     echo '</div>';
     $context = ob_get_contents();
     ob_end_clean();
     return $context;
 }
 function getMentPagination($parent, $p = null)
 {
     ob_start();
     $post = $this->getPost($parent);
     $dataroom = $this->getDataroom($post->did);
     $templetPath = $dataroom->templetPath;
     $templetDir = $dataroom->templetDir;
     $totalMents = $this->db()->select($this->table->ment_depth)->where('parent', $parent)->count();
     $totalPage = ceil($totalMents / $dataroom->mentlimit) == 0 ? 1 : ceil($totalMents / $dataroom->mentlimit);
     $pagination = GetPagination($p == null ? $totalPage : $p, $totalPage, $dataroom->pagelimit, 'LEFT', '@Dataroom.ment.loadPage');
     echo '<div id="ModuleDataroomMentPagination-' . $parent . '" class="mentPagination" data-parent="' . $parent . '"' . ($totalPage == 1 ? ' style="display:none;"' : '') . '>' . PHP_EOL;
     $IM = $this->IM;
     $Module = $this;
     if (file_exists($templetPath . '/ment.pagination.php') == true) {
         include $templetPath . '/ment.pagination.php';
     }
     echo '</div>' . PHP_EOL;
     $context = ob_get_contents();
     ob_end_clean();
     return $context;
 }
Example #3
0
 function getListContext($qid, $config)
 {
     ob_start();
     $this->IM->setView('list');
     $this->IM->addSiteHeader('meta', array('name' => 'robots', 'content' => 'noindex,follow'));
     $label = empty($config->label) == true ? Request('label') : $config->label;
     $qna = $this->getQna($qid);
     $templetPath = $qna->templetPath;
     $templetDir = $qna->templetDir;
     if ($label == null) {
         $strQuery = $this->db()->select($this->table->post . ' p', 'p.*')->where('p.qid', $qid);
     } else {
         $strQuery = $this->db()->select($this->table->post_label . ' l', 'p.*, l.label')->join($this->table->post . ' p', 'l.idx=p.idx', 'LEFT')->where('l.label', $label);
     }
     $strQuery = $strQuery->where('p.type', 'QUESTION');
     $keyword = Request('keyword');
     if ($keyword != null && strlen($keyword) > 0) {
         $strQuery = $strQuery->where('p.title,p.search', $keyword, 'FULLTEXT');
     }
     $sort = Request('sort') ? Request('sort') : 'idx';
     if ($sort == 'new') {
         $strQuery = $strQuery->where('p.answer', 0);
     } elseif ($sort == 'answer') {
         $strQuery = $strQuery->where('p.answer', 0, '>');
     } elseif ($sort == 'mypost') {
         $strQuery = $strQuery->where('p.midx', $this->IM->getModule('member')->getLogged());
     }
     $p = Request('p') != null && is_numeric(Request('p')) == true ? Request('p') : 1;
     $p = $p < 1 ? 1 : $p;
     $startPosition = ($p - 1) * $qna->postlimit;
     $totalCount = $strQuery->copy()->count();
     if ($sort == 'answer') {
         $strQuery = $strQuery->orderBy('p.last_answer', 'desc');
     } else {
         $strQuery = $strQuery->orderBy('p.idx', 'desc');
     }
     $totalPage = ceil($totalCount / $qna->postlimit);
     $lists = $strQuery->limit($startPosition, $qna->postlimit)->get();
     $pagination = GetPagination($p, $totalPage, $qna->pagelimit, 'LEFT');
     $loopnum = $totalCount - ($p - 1) * $qna->postlimit;
     for ($i = 0, $loop = count($lists); $i < $loop; $i++) {
         $lists[$i] = $this->getArticle('post', $lists[$i]);
         $lists[$i]->loopnum = $loopnum - $i;
         $lists[$i]->link = $this->IM->getUrl(null, null, 'view', $lists[$i]->idx) . $this->IM->getQueryString();
     }
     echo '<form name="ModuleQnaListForm" onsubmit="return Qna.getListUrl(this);">' . PHP_EOL;
     echo '<input type="hidden" name="menu" value="' . $this->IM->menu . '">' . PHP_EOL;
     echo '<input type="hidden" name="page" value="' . $this->IM->page . '">' . PHP_EOL;
     echo '<input type="hidden" name="oKeyword" value="' . $keyword . '">' . PHP_EOL;
     echo '<input type="hidden" name="oLabel" value="' . $label . '">' . PHP_EOL;
     echo '<input type="hidden" name="oSort" value="' . $sort . '">' . PHP_EOL;
     echo '<input type="hidden" name="label" value="' . $label . '">' . PHP_EOL;
     echo '<input type="hidden" name="sort" value="' . $sort . '">' . PHP_EOL;
     echo '<input type="hidden" name="p" value="' . $p . '">' . PHP_EOL;
     $values = new stdClass();
     $values->lists = $lists;
     $this->IM->fireEvent('afterInitContext', 'qna', __FUNCTION__, $values);
     $IM = $this->IM;
     $Module = $this;
     if (file_exists($templetPath . '/list.php') == true) {
         include $templetPath . '/list.php';
     }
     echo '</form>' . PHP_EOL;
     $context = ob_get_contents();
     ob_end_clean();
     return $context;
 }