Commit 2ca118fc authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review
Browse files

Merge changes I5fea9db5,Ia8b82b05

* changes:
  Changing moodle specific behat_base to mahara specific BehatBase
  Render social profile block with block owner's data (Bug #1448948)
parents 6362bcd6 88b0ef49
......@@ -27,15 +27,16 @@ class PluginBlocktypeSocialprofile extends PluginBlocktype {
}
public static function render_instance(BlockInstance $instance, $editing=false) {
global $USER;
$configdata = $instance->get('configdata');
$type = (isset($configdata['displaytype']) ? $configdata['displaytype'] : 'texticon');
$showicon = ($type == 'icononly' || $type == 'texticon' ? true : false);
$showtext = ($type == 'textonly' || $type == 'texticon' ? true : false);
$owner = $instance->get('view_obj')->get('owner');
// Whether to include email button
if (isset($configdata['displayemail']) && $configdata['displayemail']) {
$email = get_field('artefact_internal_profile_email', 'email', 'principal', 1, 'owner', $instance->get('view_obj')->get('owner'));
$email = get_field('artefact_internal_profile_email', 'email', 'principal', 1, 'owner', $owner);
}
else {
$email = false;
......@@ -53,13 +54,12 @@ class PluginBlocktypeSocialprofile extends PluginBlocktype {
AND owner = ? AND artefacttype = ?
ORDER BY description ASC';
if (!$data = get_records_sql_array($sql, array($USER->get('id'), 'socialprofile'))) {
if (!$data = get_records_sql_array($sql, array($owner, 'socialprofile'))) {
$data = array();
}
safe_require('artefact', 'internal');
$data = ArtefactTypeSocialprofile::get_profile_icons($data);
$smarty = smarty_core();
$smarty->assign('showicon', $showicon);
$smarty->assign('showtext', $showtext);
......
......@@ -1017,6 +1017,9 @@ class ArtefactTypeSocialprofile extends ArtefactTypeProfileField {
}
switch ($type) {
case 'facebook':
$link = 'https://www.facebook.com/' . hsc($data);
break;
case 'twitter':
// Strip an "@" sign if they put one on.
if (strlen($data) && $data[0] == '@') {
......
......@@ -54,7 +54,7 @@ class BehatContextHelper {
*
* @throws coding_exception
* @param string $classname Context identifier (the class name).
* @return behat_base
* @return BehatBase
*/
public static function get($classname) {
......
......@@ -46,7 +46,7 @@ class BehatFormFilemanager extends BehatFormField {
public function get_value() {
// Wait until DOM and JS is ready.
$this->session->wait(behat_base::TIMEOUT, behat_base::PAGE_READY_JS);
$this->session->wait(BehatBase::TIMEOUT, BehatBase::PAGE_READY_JS);
// Get the label to restrict the files to this single form field.
$fieldlabel = $this->get_field_locator();
......
......@@ -89,7 +89,7 @@ class BehatFormSelect extends BehatFormField {
// Wait for all the possible AJAX requests that have been
// already triggered by selectOption() to be finished.
$this->session->wait(behat_base::TIMEOUT * 1000, behat_base::PAGE_READY_JS);
$this->session->wait(BehatBase::TIMEOUT * 1000, BehatBase::PAGE_READY_JS);
// Wrapped in try & catch as the element may disappear if an AJAX request was submitted.
try {
......@@ -324,14 +324,14 @@ class BehatFormSelect extends BehatFormField {
}
/**
* Returns the opton XPath based on it's select xpath.
* Returns the option XPath based on it's select xpath.
*
* @param string $option
* @param string $selectxpath
* @return string xpath
*/
protected function get_option_xpath($option, $selectxpath) {
$valueliteral = $this->escaper->escapeLiteral(trim($option));
$valueliteral = $this->session->getSelectorsHandler()->xpathLiteral(trim($option));
return $selectxpath . "/descendant::option[(./@value=$valueliteral or normalize-space(.)=$valueliteral)]";
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment