public function getAllFile($fid) { $df = new DocumentsPortal(); return $df->getWhere("file_folder_id = '{$fid}'"); }
public function search() { $s = isset($_GET['s']) ? addslashes($_GET['s']) : die('please insert search text'); $loc = isset($_GET['loc']) ? addslashes($_GET['loc']) : die('please define location'); $_SESSION['DocumentPortal_view_only'] = 1; //$mode = isset($_GET['mode'])?addslashes($_GET['mode']):die('no mode'); // if($mode<1)die("mode hrs integer"); // $s = isset($_GET['s'])?addslashes($_GET['s']):""; /* * TODO Check CHANNEL Allowed */ $halaman = isset($_GET['p']) ? addslashes($_GET['p']) : 1; $limit = 5; $begin = ($halaman - 1) * $limit; $searchText = ""; if ($s != "") { $searchText = " ( file_url LIKE '%{$s}%' OR file_isi LIKE '%{$s}%')"; } $page = new DocumentsPortal(); $whereClause = " {$searchText}"; $arrPage = $page->getWhere($whereClause . " ORDER BY file_url DESC LIMIT {$begin},{$limit}"); $jml = $page->getJumlah($whereClause); $jmlpage = ceil($jml / $limit); $mode = 0; //$pc = new PageContainer(); //$pc->getByID($mode); //$gw = new GalleryWeb(); //$page->file_filename ?> <h1 class="tbsh1" style="margin-bottom:20px; background-color: #efefef; padding: 10px; color: #000;"> <?php echo Lang::t('Documents'); ?> <div style="float: right; width: 200px; display: none;"> <div class="input-group"> <input id="seachtext" type="text" value="<?php echo $s; ?> " class="form-control" placeholder="search "> <span class="input-group-btn"> <button onclick="document.location='<?php echo _SPPATH; ?> pagecontainer?mode=<?php echo $mode; ?> &s='+$('#seachtext').val();" class="btn btn-default" type="button"> <i class="glyphicon glyphicon-search"></i> </button> </span> <script> $("#seachtext").keyup(function(){ if (event.keyCode == 13) { //on enter var slc = $('#seachtext').val(); $('#<?php echo $loc; ?> ').load('<?php echo _SPPATH; ?> PageWeb/search?s='+$('#seachtext').val()); } }); </script> </div><!-- /input-group --> </div> <div style="float:right; font-size: 12px; line-height: 24px;"> <?php echo $jml; ?> <?php echo Lang::t('results in'); ?> <?php echo $jmlpage; ?> <?php echo Lang::t('pages'); ?> </div> </h1> <style> .post-title{ font-size: 18px !important; color:#333 !important; font-weight: bold; } .post-title a{ color:#555 !important; } </style> <?php foreach ($arrPage as $num => $p) { $url = "dm"; $link = _SPPATH . "docviewer?gurl=" . $url . "&id=" . $p->file_id; $onclick = "onclick=\"window.open('" . $link . "','_blank');\""; $arrParents = $p->findAllParents(); //pr($arrParents); //pr($p); $arrpar = array(); $arrParents = array_reverse($arrParents); foreach ($arrParents as $par) { $arrpar[] = $par->folder_name; } $strpar = implode("/", $arrpar); ?> <div class="post-preview"> <div class="col-md-12"> <div style="padding-left:10px;"> <div class="post-meta" style="font-size:11px;font-style: italic; color:#555;"><?php echo indonesian_date($p->file_date); ?> </div> <div <?php echo $onclick; ?> class="post-title" style="cursor:pointer;"> <i class="glyphicon glyphicon-list-alt"></i> <?php echo stripslashes($p->file_url); ?> </div> <div class="locat" style="font-size:12px;font-style: italic; color:#555;"><?php echo $strpar; ?> </div> <div class="post-subtitle" style="font-size:13px;font-style: italic; color:#555;"> <?php echo substr(stripslashes(strip_tags($p->file_isi)), 0, 100); ?> <?php if (strlen($p->file_isi) > 100) { ?> ... <?php } ?> <?php /*<a href="<?=_SPPATH.$page->upload_url;?><?=$p->file_filename;?>"> <?=Lang::t('read more');?> </a>*/ ?> </div> </div> </div> <div class="clearfix"></div> </div> <?php if ($num < count($arrPage) - 1) { ?> <hr> <?php } ?> <style> .post-meta{ font-size: 14px; padding-top: 0; margin-top: 0; } .post-title{ margin-bottom: 0; margin-top: 0; padding: 0; } .post-subtitle{ padding-top: 10px; } .buttonefi{ margin: 0 auto; text-align: center; font-weight: bold; cursor: pointer; background-color: #dedede; border-radius: 5px; padding: 10px; margin: 10px; } .buttonefi:hover{ background-color: #efefef; } </style> <?php } $jmlpage = ceil($jml / $limit); ?> <nav> <ul class="pagination"> <?php if ($halaman > 1) { ?> <li><a onclick="$('#<?php echo $loc; ?> ').load('<?php echo _SPPATH; ?> DMWeb/search?loc=<?php echo $loc; ?> &s=<?php echo $s; ?> &p=<?php echo $halaman - 1; ?> ');" > <span aria-hidden="true">«</span><span class="sr-only">Previous</span> </a> </li> <?php } ?> <?php //ambil 3 bh terdekat // $mulai = $halaman - 2; $akhir = $halaman + 2; //echo $mulai.$akhir; $min = max($mulai, 1); $max = min($akhir, $jmlpage); //echo "<br> max :".$max; //echo "<br> min :".$min; for ($x = $min; $x <= $max; $x++) { ?> <li <?php if ($x == $halaman) { ?> class="active"<?php } ?> > <a onclick="$('#<?php echo $loc; ?> ').load('<?php echo _SPPATH; ?> DMWeb/search?loc=<?php echo $loc; ?> &s=<?php echo $s; ?> &p=<?php echo $x; ?> ');" > <?php echo $x; ?> </a> </li> <?php } ?> <?php if ($jml > $begin + $limit) { ?> <li> <a onclick="$('#<?php echo $loc; ?> ').load('<?php echo _SPPATH; ?> DMWeb/search?loc=<?php echo $loc; ?> &s=<?php echo $s; ?> &p=<?php echo $halaman + 1; ?> ');" > <span aria-hidden="true">»</span><span class="sr-only">Next</span> </a> </li> <?php } ?> </ul> </nav> <!-- <h4><?php echo $jml; ?> results in <?php echo $jmlpage; ?> pages</h4> --> <?php }