latest work on tabs for instance config. Now if a block is not configured you get a unique link in the body of the block

This commit is contained in:
dhawes 2005-05-15 14:35:41 +00:00
parent f7cb98c5ed
commit 339c1d1153
3 changed files with 24 additions and 17 deletions

View File

@ -86,7 +86,17 @@ class block_rss_client extends block_base {
$userisloggedin = true;
}
if ( $userisloggedin && (isadmin() || $submitters == SUBMITTERS_ALL_ACCOUNT_HOLDERS || ($submitters == SUBMITTERS_ADMIN_AND_TEACHER && $isteacher)) ) {
$output .= '<div align="center"><a href="'. $CFG->wwwroot .'/blocks/rss_client/block_rss_client_action.php?courseid='. $this->courseid .'">'. get_string('block_rss_feeds_add_edit', 'block_rss_client') .'</a></div><br />';
$page = page_create_object($this->instance->pagetype, $this->instance->pageid);
if (isset($this->config)) {
// this instance is configured - show Add/Edit feeds link
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'managefeeds'));
$output .= '<div align="center"><a title="'. get_string('block_rss_feeds_add_edit', 'block_rss_client') .'" href="'. $script .'">'. get_string('block_rss_feeds_add_edit', 'block_rss_client') .'</a></div><br />';
} else {
// this instance has not been configured yet - show configure link
$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => $USER->sesskey, 'blockaction' => 'config', 'currentaction' => 'configblock'));
$output .= '<div align="center"><a title="'. get_string('configuration') .'" href="'. $script.'">'. get_string('configuration') .'</a></div><br />';
}
}
// Daryl Hawes note: if count of rssidarray is greater than 1
@ -96,7 +106,7 @@ class block_rss_client extends block_base {
$numids = count($rssidarray);
$count = 0;
foreach ($rssidarray as $rssid) {
$output = $this->get_rss_by_id($rssid, $display_description, $shownumentries, ($numids > 1) ? true : false);
$output .= $this->get_rss_by_id($rssid, $display_description, $shownumentries, ($numids > 1) ? true : false);
if ($numids > 1 && $count != $numids -1 && !empty($rssfeedstring)) {
$output .= '<hr width="80%" />';
}

View File

@ -1,19 +1,15 @@
<?php
require_once($CFG->libdir .'/rsslib.php');
/// Print tabs at top
global $currenttab;
if (empty($currenttab) || $currenttab == 'configblock') {
$currenttab = 'configblock';
$inactive = 'configblock';
$activetab = 'managefeeds';
global $currentaction;
if (empty($currentaction) || $currentaction == 'configblock') {
$currentaction = 'configblock';
} else {
$currenttab = 'managefeeds';
$inactive = 'managefeeds';
$activetab = 'configblock';
$currentaction = 'managefeeds';
}
include('config_instance_tabs.php');
if ($currenttab == 'configblock') {
if ($currentaction == 'configblock') {
?>
<table cellpadding="9" cellspacing="0">
<tr valign="top">

View File

@ -1,18 +1,19 @@
<?php // $Id$
/// This file to be included so we can assume config.php has already been included.
/// We also assume that $inactive, $activetab and $currenttab have been set
/// We also assume that $inactive, $activetab and $currentaction have been set
$row = array();
$tabs = $row = array();
$row[] = new tabobject('configblock', me().'&amp;currenttab=configblock',
$row[] = new tabobject('configblock', me().'&amp;currentaction=configblock',
get_string('block_rss_configblock', 'block_rss_client'));
$row[] = new tabobject('managefeeds', me().'&amp;currenttab=managefeeds',
$row[] = new tabobject('managefeeds', me().'&amp;currentaction=managefeeds',
get_string('block_rss_managefeeds', 'block_rss_client'));
$tabs = array($row);
$tabs[] = $row;
/// Print out the tabs and continue!
print '<div align="center">';
print_tabs($tabs, $currenttab, $inactive, $activetab);
print_tabs($tabs, $currentaction);
print '</div>';
?>