Commit 57e337f2 authored by Engr_hammad_patel's avatar Engr_hammad_patel
Browse files

updated version on 3.3

parent eec07799
Loading
Loading
Loading
Loading
+15 −17
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
@@ -14,34 +13,33 @@
//
// 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 organization,
 * where such activities are organized for a more structured learning program.
 * @package blocks
 * @author: Azmat Ullah, Talha Noor
 * @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
 * @package    block_learning_plan
 * @copyright  3i Logic<lms@3ilogic.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @author     Azmat Ullah <azmat@3ilogic.com>
 */

require_once('../../config.php');
require_once('learning_plan_form.php');
require_once("lib.php");
global $DB;
$attributes = array();
$lp_id = required_param('id', PARAM_INT); // $_GET['id'];
$u_id = optional_param('u_id', null, PARAM_INT); // $_GET['u_id'];
$t = optional_param('t', null, PARAM_INT); // $_GET['t'];
$t_id = optional_param('t_id', null, PARAM_INT); // $_GET['t_id'];
$status = optional_param('status', null, PARAM_INT);  // $_GET['status'];
$hidetraining = optional_param('hidetraining', null, PARAM_INT); // $_GET['hidetraining'];
$hideusers = optional_param('hideusers', null, PARAM_INT); //$_GET['hideusers'];
$lp_id = required_param('id', PARAM_INT);
$u_id = optional_param('u_id', null, PARAM_INT);
$t = optional_param('t', null, PARAM_INT);
$t_id = optional_param('t_id', null, PARAM_INT);
$status = optional_param('status', null, PARAM_INT);
$hidetraining = optional_param('hidetraining', null, PARAM_INT);
$hideusers = optional_param('hideusers', null, PARAM_INT);
$t_type_id = optional_param('t_type_id', null, PARAM_INT);
$g_id = optional_param('g_id', null, PARAM_INT);
if (!isloggedin()) {
    redirect($CFG->wwwroot);
}
require_login(NULL, false);
require_login(null, false);
$PAGE->set_context(context_system::instance());
$PAGE->set_url('/blocks/learning_plan/ajax_bridge.php');

@@ -62,7 +60,7 @@ if ($lp_id && $t_id) {
                                                 where lp_id= ?', array($lp_id), $limitfrom = 0, $limitnum = 0);
    }

    // Change users on the base of Learning plan
    // Change users on the base of Learning plan.
    else if ($lp_id && $hidetraining) {
        $attributes1 = $DB->get_records_sql_menu('SELECT id, training_name as name from {learning_training} where type_id=?', array($t_type_id), $limitfrom = 0, $limitnum = 0);
        $attributes2 = $DB->get_records_sql_menu('SELECT  t_id as id, (SELECT training_name from {learning_training} where id =t_id) as name from {learning_plan_training}
+18 −13
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
@@ -14,30 +13,35 @@
//
// 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 organization,
 * where such activities are organized for a more structured learning program.
 * @package blocks
 * @author: Azmat Ullah, Talha Noor
 * @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
 * @package    block_learning_plan
 * @copyright  3i Logic<lms@3ilogic.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @author     Azmat Ullah <azmat@3ilogic.com>
 */
defined('MOODLE_INTERNAL') || die();

require_once(realpath(dirname(__FILE__) . '/lib.php'));

/**
 * Class to display content on block to access a page.
 *
 * @copyright 3i Logic<lms@3ilogic.com>
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class block_learning_plan extends block_base {

    public function init() {
        global $CFG, $USER, $COURSE;

        $this->title = get_string('learning_plan', 'block_learning_plan');
    }

    public function get_content() {
        if ($this->content !== null) {
            return $this->content;


        }
        global $CFG, $USER, $COURSE, $PAGE, $DB;
        if (has_capability('block/learning_plan:managepages', $this->context)) {
@@ -47,17 +51,18 @@ class block_learning_plan extends block_base {
        }
        $this->content = new stdClass;
        $this->content->text = '';

        if (has_capability('block/learning_plan:managepages', $this->context)) {
            $pageurl = new moodle_url('/blocks/learning_plan/view.php?viewpage');
            if (!strpos($pageurl, '=')) {
                $pageurl .= '=';
            }

            $this->content->text .= html_writer::link($pageurl . '1', get_string('learningpath', 'block_learning_plan')) . '<br>';
            $this->content->text .= html_writer::link($pageurl . '2', get_string('add_training', 'block_learning_plan')) . '<br>';
            $this->content->text .= html_writer::link($pageurl . '4', get_string('assign_training_learningplan', 'block_learning_plan')) . '<br>';
            $this->content->text .= html_writer::link($pageurl . '5', get_string('assign_learningplan_user', 'block_learning_plan')) . '<br>';
            $this->content->text .= html_writer::link($pageurl . '6', get_string('trainingstatus', 'block_learning_plan')) . '<br>';
            $this->content->text .= html_writer::link($pageurl . '8', get_string('send_notification', 'block_learning_plan')) . '<br>';
            $this->content->text .= html_writer::link($pageurl . '7', get_string('search', 'block_learning_plan'));
        } else if (has_capability('block/learning_plan:viewpages', $this->context)) {
            $pageurl = new moodle_url('/blocks/learning_plan/student/view.php?id');
+59 −2
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
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();
/**
 * This plugin serves as a database and plan for all learning activities in the organization,
 * where such activities are organized for a more structured learning program.
 * @package    block_learning_plan
 * @copyright  3i Logic<lms@3ilogic.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @author     Azmat Ullah <azmat@3ilogic.com>
 */

$capabilities = array(
    'block/learning_plan:viewmessages' => array(
        'captype' => 'read',
        'contextlevel' => CONTEXT_COURSE,
        'legacy' => array(
            'guest' => CAP_PREVENT,
            'student' => CAP_ALLOW,
            'teacher' => CAP_ALLOW,
            'editingteacher' => CAP_ALLOW,
            'coursecreator' => CAP_ALLOW,
            'manager' => CAP_ALLOW
        )
    ),
    'block/learning_plan:sendmessages' => array(
        'captype' => 'read',
        'contextlevel' => CONTEXT_COURSE,
        'legacy' => array(
            'guest' => CAP_PREVENT,
            'student' => CAP_PREVENT,
            'teacher' => CAP_ALLOW,
            'editingteacher' => CAP_ALLOW,
            'coursecreator' => CAP_ALLOW,
            'manager' => CAP_ALLOW
        )
    ),
    'block/learning_plan:viewpages' => array(
        'captype' => 'read',
        'contextlevel' => CONTEXT_BLOCK,
@@ -15,6 +60,17 @@ $capabilities = array(
            'coursecreator' => CAP_ALLOW,
            'manager' => CAP_ALLOW
        )
    ), 'block/learning_plan:myaddinstance' => array(
        'riskbitmask' => RISK_PERSONAL,
        'captype' => 'read',
        'contextlevel' => CONTEXT_BLOCK,
        'archetypes' => array(
            'user' => CAP_ALLOW,
            'editingteacher' => CAP_ALLOW,
            'manager' => CAP_ALLOW,
            'student' => CAP_ALLOW,
        ),
        'clonepermissionsfrom' => 'moodle/my:manageblocks'
    ),
    'block/learning_plan:addinstance' => array(
        'riskbitmask' => RISK_SPAM | RISK_XSS,
@@ -37,5 +93,6 @@ $capabilities = array(
            'coursecreator' => CAP_ALLOW,
            'manager' => CAP_ALLOW
        )
    )
    ),

);

db/messages.php

0 → 100644
+34 −0
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
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * This plugin serves as a database and plan for all learning activities in the organization,
 * where such activities are organized for a more structured learning program.
 * @package    block_learning_plan
 * @copyright  3i Logic<lms@3ilogic.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @author     Azmat Ullah <azmat@3ilogic.com>
 */


$messageproviders = array(
    'send' => array(
        'capability' => 'block/learning_plan:sendmessages'
    ),
    'view' => array(
        'capability' => 'block/learning_plan:viewmessages'
    )
);
 No newline at end of file
+20 −11
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
@@ -14,16 +13,26 @@
//
// 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,

/**
 * This plugin serves as a database and plan for all learning activities in the organization,
 * where such activities are organized for a more structured learning program.
 * @package blocks
 * @author: Azmat Ullah, Talha Noor
 * @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
 * @package    block_learning_plan
 * @copyright  3i Logic<lms@3ilogic.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @author     Azmat Ullah <azmat@3ilogic.com>
 */
// Ref: http://docs.moodle.org/dev/Upgrade_API.

defined('MOODLE_INTERNAL') || die();


/**
 * Checking previous versions allow us to upgrade only the settings that need to be changed
 * and avoid changes that might have since been customized by the site administrator.
 * @param float old version information
 * @return boolean.
 */
// Ref: http://docs.moodle.org/dev/Upgrade_API
function xmldb_block_learning_plan_upgrade($oldversion) {
    global $DB;
    $plugin = new stdClass();
Loading