/**
  * Return array of rows where each row is an array of tab objects
  * taking into account permissions of current user
  */
 public function get_tabs()
 {
     $toprow = array();
     $context = $this->att->context;
     $capabilities = array('mod/attendance:manageattendances', 'mod/attendance:takeattendances', 'mod/attendance:changeattendances');
     if (has_any_capability($capabilities, $context)) {
         $toprow[] = new tabobject(self::TAB_SESSIONS, $this->att->url_manage()->out(), get_string('sessions', 'attendance'));
     }
     if (has_capability('mod/attendance:manageattendances', $context)) {
         $toprow[] = new tabobject(self::TAB_ADD, $this->att->url_sessions()->out(true, array('action' => att_sessions_page_params::ACTION_ADD)), get_string('add', 'attendance'));
     }
     if (has_capability('mod/attendance:viewreports', $context)) {
         $toprow[] = new tabobject(self::TAB_REPORT, $this->att->url_report()->out(), get_string('report', 'attendance'));
     }
     if (has_capability('mod/attendance:export', $context)) {
         $toprow[] = new tabobject(self::TAB_EXPORT, $this->att->url_export()->out(), get_string('export', 'attendance'));
     }
     if (has_capability('mod/attendance:changepreferences', $context)) {
         $toprow[] = new tabobject(self::TAB_PREFERENCES, $this->att->url_preferences()->out(), get_string('settings', 'attendance'));
     }
     if (has_capability('mod/attendance:managetemporaryusers', $context)) {
         $toprow[] = new tabobject(self::TAB_TEMPORARYUSERS, $this->att->url_managetemp()->out(), get_string('tempusers', 'attendance'));
     }
     return array($toprow);
 }
示例#2
0
    /**
     * Return array of rows where each row is an array of tab objects
     * taking into account permissions of current user
     */
    public function get_tabs() {
        $toprow = array();
        if ($this->att->perm->can_manage() or
                $this->att->perm->can_take() or
                $this->att->perm->can_change()) {
            $toprow[] = new tabobject(self::TAB_SESSIONS, $this->att->url_manage()->out(), get_string('sessions', 'local_attendance'));
        }

        if ($this->att->perm->can_manage()) {
            $toprow[] = new tabobject(self::TAB_ADD, $this->att->url_sessions()->out(true, array('action' => local_att_sessions_page_params::ACTION_ADD)), get_string('add', 'local_attendance'));
        }

        if ($this->att->perm->can_view_reports()) {
            $toprow[] = new tabobject(self::TAB_REPORT, $this->att->url_report()->out(), get_string('report', 'local_attendance'));
        }

        if ($this->att->perm->can_export()) {
            $toprow[] = new tabobject(self::TAB_EXPORT, $this->att->url_export()->out(), get_string('export', 'local_attendance'));
        }

        if ($this->att->perm->can_change_preferences()) {
            $toprow[] = new tabobject(self::TAB_PREFERENCES, $this->att->url_preferences()->out(), get_string('settings', 'local_attendance'));
        }

        return array($toprow);
    }
示例#3
0
 * @copyright  2011 Artem Andreev <*****@*****.**>
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once dirname(__FILE__) . '/../../config.php';
require_once dirname(__FILE__) . '/locallib.php';
require_once dirname(__FILE__) . '/export_form.php';
require_once dirname(__FILE__) . '/renderables.php';
require_once dirname(__FILE__) . '/renderhelpers.php';
$id = required_param('id', PARAM_INT);
$cm = get_coursemodule_from_id('attendance', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$att = $DB->get_record('attendance', array('id' => $cm->instance), '*', MUST_EXIST);
require_login($course, true, $cm);
$att = new attendance($att, $cm, $course, $PAGE->context);
$att->perm->require_export_capability();
$PAGE->set_url($att->url_export());
$PAGE->set_title($course->shortname . ": " . $att->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_cacheable(true);
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'attendance'));
$PAGE->navbar->add(get_string('export', 'quiz'));
$formparams = array('course' => $course, 'cm' => $cm, 'modcontext' => $PAGE->context);
$mform = new mod_attendance_export_form($att->url_export(), $formparams);
if ($mform->is_submitted()) {
    $formdata = $mform->get_data();
    $pageparams = new att_page_with_filter_controls();
    $pageparams->init($cm);
    $pageparams->page = 0;
    $pageparams->group = $formdata->group;
    $pageparams->set_current_sesstype($formdata->group ? $formdata->group : att_page_with_filter_controls::SESSTYPE_ALL);
    if (isset($formdata->includeallsessions)) {