Loading view.php +24 −30 Changes for view.php: 24 added lines, 30 removed lines. Original line number Diff line number Diff line <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify Loading @@ -13,17 +14,15 @@ // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /* Learning Plan Block * This plugin serves as a database and plan for all learning activities in the organziation, * where such activities are organized for a more structured learning program. * @package blocks * @author: Azmat Ullah, Talha Noor * @date: 20-Sep-2013 * @copyright Copyrights © 2012 - 2013 | 3i Logic (Pvt) Ltd. * @date: 20-Aug-2014 * @copyright Copyrights © 2012 - 2014 | 3i Logic (Pvt) Ltd. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once('../../config.php'); $setting = null; $row = array(); Loading @@ -36,22 +35,26 @@ $rem = optional_param('rem', null, PARAM_RAW); $edit = optional_param('edit', null, PARAM_RAW); $delete = optional_param('delete', null, PARAM_RAW); $id = optional_param('id', null, PARAM_INT); $u_id = optional_param('id', null, PARAM_INT); $lp = optional_param('lp', null, PARAM_INT); $pageurl = new moodle_url('/blocks/learning_plan/view.php?viewpage=' . $viewpage); $learningplan_url = new moodle_url('/blocks/learning_plan/view.php?viewpage=1'); $nav_title = nav_title($viewpage); require_login(); $context = context_system::instance(); if (!has_capability('block/learning_plan:managepages', $context)) { redirect($CFG->wwwroot); } $context = context_system::instance(); $PAGE->set_context($context); $PAGE->set_url('/blocks/learning_plan/view.php'); $PAGE->set_url($pageurl); $PAGE->set_pagelayout('standard'); $PAGE->set_heading('Learning Plan'); $PAGE->set_title('Learning Plan'); //$PAGE->set_heading('Learning Plan'); //$PAGE->set_title('Learning Plan'); $pageurl = new moodle_url('/blocks/learning_plan/view.php?viewpage=' . $viewpage); $learningplan_url = new moodle_url('/blocks/learning_plan/view.php?viewpage=1'); $nav_title = nav_title($viewpage); $PAGE->set_heading(get_string('learning_plan', 'block_learning_plan')); $PAGE->set_title(get_string('learning_plan', 'block_learning_plan')); $PAGE->navbar->ignore_active(); $PAGE->navbar->add(get_string("pluginname", 'block_learning_plan'), new moodle_url($learningplan_url)); $PAGE->navbar->add($nav_title); Loading @@ -67,7 +70,6 @@ $table->size = array('15%', '15%', '20%', '25%', '15%', '10%'); $table->align = array('center', 'center', 'center', 'center', 'center', 'center'); $table->width = '100%'; $table->data[] = $row; echo html_writer::table($table); if ($viewpage == 1) { // Add Learning Plans. $form = new learningplan_form(); Loading @@ -82,11 +84,9 @@ if ($viewpage == 1) { // Add Learning Plans. } redirect($pageurl); } // Delete Record. if ($rem) { echo $OUTPUT->confirm(get_string('plan_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=1&rem=rem&delete='.$id, '/blocks/learning_plan/view.php?viewpage=1'); echo $OUTPUT->confirm(get_string('plan_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=1&rem=rem&delete=' . $id, '/blocks/learning_plan/view.php?viewpage=1'); if ($delete) { delete_learningplan_record('learning_learningplan', $delete, $pageurl); } Loading @@ -112,8 +112,7 @@ if ($viewpage == 1) { // Add Learning Plans. } // Delete Record. if ($rem) { echo $OUTPUT->confirm(get_string('training_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=2&rem=rem&delete='.$id, '/blocks/learning_plan/view.php?viewpage=2'); echo $OUTPUT->confirm(get_string('training_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=2&rem=rem&delete=' . $id, '/blocks/learning_plan/view.php?viewpage=2'); if ($delete) { delete_learningplan_record('learning_training', $delete, $pageurl); } Loading @@ -124,7 +123,6 @@ if ($viewpage == 1) { // Add Learning Plans. $form = new training_form(null, array('id' => $get_learningplan->id)); $form->set_data($get_learningplan); } /* // $fromform->save_file('$fromform', 'http://localhost/moodle/blocks/learning_plan/data/', null); // echo $content; Loading @@ -134,7 +132,6 @@ if ($viewpage == 1) { // Add Learning Plans. $form->save_file('attachment', $importfile, true); echo $importfile; */ } else if ($viewpage == 3) { // Add Training Method. $form = new trainingmethod_form(); } else if ($viewpage == 4) { // Assign Training into Learning Plan. Loading @@ -153,7 +150,6 @@ if ($viewpage == 1) { // Add Learning Plans. foreach ($fromform->t_id as $formtid) { $record->t_id = $formtid; $DB->insert_record('learning_plan_training', $record); // Condtion for already assigned learning plan // Getting lpt_id // Get lp_id and getting user array Loading @@ -174,15 +170,16 @@ if ($viewpage == 1) { // Add Learning Plans. } // Delete Record. if ($rem) { echo $OUTPUT->confirm(get_string('record_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=4&rem=rem&delete='.$id, '/blocks/learning_plan/view.php?viewpage=4'); // echo $OUTPUT->confirm(get_string('record_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=4&rem=rem&delete='.$id, // '/blocks/learning_plan/view.php?viewpage=4'); echo $OUTPUT->confirm(get_string('record_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=4&rem=rem&delete=' . $id . '&id=' . $lp, '/blocks/learning_plan/view.php?viewpage=4'); if ($delete) { delete_learningplan_record('learning_plan_training', $delete, $pageurl); // delete_learningplan_record('learning_plan_training', $delete, $pageurl); delete_learningplan_record('learning_plan_training', $delete, $pageurl, $id); } } } else if ($viewpage == 5) { // Assign Learning plan to User. $form = new assignlerningplan_user_form(); if ($fromform = $form->get_data()) { // print_object($fromform); if ($fromform->id) { Loading Loading @@ -212,32 +209,29 @@ if ($viewpage == 1) { // Add Learning Plans. // Delete Record. if ($rem) { echo $OUTPUT->confirm(get_string('record_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=5&rem=rem&delete='.$id, '/blocks/learning_plan/view.php?viewpage=5'); // '/blocks/learning_plan/view.php?viewpage=5&rem=rem&delete='.$id, '/blocks/learning_plan/view.php?viewpage=5'); '/blocks/learning_plan/view.php?viewpage=5&rem=rem&delete=' . $u_id . '&lp=' . $lp, '/blocks/learning_plan/view.php?viewpage=5'); if ($delete) { delete_learningplan_record('learning_user_learningplan', $delete, $pageurl); // echo $pageurl; // delete_learningplan_record('learning_user_learningplan', $delete, $pageurl); delete_learningplan_record('learning_user_learningplan', $delete, $pageurl, $lp); } } } else if ($viewpage == 6) { // Set Training Status. $form = new trainingstatus_form(); $setting = optional_param('setting', null, PARAM_INT); if ($fromform = $form->get_data()) { $status_id = status_id($fromform->l_id, $fromform->u_id, $fromform->t_id); $fromform->id = $status_id; $DB->update_record('learning_user_trainingplan', $fromform); } } else if ($viewpage == 7) { $form = new search(); } // Set viewpage with form. $toform['viewpage'] = $viewpage; $form->set_data($toform); // Display Form. $form->display(); // Form Cancel. if ($fromform = $form->is_cancelled()) { redirect("{$CFG->wwwroot}" . "/blocks/learning_plan/view.php?viewpage=" . $viewpage); Loading Loading
view.php +24 −30 Changes for view.php: 24 added lines, 30 removed lines. Original line number Diff line number Diff line <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify Loading @@ -13,17 +14,15 @@ // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /* Learning Plan Block * This plugin serves as a database and plan for all learning activities in the organziation, * where such activities are organized for a more structured learning program. * @package blocks * @author: Azmat Ullah, Talha Noor * @date: 20-Sep-2013 * @copyright Copyrights © 2012 - 2013 | 3i Logic (Pvt) Ltd. * @date: 20-Aug-2014 * @copyright Copyrights © 2012 - 2014 | 3i Logic (Pvt) Ltd. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once('../../config.php'); $setting = null; $row = array(); Loading @@ -36,22 +35,26 @@ $rem = optional_param('rem', null, PARAM_RAW); $edit = optional_param('edit', null, PARAM_RAW); $delete = optional_param('delete', null, PARAM_RAW); $id = optional_param('id', null, PARAM_INT); $u_id = optional_param('id', null, PARAM_INT); $lp = optional_param('lp', null, PARAM_INT); $pageurl = new moodle_url('/blocks/learning_plan/view.php?viewpage=' . $viewpage); $learningplan_url = new moodle_url('/blocks/learning_plan/view.php?viewpage=1'); $nav_title = nav_title($viewpage); require_login(); $context = context_system::instance(); if (!has_capability('block/learning_plan:managepages', $context)) { redirect($CFG->wwwroot); } $context = context_system::instance(); $PAGE->set_context($context); $PAGE->set_url('/blocks/learning_plan/view.php'); $PAGE->set_url($pageurl); $PAGE->set_pagelayout('standard'); $PAGE->set_heading('Learning Plan'); $PAGE->set_title('Learning Plan'); //$PAGE->set_heading('Learning Plan'); //$PAGE->set_title('Learning Plan'); $pageurl = new moodle_url('/blocks/learning_plan/view.php?viewpage=' . $viewpage); $learningplan_url = new moodle_url('/blocks/learning_plan/view.php?viewpage=1'); $nav_title = nav_title($viewpage); $PAGE->set_heading(get_string('learning_plan', 'block_learning_plan')); $PAGE->set_title(get_string('learning_plan', 'block_learning_plan')); $PAGE->navbar->ignore_active(); $PAGE->navbar->add(get_string("pluginname", 'block_learning_plan'), new moodle_url($learningplan_url)); $PAGE->navbar->add($nav_title); Loading @@ -67,7 +70,6 @@ $table->size = array('15%', '15%', '20%', '25%', '15%', '10%'); $table->align = array('center', 'center', 'center', 'center', 'center', 'center'); $table->width = '100%'; $table->data[] = $row; echo html_writer::table($table); if ($viewpage == 1) { // Add Learning Plans. $form = new learningplan_form(); Loading @@ -82,11 +84,9 @@ if ($viewpage == 1) { // Add Learning Plans. } redirect($pageurl); } // Delete Record. if ($rem) { echo $OUTPUT->confirm(get_string('plan_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=1&rem=rem&delete='.$id, '/blocks/learning_plan/view.php?viewpage=1'); echo $OUTPUT->confirm(get_string('plan_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=1&rem=rem&delete=' . $id, '/blocks/learning_plan/view.php?viewpage=1'); if ($delete) { delete_learningplan_record('learning_learningplan', $delete, $pageurl); } Loading @@ -112,8 +112,7 @@ if ($viewpage == 1) { // Add Learning Plans. } // Delete Record. if ($rem) { echo $OUTPUT->confirm(get_string('training_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=2&rem=rem&delete='.$id, '/blocks/learning_plan/view.php?viewpage=2'); echo $OUTPUT->confirm(get_string('training_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=2&rem=rem&delete=' . $id, '/blocks/learning_plan/view.php?viewpage=2'); if ($delete) { delete_learningplan_record('learning_training', $delete, $pageurl); } Loading @@ -124,7 +123,6 @@ if ($viewpage == 1) { // Add Learning Plans. $form = new training_form(null, array('id' => $get_learningplan->id)); $form->set_data($get_learningplan); } /* // $fromform->save_file('$fromform', 'http://localhost/moodle/blocks/learning_plan/data/', null); // echo $content; Loading @@ -134,7 +132,6 @@ if ($viewpage == 1) { // Add Learning Plans. $form->save_file('attachment', $importfile, true); echo $importfile; */ } else if ($viewpage == 3) { // Add Training Method. $form = new trainingmethod_form(); } else if ($viewpage == 4) { // Assign Training into Learning Plan. Loading @@ -153,7 +150,6 @@ if ($viewpage == 1) { // Add Learning Plans. foreach ($fromform->t_id as $formtid) { $record->t_id = $formtid; $DB->insert_record('learning_plan_training', $record); // Condtion for already assigned learning plan // Getting lpt_id // Get lp_id and getting user array Loading @@ -174,15 +170,16 @@ if ($viewpage == 1) { // Add Learning Plans. } // Delete Record. if ($rem) { echo $OUTPUT->confirm(get_string('record_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=4&rem=rem&delete='.$id, '/blocks/learning_plan/view.php?viewpage=4'); // echo $OUTPUT->confirm(get_string('record_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=4&rem=rem&delete='.$id, // '/blocks/learning_plan/view.php?viewpage=4'); echo $OUTPUT->confirm(get_string('record_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=4&rem=rem&delete=' . $id . '&id=' . $lp, '/blocks/learning_plan/view.php?viewpage=4'); if ($delete) { delete_learningplan_record('learning_plan_training', $delete, $pageurl); // delete_learningplan_record('learning_plan_training', $delete, $pageurl); delete_learningplan_record('learning_plan_training', $delete, $pageurl, $id); } } } else if ($viewpage == 5) { // Assign Learning plan to User. $form = new assignlerningplan_user_form(); if ($fromform = $form->get_data()) { // print_object($fromform); if ($fromform->id) { Loading Loading @@ -212,32 +209,29 @@ if ($viewpage == 1) { // Add Learning Plans. // Delete Record. if ($rem) { echo $OUTPUT->confirm(get_string('record_delete', 'block_learning_plan'), '/blocks/learning_plan/view.php?viewpage=5&rem=rem&delete='.$id, '/blocks/learning_plan/view.php?viewpage=5'); // '/blocks/learning_plan/view.php?viewpage=5&rem=rem&delete='.$id, '/blocks/learning_plan/view.php?viewpage=5'); '/blocks/learning_plan/view.php?viewpage=5&rem=rem&delete=' . $u_id . '&lp=' . $lp, '/blocks/learning_plan/view.php?viewpage=5'); if ($delete) { delete_learningplan_record('learning_user_learningplan', $delete, $pageurl); // echo $pageurl; // delete_learningplan_record('learning_user_learningplan', $delete, $pageurl); delete_learningplan_record('learning_user_learningplan', $delete, $pageurl, $lp); } } } else if ($viewpage == 6) { // Set Training Status. $form = new trainingstatus_form(); $setting = optional_param('setting', null, PARAM_INT); if ($fromform = $form->get_data()) { $status_id = status_id($fromform->l_id, $fromform->u_id, $fromform->t_id); $fromform->id = $status_id; $DB->update_record('learning_user_trainingplan', $fromform); } } else if ($viewpage == 7) { $form = new search(); } // Set viewpage with form. $toform['viewpage'] = $viewpage; $form->set_data($toform); // Display Form. $form->display(); // Form Cancel. if ($fromform = $form->is_cancelled()) { redirect("{$CFG->wwwroot}" . "/blocks/learning_plan/view.php?viewpage=" . $viewpage); Loading