tags. Please do not cause invalid XHTML.
+ */
+ public $title = '';
+
+ /**
+ * @param string $content HTML for the content
+ */
+ public $content = '';
+
+ /**
+ * @param array $list an alternative to $content, it you want a list of things with optional icons.
+ */
+ public $footer = '';
+
+ /**
+ * Any small print that should appear under the block to explain to the
+ * teacher about the block, for example 'This is a sticky block that was
+ * added in the system context.'
+ * @var string
+ */
+ public $annotation = '';
+
+ /**
+ * @var integer one of the constants NOT_HIDEABLE, VISIBLE, HIDDEN. Whether
+ * the user can toggle whether this block is visible.
+ */
+ public $collapsible = self::NOT_HIDEABLE;
+
+ /**
+ * A (possibly empty) array of editing controls. Each element of this array
+ * should be an array('url' => $url, 'icon' => $icon, 'caption' => $caption).
+ * $icon is the icon name. Fed to $OUTPUT->old_icon_url.
+ * @var array
+ */
+ public $controls = array();
+
+ /**
+ * @see moodle_html_component::prepare()
* @return void
*/
public function prepare() {
+ $this->skipid = self::$idcounter;
+ self::$idcounter += 1;
+ $this->add_class('sideblock');
+ if (empty($this->blockinstanceid) || !strip_tags($this->title)) {
+ $this->collapsible = self::NOT_HIDEABLE;
+ }
+ if ($this->collapsible == self::HIDDEN) {
+ $this->add_class('hidden');
+ }
+ if (!empty($this->controls)) {
+ $this->add_class('block_with_controls');
+ }
parent::prepare();
}
}
+
+/**
+ * This class represents a target for where a block can go when it is being moved.
+ *
+ * This needs to be rendered as a form with the given hidden from fields, and
+ * clicking anywhere in the form should submit it. The form action should be
+ * $PAGE->url.
+ *
+ * @copyright 2009 Tim Hunt
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @since Moodle 2.0
+ */
+class block_move_target extends moodle_html_component {
+ /**
+ * List of hidden form fields.
+ * @var array
+ */
+ public $url = array();
+ /**
+ * List of hidden form fields.
+ * @var array
+ */
+ public $text = '';
+}
diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php
index a0615c2ad53..f16adeec72f 100644
--- a/lib/outputrenderers.php
+++ b/lib/outputrenderers.php
@@ -1221,7 +1221,7 @@ class moodle_core_renderer extends moodle_renderer_base {
*/
public function doc_link($path, $text=false, $iconpath=false) {
global $CFG, $OUTPUT;
- $icon = new action_icon();
+ $icon = new moodle_action_icon();
$icon->linktext = $text;
$icon->image->alt = $text;
$icon->image->add_class('iconhelp');
@@ -1242,9 +1242,9 @@ class moodle_core_renderer extends moodle_renderer_base {
}
/**
- * Given a action_icon object, outputs an image linking to an action (URL or AJAX).
+ * Given a moodle_action_icon object, outputs an image linking to an action (URL or AJAX).
*
- * @param action_icon $icon An action_icon object
+ * @param moodle_action_icon $icon A moodle_action_icon object
* @return string HTML fragment
*/
public function action_icon($icon) {
@@ -1402,7 +1402,7 @@ class moodle_core_renderer extends moodle_renderer_base {
* This method can be used in two ways:
*
* // Option 1:
- * $userpic = new user_picture();
+ * $userpic = new moodle_user_picture();
* // Set properties of $userpic
* $OUTPUT->user_picture($userpic);
*
@@ -1414,20 +1414,20 @@ class moodle_core_renderer extends moodle_renderer_base {
* @param object $userpic Object with at least fields id, picture, imagealt, firstname, lastname
* If any of these are missing, or if a userid is passed, the database is queried. Avoid this
* if at all possible, particularly for reports. It is very bad for performance.
- * A user_picture object is a better parameter.
+ * A moodle_user_picture object is a better parameter.
* @param int $courseid courseid Used when constructing the link to the user's profile. Required if $userpic
- * is not a user_picture object
+ * is not a moodle_user_picture object
* @return string HTML fragment
*/
public function user_picture($userpic, $courseid=null) {
- // Instantiate a user_picture object if $user is not already one
- if (!($userpic instanceof user_picture)) {
+ // Instantiate a moodle_user_picture object if $user is not already one
+ if (!($userpic instanceof moodle_user_picture)) {
if (empty($courseid)) {
throw new coding_exception('Called $OUTPUT->user_picture with a $user object but no $courseid.');
}
$user = $userpic;
- $userpic = new user_picture();
+ $userpic = new moodle_user_picture();
$userpic->user = $user;
$userpic->courseid = $courseid;
} else {
diff --git a/lib/simpletest/testoutputlib.php b/lib/simpletest/testoutputlib.php
index 80a26ca42de..851dd5bf3db 100644
--- a/lib/simpletest/testoutputlib.php
+++ b/lib/simpletest/testoutputlib.php
@@ -1187,7 +1187,7 @@ class moodle_core_renderer_test extends UnitTestCase {
$this->assert(new ContainsTagWithContents('option', 'value3'), $html);
$this->assert(new ContainsTagWithContents('option', 'value4'), $html);
}
-
+
public function test_userpicture() {
global $CFG;
// Set up the user with the required fields
@@ -1197,7 +1197,7 @@ class moodle_core_renderer_test extends UnitTestCase {
$user->picture = false;
$user->imagealt = false;
$user->id = 1;
- $userpic = new user_picture();
+ $userpic = new moodle_user_picture();
$userpic->user = $user;
$userpic->courseid = 1;
$userpic->url = true;
diff --git a/repository/filepicker.php b/repository/filepicker.php
index 07a3f9579e4..ba9788d075f 100755
--- a/repository/filepicker.php
+++ b/repository/filepicker.php
@@ -233,7 +233,7 @@ case 'plugins':
echo '';
foreach($repos as $repo) {
$info = $repo->get_meta();
- $icon = new action_icon();
+ $icon = new moodle_action_icon();
$icon->image->src = $info->icon;
$icon->image->style = 'height: 16px; width: 16px;';
$icon->link->url = clone($url);