Skip to content

Commit

Permalink
MDL-19823 Converted print_box* to $OUTPUT->box*
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasconnault committed Aug 10, 2009
1 parent 70f52c7 commit 456d32f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
12 changes: 6 additions & 6 deletions tag/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
if ($courses = coursetag_get_tagged_courses($tag->id)) {

$totalcount = count( $courses );
print_box_start('generalbox', 'tag-blogs'); //could use an id separate from tag-blogs, but would have to copy the css style to make it look the same
echo $OUTPUT->box_start('generalbox', 'tag-blogs'); //could use an id separate from tag-blogs, but would have to copy the css style to make it look the same

$heading = get_string('courses') . ' ' . get_string('taggedwith', 'tag', $tagname) .': '. $totalcount;
echo "<a name='course'></a>";
Expand All @@ -89,7 +89,7 @@
print_course($course);
}

print_box_end();
echo $OUTPUT->box_end();
}

// Print up to 10 previous blogs entries
Expand All @@ -102,7 +102,7 @@
$count = 10;
if ($blogs = blog_fetch_entries('', $count, 0, 'site', '', $tag->id)) {

print_box_start('generalbox', 'tag-blogs');
echo $OUTPUT->box_start('generalbox', 'tag-blogs');
$heading = get_string('relatedblogs', 'tag', $tagname). ' ' . get_string('taggedwith', 'tag', $tagname);
echo "<a name='blog'></a>";
echo $OUTPUT->heading($heading, 3);
Expand All @@ -129,15 +129,15 @@

echo '<p class="moreblogs"><a href="'.$CFG->wwwroot.'/blog/index.php?filtertype=site&amp;filterselect=0&amp;tagid='.$tag->id.'">'.get_string('seeallblogs', 'tag', $tagname).'</a></p>';

print_box_end();
echo $OUTPUT->box_end();
}
}

$usercount = tag_record_count('user', $tag->id);
if ($usercount > 0) {

//user table box
print_box_start('generalbox', 'tag-user-table');
echo $OUTPUT->box_start('generalbox', 'tag-user-table');

$heading = get_string('users'). ' ' . get_string('taggedwith', 'tag', $tagname) . ': ' . $usercount;
echo "<a name='user'></a>";
Expand All @@ -148,7 +148,7 @@
$pagingbar->pagevar = 'userpage';
echo $OUTPUT->paging_bar($pagingbar);
tag_print_tagged_users_table($tag, $userpage * $perpage, $perpage);
print_box_end();
echo $OUTPUT->box_end();
}

echo $OUTPUT->footer();
Expand Down
38 changes: 19 additions & 19 deletions tag/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
function tag_print_cloud($nr_of_tags=150, $return=false) {
global $CFG, $DB;

$can_manage_tags = has_capability('moodle/tag:manage', get_context_instance(CONTEXT_SYSTEM));

if ( !$tagsincloud = $DB->get_records_sql('SELECT tg.rawname, tg.id, tg.name, tg.tagtype, COUNT(ti.id) AS count, tg.flag
Expand Down Expand Up @@ -69,7 +69,7 @@ function tag_print_cloud($nr_of_tags=150, $return=false) {
}

/**
* This function is used by print_tag_cloud, to usort() the tags in the cloud.
* This function is used by print_tag_cloud, to usort() the tags in the cloud.
* See php.net/usort for the parameters documentation. This was originally in
* blocks/blog_tags/block_blog_tags.php, named blog_tags_sort().
*/
Expand Down Expand Up @@ -99,7 +99,7 @@ function tag_cloud_sort($a, $b) {
*/
function tag_print_description_box($tag_object, $return=false) {

global $USER, $CFG;
global $USER, $CFG, $OUTPUT;

$max_tags_displayed = 10; // todo: turn this into a system setting

Expand All @@ -110,7 +110,7 @@ function tag_print_description_box($tag_object, $return=false) {
$output = '';

if ($content) {
$output .= print_box_start('generalbox', 'tag-description', true);
$output .= $OUTPUT->box_start('generalbox', 'tag-description');
}

if (!empty($tag_object->description)) {
Expand All @@ -132,7 +132,7 @@ function tag_print_description_box($tag_object, $return=false) {
}

if ($content) {
$output .= print_box_end(true);
$output .= $OUTPUT->box_end();
}

if ($return) {
Expand All @@ -150,16 +150,16 @@ function tag_print_description_box($tag_object, $return=false) {
*/
function tag_print_management_box($tag_object, $return=false) {

global $USER, $CFG;
global $USER, $CFG, $OUTPUT;

$tagname = tag_display_name($tag_object);
$output = '';

if (!isguestuser()) {
$output .= print_box_start('box','tag-management-box', true);
$output .= $OUTPUT->box_start('box','tag-management-box');
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
$links = array();

// Add a link for users to add/remove this from their interests
if (tag_record_tagged_with('user', $USER->id, $tag_object->name)) {
$links[] = '<a href="'. $CFG->wwwroot .'/tag/user.php?action=removeinterest&amp;sesskey='. sesskey() .'&amp;tag='. rawurlencode($tag_object->name) .'">'. get_string('removetagfrommyinterests', 'tag', $tagname) .'</a>';
Expand All @@ -171,13 +171,13 @@ function tag_print_management_box($tag_object, $return=false) {
$links[] = '<a href="'. $CFG->wwwroot .'/tag/user.php?action=flaginappropriate&amp;sesskey='. sesskey() .'&amp;tag='. rawurlencode($tag_object->name) .'">'. get_string('flagasinappropriate', 'tag', rawurlencode($tagname)) .'</a>';

// Edit tag: Only people with moodle/tag:edit capability who either have it as an interest or can manage tags
if (has_capability('moodle/tag:edit', $systemcontext) ||
if (has_capability('moodle/tag:edit', $systemcontext) ||
has_capability('moodle/tag:manage', $systemcontext)) {
$links[] = '<a href="'. $CFG->wwwroot .'/tag/edit.php?tag='. rawurlencode($tag_object->name) .'">'. get_string('edittag', 'tag') .'</a>';
}

$output .= implode(' | ', $links);
$output .= print_box_end(true);
$output .= $OUTPUT->box_end();
}

if ($return) {
Expand All @@ -193,16 +193,16 @@ function tag_print_management_box($tag_object, $return=false) {
* @param bool $return if true return html string
*/
function tag_print_search_box($return=false) {
global $CFG;
global $CFG, $OUTPUT;

$output = print_box_start('','tag-search-box', true);
$output = $OUTPUT->box_start('','tag-search-box');
$output .= '<form action="'.$CFG->wwwroot.'/tag/search.php" style="display:inline">';
$output .= '<div>';
$output .= '<input id="searchform_search" name="query" type="text" size="40" />';
$output .= '<button id="searchform_button" type="submit">'. get_string('search', 'tag') .'</button><br />';
$output .= '</div>';
$output .= '</form>';
$output .= print_box_end(true);
$output .= $OUTPUT->box_end();

if ($return) {
return $output;
Expand Down Expand Up @@ -248,7 +248,7 @@ function tag_print_search_results($query, $page, $perpage, $return=false) {

//print a link "Add $query to my interests"
if (!empty($addtaglink)) {
$output .= print_box($addtaglink, 'box', 'tag-management-box', true);
$output .= $OUTPUT->box($addtaglink, 'box', 'tag-management-box');
}

$nr_of_lis_per_ul = 6;
Expand All @@ -273,7 +273,7 @@ function tag_print_search_results($query, $page, $perpage, $return=false) {

//print a link "Add $query to my interests"
if (!empty($addtaglink)) {
$output .= print_box($addtaglink, 'box', 'tag-management-box', true);
$output .= $OUTPUT->box($addtaglink, 'box', 'tag-management-box');
}
}

Expand Down Expand Up @@ -316,7 +316,7 @@ function tag_print_tagged_users_table($tag_object, $limitfrom='' , $limitnum='',
* @param $return if true return html string
*/
function tag_print_user_box($user, $return=false) {
global $CFG;
global $CFG, $OUTPUT;

$textlib = textlib_get_instance();
$usercontext = get_context_instance(CONTEXT_USER, $user->id);
Expand All @@ -326,7 +326,7 @@ function tag_print_user_box($user, $return=false) {
$profilelink = $CFG->wwwroot .'/user/view.php?id='. $user->id;
}

$output = print_box_start('user-box', 'user'. $user->id, true);
$output = $OUTPUT->box_start('user-box', 'user'. $user->id);
$fullname = fullname($user);
$alt = '';

Expand All @@ -341,7 +341,7 @@ function tag_print_user_box($user, $return=false) {
} else {
$output .= '<img alt="'. $alt .'" class="user-image" src="'. $CFG->wwwroot .'/pix/u/f1.png" />';
}

$output .= '<br />';

if (!empty($profilelink)) {
Expand All @@ -354,7 +354,7 @@ function tag_print_user_box($user, $return=false) {
}

$output .= '<strong>'. $fullname .'</strong>';
$output .= print_box_end(true);
$output .= $OUTPUT->box_end();

if ($return) {
return $output;
Expand Down
4 changes: 2 additions & 2 deletions tag/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@

echo '<br/><br/>';

print_box_start('generalbox', 'big-tag-cloud-box');
echo $OUTPUT->box_start('generalbox', 'big-tag-cloud-box');
tag_print_cloud(150);
print_box_end();
echo $OUTPUT->box_end();

echo $OUTPUT->footer();

Expand Down

0 comments on commit 456d32f

Please sign in to comment.