MDL-16520 - print info about current export

This commit is contained in:
mjollnir_ 2008-09-16 12:28:20 +00:00
parent b9c639d6c2
commit 6e6cf8a366
3 changed files with 40 additions and 6 deletions

View File

@ -2,7 +2,6 @@
$string['activeportfolios'] = 'Active portfolios';
$string['alreadyalt'] = 'Already exporting - please click here to resolve this transfer';
$string['alreadytext'] = 'Add to portfolio - needs attention';
$string['addnewportfolio'] = 'Add a new portfolio';
$string['addtoportfolio'] = 'Add to portfolio';
$string['addalltoportfolio'] = 'Add all to portfolio';

View File

@ -189,7 +189,7 @@ class portfolio_add_button {
*/
public function to_html($format=null, $addstr=null) {
if ($this->alreadyexporting) {
return $this->already_exporting($format);
return $this->already_exporting($format, $addstr);
}
global $CFG, $COURSE;
if (!$this->is_renderable()) {
@ -323,25 +323,28 @@ class portfolio_add_button {
return $this->callbackclass;
}
private function already_exporting($format) {
private function already_exporting($format, $addstr) {
global $CFG;
$url = $CFG->wwwroot . '/portfolio/already.php';
$icon = $CFG->pixpath . '/t/portfoliono.gif';
$alt = get_string('alreadyalt', 'portfolio');
$text = get_string('alreadytext', 'portfolio');
if (empty($format)) {
$format = PORTFOLIO_ADD_FULL_FORM;
}
if (empty($addstr)) {
$addstr = get_string('addtoportfolio', 'portfolio');
}
switch ($format) {
case PORTFOLIO_ADD_FULL_FORM:
return '<form action="' . $url . '">' . "\n"
. '<input type="submit" value="' . $text . '" />' . "\n"
. '<input type="submit" value="' . $addstr . '" />' . "\n"
. '<img src="' . $icon . '" alt="' . $alt . '" />' . "\n"
. ' </form>';
case PORTFOLIO_ADD_ICON_FORM:
case PORTFOLIO_ADD_ICON_LINK:
return '<a href="' . $url . '"><img src="' . $icon . '" alt="' . $alt . '" /></a>';
case PORTFOLIO_ADD_TEXT_LINK:
return '<a href="' . $url . '">' . $text . '</a>';
return '<a href="' . $url . '">' . $addstr . '(!) </a>';
default:
debugging(get_string('invalidaddformat', 'portfolio', $format));
}

View File

@ -4,12 +4,44 @@ require_once(dirname(dirname(__FILE__)) . '/config.php');
if (empty($CFG->enableportfolios)) {
print_error('disabled', 'portfolio');
}
require_once($CFG->libdir . '/portfoliolib.php');
$dataid = 0;
$currentinfo = null;
if (!$dataid = optional_param('id', '', PARAM_INT) ) {
if (isset($SESSION->portfolioexport)) {
$dataid = $SESSION->portfolioexport;
}
}
$table = new StdClass;
$table->head = array(
get_string('displayarea', 'portfolio'),
get_string('plugin', 'portfolio'),
get_string('displayinfo', 'portfolio'),
);
$table->data = array();
if ($dataid) {
try {
$exporter = portfolio_exporter::rewaken_object($dataid);
$exporter->verify_rewaken();
$table->data[] = array(
$exporter->get('caller')->display_name(),
$exporter->get('instance')->get('name'),
$exporter->get('caller')->heading_summary(),
);
} catch (portfolio_exception $e) { }
}
$strheading = get_string('activeexport', 'portfolio');
print_header($strheading, $strheading);
notice_yesno(get_string('alreadyexporting', 'portfolio'), $CFG->wwwroot . '/portfolio/add.php', $CFG->wwwroot . '/portfolio/add.php?cancel=1');
if (count($table->data) > 0) {
print_table($table);
}
print_footer();
?>