Skip to content
Permalink
Browse files

MDL-16423 - fixing bugs in last commit (portfolio_add_button refactor)

  • Loading branch information...
mjollnir_
mjollnir_ committed Sep 10, 2008
1 parent ce09fec commit 380a251f58a67af2f5397cb1fc461f07406cf6c2
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/portfoliolib.php
@@ -82,6 +82,7 @@ public function __construct($options=null) {
$a->finish = $CFG->wwwroot . '/portfolio/add.php?id=' . $SESSION->portfolioexport;
throw new portfolio_button_exception('alreadyexporting', 'portfolio', null, $a);
}
$this->instances = portfolio_instances();
if (empty($options)) {
return true;
}
@@ -91,7 +92,6 @@ public function __construct($options=null) {
}
$this->{$key} = $value;
}
$this->instances = portfolio_instances();
}
/*
@@ -157,7 +157,7 @@ public function set_formats($formats=null) {
* this is whole string, not key. optional, defaults to 'Add to portfolio';
*/
public function render($format=null, $addstr=null) {
echo $this->tohtml($format, $addstr);
echo $this->to_html($format, $addstr);
}
/*
@@ -174,8 +174,8 @@ public function to_html($format=null, $addstr=null) {
if (!$this->is_renderable()) {
return;
}
if (empty($this->callbackclass) || $this->callbackfile) {
throw new portfolio_button_exception('mustcallsetcallbackoptions', 'portfolio');
if (empty($this->callbackclass) || empty($this->callbackfile)) {
throw new portfolio_button_exception('mustsetcallbackoptions', 'portfolio');
}
if (empty($this->formats)) {
// use the caller defaults
@@ -264,7 +264,7 @@ private function is_renderable() {
// eg forum_print_attachments
return false;
}
if (!$this->instances) {
if (empty($this->instances) || count($this->instances) == 0) {
return false;
}
return true;

0 comments on commit 380a251

Please sign in to comment.
You can’t perform that action at this time.