Skip to content
This repository has been archived by the owner on Jun 15, 2020. It is now read-only.

Commit

Permalink
Removed prefixes for attforblock methods. Fixed errors and notices.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreev-artem committed Nov 18, 2011
1 parent e91283a commit 032c546
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions export.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
$pageparams->set_current_sesstype($formdata->group ? $formdata->group : att_page_with_filter_controls::SESSTYPE_ALL);
if (isset($formdata->includeallsessions)) {
if (isset($formdata->includenottaken)) {
$pageparams->view = VIEW_ALL;
$pageparams->view = ATT_VIEW_ALL;
} else {
$pageparams->view = VIEW_ALLPAST;
$pageparams->view = ATT_VIEW_ALLPAST;
$pageparams->curdate = time();
}
$pageparams->init_start_end_date();
Expand Down
22 changes: 11 additions & 11 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ public function update_session_from_form_data($formdata, $sessionid) {
public function take_from_form_data($formdata) {
global $DB, $USER;

$statuses = implode(',', array_keys( (array)$this->att_get_statuses() ));
$statuses = implode(',', array_keys( (array)$this->get_statuses() ));
$now = time();
$sesslog = array();
$formdata = (array)$formdata;
Expand Down Expand Up @@ -870,7 +870,7 @@ public function get_user($userid) {
return $user;
}

public function att_get_statuses($onlyvisible = true) {
public function get_statuses($onlyvisible = true) {
global $DB;

if (!isset($this->statuses)) {
Expand Down Expand Up @@ -925,13 +925,13 @@ public function get_user_stat($userid) {
global $DB;

$ret = array();
$ret['completed'] = $this->att_get_user_taken_sessions_count($userid);
$ret['statuses'] = $this->att_get_user_statuses_stat($userid);
$ret['completed'] = $this->get_user_taken_sessions_count($userid);
$ret['statuses'] = $this->get_user_statuses_stat($userid);

return $ret;
}

public function att_get_user_taken_sessions_count($userid) {
public function get_user_taken_sessions_count($userid) {
global $DB;

if (!array_key_exists($userid, $this->usertakensesscount))
Expand All @@ -940,7 +940,7 @@ public function att_get_user_taken_sessions_count($userid) {
return $this->usertakensesscount[$userid];
}

public function att_get_user_statuses_stat($userid) {
public function get_user_statuses_stat($userid) {
global $DB;

if (!array_key_exists($userid, $this->userstatusesstat)) {
Expand All @@ -963,8 +963,8 @@ public function att_get_user_statuses_stat($userid) {
return $this->userstatusesstat[$userid];
}

public function att_get_user_grade($userid) {
return att_get_user_grade($this->att_get_user_statuses_stat($userid), $this->att_get_statuses());
public function get_user_grade($userid) {
return att_get_user_grade($this->get_user_statuses_stat($userid), $this->get_statuses());
}

// For getting sessions count implemented simplest method - taken sessions.
Expand All @@ -974,16 +974,16 @@ public function att_get_user_grade($userid) {
// * all sessions between user start and end enrolment date.
// While implementing those methods we need recalculate grades of all users
// on session adding
public function att_get_user_max_grade($userid) {
return att_get_user_max_grade($this->att_get_user_taken_sessions_count($userid), $this->att_get_statuses());
public function get_user_max_grade($userid) {
return att_get_user_max_grade($this->get_user_taken_sessions_count($userid), $this->get_statuses());
}

public function update_users_grade($userids) {
$grades = array();

foreach ($userids as $userid) {
$grades[$userid]->userid = $userid;
$grades[$userid]->rawgrade = att_calc_user_grade_percent($this->att_get_user_grade($userid), $this->att_get_user_max_grade($userid));
$grades[$userid]->rawgrade = att_calc_user_grade_percent($this->get_user_grade($userid), $this->get_user_max_grade($userid));
}

return grade_update('mod/attforblock', $this->course->id, 'mod', 'attforblock',
Expand Down
4 changes: 2 additions & 2 deletions preferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
$att->add_status($newacronym, $newdescription, $newgrade);
break;
case att_preferences_page_params::ACTION_DELETE:
if (has_logs_for_status($att->pageparams->statusid))
if (att_has_logs_for_status($att->pageparams->statusid))
print_error('cantdeletestatus', 'attforblock', "attsettings.php?id=$id");

$confirm = optional_param('confirm', NULL, PARAM_INT);
Expand All @@ -53,7 +53,7 @@
redirect($att->url_preferences(), get_string('statusdeleted','attforblock'));
}

$statuses = $att->att_get_statuses();
$statuses = $att->get_statuses();
$status = $statuses[$att->pageparams->statusid];
$message = get_string('deletecheckfull', '', get_string('variable', 'attforblock'));
$message .= str_repeat(html_writer::empty_tag('br'), 2);
Expand Down
30 changes: 15 additions & 15 deletions renderables.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ public function __construct(attforblock $att) {
$this->nextcur = make_timestamp($year, $mon, $mday + 1);
$this->curdatetxt = userdate($att->pageparams->startdate, $format);
break;
case VIEW_WEEKS:
case ATT_VIEW_WEEKS:
$format = get_string('strftimedm', 'attforblock');
$this->prevcur = $att->pageparams->startdate - WEEKSECS;
$this->nextcur = $att->pageparams->startdate + WEEKSECS;
$this->curdatetxt = userdate($att->pageparams->startdate, $format)." - ".userdate($att->pageparams->enddate, $format);
break;
case VIEW_MONTHS:
case ATT_VIEW_MONTHS:
$format = '%B';
$this->prevcur = make_timestamp($year, $mon - 1);
$this->nextcur = make_timestamp($year, $mon + 1);
Expand Down Expand Up @@ -256,7 +256,7 @@ public function __construct(attforblock $att) {
$this->groupmode = $att->get_group_mode();
$this->cm = $att->cm;

$this->statuses = $att->att_get_statuses();
$this->statuses = $att->get_statuses();

$this->sessioninfo = $att->get_session_info($att->pageparams->sessionid);
$this->updatemode = $this->sessioninfo->lasttaken > 0;
Expand Down Expand Up @@ -336,14 +336,14 @@ public function __construct(attforblock $att, $userid) {
}

if ($this->pageparams->mode == att_view_page_params::MODE_THIS_COURSE) {
$this->statuses = $att->att_get_statuses();
$this->statuses = $att->get_statuses();

$this->stat = $att->get_user_stat($userid);

$this->gradable = $att->grade > 0;
if ($this->gradable) {
$this->grade = $att->att_get_user_grade($userid);
$this->maxgrade = $att->att_get_user_max_grade($userid);
$this->grade = $att->get_user_grade($userid);
$this->maxgrade = $att->get_user_max_grade($userid);
}


Expand All @@ -352,7 +352,7 @@ public function __construct(attforblock $att, $userid) {
$this->sessionslog = $att->get_user_filtered_sessions_log_extended($userid);
}
else {
$this->coursesatts = get_user_courses_attendances($userid);
$this->coursesatts = att_get_user_courses_attendances($userid);

$this->statuses = array();
$this->stat = array();
Expand All @@ -361,8 +361,8 @@ public function __construct(attforblock $att, $userid) {
$this->maxgrade = array();
foreach ($this->coursesatts as $ca) {
$statuses = att_get_statuses($ca->attid);
$user_taken_sessions_count = get_user_taken_sessions_count($ca->attid, $ca->coursestartdate, $userid);
$user_statuses_stat = get_user_statuses_stat($ca->attid, $ca->coursestartdate, $userid);
$user_taken_sessions_count = att_get_user_taken_sessions_count($ca->attid, $ca->coursestartdate, $userid);
$user_statuses_stat = att_get_user_statuses_stat($ca->attid, $ca->coursestartdate, $userid);

$this->statuses[$ca->attid] = $statuses;

Expand Down Expand Up @@ -441,8 +441,8 @@ public function __construct(attforblock $att) {

$this->sessions = $att->get_filtered_sessions();

$this->statuses = $att->att_get_statuses();
$this->allstatuses = $att->att_get_statuses(false);
$this->statuses = $att->get_statuses();
$this->allstatuses = $att->get_statuses(false);

$this->gradable = $att->grade > 0;

Expand All @@ -458,8 +458,8 @@ public function __construct(attforblock $att) {
$this->usersstats[$user->id] = $att->get_user_statuses_stat($user->id);

if ($this->gradable) {
$this->grades[$user->id] = $att->att_get_user_grade($user->id);
$this->maxgrades[$user->id] = $att->att_get_user_max_grade($user->id);
$this->grades[$user->id] = $att->get_user_grade($user->id);
$this->maxgrades[$user->id] = $att->get_user_max_grade($user->id);
}
}

Expand Down Expand Up @@ -488,9 +488,9 @@ class attforblock_preferences_data implements renderable {
private $att;

public function __construct(attforblock $att) {
$this->statuses = $att->att_get_statuses(false);
$this->statuses = $att->get_statuses(false);

foreach ($this->statuses as $st) $st->haslogs = has_logs_for_status ($st->id);
foreach ($this->statuses as $st) $st->haslogs = att_has_logs_for_status ($st->id);

$this->att = $att;
}
Expand Down
14 changes: 7 additions & 7 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ protected function render_curdate_controls(attforblock_filter_controls $fcontrol
}

protected function render_view_controls(attforblock_filter_controls $fcontrols) {
$views[VIEW_ALL] = get_string('all', 'attforblock');
$views[VIEW_ALLPAST] = get_string('allpast', 'attforblock');
$views[VIEW_MONTHS] = get_string('months', 'attforblock');
$views[VIEW_WEEKS] = get_string('weeks', 'attforblock');
$views[ATT_VIEW_ALL] = get_string('all', 'attforblock');
$views[ATT_VIEW_ALLPAST] = get_string('allpast', 'attforblock');
$views[ATT_VIEW_MONTHS] = get_string('months', 'attforblock');
$views[ATT_VIEW_WEEKS] = get_string('weeks', 'attforblock');
$views[ATT_VIEW_DAYS] = get_string('days', 'attforblock');
$viewcontrols = '';
foreach ($views as $key => $sview) {
Expand Down Expand Up @@ -444,12 +444,12 @@ protected function render_attforblock_take_grid(attforblock_take_data $takedata)
private function construct_fullname_head($data) {
global $CFG;

if ($data->pageparams->sort == SORT_LASTNAME)
$firstname = html_writer::link($data->url(array('sort' => SORT_FIRSTNAME)), get_string('firstname'));
if ($data->pageparams->sort == ATT_SORT_LASTNAME)
$firstname = html_writer::link($data->url(array('sort' => ATT_SORT_FIRSTNAME)), get_string('firstname'));
else
$firstname = get_string('firstname');

if ($data->pageparams->sort == SORT_FIRSTNAME)
if ($data->pageparams->sort == ATT_SORT_FIRSTNAME)
$lastname = html_writer::link($data->url(array('sort' => SORT_LASTNAME)), get_string('lastname'));
else
$lastname = get_string('lastname');
Expand Down

0 comments on commit 032c546

Please sign in to comment.