default.php 41.1 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060
<?php
/* ======================================================
# Monthly Archive - Joomla! Component v4.3.3 (PRO version)
# -------------------------------------------------------
# For Joomla! 3.x
# Author: Yiannis Christodoulou (yiannis@web357.eu)
# Copyright (©) 2009-2018 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https://www.web357.eu/
# Demo: http://demo.web357.eu/?item=monthlyarchive
# Support: support@web357.eu
# Last modified: 09 Feb 2018, 13:55:18
========================================================= */

// No direct access
defined('_JEXEC') or die; 

if ($this->content_type == 'default')
{
	JHtml::addIncludePath(JPATH_SITE . '/components/com_content/helpers');
}

// Import filesystem libraries. Perhaps not necessary, but does not hurt
jimport('joomla.filesystem.file'); ?>

<script>
jMA(document).ready(function($) {
    "use strict";

	// UIkit run in scope mode to avoid conflicts
	UIkit.container = '.uk-scope'; // UIkit.util.$('.uk-scope');

	// Search button validation
	$('button#search-button-home, button#search-button-page').on('click', function () {

		var filter_search 	= $('#filter_search').val();
		var filter_author 	= $('#filter_author').val();
		var filter_category = $('#filter_category').val();

		if (
			(filter_search === null || filter_search === "") && 
			(filter_author === null || filter_author === "") && 
			(filter_category === null || filter_category === "")
		   )
		{
			$("#filter_search, #filter_author, #filter_category").css("border", "1px solid red");
			UIkit.modal.alert("<?php echo JText::_('COM_MONTHLYARCHIVE_ALERT_ERROR_EMPTY_FORM'); ?>");
			return false;
		}
		else if (filter_search.length < 3)
		{
			$("#filter_search").css("border", "1px solid red");
			UIkit.modal.alert("<?php echo JText::_('COM_MONTHLYARCHIVE_ALERT_MAXLENGHT_SEARCH_INPUT_FORM'); ?>");
			return false;
		}
	});		

	// bind change event to select
	$('#filter_date, #filter_orderby, #filter_author, #filter_category').on('change', function () {

		var filter_date = $('#filter_date').val(); // get selected value
		var filter_orderby = $('#filter_orderby').val(); // get selected value
		var filter_category = $('#filter_category').val(); // get selected value
		var filter_author = $('#filter_author').val(); // get selected value
		var menu_item_id = $('#menu_item_id').val(); // get selected value

		var url = 'index.php?option=com_monthlyarchive<?php echo (!$this->sef ? '&view=archive' : ''); ?>';

		if (filter_date) 
		{
			var date_arr = filter_date.split("-");
			var year = date_arr[0];
			var month = date_arr[1];

			if (year)
			{
				url += '&year=' + year;
			}

			if (month)
			{
				url += '&month=' + month;
			}
		}
		else
		{
			url += '&year=all';
		}

		if (filter_orderby) 
		{
			url += '&orderby=' + filter_orderby;
		}

		if (filter_category) 
		{
			url += '&category=' + filter_category;
		}

		if (filter_author) 
		{
			url += '&author=' + filter_author;
		}

		if (menu_item_id) 
		{
			url += '&Itemid=' + menu_item_id;
		}

		url += '&task=archive.goToURL';

		$('#adminForm').attr('action', url);
		$('#adminForm').submit();
	});

	// CLEAR FILTERS
	$('button#clear-search-button-home, #back-to-monthly-archive').on('click', function () {
		$('#filter_search').val('');
		$('#filter_orderby').val('most_recent_first');
		$('#filter_author').val('');
		$('#filter_category').val('');
		$('#filter_date').val('all');
		$('#filter_year').val('');
		$('#filter_month').val('');
		$('#adminForm').attr('action', '<?php echo ($this->sef ? JRoute::_('index.php?option=com_monthlyarchive'.$this->menu_item_id) : 'index.php?option=com_monthlyarchive&view=archive'.$this->menu_item_id); ?>');
		$('#adminForm').submit();
	});
	$('button#clear-search-button-page').on('click', function () {
		$('#filter_search').val('');
		$('#filter_orderby').val('most_recent_first');
		$('#filter_author').val('');
		$('#filter_category').val('');
		$('#filter_date').val('all');
		$('#filter_year').val('');
		$('#filter_month').val('');
		$('#adminForm').attr('action', '<?php echo ($this->sef ? JRoute::_('index.php?option=com_monthlyarchive&year=all'.$this->menu_item_id) : 'index.php?option=com_monthlyarchive&view=archive&year=all'.$this->menu_item_id); ?>');
		$('#adminForm').submit();
	});
});
</script>

<?php $page_heading = (!empty($this->menu_browser_page_title)) ? $this->menu_browser_page_title : JText::_('MONTHLY_ARCHIVE'); ?>

<div class="uk-scope">
	<div id="ma-container" class="uk-container uk-padding-remove uk-margin-remove">

		<?php
		// =============================================
		// LIST OF MONTHS AND YEARS
		// =============================================
		// If year or month are not detected, display a list of months and $monthsyears_arr
		if ($this->display_type == 'list_of_months_and_years' && $this->get_year != 'all' && (empty($this->get_year) && empty($this->get_month))) : ?> 

			<?php $this->document->setTitle(!empty($this->menu_browser_page_title) ? $this->menu_browser_page_title : ($this->show_page_title_list_of_months_and_years ? $this->page_title_list_of_months_and_years : JText::_('COM_MONTHLYARCHIVE'))); ?>

			<?php if (!empty($this->menu_page_heading)): ?>
				<h1 class="uk-heading-bullet uk-h2 ma-page-heading"><?php echo $this->menu_page_heading; ?></h1>
			<?php elseif ($this->show_page_title_list_of_months_and_years): ?>
				<h1 class="uk-heading-bullet uk-h2 ma-page-heading"><?php echo $this->page_title_list_of_months_and_years; ?></h1>
			<?php endif; ?>

			<?php if ($this->show_welcome_message_list_of_months_and_years): ?>
				<div class="uk-margin-top uk-margin-bottom ma-welcome-message"><?php echo sprintf($this->welcome_message_list_of_months_and_years, count($this->content_items)); ?></div>
			<?php endif; ?>

			<?php 
			$monthsyears_arr = array();
			foreach ($this->items as $i => $item) : ?>
		
				<?php 
				if ($this->show_date_beside_articles_type == 'publish_up')
				{
					if ($item->publish_up != '0000-00-00 00:00:00'):
						$year = JHTML::_('date', $item->publish_up, "Y");
						$month = JHTML::_('date', $item->publish_up, "m");
					endif;
				}
				else
				{
					if ($item->created != '0000-00-00 00:00:00'):
						$year = JHTML::_('date', $item->created, "Y");
						$month = JHTML::_('date', $item->created, "m");
					endif;
				}
				$monthsyears_arr[$year][] = $month;
				$monthsyears_arr_count_years[$year][] = $item->id;
				$monthsyears_arr_count_months[$year][$month][] = $item->id;
				?>
		
			<?php endforeach; ?>

			<form action="<?php echo ($this->sef ? JRoute::_('index.php?option=com_monthlyarchive&year=all'.$this->menu_item_id) : 'index.php?option=com_monthlyarchive&view=archive&year=all'.$this->menu_item_id); ?>" method="post" name="adminForm" id="adminForm" class="uk-form-stacked ma-form ma-form-list-of-months-and-years">
				
				<fieldset class="uk-fieldset ma-fieldset">
				
					<?php if ($this->select_category_home || $this->select_author_home || $this->search_input_home): ?>
					
						<div class="uk-margin-medium-bottom ma-form-fields">

							<?php if($this->select_category_home || $this->select_author_home): ?>
								<div class="uk-grid-small uk-margin uk-child-width-expand@s" uk-grid>
									<?php if($this->select_category_home): ?>
										<div class="ma-select-category">
											<div class="uk-form-controls">
												<?php echo $this->categories_list; ?>
											</div>
										</div>
									<?php endif; ?>
									<?php if($this->select_author_home): ?>
										<div class="ma-select-author">
											<div class="uk-form-controls">
												<?php echo $this->authors_list; ?>
											</div>
										</div>
									<?php endif; ?>
								</div>
							<?php endif; ?>

							<?php if($this->search_input_home): ?>
								<div class="uk-grid-small uk-margin uk-margin-remove-bottom ma-search-input-grid" uk-grid>
									<div class="uk-width-3-5@s ma-search-input-form-field">
										<?php echo $this->search_input; ?>
									</div>
									<div class="uk-width-2-5@s uk-text-right@s">
										<div class="uk-grid-small" uk-grid>
											<div class="uk-width-2-3">
												<button type="submit" id="search-button-home" class="uk-button uk-button-default uk-width-1-1 ma-search-btn"><span uk-icon="icon: search; ratio: 0.6"></span> <?php echo JText::_('COM_MONTHLYARCHIVE_SEARCH'); ?></button>
											</div>
											<div class="uk-width-1-3">
												<button type="button" id="clear-search-button-home" class="uk-button uk-button-default uk-width-1-1 ma-clear-btn" data-tooltip="<?php echo JText::_('COM_MONTHLYARCHIVE_CLEAR_FORM'); ?>"><span uk-icon="icon: close"></span></button>
											</div>
										</div>
									</div>
								</div>
							<?php endif; ?>
					
						</div>

					<?php endif; ?>

					<?php if ($this->ma_layout == 'accordion'): ?>
						<ul class="uk-margin-remove ma-accordion-list" uk-accordion>
					<?php endif; ?>

					<?php
					// Years ordering
					if ($this->sort_years_by == 'newest_first'):
						krsort($monthsyears_arr); // high to low (most recent years first)
					elseif ($this->sort_years_by == 'oldest_first'):
						ksort($monthsyears_arr); // low to high (oldest years first)
					endif;
					?>

					<?php
					$count_year = 1;
					$count_month = 1;
					foreach ($monthsyears_arr as $year=>$months): ?>

						<?php
						if ($this->show_year || $this->ma_layout == 'accordion'):
							$limit_of_years = $this->limit_of_years;
						else:
							$limit_of_years = 24;
						endif;
						?>

						<?php if ($count_year++ <= $limit_of_years): ?>

							<?php if ($this->ma_layout == 'accordion'): ?>
								<li class="ma-accordion-list-item">
							<?php endif; ?>		

							<?php if ($this->show_year || $this->ma_layout == 'accordion'): ?>

								<?php $count_articles_by_year = count($monthsyears_arr_count_years[$year]); ?>
								
								<?php if ($this->ma_layout == 'accordion'): ?>

									<h3 class="uk-accordion-title ma-accordion-title">
										<?php echo $year; ?>
										<?php if($this->show_count_of_articles_beside_years): ?>
											<div class="uk-display-inline-block">
												(<?php echo $count_articles_by_year; ?> <?php echo ($count_articles_by_year > 1 ? JText::_('COM_MONTHLYARCHIVE_ARTICLES') : JText::_('COM_MONTHLYARCHIVE_ARTICLE')); ?>)
											</div>
										<?php endif; ?>
									</h3>
								
								<?php elseif ($this->ma_layout == 'default'): ?>
									
									<?php $margin_year = (($this->show_year && !$this->show_month) || $this->ma_layout == 'accordion') ? 'uk-margin-small-bottom' : 'uk-margin-remove'; ?>

									<div class="uk-clearfix">
										<h3 class="uk-text-bold uk-display-inline-block ma-year-heading <?php echo $margin_year; ?>">
											<a href="<?php echo ($this->sef ? JRoute::_('index.php?option=com_monthlyarchive&year='.(int) $year.$this->menu_item_id) : 'index.php?option=com_monthlyarchive&view=archive&year='.(int) $year.$this->menu_item_id); ?>"<?php echo $this->rel_nofollow; ?>>
												<?php echo $year; ?>
											</a>
										</h3>

										<?php if($this->show_count_of_articles_beside_years): ?>
											<div class="uk-display-inline-block">
												(<?php echo $count_articles_by_year; ?> <?php echo ($count_articles_by_year > 1 ? JText::_('COM_MONTHLYARCHIVE_ARTICLES') : JText::_('COM_MONTHLYARCHIVE_ARTICLE')); ?>)
											</div>
										<?php endif; ?>
										
									</div>

								<?php endif; ?>
									
							<?php endif; ?>
							
							<?php if ($this->show_month || $this->ma_layout == 'accordion'): ?>

								<?php 
								if (($this->show_year && $this->show_month) || $this->ma_layout == 'accordion')
								{
									$margin_class = ($this->ma_layout == 'accordion') ? 'uk-margin-remove-left' : 'uk-margin-remove-left uk-margin-bottom uk-margin-small-top';
								}
								elseif (($this->show_year && !$this->show_month) || $this->ma_layout == 'accordion')
								{
									$margin_class = 'uk-margin-remove';
								}
								elseif ((!$this->show_year && $this->show_month) || $this->ma_layout == 'accordion')
								{
									$margin_class = 'uk-margin-small-bottom uk-margin-remove-left uk-margin-remove-top';
								}
								else
								{
									$margin_class = '';
								}
								?>

									<?php if ($this->ma_layout == 'accordion'): ?>
										<div class="uk-accordion-content ma-accordion-content">
									<?php endif; ?>

									<ul class="uk-list ma-list <?php echo $margin_class; ?>">
										<?php 

										$months_arr_reverse = array_reverse(array_values(array_unique($months)));
										$months_arr = array_values(array_unique($months));

										// Months ordering
										if ($this->sort_months_by == 'asc'):
											asort($months_arr); // low to high (order months desc)
										elseif ($this->sort_months_by == 'desc'):
											arsort($months_arr); // high to low (order months asc)
										endif;
											
										// re-index array
										$months_arr = array_values($months_arr);

										for ($i=0;$i<count($months_arr);$i++): 

											if (!$this->show_year && $this->ma_layout == 'default' && $count_month > $this->limit_of_months):
												break;
											endif; 

											$month = $months_arr[$i] < 10 ? '0'. (int) $months_arr[$i] : (int) $months_arr[$i];
											$dateObj   = DateTime::createFromFormat('!m', (int) $month);
											$month_name = $dateObj->format('F');
											$month_name = JText::_($month_name."_FULL");
											$count_articles_by_month = count($monthsyears_arr_count_months[$year][$month]);
											?>
												<li>
													<a href="<?php echo ($this->sef ? JRoute::_('index.php?option=com_monthlyarchive&year='.(int) $year.'&month='.$month.$this->menu_item_id) : 'index.php?option=com_monthlyarchive&view=archive&year='.(int) $year.'&month='.$month.$this->menu_item_id); ?>"<?php echo $this->rel_nofollow; ?>>
														<?php echo $month_name.' '.$year; ?>
													</a>
													<?php if($this->show_count_of_articles_beside_months): ?>
														<span>(<?php echo $count_articles_by_month; ?> <?php echo ($count_articles_by_month > 1 ? JText::_('COM_MONTHLYARCHIVE_ARTICLES') : JText::_('COM_MONTHLYARCHIVE_ARTICLE')); ?>)</span>
													<?php endif; ?>
												</li>

										<?php
										$count_month++;
										endfor;
										?>
									</ul>

									<?php if ($this->ma_layout == 'accordion'): ?>
										</div>
									<?php endif; ?>
							
							<?php endif; ?>

							<?php if ($this->ma_layout == 'accordion'): ?>
								</li>
							<?php endif; ?>

						<?php endif; ?>

					<?php endforeach; ?>

					<?php if ($this->ma_layout == 'accordion'): ?>
						</ul>
					<?php endif; ?>

					<input type="hidden" name="menu_item_id" id="menu_item_id" value="<?php echo $this->menu_item_id_value; ?>"/>
					<?php echo JHtml::_('form.token'); ?>
				
				</fieldset>

			</form>

		<?php else: ?>
			
			<?php 
			// =============================================
			// LIST OF ALL ARTICLES
			// =============================================
			
			// Title
			if (empty($this->get_year) || $this->get_year == 'all'): ?>
			
				<?php $this->document->setTitle(JText::_($page_heading)); ?>

				<?php if (!empty($this->menu_page_heading)): ?>
					<h1 class="uk-heading-bullet uk-h2 uk-display-inline-block uk-margin-right ma-page-heading"><?php echo $this->menu_page_heading; ?></h1>
				<?php elseif ($this->show_page_title_list_of_all_articles): ?>
					<h1 class="uk-heading-bullet uk-h2 uk-display-inline-block uk-margin-right ma-page-heading"><?php echo $this->page_title_list_of_all_articles; ?></h1>
				<?php endif; ?>

				<?php if ($this->display_type == 'list_of_months_and_years' && $this->show_back_btn): ?>
					<div class="uk-display-inline-block ma-back-btn-area"><button type="button" class="uk-button uk-button-link uk-text-lowercase ma-back-btn" id="back-to-monthly-archive"><?php echo JText::_('COM_MONTHLYARCHIVE_BACK'); ?> <span uk-icon="icon: arrow-right"></span></button></div>
				<?php endif; ?>

			<?php elseif (!empty($this->get_year) && (is_numeric($this->get_year) && strlen($this->get_year) == 4)): ?>

				<?php 
				$dateObj   = DateTime::createFromFormat('!m', (int) $this->get_month);
				$month_name = $dateObj->format('m');
				//$month_name = JText::_($month_name."_FULL");
				$date_page_heading = (!empty($this->get_month) ? $this->get_year . '年' . $month_name.'月' : '');
				$this->document->setTitle(JText::_($date_page_heading) . ' - ' . JText::_($page_heading)); 
				?>

				<?php if (!empty($this->menu_page_heading)): ?>
					<h1 class="uk-heading-bullet uk-h2 uk-display-inline-block uk-margin-right ma-page-heading"><?php echo $this->menu_page_heading; ?></h1>
				<?php elseif ($this->show_page_title_list_of_all_articles): ?>
					<h1 class="uk-heading-bullet uk-h2 uk-display-inline-block uk-margin-right ma-page-heading"><?php echo $this->page_title_list_of_all_articles; ?></h1>
				<?php endif; ?>

				<?php if ($this->display_type == 'list_of_months_and_years' && $this->show_back_btn): ?>
					<div class="uk-display-inline-block ma-back-btn-area"><button type="button" class="uk-button uk-button-link uk-text-lowercase ma-back-btn" id="back-to-monthly-archive"><?php echo JText::_('COM_MONTHLYARCHIVE_BACK'); ?><span uk-icon="icon: arrow-right"></span></button></div>
				<?php endif; ?>

				<h2 class="uk-h3 uk-margin-top uk-margin-bottom ma-page-heading-date"><?php echo JText::_($date_page_heading); ?></h2>

			<?php endif; ?>

			<?php if ($this->show_welcome_message_list_of_all_articles): ?>
				
				<?php
				// get results counter
				$get_results_counter_html = $this->pagination->getResultsCounter();
				$get_results_counter_matches = array();
				if (!empty($get_results_counter_html))
				{
					preg_match_all('/[0-9]+/', $get_results_counter_html, $get_results_counter_matches);
					$get_results_counter = (int) (isset($get_results_counter_matches[0][2]) ? $get_results_counter_matches[0][2] : count($this->items));
				}
				else
				{
					$get_results_counter = (int) count($this->items);
				}
				?>

				<div class="uk-margin-top uk-margin-bottom ma-welcome-message">
					<?php echo sprintf($this->welcome_message_list_of_all_articles, $get_results_counter); ?>
				</div>
				
			<?php endif; ?>

			<form action="<?php echo ($this->sef ? JRoute::_('index.php?option=com_monthlyarchive&year='.$this->get_year.'&month='.$this->get_month.$this->menu_item_id) : 'index.php?option=com_monthlyarchive&view=archive&year='.$this->get_year.'&month='.$this->get_month.$this->menu_item_id); ?>" method="post" name="adminForm" id="adminForm" class="uk-form-stacked ma-form ma-form-list-of-articles">
			
				<fieldset class="uk-fieldset ma-fieldset">

					<?php if($this->select_months_page || $this->select_order_page || $this->select_category_page || $this->select_author_page): ?>
						<div class="uk-grid-small uk-margin uk-child-width-expand@s" uk-grid>
							<?php if($this->select_months_page): ?>
								<div class="ma-select-date">
									<div class="uk-form-controls">
										<?php echo $this->date_list; ?>
									</div>
								</div>
							<?php endif; ?>
							
							<?php if($this->select_order_page): ?>
								<div class="ma-select-order">
									<div class="uk-form-controls">
										<?php echo $this->orderby_list; ?>
									</div>
								</div>
							<?php endif; ?>
			
							<?php if($this->select_category_page): ?>
								<div class="ma-select-category">
									<div class="uk-form-controls">
										<?php echo $this->categories_list; ?>
									</div>
								</div>
							<?php endif; ?>

							<?php if($this->select_author_page): ?>
								<div class="ma-select-author">
									<div class="uk-form-controls">
										<?php echo $this->authors_list; ?>
									</div>
								</div>
							<?php endif; ?>
						</div>
					<?php endif; ?>

					<?php if($this->search_input_page): ?>
						<div class="uk-grid-small uk-margin ma-search-input-grid" uk-grid>
							<div class="uk-width-3-5@s ma-search-input-form-field">
								<?php echo $this->search_input; ?>
							</div>
							<div class="uk-width-2-5@s uk-text-right@s">
								<div class="uk-grid-small" uk-grid>
									<div class="uk-width-2-3">
										<button type="submit" id="search-button-page" class="uk-button uk-button-default uk-width-1-1 ma-search-btn"><span uk-icon="icon: search; ratio: 0.6"></span> <?php echo JText::_('COM_MONTHLYARCHIVE_SEARCH'); ?></button>
									</div>
									<div class="uk-width-1-3">
										<button type="button" id="clear-search-button-page" class="uk-button uk-button-default uk-width-1-1 ma-clear-btn" data-tooltip="<?php echo JText::_('COM_MONTHLYARCHIVE_CLEAR_FORM'); ?>"><span uk-icon="icon: close"></span></button>
									</div>
								</div>
							</div>
						</div>
					<?php endif; ?>

					<div class="uk-clearfix uk-margin-bottom ma-clearfix"></div>






					
					<?php if (count($this->items) > 0): ?>
						
						<div class="ma-articles-list">
							
							<?php foreach ($this->items as $i => $item): ?>
							
								<?php 
								// date format
								if ($this->default_date_format == 'custom' && !empty($this->custom_date_format))
								{
									$date_format = $this->custom_date_format;
								}
								else
								{
									$date_format = $this->default_date_format;
								}

								// date format for tooltip
								if ($this->default_date_format_for_tooltip == 'custom' && !empty($this->custom_date_format_for_tooltip))
								{
									$date_format_for_tooltip = $this->custom_date_format_for_tooltip;
								}
								else
								{
									$date_format_for_tooltip = $this->default_date_format_for_tooltip;
								}

								// article's content
								if ($this->display_content_type == 'introtext')
								{
									$article_text = $item->introtext;
								}
								elseif ($this->display_content_type == 'fulltext')
								{
									if (!empty($item->fulltext))
									{
										$article_text = $item->fulltext;
									}
									elseif (!empty($item->introtext))
									{
										$article_text = $item->introtext;
									}
									else
									{
										$article_text = 'There is no text for this item';
									}
								}
								else
								{
									$article_text = $item->introtext.$item->fulltext;
								}

								// article text before limited or striped
								$article_text_fullcode = (!empty($article_text)) ? $article_text : 'empty';
								
								// limit chars
								if ($this->article_limit_chars > 0)
								{
									$article_text_limited  = JString::substr(strip_tags($article_text), 0, $this->article_limit_chars);
									$article_text_limited .= ($this->article_limit_chars < strip_tags($article_text)) ? '<span class="uk-display-inline">...</span>' : '';
									$article_text 		   = $article_text_limited;
								}

								// Allowed html tags
								$allowed_html_tags = str_replace(' ', '', $this->allowed_html_tags);
								$allowed_html_tags_arr = array();
								$allowed_html_tags_arr = explode(',', $allowed_html_tags);
								$allowed_html_tags_format = '';
								foreach ($allowed_html_tags_arr as $tag):
									$allowed_html_tags_format .= '<'.$tag.'>';
								endforeach;
								
								// article text
								if (!empty($allowed_html_tags)):
									$article_text = strip_tags($article_text, $allowed_html_tags_format);
								endif;

								// Article's Image
								if ($this->display_image || $this->display_image_in_modal)
								{
									// define variables
									$image_src_intro = ''; 
									$image_src_full = ''; 
									$image_src_auto = ''; 
									$image_src_blank = '';
									
									// global
									$blank_image_src = 'components'.DS.'com_monthlyarchive'.DS.'assets'.DS.'images'.DS.'blank-image.png';
									$image_alt = $this->escape($item->title);

									// com_k2
									if ($this->content_type == 'k2' && $this->isActive('com_k2'))
									{
										// get k2 image
										$image_src_intro = 'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_M.jpg';
										$image_src_full = 'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_M.jpg';
										
										// get k2 image (auto detect)
										$dom = new domDocument;
										$dom->loadHTML($article_text_fullcode);
										$dom->preserveWhiteSpace = true;
										$images = $dom->getElementsByTagName('img');
										$article_images_arr = array();
										foreach ($images as $image) {
											$article_images_arr[] = $image->getAttribute('src');
										}
						
										if (!empty($article_images_arr))
										{
											if ($this->auto_image_order == "random_image")
											{
												shuffle($article_images_arr);
											}

											if (isset($article_images_arr[0]) && JFile::exists($article_images_arr[0]))
											{
												$image_src_auto = $article_images_arr[0];
											}
											else
											{
												$image_src_auto = '';
											}
										}
										else
										{
											$image_src_auto = '';
										}
										
										// blank
										$image_src_blank = $blank_image_src;

										// IMAGE PRIORITY
										if (!empty(${"image_src_".$this->image_priority_1})):
											$image_src = ${"image_src_".$this->image_priority_1};
										elseif (!empty(${"image_src_".$this->image_priority_2})):
											$image_src = ${"image_src_".$this->image_priority_2};
										elseif (!empty(${"image_src_".$this->image_priority_3})):
											$image_src = ${"image_src_".$this->image_priority_3};
										elseif (!empty(${"image_src_".$this->image_priority_4})):
											$image_src = ${"image_src_".$this->image_priority_4};
										endif;
									}
									else
									{
									// com_content

										// get image object from com_content
										$image = json_decode($item->images);

										if (!empty($image->image_intro))
										{
											$image_src_intro = $image->image_intro;
											$image_alt = (!empty($image->image_intro_alt)) ? $image->image_intro_alt : $image_alt;
										}
										
										if (!empty($image->image_fulltext))
										{
											$image_src_full	= $image->image_fulltext;
											$image_alt = (!empty($image->image_fulltext_alt)) ? $image->image_fulltext_alt : $image_alt;
										}
										
										$dom = new domDocument;
										libxml_use_internal_errors(true); // Disable libxml errors
										$dom->loadHTML($article_text_fullcode);
										$dom->preserveWhiteSpace = true;
										$images = $dom->getElementsByTagName('img');
										$article_images_arr = array();
										foreach ($images as $image) {
											$article_images_arr[] = $image->getAttribute('src');
										}

										if (!empty($article_images_arr))
										{
											if ($this->auto_image_order == "random_image")
											{
												shuffle($article_images_arr);
											}
											
											if (isset($article_images_arr[0]) && JFile::exists($article_images_arr[0]))
											{
												$image_src_auto = $article_images_arr[0];
											}
											else
											{
												$image_src_auto = '';
											}
										}
										else
										{
											$image_src_auto = '';
										}
										
										// blank
										$image_src_blank = $blank_image_src;
										
										// IMAGE PRIORITY
										if (!empty(${"image_src_".$this->image_priority_1})):
											$image_src = ${"image_src_".$this->image_priority_1};
										elseif (!empty(${"image_src_".$this->image_priority_2})):
											$image_src = ${"image_src_".$this->image_priority_2};
										elseif (!empty(${"image_src_".$this->image_priority_3})):
											$image_src = ${"image_src_".$this->image_priority_3};
										elseif (!empty(${"image_src_".$this->image_priority_4})):
											$image_src = ${"image_src_".$this->image_priority_4};
										endif;

									}
									
								}
								?>
								
								<?php if ($this->link_type == 'modal'): ?>
									<!-- Modal Dialog -->
									<div id="modal-container-<?php echo $item->id; ?>" class="uk-modal-container" uk-modal>
										<div class="uk-modal-dialog uk-modal-body">
											<button class="uk-modal-close-outside" type="button" uk-close></button>
											<h2 class="uk-modal-title"><?php echo $this->maHighlight($this->escape($item->title), $this->filter_search); ?></h2>
											
											<?php 
											// =====
											// IMAGE IN MODAL
											// =====
											?>
											<?php if ($this->display_image_in_modal): ?>
												<?php if (!empty($image_src)): ?>
													<div class="uk-align-center ma-image-in-modal uk-text-center">
														<img 
														src="<?php echo $image_src; ?>" 
														title="<?php echo $this->escape($item->title); ?>" 
														<?php echo (!empty($image_alt) ? 'alt="'.$image_alt.'"' : ''); ?> 
														<?php echo (!empty($this->img_width) ? 'style="max-width: '.$this->img_width.'px;" width="'.$this->img_width.'"' : ''); ?> 
														<?php echo (!empty($this->img_height) ? 'style="max-height: '.$this->img_height.'px;" height="'.$this->img_height.'"' : ''); ?> 
														>
													</div>
												<?php endif; ?>
											<?php endif; ?>
											<?php 
											// import content prepare plugin         
											echo JHtml::_('content.prepare', $this->maHighlight($item->introtext.$item->fulltext, $this->filter_search));
											?>
										</div>
									</div>
								<?php endif; ?>

								<?php
								// =========================
								// BEGIN: Display Item (row)
								// =========================
								?>
								
								<div class="uk-grid-small ma-article" uk-grid>

									<?php 
									// =====
									// IMAGE
									// =====
									?>
									<?php if ($this->display_image): ?>

										<?php if (!empty($image_src)): ?>
											<div class="uk-width-1-3@s ma-image uk-text-center">

												<?php if ($this->link_to_image): ?>
													<?php if ($this->content_type == 'k2' && $this->isActive('com_k2')): ?>

														<?php if ($this->link_type == 'modal'): ?>
															<a title="<?php echo $this->escape($item->title); ?>" href="#modal-container-<?php echo $item->id; ?>" uk-toggle="container: #ma-container" <?php echo $this->rel_nofollow; ?>>
														<?php else: ?>
															<a title="<?php echo $this->escape($item->title); ?>" href="<?php echo JRoute::_(K2HelperRoute::getItemRoute($item->id,  $item->catid, $item->language)); ?>" <?php echo $this->rel_nofollow; ?>>
														<?php endif; ?>

													<?php else: ?>

														<?php if ($this->link_type == 'modal'): ?>
															<a title="<?php echo $this->escape($item->title); ?>" href="#modal-container-<?php echo $item->id; ?>" uk-toggle="container: #ma-container" <?php echo $this->rel_nofollow; ?>>
														<?php else: ?>
															<a title="<?php echo $this->escape($item->title); ?>" href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($item->id,  $item->catid, $item->language)); ?>" <?php echo $this->rel_nofollow; ?>>
														<?php endif; ?>

													<?php endif; ?>
												<?php endif; ?>
													<img 
													src="<?php echo $image_src; ?>" 
													title="<?php echo $this->escape($item->title); ?>" 
													<?php echo (!empty($image_alt) ? 'alt="'.$image_alt.'"' : ''); ?> 
													<?php echo (!empty($this->img_width) ? 'style="max-width: '.$this->img_width.'px;" width="'.$this->img_width.'"' : ''); ?> 
													<?php echo (!empty($this->img_height) ? 'style="max-height: '.$this->img_height.'px;" height="'.$this->img_height.'"' : ''); ?> 
													>
												<?php if ($this->link_to_image): ?>
													</a>
												<?php endif; ?>
												
											</div>
										<?php endif; ?>

									<?php endif; ?>

									<?php 
									// =====
									// CONTENT
									// =====
									?>
									<div class="uk-width-expand@s ma-content-item">

										<?php 
										// datetime, category, author, hits, comments
										if ($this->show_date_beside_articles || $this->show_category_beside_article || $this->show_author_beside_article || $this->show_hits || ($this->show_count_comments && !empty($item->comments_count))): ?>
									
										<div class="ma-meta-info">
											
											<?php 
											// datetime
											if ($this->show_date_beside_articles): ?>
												<?php if ($this->show_date_beside_articles_type == 'created'): ?>

													<div class="uk-display-inline-block uk-margin-right uk-margin-bottom ma-date" data-tooltip2="<?php echo JText::_( 'COM_MONTHLYARCHIVE_WRITTEN_ON' ); ?> <?php echo JHTML::_('date', $item->created, $date_format_for_tooltip); ?>"><span uk-icon="icon: clock; ratio: 0.7"></span> <time datetime="<?php echo JHTML::_('date', $item->created, 'Y-m-d H:i:s'); ?>"><?php echo JHTML::_('date', $item->created, $date_format); ?></time></div>

												<?php elseif ($this->show_date_beside_articles_type == 'publish_up'): ?>

													<div class="uk-display-inline-block uk-margin-right uk-margin-bottom ma-date" data-tooltip2="<?php echo JText::_( 'COM_MONTHLYARCHIVE_WRITTEN_ON' ); ?> <?php echo JHTML::_('date', $item->publish_up, $date_format_for_tooltip); ?>"><span uk-icon="icon: clock; ratio: 0.7"></span> <time datetime="<?php echo JHTML::_('date', $item->publish_up, 'Y-m-d H:i:s'); ?>"><?php echo JHTML::_('date', $item->publish_up, $date_format); ?></time></div>

												<?php endif; ?>
											<?php endif; ?>

											<?php 
											// category
											if ($this->show_category_beside_article): ?>
												<div class="uk-display-inline-block uk-margin-right uk-margin-bottom ma-category" data-tooltip2="<?php echo sprintf(JText::_( 'COM_MONTHLYARCHIVE_PUBLISHED_IN' ), $item->category_title); ?>"><span uk-icon="icon: folder; ratio: 0.7"></span> <?php echo $item->category_title; ?></div>
											<?php endif; ?>

											<?php 
											// author
											if ($this->show_author_beside_article): ?>
												<?php if ($this->author_name_type == 'author_name'): ?>
													<div class="uk-display-inline-block uk-margin-right uk-margin-bottom ma-author" data-tooltip2="<?php echo JText::_( 'COM_MONTHLYARCHIVE_WRITTEN_BY' ); ?> <?php echo $item->author_name; ?>."><span uk-icon="icon: user; ratio: 0.7"></span> <?php echo $item->author_name; ?></div>
												<?php elseif ($this->author_name_type == 'author_username'): ?>
													<div class="uk-display-inline-block uk-margin-right uk-margin-bottom ma-author" data-tooltip="<?php echo JText::_( 'COM_MONTHLYARCHIVE_WRITTEN_BY' ); ?> <?php echo $item->author_username; ?>."><span uk-icon="icon: user; ratio: 0.7"></span> <?php echo $item->author_username; ?></div>
												<?php endif; ?>
											<?php endif; ?>

											<?php 
											// hits
											if ($this->show_hits): ?>
												<div class="uk-display-inline-block uk-margin-right uk-margin-bottom ma-hits" data-tooltip2="<?php echo sprintf(JText::_( 'COM_MONTHLYARCHIVE_VIEWED_X_TIMES' ), (int) $item->hits); ?>"><span uk-icon="icon: bolt; ratio: 0.7"></span> <?php echo $item->hits; ?></div>
											<?php endif; ?>

											<?php 
											// edit Joomla! article
											if ($this->content_type == 'default'):

												// Technically guest could edit an article, but lets not check that to improve performance a little.
												$canEdit = false;
												$user = JFactory::getUser();
												if (!$user->get('guest'))
												{
													$userId = $user->get('id');
													$asset = 'com_content.article.' . $item->id;

													// Check general edit permission first.
													if ($user->authorise('core.edit', $asset))
													{
														$canEdit = true;
													}

													// Now check if edit.own is available.
													elseif (!empty($userId) && $user->authorise('core.edit.own', $asset))
													{
														// Check for a valid user and that they are the owner.
														if ($userId == $item->created_by)
														{
															$canEdit = true;
														}
													}
												}

												if ($canEdit): ?>
													<div class="uk-display-inline-block uk-margin-right uk-margin-bottom ma-edit-article">
														<span uk-icon="icon: pencil; ratio: 0.7"></span> 
														<?php
														$edit_article_link_with_img = JHtml::_('icon.edit', $item, $this->com_content_params, array('class'=>'ma-edit-article-link', 'uk-tooltip'=>''), true);
														$edit_article_link = preg_replace("/<img[^>]+\>/i", JText::_('JGLOBAL_EDIT_TITLE'), $edit_article_link_with_img); 
														echo $edit_article_link;
														?>
													</div>
												<?php endif; ?>

											<?php endif; ?>

											<?php
											// comments
											if ($this->show_count_comments && !empty($item->comments_count)): ?>
												<?php if ($item->comments_count > 0): ?>
													<div class="uk-display-inline-block uk-margin-bottom ma-comments" data-tooltip="<?php echo sprintf(JText::_( 'COM_MONTHLYARCHIVE_COMMENTED_X_TIMES' ), (int) $item->comments_count); ?>"><span uk-icon="icon: comments; ratio: 0.7"></span> <?php echo (int) $item->comments_count; ?></div>
												<?php endif; ?>
											<?php endif; ?>

										</div>

										<?php endif; ?>
										
										<div>
											
											<!-- TITLE -->
											<h3 class="uk-margin-small-bottom ma-title">
												<?php if ($this->link_to_article): ?>
													<?php if ($this->content_type == 'k2' && $this->isActive('com_k2')): ?>

														<?php if ($this->link_type == 'modal'): ?>
															
														<?php else: ?>
															
														<?php endif; ?>

													<?php else: ?>

														<?php if ($this->link_type == 'modal'): ?>
															
														<?php else: ?>
															
														<?php endif; ?>

													<?php endif; ?>
												<?php endif; ?>
													<?php echo $this->maHighlight($this->escape($item->title), $this->filter_search); ?>
												<?php if ($this->link_to_article): ?>
													
												<?php endif; ?>
											</h3>

											<!-- INTROTEXT -->
											<div class="ma-introtext">

												<?php 
												// import content prepare plugin
												echo $article_text_fullcode;
												?>
										
												<?php 
												// readmore link
												if ($this->show_readmore_link && $this->article_limit_chars > 0): ?>
					
													<?php if ($this->content_type == 'k2' && $this->isActive('com_k2')): ?>

														<?php if ($this->link_type == 'modal'): ?>
															<a class="uk-display-inline ma-readmore-link" href="#modal-container-<?php echo $item->id; ?>" uk-toggle="container: #ma-container" <?php echo $this->rel_nofollow; ?>>
														<?php else: ?>
															<a class="uk-display-inline ma-readmore-link" href="<?php echo JRoute::_(K2HelperRoute::getItemRoute($item->id,  $item->catid, $item->language)); ?>" <?php echo $this->rel_nofollow; ?>>
														<?php endif; ?>

													<?php else: ?>

														<?php if ($this->link_type == 'modal'): ?>
															<a class="uk-display-inline ma-readmore-link" href="#modal-container-<?php echo $item->id; ?>" uk-toggle="container: #ma-container" <?php echo $this->rel_nofollow; ?>>
														<?php else: ?>
															<a class="uk-display-inline ma-readmore-link" href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($item->id,  $item->catid, $item->language)); ?>" <?php echo $this->rel_nofollow; ?>>
														<?php endif; ?>

													<?php endif; ?>
														<?php echo JText::_( 'COM_MONTHLYARCHIVE_READMORE'); ?>
													</a>

												<?php endif; ?>

											</div>
										</div>
										
									</div>
								
								</div>
								
								<hr class="uk-text-center uk-margin-top uk-margin-bottom ma-divider">

								<?php
								// =========================
								// END: Display Item (row)
								// =========================
								?>

							<?php endforeach; ?>
						</div>
						
						<?php if ($this->display_pagination): ?>
							<div class="uk-text-center ma-pagination">
								<div class="uk-display-block ma-pagination-list-footer pagination"><?php echo $this->pagination->getPagesLinks(); ?></div>
								<div class="uk-display-block ma-pagination-results-counter"><?php echo $this->pagination->getResultsCounter(); ?></div>
							</div>
						<?php endif; ?>
							
					<?php endif; ?>
				
				</fieldset>

				<input type="hidden" name="menu_item_id" id="menu_item_id" value="<?php echo $this->menu_item_id_value; ?>"/>
				<?php echo JHtml::_('form.token'); ?>
			</form>

		<?php endif; ?>

		<?php if (count($this->items) == 0): ?>

			<div class="uk-margin-small-top ma-no-results">
				<?php 
				$filter_search_state = $this->getState('filter.search');
				if (!empty($filter_search_state)):
					echo sprintf(JText::_( 'COM_MONTHLYARCHIVE_EMPTY_SEARCH_RESULTS' ), $this->getState('filter.search'));
				else:
					echo JText::_( 'COM_MONTHLYARCHIVE_NO_RESULTS' );
				endif;
				?>
			</div>

		<?php endif; ?>

		<?php
		// Copyright message
		if ($this->copyright):
			echo '<div class="uk-margin-top uk-text-center ma-copyright uk-text-muted">'.JText::_('COM_MONTHLYARCHIVE_POWERED_BY').' <a href="https://www.web357.eu/joomla-extensions/monthly-archive?utm_source=CLIENT&utm_medium=CLIENT-CopyrightLink-monthlyarchive&utm_content=CLIENT-CopyrightLink&utm_campaign=monthlyarchive" rel="nofollow" target="_blank">'.JText::_('MONTHLY_ARCHIVE').'</a></div>';
		endif;
		?>

	</div>
</div>