Example #1
0
 * 
 * @package    local_note
 * @copyright  2015 MoodleOfIndia
 * @author     shambhu kumar
 * @license    MoodleOfIndia {@web http://www.moodleofindia.com}
 */
require_once './../../config.php';
require_once 'classes/note.php';
require_once 'locallib.php';
require_login(0, false);
$PAGE->set_context(context_system::instance());
$PAGE->set_pagelayout(get_layout());
$PAGE->set_title(get_string('viewnote', 'local_note'));
$PAGE->set_heading(get_string('viewnote', 'local_note'));
$PAGE->set_url($CFG->wwwroot . '/local/note/view_all_note.php');
$note = new \moi\note($DB, $USER->id);
$id = optional_param('id', false, PARAM_INT);
$row = $note->get_note($id);
$PAGE->navbar->add($row['title']);
echo $OUTPUT->header();
echo html_writer::start_div('row');
if (!$note->haspermission($id)) {
    throw new moodle_exception('nopermissiontoshow');
}
$content = html_writer::tag('p', $row['title'], ['class' => 'lead']);
$link = html_writer::link(new moodle_url($CFG->wwwroot . '/user/profile.php?id=' . $row['publisherid']), $row['name']);
$content .= html_writer::tag('p', get_string('author', 'local_note') . ' ' . $link);
$content .= html_writer::tag('p', get_string('postedon', 'local_note') . userdate($row['datetime'], '%d %b %Y'), ['class' => 'pull-left']);
if (isset($row['attchfilename'])) {
    $content .= html_writer::tag('p', get_string('attachment', 'local_note') . ' <i class="icon  icon-download-alt"></i><a href="' . $row['attchfile'] . '">Download</a>', ['class' => 'pull-right']);
}
Example #2
0
$PAGE->set_context(context_system::instance());
$PAGE->set_pagelayout(get_layout());
$PAGE->set_title(get_string('deletenote', 'local_note'));
$PAGE->set_heading(get_string('deletenote', 'local_note'));
$PAGE->set_url($CFG->wwwroot . '/local/note/my_notes.php');
if (!($id = required_param('id', PARAM_INT))) {
    new moodle_exception('invalidparam');
}
$form = new delete_note();
$form->set_data((object) array('id' => $id));
$message = false;
if ($form->is_cancelled()) {
    redirect(new moodle_url($CFG->wwwroot . '/local/note/my_notes.php'));
} else {
    if ($data = $form->get_data()) {
        $note = new \moi\note($DB, $USER->id);
        if ($note->author_authenticate($data->id)) {
            if ($note->delete($data->id)) {
                $message = html_writer::div(get_string('notedeleted', 'local_note'), 'alert alert-success');
                $form = null;
            }
        } else {
            $message = \html_writer::div(get_string('permisssiondenieddelete', 'local_note'), 'alert alert-danger');
            $form = null;
        }
    }
}
echo $OUTPUT->header();
echo html_writer::start_div('row');
echo html_writer::start_div('span12');
if ($message) {
Example #3
0
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * My notes 
 * @desc this page will view on author of notes
 * 
 * @package    local_note
 * @copyright  2015 MoodleOfIndia
 * @author     shambhu kumar
 * @license    MoodleOfIndia {@web http://www.moodleofindia.com}
 */
require dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once 'locallib.php';
require_once 'classes/note.php';
require_login(0, false);
$context = context_system::instance();
$PAGE->set_context($context);
$PAGE->set_pagelayout(get_layout());
$PAGE->set_title(get_string('mynotes', 'local_note'));
$PAGE->set_heading(get_string('mynotes', 'local_note'));
$PAGE->set_url($CFG->wwwroot . '/local/note/my_notes.php');
echo $OUTPUT->header();
echo html_writer::start_div('row');
global $DB, $USER, $CFG;
$note = new \moi\note($DB, $USER->id, $CFG);
echo html_writer::start_div('span12');
echo $note->get_all_my_notes();
echo html_writer::end_div();
echo html_writer::end_div();
echo $OUTPUT->footer();
Example #4
0
 * @package    local_note
 * @copyright  2015 MoodleOfIndia
 * @author     shambhu kumar
 * @license    MoodleOfIndia {@web http://www.moodleofindia.com}
 */
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_login(0, false);
require_once 'locallib.php';
require_once 'classes/note.php';
$noteid = required_param('id', PARAM_INT);
$PAGE->set_context(context_system::instance());
$PAGE->set_pagelayout(get_layout());
$PAGE->set_title(get_string('editnote', 'local_note'));
$PAGE->set_heading(get_string('editnote', 'local_note'));
$PAGE->set_url($CFG->wwwroot . '/local/note/add_note.php');
$note = new \moi\note($DB, $USER->id);
if (!$note->author_authenticate($noteid, false)) {
    throw new moodle_exception('nopermissiontoshow');
}
$noteform = new \note_form($noteid);
$data = $DB->get_record('cli_note', array('id' => $noteid));
$noteform->set_data($data);
$message = false;
if ($noteform->is_cancelled()) {
    redirect(new moodle_url($CFG->wwwroot . '/local/note/my_notes.php'));
} else {
    if ($data = $noteform->get_data()) {
        $data->modifiedtime = time();
        $data->publisherid = $USER->id;
        if ($DB->update_record('cli_note', $data)) {
            $context = \context_system::instance();