} echo $output->render($stashinfo); $submitform->set_data(array('name' => s($stash->name), 'stashid' => $stash->id)); $submitform->display(); echo $output->footer(); die; } // Own stashes if (!($stashes = $DB->get_records('amos_stashes', array('ownerid' => $USER->id), 'timecreated DESC'))) { echo $output->heading(get_string('ownstashesnone', 'local_amos')); } else { // catch output into these two variables $autosavestash = ''; $ownstashes = ''; foreach ($stashes as $stashdata) { $stash = local_amos_stash::instance_from_record($stashdata, $USER); if (has_capability('local/amos:stage', get_system_context())) { $stash->add_action('apply', new moodle_url($PAGE->url, array('apply' => $stash->id)), get_string('stashapply', 'local_amos')); if (!$stash->isautosave) { $stash->add_action('pop', new moodle_url($PAGE->url, array('pop' => $stash->id)), get_string('stashpop', 'local_amos')); } } if (!$stash->isautosave) { $stash->add_action('drop', new moodle_url($PAGE->url, array('drop' => $stash->id)), get_string('stashdrop', 'local_amos')); $stash->add_action('submit', new moodle_url($PAGE->url, array('submit' => $stash->id)), get_string('stashsubmit', 'local_amos')); } if ($stash->isautosave) { $autosavestash .= $output->render($stash); } else { $ownstashes .= $output->render($stash); }
/** * Render stash information * * @param local_amos_stash $stash * @return string to be echo'ed */ protected function render_local_amos_stash(local_amos_stash $stash) { $output = html_writer::start_tag('div', array('class' => 'stash')); if ($stash->isautosave) { $output .= html_writer::tag('h3', get_string('stashautosave', 'local_amos')); $extraclasses = ' autosave'; } else { $output .= html_writer::tag('h3', s($stash->name)); $extraclasses = ''; } $output .= html_writer::tag('div', fullname($stash->owner), array('class' => 'owner')); $output .= $this->output->user_picture($stash->owner); $output .= html_writer::tag('div', userdate($stash->timecreated, get_string('strftimedaydatetime', 'langconfig')), array('class' => 'timecreated')); $output .= html_writer::tag('div', get_string('stashstrings', 'local_amos', $stash->strings), array('class' => 'strings')); $output .= html_writer::tag('div', get_string('stashlanguages', 'local_amos', s(implode(', ', $stash->languages))), array('class' => 'languages')); $output .= html_writer::tag('div', get_string('stashcomponents', 'local_amos', s(implode(', ', $stash->components))), array('class' => 'components')); $output .= html_writer::end_tag('div'); $actions = ''; foreach ($stash->get_actions() as $action) { $actions .= $this->output->single_button($action->url, $action->label, 'post', array('class' => 'singlebutton ' . $action->id)); } if ($actions) { $actions .= $this->output->help_icon('ownstashactions', 'local_amos'); $actions = html_writer::tag('div', $actions, array('class' => 'actions')); } $output = $this->output->box($output . $actions, 'generalbox stashwrapper' . $extraclasses); return $output; }