Commit 5197c2d5 authored by 3i Logic LMS's avatar 3i Logic LMS
Browse files

Files uploaded

parents
Loading
Loading
Loading
Loading
+80
Changes for ajax_bridge.php: 80 added lines, 0 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
// 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/>.

/* 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.
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */


require_once('../../config.php');
require_once('learning_plan_form.php');
require_once("lib.php");
global $DB;
$attributes = array();
$lp_id = $_GET['id'];
$u_id = $_GET['u_id'];
$t = $_GET['t'];
$t_id = $_GET['t_id'];
$status = $_GET['status'];
$hidetraining = $_GET['hidetraining'];
$hideusers = $_GET['hideusers'];
if($lp_id && $t_id) {
    $form = new search();
    $table = $form->display_list($lp_id, $t_id, $status);
    $a =   html_writer::table($table);
    echo $a;
} else {
    // Change training on the base of learning plan and user.
    if($lp_id && $u_id) {
        $attributes =  $DB->get_records_sql_menu('select lpt.t_id as id, (select training_name from  {learning_training} where id =lpt.t_id) as name from {learning_plan_training}
                                                 lpt inner join {learning_user_trainingplan} lut on lut.lpt_id=lpt.id  where lpt.lp_id=? AND lut.u_id=?',
                                                 array ($lp_id, $u_id), $limitfrom=0, $limitnum=0);
    }
    // Find traiing on the base of lp Id.
    else if($lp_id && $t) {
        $attributes =  $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}
                                                 where lp_id= ?', array ($lp_id), $limitfrom=0, $limitnum=0);
    }

    // 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}  ', null, $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}
                                                  where lp_id=?', array($lp_id), $limitfrom=0, $limitnum=0);
        $attributes = array_diff($attributes1, $attributes2);
    }
    else if( $lp_id && $hideusers) {
        $attributes3 =  $DB->get_records_sql_menu('SELECT id, CONCAT(firstname," ", lastname) as name FROM {user} where firstname != "Guest User"', null, $limitfrom=0, $limitnum=0);
        $attributes4 =  $DB->get_records_sql_menu('SELECT u_id as id, (SELECT concat(firstname," ", lastname) FROM {user} WHERE id = u_id) as name FROM {learning_user_learningplan}
                                                   where lp_id = ?', array($lp_id), $limitfrom=0, $limitnum=0);
        $attributes = array_diff($attributes3, $attributes4);
    }
    else if($lp_id) {
        $attributes =  $DB->get_records_sql_menu('SELECT u.u_id as id, (SELECT  CONCAT(firstname," ", lastname)FROM {user} where username!="guest" AND id = u. u_id) as name FROM
                                                 {learning_user_learningplan} as u where lp_id= ?', array ($lp_id), $limitfrom=0, $limitnum=0);
    }
    $data = "";
    foreach ($attributes as $key => $attrib) {
        $data .= $key.'~'.$attrib .'^';
    }
    return print_r($data);
}
 No newline at end of file
+78
Changes for block_learning_plan.php: 78 added lines, 0 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
// 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/>.

/* 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.
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

require_once('lib.php');
class block_learning_plan extends block_base {
    public function init() {
        global $CFG, $USER, $COURSE;
        $context = context_course::instance($COURSE->id);
        if (has_capability('block/learning_plan:managepages', $context)) {
            $this->title = get_string('learning_plan', 'block_learning_plan');
        } else if (has_capability('block/learning_plan:viewpages', $context)) {
            $this->title = get_string('myview', 'block_learning_plan');
        } else {
            $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;
        $this->content =  new stdClass;
        $context = context_course::instance($COURSE->id);
        if (has_capability('block/learning_plan:managepages', $context)) {
            $pageurl = new moodle_url('/blocks/learning_plan/view.php?viewpage=');
            $this->content->text .= html_writer::start_tag('li');
            $this->content->text .= html_writer::link($pageurl.'1', get_string('learningpath', 'block_learning_plan'));
            $this->content->text .= html_writer::end_tag('li');
            $this->content->text .= html_writer::start_tag('li');
            $this->content->text .= html_writer::link($pageurl.'2', get_string('add_training', 'block_learning_plan'));
            $this->content->text .= html_writer::end_tag('li');
            $this->content->text .= html_writer::start_tag('li');
            $this->content->text .= html_writer::link($pageurl.'4', get_string('assign_training_learningplan', 'block_learning_plan'));
            $this->content->text .= html_writer::end_tag('li');
            $this->content->text .= html_writer::start_tag('li');
            $this->content->text .= html_writer::link($pageurl.'5', get_string('assign_learningplan_user', 'block_learning_plan'));
            $this->content->text .= html_writer::end_tag('li');
            $this->content->text .= html_writer::start_tag('li');
            $this->content->text .= html_writer::link($pageurl.'6', get_string('trainingstatus', 'block_learning_plan'));
            $this->content->text .= html_writer::end_tag('li');
            $this->content->text .= html_writer::start_tag('li');
            $this->content->text .= html_writer::link($pageurl.'7', get_string('search', 'block_learning_plan'));
            $this->content->text .= html_writer::end_tag('li');
        } else  {
            $pageurl = new moodle_url('/blocks/learning_plan/student/view.php?id=');
            $learning_plan=user_learningplan($USER->id);
            foreach($learning_plan as $lp) {
                $this->content->text .= html_writer::start_tag('li');
                $this->content->text .= html_writer::link($pageurl.$lp->id, $lp->learningplan);
                $this->content->text .= html_writer::end_tag('li');
            }
        }
    return $this->content;
    }
}
 No newline at end of file
+44
Changes for db/access.php: 44 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php
defined('MOODLE_INTERNAL') || die();

$capabilities = array(

    'block/learning_plan:viewpages' => 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:addinstance' => array(
        'riskbitmask' => RISK_SPAM | RISK_XSS,
 
        'captype' => 'write',
        'contextlevel' => CONTEXT_BLOCK,
        'archetypes' => array(
            'editingteacher' => CAP_ALLOW,
            'manager' => CAP_ALLOW,
            ),
 
        'clonepermissionsfrom' => 'moodle/site:manageblocks'
    ),
    'block/learning_plan:managepages' => array(

        'captype' => 'read',
        'contextlevel' => CONTEXT_COURSE,
        'legacy' => array(
            'guest' => CAP_PREVENT,
            'student' => CAP_PREVENT,
            'teacher' => CAP_PREVENT,
            'editingteacher' => CAP_ALLOW,
            'coursecreator' => CAP_ALLOW,
            'manager' => CAP_ALLOW
        )
    )
);
 No newline at end of file
+87
Changes for db/install.xml: 87 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="blocks/learning_plan/db" VERSION="20130712" COMMENT="XMLDB file for Moodle blocks/learning_plan"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
  <TABLES>
    <TABLE NAME="block_learning_plan" COMMENT="Default comment for block_learning_plan, please edit me" NEXT="learning_learningplan">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
    </TABLE>
    <TABLE NAME="learning_learningplan" COMMENT="Learning Plan" PREVIOUS="block_learning_plan" NEXT="learning_training">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="learning_plan"/>
        <FIELD NAME="learning_plan" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="description"/>
        <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" PREVIOUS="learning_plan"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
    </TABLE>
    <TABLE NAME="learning_training" COMMENT="Default comment for the table, please edit me" PREVIOUS="learning_learningplan" NEXT="learning_plan_training">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="training_name"/>
        <FIELD NAME="training_name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="type_id"/>
        <FIELD NAME="type_id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="training_name" NEXT="file"/>
        <FIELD NAME="file" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" PREVIOUS="type_id" NEXT="url"/>
        <FIELD NAME="url" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" PREVIOUS="file" NEXT="start_date"/>
        <FIELD NAME="start_date" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" PREVIOUS="url" NEXT="end_date"/>
        <FIELD NAME="end_date" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" PREVIOUS="start_date"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
    </TABLE>
    <TABLE NAME="learning_plan_training" COMMENT="Default comment for the table, please edit me" PREVIOUS="learning_training" NEXT="learning_traningtype">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="lp_id"/>
        <FIELD NAME="lp_id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="t_id"/>
        <FIELD NAME="t_id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="lp_id"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="lp_id"/>
        <KEY NAME="lp_id" TYPE="foreign" FIELDS="lp_id" REFTABLE="learning_learningplan" REFFIELDS="id" PREVIOUS="primary" NEXT="t_id"/>
        <KEY NAME="t_id" TYPE="foreign" FIELDS="t_id" REFTABLE="learning_training" REFFIELDS="id" PREVIOUS="lp_id"/>
      </KEYS>
    </TABLE>
    <TABLE NAME="learning_traningtype" COMMENT="Default comment for the table, please edit me" PREVIOUS="learning_plan_training" NEXT="learning_user_learningplan">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="training_type"/>
        <FIELD NAME="training_type" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="description"/>
        <FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" PREVIOUS="training_type"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
      </KEYS>
    </TABLE>
    <TABLE NAME="learning_user_learningplan" COMMENT="Default comment for the table, please edit me" PREVIOUS="learning_traningtype" NEXT="learning_user_trainingplan">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="u_id"/>
        <FIELD NAME="u_id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="lp_id"/>
        <FIELD NAME="lp_id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="u_id" NEXT="assignee_id"/>
        <FIELD NAME="assignee_id" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" PREVIOUS="lp_id"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="lp_id"/>
        <KEY NAME="lp_id" TYPE="foreign" FIELDS="lp_id" REFTABLE="learning_learningplan" REFFIELDS="id" PREVIOUS="primary"/>
      </KEYS>
    </TABLE>
    <TABLE NAME="learning_user_trainingplan" COMMENT="Default comment for the table, please edit me" PREVIOUS="learning_user_learningplan">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="lpt_id"/>
        <FIELD NAME="lpt_id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="u_id"/>
        <FIELD NAME="u_id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="lpt_id" NEXT="status"/>
        <FIELD NAME="status" TYPE="char" LENGTH="25" NOTNULL="false" DEFAULT="Not Yet Started" SEQUENCE="false" PREVIOUS="u_id" NEXT="remarks"/>
        <FIELD NAME="remarks" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" PREVIOUS="status"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="lpt_id"/>
        <KEY NAME="lpt_id" TYPE="foreign" FIELDS="lpt_id" REFTABLE="learning_plan_training" REFFIELDS="id" PREVIOUS="primary"/>
      </KEYS>
    </TABLE>
  </TABLES>
</XMLDB>
 No newline at end of file
+86
Changes for lang/en/block_learning_plan.php: 86 added lines, 0 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
// 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/>.

/* 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.
* @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$string['pluginname'] = 'Learning plan';
$string['learning_plan'] = 'Learning plan';
$string['learning_plan_name'] = 'Name';
$string['learningpath'] = 'Add learning plan';
$string['desc'] = 'Description';
$string['end_date'] = 'End date';
$string['attachment'] = 'Upload file';
$string['start_date'] = 'Start date';
$string['end_date'] = 'End date';
$string['onthejob'] = 'On the job';
$string['classroom'] = 'Class room';
$string['elearning'] = 'eLearning';
$string['url'] = 'URL';
$string['add_training'] = 'Add training';
$string['add_training_method'] = 'Add training method';
$string['training_method'] = 'Training method';
$string['assign_training_learningplan'] = 'Assign training into learning plan';
$string['training_name'] = 'Training name';
$string['learningplan'] = 'Learning plan';
$string['training'] = 'Training';
$string['add_learningplan'] = 'Add learning plan';
$string['trainingstatus'] = 'Set training status';
$string['users'] = 'Users';
$string['remarks'] = 'Remarks';
$string['status'] = 'Status';
$string['assign_learningplan_user'] = 'Assign learning plan to users';
$string['addusers'] = 'Add users';
$string['searchusers'] = 'Search users';
$string['showuser'] = 'Show users';
$string['block/learning_plan:viewpages'] = 'Learning plan view pages';
$string['block/learning_plan:managepages'] = 'Learning plan manage pages';
$string['myview'] = 'My training';
$string['search'] = 'Search';
$string['status_report'] = 'Status report';
$string['report_at'] = 'Report as at';
$string['plan_format'] = 'Please add learning plan in correct format.';
$string['plan_exist'] = 'Learning Plan already exist';
$string['training_format'] = 'Please add  training in correct format';
$string['training_exist'] = 'Training already exist.';
$string['date_val'] = 'Start date should be greater than end date.';
$string['s_no'] = 'Serial no.';
$string['wrong_url'] = 'Wrong URL';
$string['elearning'] = 'eLearning';
$string['classroom'] = 'Class room';
$string['onthejob'] = 'On the job';
$string['training_m'] = 'Training method';
$string['assignee'] = 'Assignee';
$string['remove'] = 'Remove';
$string['setting'] = 'Setting';
$string['plan_delete'] = 'Do you want to delete learning plan?';
$string['training_delete'] = 'Do You Want to Delete training?';
$string['record_delete'] = 'Do you want to delete record?';
$string['learning_plan:addinstance'] = 'Add instance';
$string['learning_plan:managepages'] = 'Manage pages';
$string['learning_plan:viewpages'] = 'View pages';
$string['user'] = 'User';



Loading