function get_content(&$arguments, $properties) { $this->template = Createobject('phpgwapi.Template', $this->find_template_dir()); $this->template->set_file('blogs', 'blogsblock.tpl'); //Common langs $this->template->set_var(array("blogged_by" => lang('Blogged by'), "read_more" => lang('Read more'), "more_blogs" => lang('Other posts'))); $this->template->set_block('blogs', 'BlogsBlock', 'blogsitem'); $this->template->set_block('blogs', 'RssBlock', 'rsshandle'); $this->template->set_var('rsslink', $arguments['base_url'] . "weblog/rss"); $this->template->parse('rsshandle', 'RssBlock'); $this->db->query("select posts.*, users.username , users.name, icons.filename from `" . $arguments['posts_table'] . "` posts left join `" . $arguments['users_table'] . "` users on posts.owner=users.ident left join `" . $arguments['icons_table'] . "` icons on users.icon=icons.ident " . "where access = 'PUBLIC' order by posted desc", _LINE_, _FILE_, 0, $arguments['num']); while ($this->db->next_record()) { $row = $this->db->row(); $this->template->set_var(array('post_title' => $row['title'], 'post_url' => $arguments['base_url'] . $row['username'] . "/weblog/" . $row['ident'] . ".html", 'author_pic' => $arguments['base_url'] . "_icons/data/" . $row['filename'], 'post_author_url' => $arguments['base_url'] . $row['username'], 'post_author' => $row['name'], 'post_date' => date("F j, Y, g:i a", $row['posted']), 'post_content' => strip_tags($row['body'], "<p></p><a></a>"), 'author_blog_url' => $arguments['base_url'] . $row['username'] . "/weblog")); $this->template->parse('blogsitem', 'BlogsBlock', True); } return $this->template->parse('out', 'blogs'); }
function get_content(&$arguments, $properties) { $t = Createobject('phpgwapi.Template'); $t->set_root($this->find_template_dir()); $t->set_file('mini_calendar', 'mini_cal.tpl'); if (!$arguments['timestamp']) { $arguments['timestamp'] = time(); } if ($arguments['prevmonth']) { $arguments['timestamp'] = mktime(0, 0, 0, date("m", $arguments['timestamp']) - 1, date("d", $arguments['timestamp']), date("Y", $arguments['timestamp'])); } elseif ($arguments['nextmonth']) { $arguments['timestamp'] = mktime(0, 0, 0, date("m", $arguments['timestamp']) + 1, date("d", $arguments['timestamp']), date("Y", $arguments['timestamp'])); } $date = $GLOBALS['phpgw']->datetime->gmtdate($arguments['timestamp']); $month = $date['month']; $day = $date['day']; $year = $date['year']; $this->bo->read_holidays($year); $month_ago = intval(date('Ymd', mktime(0, 0, 0, $month - 1, $day, $year))); $month_ahead = intval(date('Ymd', mktime(0, 0, 0, $month + 1, $day, $year))); $monthstart = intval(date('Ymd', mktime(0, 0, 0, $month, 1, $year))); $monthend = intval(date('Ymd', mktime(0, 0, 0, $month + 1, 0, $year))); $weekstarttime = $GLOBALS['phpgw']->datetime->get_weekday_start($year, $month, 1); $t->set_block('mini_calendar', 'mini_cal', 'mini_cal'); $t->set_block('mini_calendar', 'mini_week', 'mini_week'); $t->set_block('mini_calendar', 'mini_day', 'mini_day'); $linkdata['menuaction'] = 'calendar.uicalendar.month'; $linkdata['month'] = $GLOBALS['phpgw']->common->show_date($date['raw'], 'm'); $linkdata['year'] = $GLOBALS['phpgw']->common->show_date($date['raw'], 'Y'); $month = '<a href="' . $GLOBALS['phpgw']->link('/index.php', $linkdata) . '" class="minicalendar">' . lang($GLOBALS['phpgw']->common->show_date($date['raw'], 'F')) . ' ' . $GLOBALS['phpgw']->common->show_date($date['raw'], 'Y') . '</a>'; $var = array('cal_img_root' => $GLOBALS['phpgw']->common->image('calendar', 'mini-calendar-bar'), 'bgcolor' => $calui->theme['bg_color'], 'bgcolor1' => $calui->theme['bg_color'], 'month' => $month, 'bgcolor2' => $calui->theme['cal_dayview'], 'holiday_color' => $calui->holiday_color, 'navig' => '<form method="post">' . $this->build_post_element('prevmonth') . ' ' . $this->build_post_element('nextmonth') . '</form>'); $t->set_var($var); if (!$t->get_var('daynames')) { for ($i = 0; $i < 7; $i++) { $var = array('dayname' => '<b>' . substr(lang($GLOBALS['phpgw']->datetime->days[$i]), 0, 2) . '</b>', 'day_image' => ''); $this->output_template_array($t, 'daynames', 'mini_day', $var); } } $today = date('Ymd', $GLOBALS['phpgw']->datetime->users_localtime); unset($date); for ($i = $weekstarttime + $GLOBALS['phpgw']->datetime->tz_offset; date('Ymd', $i) <= $monthend; $i += 24 * 3600 * 7) { unset($var); $daily = $this->set_week_array($i - $GLOBALS['phpgw']->datetime->tz_offset, $cellcolor, $weekly); @reset($daily); while (list($date, $day_params) = each($daily)) { $year = intval(substr($date, 0, 4)); $month = intval(substr($date, 4, 2)); $day = intval(substr($date, 6, 2)); $str = ''; unset($linkdata); $linkdata['menuaction'] = 'calendar.uicalendar.day'; $linkdata['date'] = $date; $str = '<a href="' . $GLOBALS['phpgw']->link('/index.php', $linkdata) . '" class="' . $day_params['class'] . '">' . $day . '</a>'; $var[] = array('day_image' => $day_params['day_image'], 'dayname' => $str); } for ($l = 0; $l < count($var); $l++) { $this->output_template_array($t, 'monthweek_day', 'mini_day', $var[$l]); } $t->parse('display_monthweek', 'mini_week', True); $t->set_var('dayname', ''); $t->set_var('monthweek_day', ''); } $return_value = $t->fp('out', 'mini_cal'); $t->set_var('display_monthweek', ''); // $t->set_var('daynames',''); // unset($p); return $return_value; }
function get_content(&$arguments, $properties) { if (!$this->bo) { return lang('Application sitemgr_module_guestbook must be installed as a eGrouPware application for this module to run'); } if ($arguments['save']) { $this->bo->add_entry($arguments['name'], $arguments['comment'], $arguments['book']); } $this->template = Createobject('phpgwapi.Template'); $this->template->set_root($this->find_template_dir()); $this->template->set_file('form', 'form.tpl'); $this->template->set_block('form', 'entry', 'Eblock'); $this->template->set_var(array('lang_sign' => lang('Please sign the guestbook'), 'inputname' => $this->build_post_element('name', lang('Your name')), 'inputcomment' => $this->build_post_element('comment', lang('Your comment')), 'btnsave' => $this->build_post_element('save'), 'lang_lastentries' => lang('Last entries to the guestbook'))); $entries = $this->bo->get_entries($arguments['book']); while (list(, $entry) = @each($entries)) { $this->template->set_var(array('name' => $entry['name'], 'comment' => nl2br($entry['comment']), 'timestamp' => date('r', $entry['timestamp']))); $this->template->parse('Eblock', 'entry', true); } return $this->template->parse('out', 'form'); }
function process_blocks($vars) { global $page; global $objbo; $areaname = is_array($vars) ? $vars[1] : $vars; $this->permitted_modules = array_keys($this->modulebo->getcascadingmodulepermissions($areaname, $page->cat_id)); $transformername = $areaname . '_bt'; $transformerfile = $this->transformer_root . SEP . $transformername . '.inc.php'; if (file_exists($transformerfile)) { include_once $transformerfile; if (class_exists($transformername)) { $transformer = new $transformername(); } } elseif (($areaname == "left" || $areaname == "right") && file_exists($this->root . SEP . 'sideblock.tpl')) { $t = Createobject('phpgwapi.Template'); $t->set_root($this->root); $t->set_file('SideBlock', 'sideblock.tpl'); $transformer = new sideblock_transform($t); } $content = ''; $blocks = $this->bo->getvisibleblockdefsforarea($areaname, $page->cat_id, $page->id, $objbo->is_admin(), $objbo->isuser); // if we are in the center area, we append special blocks if ($areaname == "center" && $page->block) { array_unshift($blocks, $page->block); } if ($blocks) { while (list(, $block) = each($blocks)) { if (in_array($block->module_id, $this->permitted_modules)) { //we maintain an array of modules we have already used, so we do not //have to create them anew. Since they are copied, before the transformer //is added, we do not have to worry about transformers staying around //on the transformer chain $moduleobject = $this->getmodule($block->module_name); if ($block->id) { $block->title = $this->getblocktitlewrapper($block->id); $block->arguments = $moduleobject->i18n ? $this->getversionwrapper($block->version) : $this->bo->getversion($block->version); } $moduleobject->set_block($block, True); if ($block->state == SITEMGR_STATE_PREPUBLISH && is_object($this->draft_transformer)) { $moduleobject->add_transformer($this->draft_transformer); } if (isset($transformer)) { $moduleobject->add_transformer($transformer); } if ($GLOBALS['sitemgr_info']['mode'] == 'Edit' && $block->id && $GLOBALS['Common_BO']->acl->can_write_category($block->cat_id) && is_object($this->edit_transformer)) { $moduleobject->add_transformer($this->edit_transformer); } $output = $moduleobject->get_output(); //process module calls embedded into output $content .= preg_replace_callback("/\\{([[:alnum:]_-]*)\\.([[:alnum:]_-]*)(\\?([^{ ]+))?\\}/", array($this, 'exec_module'), $output); } else { $content .= lang('Module %1 is not permitted in this context!', $block->module_name); } } } if ($GLOBALS['sitemgr_info']['mode'] == 'Edit' && is_object($this->edit_transformer) && method_exists($this->edit_transformer, 'area_transform')) { return $this->edit_transformer->area_transform($areaname, $content, $page); } return $content; }
function get_content(&$arguments, $properties) { //$arguments["category"] = 10; if (!is_dir(PHPGW_SERVER_ROOT . '/news_admin') || !isset($GLOBALS['phpgw_info']['apps']['news_admin'])) { return lang("Application '%1' is not installed !!!<br>Please install it, to be able to use the block.", 'news_admin'); } $bonews = CreateObject('news_admin.bonews'); $cat = createobject('phpgwapi.categories', '', 'news_admin'); $my_cat = $cat->return_single($arguments['category']); $this->template = Createobject('phpgwapi.Template', $this->find_template_dir()); $this->template->set_file('news', 'newsblock.tpl'); $this->template->set_block('news', 'ScriptBlock', 'ScriptBlock'); $this->template->set_var(array("HideForm" => lang('HideForm'), "SendToFriendBottom" => lang('SendToFriendBottom'))); $this->template->parse('ScriptBlock', 'ScriptBlock'); $this->template->set_block('news', 'NewsBlock', 'newsitem'); $this->template->set_block('news', 'RssBlock', 'rsshandle'); $limit = $arguments['limit'] ? $arguments['limit'] : 5; if ($arguments['rsslink']) { $this->template->set_var('rsslink', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/news_admin/website/export.php?cat_id=' . $arguments['category']); $this->template->parse('rsshandle', 'RssBlock'); } else { $this->template->set_var('rsshandle', ''); } // somehow $arguments['item'] is set to some whitespace // i have no idea why :( // so i added trim // lkneschke 2004-02-24 //$item = trim($arguments['item']); if ($this->get_curent_pageIndex("news_id") > 0) { $item = $this->get_curent_pageIndex("news_id"); } $this->template->set_block('news', 'PagingTopBlock', 'pageitemtop'); $this->template->set_block('news', 'PagingBottomBlock', 'pageitembottom'); $this->template->set_block('news', 'formurl', 'formurl'); if ($item) { $this->template->set_var('pageitemtop', ''); $this->template->set_var('pageitembottom', ''); $newsitem = $bonews->get_news($item); if ($newsitem && ($newsitem['category'] == $arguments['category'] || strtolower(substr($_SERVER["SCRIPT_FILENAME"], -8)) == "news.php")) { $this->render($newsitem, true); $link_data['item'] = 0; $this->template->set_var('morelink', '<a href="' . $this->link($link_data) . '">' . lang('More news') . '</a>'); $this->RenderForm(); return $this->template->parse('out', 'news'); // return $this->template->get_var('newsitem'); } else { return lang('No matching news item'); } } $this->template->set_var('formurl', ''); //veb: added begin. $arguments['start'] = $this->get_curent_pageIndex(); $newslist = $bonews->get_newslist($arguments['category'], $arguments['start'] * $limit, '', '', $limit, True); //fix problem if user try to hack the page. if ($bonews->total < $arguments['start'] * $limit) { $arguments['start'] = 0; $newslist = $bonews->get_newslist($arguments['category'], $arguments['start'] * $limit, '', '', $limit, True); } $this->template->set_var('content', $this->InitPaging($arguments['start'], $limit, $bonews->total)); $this->template->set_var('label', lang('more news')); $this->template->parse('pageitemtop', 'PagingTopBlock'); $this->template->parse('pageitembottom', 'PagingBottomBlock'); //veb: added end. while (list(, $newsitem) = @each($newslist)) { $this->render($newsitem); } if ($arguments['start']) { $link_data['start'] = $arguments['start'] - $limit; $this->template->set_var('lesslink', '<a href="' . $this->link($link_data) . '"><<<</a>'); } if ($bonews->total > $arguments['start'] + $limit) { $link_data['start'] = $arguments['start'] + $limit; $this->template->set_var('morelink', '<a href="' . $this->link($link_data) . '">' . lang('More news') . '</a>'); } return '<div class="contentheading" width="100%">' . $my_cat[0]['name'] . '</div>' . $this->template->parse('out', 'news'); }