MDL-54687 core_message: moved renderables to 'messagearea' namespace

This commit is contained in:
Mark Nelson 2016-08-02 16:58:37 +08:00
parent 8ec78c48fa
commit 1e5f751ffc
10 changed files with 27 additions and 27 deletions

View File

@ -43,7 +43,7 @@ class api {
* @param int $otheruserid The id of the user we have selected, 0 if none have been selected
* @param int $limitfrom
* @param int $limitnum
* @return \core_message\output\contacts
* @return \core_message\output\messagearea\contacts
*/
public static function get_conversations($userid, $otheruserid = 0, $limitfrom = 0, $limitnum = 0) {
$arrcontacts = array();
@ -53,7 +53,7 @@ class api {
}
}
return new \core_message\output\contacts($userid, $otheruserid, $arrcontacts);
return new \core_message\output\messagearea\contacts($userid, $otheruserid, $arrcontacts);
}
/**
@ -62,7 +62,7 @@ class api {
* @param int $userid The user id
* @param int $limitfrom
* @param int $limitnum
* @return \core_message\output\contacts
* @return \core_message\output\messagearea\contacts
*/
public static function get_contacts($userid, $limitfrom = 0, $limitnum = 0) {
global $DB;
@ -81,7 +81,7 @@ class api {
}
}
return new \core_message\output\contacts($userid, 0, $arrcontacts, false);
return new \core_message\output\messagearea\contacts($userid, 0, $arrcontacts, false);
}
/**
@ -92,7 +92,7 @@ class api {
* @param int $limitfrom
* @param int $limitnum
* @param string $sort
* @return \core_message\output\messages
* @return \core_message\output\messagearea\messages
*/
public static function get_messages($userid, $otheruserid, $limitfrom = 0, $limitnum = 0, $sort = 'timecreated ASC') {
$arrmessages = array();
@ -100,7 +100,7 @@ class api {
$arrmessages = \core_message\helper::create_messages($userid, $messages);
}
return new \core_message\output\messages($userid, $otheruserid, $arrmessages);
return new \core_message\output\messagearea\messages($userid, $otheruserid, $arrmessages);
}
/**
@ -108,7 +108,7 @@ class api {
*
* @param int $userid the current user
* @param int $otheruserid the other user
* @return \core_message\output\message|null
* @return \core_message\output\messagearea\message|null
*/
public static function get_most_recent_message($userid, $otheruserid) {
// We want two messages here so we get an accurate 'blocktime' value.
@ -127,7 +127,7 @@ class api {
*
* @param int $userid The user id
* @param int $otheruserid The id of the user whose profile we want to view.
* @return \core_message\output\profile
* @return \core_message\output\messagearea\profile
*/
public static function get_profile($userid, $otheruserid) {
global $CFG, $DB;
@ -157,7 +157,7 @@ class api {
$data->iscontact = false;
}
return new \core_message\output\profile($userid, $data);
return new \core_message\output\messagearea\profile($userid, $data);
}
}

View File

@ -75,7 +75,7 @@ class helper {
*
* @param int $userid
* @param array $messages
* @return \core_message\output\message[]
* @return \core_message\output\messagearea\message[]
*/
public static function create_messages($userid, $messages) {
// Store the messages.
@ -112,7 +112,7 @@ class helper {
$msg->displayblocktime = $displayblocktime;
$msg->timecreated = $message->timecreated;
$msg->timeread = $message->timeread;
$arrmessages[] = new \core_message\output\message($msg);
$arrmessages[] = new \core_message\output\messagearea\message($msg);
}
return $arrmessages;
@ -122,7 +122,7 @@ class helper {
* Helper function for creating a contact renderable.
*
* @param \stdClass $contact
* @return \core_message\output\contact
* @return \core_message\output\messagearea\contact
*/
public static function create_contact($contact) {
global $CFG, $PAGE;
@ -155,6 +155,6 @@ class helper {
$data->isonline = $userfields->lastaccess >= $time;
$data->isread = isset($contact->isread) ? $contact->isread : 0;
return new \core_message\output\contact($data);
return new \core_message\output\messagearea\contact($data);
}
}

View File

@ -22,7 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_message\output;
namespace core_message\output\messagearea;
use renderable;
use templatable;

View File

@ -22,7 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_message\output;
namespace core_message\output\messagearea;
use renderable;
use templatable;
@ -61,7 +61,7 @@ class contacts implements templatable, renderable {
*
* @param int $userid The id of the user the contacts belong to
* @param int $otheruserid The id of the user we are viewing
* @param \core_message\output\contact[] $contacts
* @param \core_message\output\messagearea\contact[] $contacts
* @param bool $conversationsselected
*/
public function __construct($userid, $otheruserid, $contacts, $conversationsselected = true) {

View File

@ -22,7 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_message\output;
namespace core_message\output\messagearea;
use renderable;
use templatable;

View File

@ -22,7 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_message\output;
namespace core_message\output\messagearea;
use renderable;
use templatable;
@ -34,7 +34,7 @@ use templatable;
* @copyright 2016 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class message_area_page implements templatable, renderable {
class message_area implements templatable, renderable {
/**
* The user id.
@ -55,8 +55,8 @@ class message_area_page implements templatable, renderable {
* Constructor.
*
* @param int $userid The ID of the user whose contacts and messages we are viewing
* @param \core_message\output\contacts $contacts
* @param \core_message\output\messages|null $messages
* @param \core_message\output\messagearea\contacts $contacts
* @param \core_message\output\messagearea\messages|null $messages
*/
public function __construct($userid, $contacts, $messages) {
$this->userid = $userid;

View File

@ -22,7 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_message\output;
namespace core_message\output\messagearea;
use renderable;
use templatable;
@ -61,7 +61,7 @@ class messages implements templatable, renderable {
*
* @param int $currentuserid The current user we are wanting to view messages for
* @param int $otheruserid The other user we are wanting to view messages for
* @param \core_message\output\message[] $messages
* @param \core_message\output\messagearea\message[] $messages
*/
public function __construct($currentuserid, $otheruserid, $messages) {
global $DB;

View File

@ -22,7 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_message\output;
namespace core_message\output\messagearea;
use renderable;
use templatable;

View File

@ -42,10 +42,10 @@ class renderer extends plugin_renderer_base {
*
* Defer to template.
*
* @param message_area_page $page
* @param \core_message\output\messagearea\message_area $page
* @return string html for the page
*/
public function render_message_area_page(message_area_page $page) {
public function render_message_area(\core_message\output\messagearea\message_area $page) {
$data = $page->export_for_template($this);
return parent::render_from_template('core_message/message_area', $data);
}

View File

@ -250,7 +250,7 @@ if (!$user2realuser) {
$conversations = \core_message\api::get_conversations($user1->id, $user2->id, 0, 20);
$messages = \core_message\api::get_messages($user1->id, $user2->id);
}
$messagearea = new \core_message\output\message_area_page($user1->id, $conversations, $messages);
$messagearea = new \core_message\output\messagearea\message_area($user1->id, $conversations, $messages);
// Now the page contents.
echo $OUTPUT->header();