Example #1
0
 /**
  * Show files (table view)
  *
  * @param   integer $id_area Area ID
  * @param   string  $category category
  * @param   string  $subcategory subcategory
  * @param   integer	$type type index
  * @param   integer	$pp pagination index
  * @return  void
  */
 public function index($id_area = 2, $category = '-', $subcategory = '-', $xtype = -1, $pp = 0, $str = '')
 {
     // load dictionary
     $this->dict->get_wordarray(array('files'));
     $amod = new Area_model();
     list($id_area, $areas) = $amod->get_my_areas($id_area);
     // get page
     $page = $this->get_page('files');
     $navbar = array($this->site->get_bredcrumb($page));
     $category = urldecode($category);
     $subcategory = urldecode($subcategory);
     // content
     $view = new X4View_core('container');
     $view->content = new X4View_core('files/file_list');
     $view->content->page = $page;
     $view->content->navbar = $navbar;
     $view->content->id_area = $id_area;
     $view->content->xtype = $xtype;
     $view->content->category = $category;
     $view->content->subcategory = $subcategory;
     $view->content->str = $str;
     $mod = new File_model();
     $view->content->items = X4Pagination_helper::paginate($mod->get_files($id_area, $category, $subcategory, $xtype, $str), $pp);
     $view->content->file_path = $mod->file_path;
     // area switcher
     $view->content->areas = $areas;
     // type switcher
     $view->content->types = $mod->get_types();
     // files category switcher
     $view->content->categories = $mod->get_cat($id_area);
     // files subcategory switcher
     $view->content->subcategories = $mod->get_subcat($id_area, $category);
     $view->render(TRUE);
 }
Example #2
0
 /**
  * Default method
  * Display paginated articles with specified key
  *
  * @param object	$page object
  * @param array		$args array of args
  * @param string	$param parameter (the key)
  * @return string
  */
 public function get_module($page, $args, $param = '')
 {
     $out = '';
     // pagination index
     $pp = isset($args[0]) ? intval($args[0]) : 0;
     // tag index
     $tag = isset($args[1]) && $args[1] == 'tag' ? urldecode($args[2]) : false;
     if (!empty($param)) {
         if ($tag) {
             $mod = new X3get_by_key_model();
             $items = X4Pagination_helper::paginate($mod->get_articles_by_key_and_tag($page->id_area, $page->lang, $param, $tag), $pp);
             $out .= '<div class="block"><h3>' . _TAG . ': ' . htmlentities($tag) . '</h3></div>';
         } else {
             $items = X4Pagination_helper::paginate($this->site->get_articles_by_key($page->id_area, $page->lang, $param), $pp);
         }
         // use pagination
         if ($items[0]) {
             foreach ($items[0] as $i) {
                 if (!empty($i->content)) {
                     $out .= '<div class="block">' . X4Utils_helper::online_edit($i, 0);
                     // options
                     $out .= X4Utils_helper::get_block_options($i);
                     // check excerpt
                     if ($i->excerpt) {
                         $text = X4Utils_helper::excerpt($i->content);
                         $out .= X4Utils_helper::reset_url(stripslashes($text[0]));
                     } else {
                         $out .= X4Utils_helper::reset_url(stripslashes($i->content));
                     }
                     $out .= '<div class="clear"></div>';
                     // display tags
                     if ($i->show_tags && !empty($i->tags)) {
                         $out .= '<p class="tags"><span>' . _TAGS . '</span>: ';
                         $tt = explode(',', $i->tags);
                         foreach ($tt as $t) {
                             $t = trim($t);
                             $out .= '<a href="' . BASE_URL . $page->url . '/0/tag/' . urlencode($t) . '" title="' . _TAG . '">' . $t . '</a> ';
                         }
                         $out .= '</p>';
                     }
                     $out .= '</div>';
                 }
                 // module
                 if (!empty($i->module)) {
                     $out .= X4Utils_helper::module($this->site, $page, $args, $i->module, $i->param);
                 }
             }
             // pager
             $out .= '<div id="pager">' . X4Pagination_helper::pager(BASE_URL . $page->url . '/', $items[1]) . '</div>';
         } else {
             $out .= '<div class="block"><p>' . _NO_ITEMS . '</p></div>';
         }
     }
     return $out;
 }
Example #3
0
        echo '<div class="one-fifth md-one-fourth sm-one-third xs-one-whole clearfix pad-right pad-bottom">
				<div class="widget dtable">
					<div class="dtable-cell">
						<div class="wbox filebox">
							<a href="' . FPATH . $what[$i->xtype] . '/' . $i->name . '" title="' . $i->alt . '">' . $i->name . '</a><br /> 
							<span class="small">' . $size . $filesize . '</span><br />
							<div class="acenter pad-top">' . $thumb . '</div>
						</div>
					</div>
					<div class="dtable-cell sidebar">' . $actions . $delete . '<input type="checkbox" class="bulkable" name="bulk[]" value="' . $i->id . '" /></div>
				</div>
			</div>';
    }
    echo '</div></form>';
    // pagination
    echo '<div id="file_pager" class="pager">' . X4Pagination_helper::pager(BASE_URL . 'files/index/' . $id_area . '/' . urlencode($category) . '/' . urlencode($subcategory) . '/' . $xtype . '/', $items[1], 5, false, '', 'btp') . '</div>';
} else {
    echo '<p>' . _NO_ITEMS . '</p>';
}
?>
<script>
window.addEvent('domready', function()
{
	X3.content('filters','files/filter/<?php 
echo $id_area . '/' . urlencode($category) . '/' . $subcategory . '/' . $str;
?>
', '<?php 
echo X4Utils_helper::navbar($navbar, ' . ', false);
?>
');
	buttonize('file_pager', 'btp', 'topic');
Example #4
0
 /**
  * Show articles (table view)
  * Can show articles by context, by category, by author, by key, by page
  * Default view is reverse chronological order
  *
  * @param   integer $id_area Area ID
  * @param   string 	$lang Language code
  * @param   string	$case view switcher
  * @param   mixed   $id_what view parameter
  * @param   integer $pp index for pagination
  * @param   string	$str Search string
  * @return  void
  */
 public function index($id_area = 2, $lang = '', $case = 'latest_articles', $id_what = 0, $pp = 0, $str = '')
 {
     // load dictionary
     $this->dict->get_wordarray(array('articles'));
     $area = new Area_model();
     list($id_area, $areas) = $area->get_my_areas($id_area);
     $_SESSION['referer'] = 'index/' . $id_area . '/' . $lang . '/' . $case . '/' . $id_what . '/' . $pp . '/' . $str;
     // get page
     $page = $this->get_page('articles');
     $navbar = array($this->site->get_bredcrumb($page));
     // content
     $mod = new Article_model();
     $view = new X4View_core('container');
     $view->content = new X4View_core('articles/article_list');
     $view->content->navbar = $navbar;
     switch ($case) {
         case 'context_order':
             $cmod = new Context_model();
             $con = $cmod->get_contexts($id_area, $lang);
             if ($id_what == 0 && $con) {
                 $id_what = $con[0]->code;
             }
             $view->content->items = X4Pagination_helper::paginate($mod->get_by_context($id_area, $lang, $id_what, $str), $pp);
             $view->content->contexts = $con;
             break;
         case 'category_order':
             $cmod = new Category_model();
             $ctg = $cmod->get_categories($id_area, $lang);
             if ($id_what === 0 && $ctg) {
                 $id_what = $ctg[0]->name;
             }
             $view->content->items = X4Pagination_helper::paginate($mod->get_by_category($id_area, $lang, $id_what, $str), $pp);
             $view->content->categories = $ctg;
             break;
         case 'author_order':
             $aut = $mod->get_authors($id_area, $lang);
             if ($id_what == 0 && $aut) {
                 $id_what = $aut[0]->id_editor;
             }
             $view->content->items = X4Pagination_helper::paginate($mod->get_by_author($id_area, $lang, $id_what, $str), $pp);
             $view->content->authors = $aut;
             break;
         case 'key_order':
             $keys = $mod->get_keys($id_area, $lang);
             if ($id_what == 0 && $keys) {
                 $id_what = $keys[0]->xkeys;
             }
             $view->content->items = X4Pagination_helper::paginate($mod->get_by_key($id_area, $lang, $id_what, $str), $pp);
             $view->content->keys = $keys;
             break;
         case 'by_page':
             $pmod = new Page_model();
             $spage = $pmod->get_by_id($id_what);
             $view->content->items = X4Pagination_helper::paginate($mod->get_by_page($id_area, $lang, $id_what, $str), $pp);
             $view->content->page = $spage;
             break;
         default:
             $view->content->items = X4Pagination_helper::paginate($mod->get_articles($id_area, $lang, 'id', $str), $pp);
             break;
     }
     // for the construction of the tabs
     $view->content->xcase = $case;
     $view->content->cases = $this->cases;
     $view->content->id_what = $id_what;
     $view->content->pp = $pp;
     $view->content->str = $str;
     // area switcher
     $view->content->id_area = $id_area;
     $view->content->areas = $areas;
     // language switcher
     $view->content->lang = $lang;
     $lang = new Language_model();
     $view->content->langs = $lang->get_languages();
     $view->render(TRUE);
 }
Example #5
0
                    $delete = '<a class="btl" href="' . BASE_URL . 'articles/set_by_bid/xlock/' . $i->id . '/' . ($i->xlock + 1) % 2 . '" title="' . _STATUS . ' ' . $lock . '"><i class="fa fa-' . $lock_status . ' fa-lg"></i></a>
							 <a class="bta" href="' . BASE_URL . 'articles/delete/' . $i->bid . '" title="' . _DELETE . '"><i class="fa fa-trash fa-lg red"></i></a>';
                }
            }
        }
        $link = ADVANCED_EDITING ? '<a class="btm" href="' . BASE_URL . 'sections/compose/' . $i->id_page . '">' . $i->page . '</a>' : '<strong>' . $i->page . '</strong>';
        echo '<tr>
				<td>' . date('Y-m-d', $i->date_in) . '<span class="dblock xsmall">' . $i->author . '</span></td>
				<td><strong>' . $i->name . '</strong><span class="dblock small">' . $i->context . ' ' . $link . '</span></td>
				<td>' . $actions . ' <a class="btm" href="' . BASE_URL . 'articles/history/' . $id_area . '/' . $lang . '/' . $i->bid . '" title="' . _ARTICLE_HISTORY . '"><i class="fa fa-history fa-lg"></i></a></td>
				<td class="aright">' . $delete . '</td>
				</tr>';
    }
    echo '</table>';
    // pagination
    echo '<div id="article_pager" class="pager">' . X4Pagination_helper::pager(BASE_URL . 'articles/index/' . $id_area . '/' . $lang . '/' . $xcase . '/' . $id_what . '/', $items[1], 5, false, '/' . $str, 'btp') . '</div>';
} else {
    echo '<p>' . _NO_ITEMS . '</p>';
}
?>
<script>
window.addEvent('domready', function() 
{
	X3.content('filters', 'articles/filter/<?php 
echo $id_area . '/' . $lang . '/' . $xcase . '/' . $id_what . '/' . $str;
?>
', '<?php 
echo X4Utils_helper::navbar($navbar, ' . ', false);
?>
');
	buttonize('article_pager', 'btp', 'topic');