1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12: 13: 14: 15: 16: 17: 18: 19: 20: 21:
22:
23: include_once dirname(__DIR__) . '/include/common.php';
24:
25: function publisher_date_to_date_show($options)
26: {
27: $myts = \Xoops\Core\Text\Sanitizer::getInstance();
28: $publisher = Publisher::getInstance();
29:
30: $block = array();
31:
32: $criteria = new CriteriaCompo();
33: $criteria->add(new Criteria('datesub', strtotime($options[0]), '>'));
34: $criteria->add(new Criteria('datesub', strtotime($options[1]), '<'));
35: $criteria->setSort('datesub');
36: $criteria->setOrder('DESC');
37:
38:
39: $itemsObj = $publisher->getItemHandler()->getItemObjects($criteria);
40: $totalItems = count($itemsObj);
41:
42: if ($itemsObj) {
43: for ($i = 0; $i < $totalItems; ++$i) {
44:
45: $newItems['itemid'] = $itemsObj[$i]->getVar('itemid');
46: $newItems['title'] = $itemsObj[$i]->title();
47: $newItems['categoryname'] = $itemsObj[$i]->getCategoryName();
48: $newItems['categoryid'] = $itemsObj[$i]->getVar('categoryid');
49: $newItems['date'] = $itemsObj[$i]->datesub();
50: $newItems['poster'] = $itemsObj[$i]->linkedPosterName();
51: $newItems['itemlink'] = $itemsObj[$i]->getItemLink(false, isset($options[3]) ? $options[3] : 65);
52: $newItems['categorylink'] = $itemsObj[$i]->getCategoryLink();
53:
54: $block['items'][] = $newItems;
55: }
56:
57: $block['lang_title'] = _MB_PUBLISHER_ITEMS;
58: $block['lang_category'] = _MB_PUBLISHER_CATEGORY;
59: $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
60: $block['lang_date'] = _MB_PUBLISHER_DATE;
61: $modulename = $myts->displayTarea($publisher->getModule()->getVar('name'));
62: $block['lang_visitItem'] = _MB_PUBLISHER_VISITITEM . " " . $modulename;
63: $block['lang_articles_from_to'] = sprintf(_MB_PUBLISHER_ARTICLES_FROM_TO, $options[0], $options[1]);
64: }
65:
66: return $block;
67: }
68:
69: 70: 71:
72: function publisher_date_to_date_edit($options)
73: {
74: $form = new Xoops\Form\BlockForm();
75:
76: $fromEle = new Xoops\Form\DateSelect(_MB_PUBLISHER_FROM, 'options[0]', strtotime($options[0]));
77:
78: $untilEle = new Xoops\Form\DateSelect(_MB_PUBLISHER_UNTIL, 'options[1]', strtotime($options[1]));
79:
80: $form->addElement($fromEle);
81: $form->addElement($untilEle);
82:
83: return $form->render();
84: }
85: