I'll propose something like:
class ActivityTypeInstitutionmessage extends ActivityType {
protected $messagetype; protected $institution; protected $username; protected $fullname;
public function __construct($data, $cron=false) { parent::__construct($data, $cron); if ($this->messagetype == 'request') { $this->url = 'admin/users/institutionusers.php'; $this->users = activity_get_users($this->get_id(), null, null, null, array($this->institution->name)); $this->add_urltext(array('key' => 'institutionmembers', 'section' => 'admin')); } else if ($this->messagetype == 'invite') { $this->url = 'account/institutions.php'; $this->users = activity_get_users($this->get_id(), $this->users); $this->add_urltext(array('key' => 'institutionmembership', 'section' => 'mahara')); } $this->institution = new Institution($this->institution->name); }
private function get_language($user, $institution) { if (!isset($user->lang) || $user->lang === '' || $user->lang === 'default') { if (!isset($institution->lang) || $institution->lang === '' || $institution->lang === 'default') { return get_config('lang') ? get_config('lang') : ''; } else return $institution->lang; } else return $user->lang; }
public function get_subject($user) { $lang = $this->get_language($user, $this->institution); if ($this->messagetype == 'request') { $userstring = $this->fullname . ' (' . $this->username . ')'; return get_string_from_language($lang, 'institutionrequestsubject', 'activity', $userstring, $this->institution->displayname); } else if ($this->messagetype == 'invite') { return get_string_from_language($lang, 'institutioninvitesubject', 'activity', $this->institution->displayname); } }
public function get_message($user) { $lang = $this->get_language($user, $this->institution); if ($this->messagetype == 'request') { return $this->get_subject($user) .' '. get_string_from_language($lang, 'institutionrequestmessage', 'activity', $this->url); } else if ($this->messagetype == 'invite') { return $this->get_subject($user) .' '. get_string_from_language($lang, 'institutioninvitemessage', 'activity', $this->url); } }
public function get_required_parameters() { return array('messagetype', 'institution'); } }
I'll propose something like:
class ActivityTypeIns titutionmessage extends ActivityType {
protected $messagetype;
protected $institution;
protected $username;
protected $fullname;
public function __construct($data, $cron=false) {
parent: :__construct( $data, $cron);
$this- >url = 'admin/ users/instituti onusers. php';
$this- >users = activity_ get_users( $this-> get_id( ), null, null, null,
array( $this-> institution- >name)) ;
$this- >add_urltext( array(' key' => 'institutionmem bers', 'section' => 'admin'));
$this- >url = 'account/ institutions. php';
$this- >users = activity_ get_users( $this-> get_id( ), $this->users);
$this- >add_urltext( array(' key' => 'institutionmem bership' , 'section' => 'mahara'));
$this- >institution = new Institution( $this-> institution- >name);
if ($this->messagetype == 'request') {
} else if ($this->messagetype == 'invite') {
}
}
private function get_language($user, $institution) { $user-> lang) || $user->lang === '' || $user->lang === 'default') { $institution- >lang) || $institution->lang === '' || $institution->lang === 'default') {
return get_config('lang') ? get_config('lang') : '';
if (!isset(
if (!isset(
}
else return $institution->lang;
}
else return $user->lang;
}
public function get_subject($user) { get_language( $user, $this-> institution) ;
$userstrin g = $this->fullname . ' (' . $this->username . ')'; from_language( $lang, 'institutionreq uestsubject' , 'activity', $userstring,
$this- >institution- >displayname) ; from_language( $lang, 'institutioninv itesubject' , 'activity',
$this- >institution- >displayname) ;
$lang = $this->
if ($this->messagetype == 'request') {
return get_string_
} else if ($this->messagetype == 'invite') {
return get_string_
}
}
public function get_message($user) { get_language( $user, $this-> institution) ; get_subject( $user) .' '. get_string_ from_language( $lang, 'institutionreq uestmessage' , 'activity', $this->url); get_subject( $user) .' '. get_string_ from_language( $lang, 'institutioninv itemessage' , 'activity', $this->url);
$lang = $this->
if ($this->messagetype == 'request') {
return $this->
} else if ($this->messagetype == 'invite') {
return $this->
}
}
public function get_required_ parameters( ) { messagetype' , 'institution');
return array('
}
}