list_tiki_items($tikiobj, $user, $tstart, $tstop, $offset, $maxRecords, $sort_mode, $find); } /** * @param $calIds * @param $viewstart * @param $viewend * @param string $group_by * @param string $item_name * @return array */ public function getCalendar($calIds, &$viewstart, &$viewend, $group_by = '', $item_name = 'actions') { return parent::getCalendar($calIds, $viewstart, $viewend, $group_by, $item_name); } /** * @param $tikiobj * @param $user * @param $tstart * @param $tstop * @param $offset * @param $maxRecords * @param string $sort_mode * @param string $find * @return array */ public function list_tiki_items($tikiobj, $user, $tstart, $tstop, $offset, $maxRecords, $sort_mode = 'name_desc', $find = '') { global $user; $ret = []; if (! is_array($tikiobj)) { return $ret; } $tikiobj = array_unique($tikiobj); if (in_array('wiki', $tikiobj)) { $tikiobj[] = 'wiki page'; $tikiobj[] = 'wiki comment'; } foreach ($tikiobj as $type) { if ($type != '' && $type != 'wiki') { $objectType = ( $type == 'wiki comment' ) ? 'wiki page' : $type; $result = $this->get_object_cal_infos($type, [$tstart, $tstop, $objectType]); if (is_object($result)) { while ($res = $result->fetchRow()) { if ($res['start'] > 0) { $res['show_description'] = 'y'; $res['visible'] = 'y'; $res['type'] = $type; $dstart = TikiLib::make_time( 0, 0, 0, TikiLib::date_format('%m', $res['start']), TikiLib::date_format('%d', $res['start']), TikiLib::date_format('%Y', $res['start']) ); $res['time'] = TikiLib::date_format('%H%M', $res['start']); $res['when'] = TikiLib::date_format('%H:%M', $res['start']); $when = '' . $res['when'] . ''; $url_vars = [$res['id'], $res['id2']]; switch ($res['type']) { case 'art': $res['description'] = TikiLib::lib('parser')->parse_data($res['description']); break; case 'blog': $res['name'] = $res['parent'] . ' :: ' . $res['name']; break; case 'dir': $res['description'] = addslashes($res['dir_url']) . '
' . $res['description']; break; case 'forum': if ($res['fid'] > 0) { $url_vars = [$res['id2'], 'threadId' . $res['id']]; } break; case 'gal': $res['description'] = tra('New Image Uploaded by') . ' %s'; break; case 'nl': $res['description'] = tra('New Subscriptions'); $res['head'] = ' ... ' . $res['head']; break; case 'track': $res['description'] = tra('New Item in Tracker'); $res['parent'] = tra('tracker'); break; case 'wiki page': $res['parent'] = 'wiki'; break; } $res['url'] = $this->get_object_url($res['type'], $url_vars); if ($res['user'] != '') { include_once('lib/smarty_tiki/modifier.username.php'); $res['user'] = smarty_modifier_username($res['user']); if (! strpos($res['description'], '%s')) { $br = ( $res['description'] == '' ) ? '' : '
'; $res['description'] = '' . tra('by') . ' %s' . $br . $res['description']; } $res['description'] = sprintf($res['description'], $res['user']); } $res['description'] = str_replace(['"',"\n|\r"], ["'",''], $res['description']); if ($res['name'] == '') { $res['name'] = $res['id']; } $res['where'] = str_replace("\n|\r", '', addslashes($res['parent'])); if (( ! isset($where) || $where == '' ) && $res['parent'] != '') { $where = ' ' . tra('in') . ' ' . $res['where'] . ''; } if ($res['head'] == '') { $res['head'] = $when . $where; } $res['group_description'] = $res['name']; $ret[$dstart][] = $res; unset($where); unset($when); } } } } } return $ret; } /** * @param $type * @param null $bindvars * @return mixed */ public function get_object_cal_infos($type, $bindvars = null) { switch ($type) { case 'art': $query = 'select `articleId` as `id`, `title` as `name`, `heading` as `description`, `authorName` as `user`,' . ' `topicName` as `parent`, `publishDate` as `start`' . ' from `tiki_articles` where (`publishDate`>? and `publishDate`? and p.`created`? and `created`? and `created`? and f.`created`? and c.`commentDate`? and `subscribed`? and `created`? and `created`? and i.`created`? and c.`commentDate`? and `lastModif` 0) { return $this->query($query, array_slice($bindvars, 0, $nb_vars)); } else { return $this->query($query); } } } /** * @param $type * @param null $bindvars * @return string */ public function get_object_url($type, $bindvars = null) { switch ($type) { case 'art': $url = 'tiki-read_article.php?articleId=%s'; break; case 'blog': $url = 'tiki-view_blog.php?blogId=%s'; break; case 'chart': $url = 'tiki-view_chart.php?chartId=%s'; break; case 'dir': $url = 'tiki-directory_redirect.php?siteId=%s'; break; case 'faq': $url = 'tiki-view_faq.php?faqId=%s'; break; case 'fgal': $url = 'tiki-list_file_gallery.php?galleryId=%s'; break; case 'forum': $url = 'tiki-view_forum_thread.php?comments_parentId=%s#%s'; break; case 'gal': $url = 'tiki-browse_image.php?imageId=%s&galleryId=%s'; break; case 'nl': $url = 'tiki-newsletters.php?nlId=%s'; break; case 'quiz': $url = 'tiki-take_quiz.php?quizId=%s'; break; case 'surv': $url = 'tiki-take_survey.php?surveyId=%s'; break; case 'track': $url = 'tiki-view_tracker_item.php?itemId=%s&trackerId=%s&offset=0&sort_mode=created_desc'; break; case 'wiki comment': $url = 'tiki-index.php?page=%s&comzone=show#comments'; break; case 'wiki page': $url = 'tiki-index.php?page=%s'; break; } if ($url != '') { if (is_array($bindvars) && ($nb_vars = substr_count($url, '%s')) > 0) { return vsprintf($url, array_map('urlencode', array_slice($bindvars, 0, $nb_vars))); } else { return $url; } } } /** * @param bool $with_infos * @return array */ public function getTikiItems($with_infos = true) { global $prefs; global $tiki_p_view, $tiki_p_read_article; global $tiki_p_read_blog, $tiki_p_forum_read, $tiki_p_view_directory; global $tiki_p_view_file_gallery, $tiki_p_view_faqs, $tiki_p_take_quiz; global $tiki_p_view_trackers, $tiki_p_take_survey, $tiki_p_subscribe_newsletters; $return = [ 'wiki' => [ 'label' => tra('Wiki'), 'feature' => '' . $prefs['feature_wiki'], 'right' => "$tiki_p_view" ], 'art' => [ 'label' => tra('Articles'), 'feature' => '' . $prefs['feature_articles'], 'right' => "$tiki_p_read_article" ], 'blog' => [ 'label' => tra('Blogs'), 'feature' => '' . $prefs['feature_blogs'], 'right' => "$tiki_p_read_blog"], 'forum' => [ 'label' => tra('Forums'), 'feature' => '' . $prefs['feature_forums'], 'right' => "$tiki_p_forum_read" ], 'dir' => [ 'label' => tra('Directory'), 'feature' => '' . $prefs['feature_directory'], 'right' => "$tiki_p_view_directory" ], 'fgal' => [ 'label' => tra('File Gallery'), 'feature' => '' . $prefs['feature_file_galleries'], 'right' => "$tiki_p_view_file_gallery" ], 'faq' => [ 'label' => tra('FAQs'), 'feature' => '' . $prefs['feature_faqs'], 'right' => $tiki_p_view_faqs ], 'quiz' => [ 'label' => tra('Quizzes'), 'feature' => '' . $prefs['feature_quizzes'], 'right' => $tiki_p_take_quiz ], 'track' => [ 'label' => tra('Trackers'), 'feature' => '' . $prefs['feature_trackers'], 'right' => "$tiki_p_view_trackers" ], 'surv' => [ 'label' => tra('Survey'), 'feature' => '' . $prefs['feature_surveys'], 'right' => "$tiki_p_take_survey" ], 'nl' => [ 'label' => tra('Newsletter'), 'feature' => '' . $prefs['feature_newsletters'], 'right' => "$tiki_p_subscribe_newsletters" ] ]; return ( $with_infos ? $return : array_keys($return) ); } } $tikicalendarlib = new TikiCalendarLib();