function tags_sideblock() { global $USER; $maxtags = $USER->get_account_preference('tagssideblockmaxtags'); $maxtags = is_null($maxtags) ? get_config('tagssideblockmaxtags') : $maxtags; if ($tagrecords = get_my_tags($maxtags)) { return array('tags' => $tagrecords); } return null; }
} // Add in bits of sync data - let's start with notifications $lastsync = param_integer('lastsync', 0); $notification_types_sql = ''; $notification_types = explode(",", trim(param_variable('notifications', ''))); if (count($notification_types) > 0) { $notification_types_sql = ' a.name IN (' . join(',', array_map('db_quote', $notification_types)) . ')'; } $activity_arr = get_records_sql_array("\n SELECT n.id, n.subject, n.message\n FROM {notification_internal_activity} n\n INNER JOIN {activity_type} a ON n.type=a.id\n WHERE {$notification_types_sql}\n AND n.read=0\n AND " . db_format_tsfield('ctime', '') . " >= ?\n AND n.usr= ? ", array($lastsync, $USER->id)); if (count($activity_arr) > 0) { $json['activity'] = $activity_arr; } // OK - let's add tags $tags_arr = array(); $tagsort = param_alpha('ts', null) != 'freq' ? 'alpha' : 'freq'; foreach (get_my_tags(null, false, $tagsort) as $tag) { $tags_arr[] = array("id" => $tag->tag, "tag" => $tag->tag); } if (count($tags_arr) > 0) { $json['tags'] = $tags_arr; } // OK - let's add journals (and journal posts) $blogs_arr = array(); $blogs = (object) array('offset' => param_integer('offset', 0), 'limit' => param_integer('limit', 10)); $blogposts_arr = array(); $blogposts = array(); list($blogs->count, $blogs->data) = ArtefactTypeBlog::get_blog_list($blogs->limit, $blogs->offset); foreach ($blogs->data as $blog) { if (!$blog->locked) { $blogs_arr[] = array("id" => $blog->id, "blog" => $blog->title); $blogposts = ArtefactTypeBlogpost::get_posts($blog->id, $blogs->limit, $blogs->offset, null);
/** * * @package mahara * @subpackage core * @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later * @copyright For copyright information on Mahara, please see the README file distributed with this software. * */ define('INTERNAL', 1); define('MENUITEM', 'myportfolio'); require 'init.php'; require_once 'searchlib.php'; define('TITLE', get_string('mytags')); $tagsort = param_alpha('ts', null) != 'freq' ? 'alpha' : 'freq'; $tags = get_my_tags(null, false, $tagsort); $tag = param_variable('tag', null); $limit = param_integer('limit', 10); $offset = param_integer('offset', 0); $sort = param_alpha('sort', 'name'); $type = param_alpha('type', null); $owner = (object) array('type' => 'user', 'id' => $USER->get('id')); $data = get_portfolio_items_by_tag($tag, $owner, $limit, $offset, $sort, $type); build_portfolio_search_html($data); $str = array(); foreach (array('tags', 'tag', 'sort', 'type') as $v) { $str[$v] = json_encode(${$v}); } $js = <<<EOF var p = null; var mytags_container = null;
* You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @package mahara * @subpackage core * @author Catalyst IT Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz * */ define('INTERNAL', 1); define('MENUITEM', 'myportfolio'); require 'init.php'; require_once 'pieforms/pieform.php'; define('TITLE', get_string('edittags')); $tags = get_my_tags(); if ($tag = param_variable('tag', null)) { $edittagform = pieform(array('name' => 'edit_tag', 'elements' => array('tagname' => array('type' => 'text', 'size' => 30, 'title' => get_string('name'), 'defaultvalue' => $tag, 'rules' => array('required' => true)), 'submit' => array('type' => 'submit', 'value' => get_string('submit'))))); $deletetagform = pieform(array('name' => 'delete_tag', 'renderer' => 'oneline', 'elements' => array('submit' => array('type' => 'submit', 'value' => get_string('delete'), 'confirm' => get_string('confirmdeletetag'))))); } $smarty = smarty(); $smarty->assign('PAGEHEADING', TITLE); $smarty->assign('tags', $tags); if ($tag) { $smarty->assign('tag', $tag); $smarty->assign('tagsearchurl', get_config('wwwroot') . 'tags.php?tag=' . urlencode($tag)); $smarty->assign('edittagform', $edittagform); $smarty->assign('deletetagform', $deletetagform); } $smarty->display('edittags.tpl'); function edit_tag_submit(Pieform $form, $values)
/** * get the posts * * @package WordPress * @subpackage tpg_get_posts * @since 2.8 * * to control formatting, sometimes it is necessary to restrict a text field to * a specific length or the last word less than the length * * @param array $args values from the shortcode passed to this routine * @return string $content the selected formated posts * */ function tpg_get_posts_gen($args = '') { global $id, $post, $more; // global $id, $post, $more, $page, $pages, $multipage, $preview, $pagenow; //default values passed to get_posts $default_attr = array('numberposts' => '5', 'offset' => '', 'category' => '', 'category_name' => '', 'tag' => '', 'orderby' => 'date', 'end-of-parms' => '---------', 'post_entire' => 'false', 'show_meta' => 'false', 'show_byline' => 'true', 'shorten_title' => '', 'shorten_content' => '', 'text_ellipsis' => ' ...', 'ul_class' => '', 'title_tag' => 'h2', 'fields' => 'post_title, post_content', 'fields_classes' => 'p_title_class, p_content_class'); //loop through attributes and add if array if key does not exist if ($args != '') { foreach ($args as $key => $value) { if (array_key_exists($key, $default_attr)) { continue; } else { $default_attr = array($key => $value) + $default_attr; } } reset($args); } reset($default_attr); //now apply any options passed to the default array $r = shortcode_atts($default_attr, $args); //if multiple category_names passed, convert to cat_id $cat_nam_list = explode(",", $r['category_name']); if (sizeof($cat_nam_list) <= 1) { //single or no cat name submitted - continue } else { //loop to get cat id and replace cat_names with cat ids foreach ($cat_nam_list as $value) { $r['category'] .= get_cat_ID($value) . ","; } $r['category'] = substr_replace($r['category'], "", -1); $r['category_name'] = ""; } //setup parms for query $q_args = array(); reset($r); while (list($key, $value) = each($r)) { if ($key == 'end-of-parms') { end($r); break; } if ($value != '') { $q_args[$key] = $value; } } //set up output fields $fields_list = explode(",", $r['fields']); $fields_classes_list = explode(",", $r['fields_classes']); if (null === $more_link_text) { $more_link_text = __('(read more...)'); } if ($r['post_entire'] == "true") { $post_entire = true; } else { $post_entire = false; } if ($r['show_meta'] == "true") { $show_meta = true; } else { $show_meta = false; } if ($r['show_byline'] == "true") { $show_byline = true; } else { $show_byline = false; } if ($r['ul_class'] == "") { $show_as_list = false; } else { $show_as_list = true; } // set flag to shorten text in title $ellip = $r['text_ellipsis']; if ($r['shorten_title'] == "") { $short_title = false; } else { $short_title = true; $st_style = substr($r['shorten_title'], 0, 1); $st_len = substr($r['shorten_title'], 1); } if ($r['shorten_content'] == "") { $short_content = false; } else { $short_content = true; $sc_style = substr($r['shorten_content'], 0, 1); $sc_len = substr($r['shorten_content'], 1); } //set up title tag if ($r['title_tag'] == '') { $t_tag_beg = ''; $t_tag_end = ''; } else { $t_tag_beg = "<" . $r['title_tag'] . ">"; $t_tag_end = "</" . $r['title_tag'] . ">"; } //open div and begin post process $content = '<div id="tpg-get-posts" />'; if ($show_as_list) { $content .= "<ul class=\"" . $r['ul_class'] . "\">\n"; } // get posts $tmp_post = $post; // save current post/page settings $posts = get_posts($q_args); foreach ($posts as $post) { if ($show_as_list) { $content .= " <li>"; } setup_postdata($post); $i = 0; foreach ($fields_list as $field) { if (isset($fields_classes_list[$i])) { $content .= "<span class=\"" . trim($fields_classes_list[$i]) . "\">"; } $field = trim($field); $wkcontent = $post->{$field}; //get the content switch ($field) { case "post_title": $wkcontent = $short_title ? shorten_text($st_style, $st_len, $wkcontent, $ellip) : $wkcontent; $wkcontent = $t_tag_beg . '<a href="' . get_permalink($post->ID) . '" id="">' . $wkcontent . '</a>' . $t_tag_end; if ($show_byline) { $wkcontent .= '<p class="p_byline" >By ' . get_the_author() . ' on ' . mysql2date('F j, Y', $post->post_date) . '</p>'; } break; case "post_content": if (!$post_entire) { //show only teaser $wkarr = preg_split('/<!--more(.*?)?-->/', $wkcontent); $wkcontent = $short_content ? shorten_text($sc_style, $sc_len, $wkarr[0], $ellip) : $wkarr[0]; $wkcontent = '<div id="tpg_post_content">' . $wkcontent; // $wkcontent .= '<a href="'.get_permalink($post->ID).'" class=\"more-link\">'.$more_link_text.'</a></div>'; $wkcontent .= apply_filters('the_content_more_link', ' <a href="' . get_permalink() . "#more-{$id}\" class=\"more-link\">{$more_link_text}</a></div>", $more_link_text); $wkcontent = force_balance_tags($wkcontent); } else { $wkcontent = '<div id="tpg_post_content">' . $wkcontent . '</div>'; } break; } $content .= $wkcontent; if (isset($fields_classes_list[$i])) { $content .= "</span>"; } $i++; } // print post metadata if ($show_meta) { $content .= '<small><p class="p_metadata_class"> '; // $content .= "<b>Posted:</b> ".$post->post_date." | <b>Author:</b> ".get_the_author_login(); ob_start(); // echo " | <b>Last Modified:</b> "; // the_modified_date( ' Y-m-d '); //date // the_modified_date('H:i'); //time comments_popup_link(' No Comments »', ' 1 Comment »', ' % Comments »'); $content .= ob_get_clean(); $content .= " | <b>Filed under:</b> " . get_my_cats($post->ID) . " | <b>Tags:</b> " . get_my_tags($post->ID); $content .= '</p></small>'; } // end of metadata if ($show_as_list) { $content .= "</li> <hr class=\"tpg_get_post_hr\" />"; } } if ($show_as_list) { $content .= '</ul>'; } $content .= '</div><!-- #tpg-get-posts -->'; $post = $tmp_post; //restore current page/post settings return $content; }
$xml_doc->load('http://calendar.vanderbilt.edu/calendar/rss/set/3?xtags=' . $caltag); if ($html = $xp->transformToXML($xml_doc)) { if ($html != '') { echo "<h4>Upcoming Events</h4>"; echo "<ul>"; echo $html; echo "<li class='more'><a href='http://calendar.vanderbilt.edu/calendar/list?xtags=" . $caltag . "&tagname=" . bloginfo('name') . "'>MORE »</a></li>"; echo "</ul>"; } } // else { trigger_error('XSL transformation failed.', E_USER_ERROR); } } if (get_option('vubrand_sitetype') == 'Blog') { // TAG CLOUD - turned off by default echo '<h4>Tag Cloud</h4>'; echo get_my_tags(); } // if is a page AND top nav chosen AND it is not the homepage - show subpages if (get_option('vubrand_navstyle') == 'top' && !is_front_page() && is_page()) { include TEMPLATEPATH . '/rightchildpages.php'; } // display a news feed in the right column if its turned on for Department -- or if the site is a blog if (get_option('vubrand_sitetype') == 'Blog' || get_option('vubrand_newsrightcol') == 'true') { include TEMPLATEPATH . '/newsdisplay.php'; } if (is_active_sidebar('right-bottom-sidebar-widgets')) { echo '<div class="rssnews">'; dynamic_sidebar('right-bottom-sidebar-widgets'); echo '</div>'; } ?>