<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require_once '../../config.php';
require_once $CFG->libdir . '/adminlib.php';
require_once $CFG->dirroot . '/blocks/iomad_company_admin/lib.php';
global $DB, $CFG, $PAGE, $OUTPUT, $SESSION;
$companyid = optional_param('companyid', 0, PARAM_INT);
$context = context_system::instance();
iomad::require_capability('block/iomad_company_admin:manageallcompany', $context);
$PAGE->set_context($context);
$PAGE->set_pagetype('my-index');
$PAGE->set_pagelayout('admin');
$PAGE->set_url(new moodle_url('/local/company_navigation/manage_company.php'));
require_login();
$linktext = get_string('managecompanies', 'block_iomad_company_admin');
// Set the url.
$linkurl = new moodle_url('/blocks/iomad_company_admin/editcompanies.php');
company_admin_fix_breadcrumb($PAGE, $linktext, $linkurl);
echo $OUTPUT->header();
$companyids = $DB->get_records_menu('company', array(), 'id, name');
//$companyids['none'] = get_string('nocompany', 'block_iomad_company_admin');
$companyids[''] = get_string('selectacompany', 'block_iomad_company_admin');
ksort($companyids);
$companyselect = new single_select(new moodle_url('/local/company_navigation/manage_company.php'), 'companyid', $companyids, $companyid);
$companyselect->label = get_string('company', 'block_iomad_company_admin');
$companyselect->formid = 'choosecompany';
示例#2
0
// (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/>.
require_once '../../config.php';
require_once $CFG->dirroot . '/blocks/iomad_company_admin/lib.php';
require_once 'lib.php';
// Check permissions.
require_login($SITE);
$context = context_system::instance();
iomad::require_capability('local/report_companies:view', $context);
// Url stuff.
$url = new moodle_url('/local/report_companies/index.php');
// Page stuff:.
$strcompletion = get_string('pluginname', 'local_report_companies');
$PAGE->set_url($url);
$PAGE->set_pagelayout('report');
$PAGE->set_title($strcompletion);
$PAGE->requires->css("/local/report_companies/styles.css");
// Set the url.
company_admin_fix_breadcrumb($PAGE, get_string('pluginname', 'local_report_companies'), $url);
// Navigation and header.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('pluginname', 'local_report_companies'));
// Ajax odds and sods.
$PAGE->requires->js_init_call('M.local_report_companies.init');
示例#3
0
// 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/>.
require_once '../../config.php';
require_once $CFG->libdir . '/completionlib.php';
require_once 'select_form.php';
require_once $CFG->dirroot . '/blocks/iomad_company_admin/lib.php';
// Deal with params.
$courseid = optional_param('courseid', 0, PARAM_INT);
$departmentid = optional_param('departmentid', 0, PARAM_INT);
$dodownload = optional_param('dodownload', 0, PARAM_INT);
// Check permissions.
require_login($SITE);
$context = context_system::instance();
iomad::require_capability('local/report_scorm_overview:view', $context);
// Url stuff.
$url = new moodle_url('/local/report_scorm_overview/index.php', array('departmentid' => $departmentid, 'courseid' => $courseid));
$dashboardurl = new moodle_url('/local/iomad_dashboard/index.php');
// Page stuff:.
$strcompletion = get_string('pluginname', 'local_report_scorm_overview');
$PAGE->set_url($url);
$PAGE->set_pagelayout('report');
$PAGE->set_title($strcompletion);
$PAGE->set_heading($SITE->fullname);
$PAGE->requires->css("/local/report_scorm_overvew/styles.css");
// Set the companyid
$companyid = iomad::get_my_companyid($context);
// Get the associated department id.
$company = new company($companyid);
$parentlevel = company::get_company_parentnode($company->id);
    $course = $DB->get_record('course', array('id' => $shopsettings->courseid), 'id, fullname, shortname', MUST_EXIST);
    $course->fullname = $course->fullname . " ({$course->shortname}))";
    if (!$_POST || !array_key_exists('block_start_1', $_POST)) {
        $priceblocks = $DB->get_records('course_shopblockprice', array('courseid' => $shopsettings->courseid), 'price_bracket_start');
    }
    $shopsettings->tags = get_course_tags($course->id);
    $shopsettings->short_summary_editor = array('text' => $shopsettings->short_description);
    $shopsettings->summary_editor = array('text' => $shopsettings->long_description);
    iomad::require_capability('block/iomad_commerce:edit_course', $context);
} else {
    $isadding = true;
    $shopsettingsid = 0;
    $shopsettings = new stdClass();
    $course = null;
    $priceblocks = null;
    iomad::require_capability('block/iomad_commerce:add_course', $context);
}
if (array_key_exists('blockPrices', $_POST)) {
    $priceblocks = array();
    $nblocks = intval($_POST['blockPrices']);
    for ($i = 0; $i < $nblocks; $i++) {
        $k = $i + 1;
        $price_bracket_start_key = "block_start_{$k}";
        if (array_key_exists($price_bracket_start_key, $_POST)) {
            $price_key = "block_price_{$k}";
            $validlength_key = "block_valid_{$k}";
            $shelflife_key = "block_shelflife_{$k}";
            $priceblocks[] = (object) array('price_bracket_start' => $_POST[$price_bracket_start_key], 'price' => $_POST[$price_key], 'validlength' => $_POST[$validlength_key], 'shelflife' => $_POST[$shelflife_key]);
        }
    }
}
                redirect($returnurl);
            } else {
                $transaction->rollback();
                echo $OUTPUT->header();
                echo $OUTPUT->notification($returnurl, get_string('deletednot', '', $classroom->name));
                die;
            }
            $transaction->rollback();
        }
    }
}
$blockpage->display_header();
$company = new company($companyid);
echo get_string('classrooms_for', $block, $company->get_name());
// Check we can actually do anything on this page.
iomad::require_capability('block/iomad_company_admin:classrooms', $context);
// Get the number of templates.
$objectcount = $DB->count_records('classroom', array('companyid' => $companyid));
echo $OUTPUT->paging_bar($objectcount, $page, $perpage, $baseurl);
flush();
if ($classrooms = $DB->get_recordset('classroom', array('companyid' => $companyid), 'name', '*', $page, $perpage)) {
    $stredit = get_string('edit');
    $strdelete = get_string('delete');
    $table = new html_table();
    $table->head = array("Name", "Capacity", "", "");
    $table->align = array("left", "left", "center", "center");
    $table->width = "95%";
    foreach ($classrooms as $classroom) {
        if (iomad::has_capability('block/iomad_company_admin:classrooms_delete', $context)) {
            $deletebutton = "<a href=\"classroom_list.php?delete={$classroom->id}&amp;sesskey=" . sesskey() . "\">{$strdelete}</a>";
        } else {
// Set the companyid to bypass the company select form if possible.
if (!empty($SESSION->currenteditingcompany)) {
    $companyid = $SESSION->currenteditingcompany;
} else {
    if (!empty($USER->company)) {
        $companyid = company_user::companyid();
    } else {
        if (!iomad::has_capability('local/email:edit', context_system::instance())) {
            print_error('There has been a configuration error, please contact the site administrator');
        } else {
            $blockpage->display_header();
            redirect(new moodle_url('/local/iomad_dashboard/index.php'), 'Please select a company from the dropdown first');
        }
    }
}
iomad::require_capability('local/email:send', $context);
if ($templateid) {
    $templaterecord = $DB->get_record('email_template', array('id' => $templateid), '*', MUST_EXIST);
} else {
    if ($templatename) {
        if (!($templaterecord = $DB->get_record('email_template', array('companyid' => $companyid, 'name' => $templatename), '*'))) {
            $templaterecord = (object) $email[$templatename];
            $templaterecord->name = $templatename;
        }
    }
}
// Correct the navbar.
// Set the name for the page.
$linktext = get_string('send_emails', 'local_email');
// Set the url.
$linkurl = new moodle_url('/local/email/template_edit_form.php');
// 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/>.
/*
* script for downloading of user lists
*/
require_once '../../config.php';
require_once $CFG->libdir . '/adminlib.php';
require_once 'lib.php';
$format = optional_param('format', '', PARAM_ALPHA);
$companyid = optional_param('companyid', 0, PARAM_INTEGER);
$context = context_system::instance();
require_login();
iomad::require_capability('block/iomad_company_admin:user_upload', $context);
// Correct the navbar.
// Set the name for the page.
$linktext = get_string('users_download', 'block_iomad_company_admin');
// Set the url.
$linkurl = new moodle_url('/blocks/iomad_company_admin/user_bulk_download.php');
// Build the nav bar.
company_admin_fix_breadcrumb($PAGE, $linktext, $linkurl);
$blockpage = new blockpage($PAGE, $OUTPUT, 'iomad_company_admin', 'block', 'user_bulk_download_title');
$blockpage->setup();
// Set the companyid
$companyid = iomad::get_my_companyid($context);
$return = $CFG->wwwroot . '/' . $CFG->admin . '/user/user_bulk.php';
// If company user override the companyid parameter - they can only download their own.
if (company_user::is_company_user()) {
    $companyid = company_user::companyid();
}
if ($courseid) {
    $urlparams['courseid'] = $courseid;
}
// Correct the navbar.
// Set the name for the page.
$linktext = get_string('enroluser', 'block_iomad_company_admin');
// Set the url.
$linkurl = new moodle_url('/blocks/iomad_company_admin/company_course_users_form.php');
// Build the nav bar.
company_admin_fix_breadcrumb($PAGE, $linktext, $linkurl);
$blockpage = new blockpage($PAGE, $OUTPUT, 'iomad_company_admin', 'block', 'company_course_users_title');
$blockpage->setup();
require_login(null, false);
// Adds to $PAGE, creates $OUTPUT.
iomad::require_capability('block/iomad_company_admin:company_course_users', $context);
// Set the companyid
$companyid = iomad::get_my_companyid($context);
$coursesform = new company_ccu_courses_form($PAGE->url, $context, $companyid, $departmentid, $selectedcourse);
$usersform = new company_course_users_form($PAGE->url, $context, $companyid, $departmentid);
$blockpage->display_header();
// GWL : Check the department is valid.
if (!empty($departmentid) && !company::check_valid_department($companyid, $departmentid)) {
    print_error('invaliddepartment', 'block_iomad_company_admin');
}
$ccuparamarray = array();
if (!empty($departmentid)) {
    $ccuparamaray['departmentid'] = $departmentid;
}
if (!empty($courseid)) {
    $ccuparamarray['currentcourses'] = $courseid;
示例#9
0
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
require_once '../../config.php';
require_once $CFG->libdir . '/completionlib.php';
require_once $CFG->libdir . '/excellib.class.php';
require_once 'select_form.php';
require_once $CFG->dirroot . '/blocks/iomad_company_admin/lib.php';
require_once 'lib.php';
// Deal with the params.
$courseid = optional_param('courseid', 0, PARAM_INT);
$participant = optional_param('participant', 0, PARAM_INT);
$dodownload = optional_param('dodownload', 0, PARAM_INT);
$departmentid = optional_param('departmentid', 0, PARAM_INT);
// Check permissions.
require_login($SITE);
$context = context_system::instance();
iomad::require_capability('local/report_attendance:view', $context);
// Url stuff.
$url = new moodle_url('/local/report_attendance/index.php');
$dashboardurl = new moodle_url('/local/iomad_dashboard/index.php');
// Page stuff:.
$strcompletion = get_string('pluginname', 'local_report_attendance');
$PAGE->set_url($url);
$PAGE->set_pagelayout('report');
$PAGE->set_title($strcompletion);
$PAGE->set_heading($SITE->fullname);
$PAGE->requires->css("/local/report_attendance/styles.css");
// Set the companyid
$companyid = iomad::get_my_companyid($context);
// Get the associated department id.
$company = new company($companyid);
$parentlevel = company::get_company_parentnode($company->id);
 * Control company capabilities.
*/
require_once dirname(__FILE__) . '/../../config.php';
require_once dirname(__FILE__) . '/lib.php';
require_once dirname(__FILE__) . '/locallib.php';
// parameters
$roleid = optional_param('roleid', 0, PARAM_INT);
$ajaxcap = optional_param('ajaxcap', '', PARAM_CLEAN);
$ajaxvalue = optional_param('ajaxvalue', '', PARAM_CLEAN);
// Set the companyid
// (before output in case it redirects)
$context = context_system::instance();
$companyid = iomad::get_my_companyid($context);
// access stuff
require_login();
iomad::require_capability('block/iomad_company_admin:restrict_capabilities', $context);
// check if ajax callback
if ($ajaxcap) {
    error_log('Got it ' . $ajaxcap . ' ' . $ajaxvalue);
    $parts = explode('.', $ajaxcap);
    list($companyid, $roleid, $capability) = $parts;
    // if box is unticked (false) an entry is created (or kept)
    // if box is ticked (true) any entry is deleted
    $restriction = $DB->get_record('company_role_restriction', array('roleid' => $roleid, 'companyid' => $companyid, 'capability' => $capability));
    if ($ajaxvalue == 'false') {
        if (!$restriction) {
            $restriction = new stdClass();
            $restriction->companyid = $companyid;
            $restriction->roleid = $roleid;
            $restriction->capability = $capability;
            $DB->insert_record('company_role_restriction', $restriction);
示例#11
0
// 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/>.
// Display iomad_dashboard.
require_once '../../config.php';
require_once '../iomad/lib/blockpage.php';
// We always require users to be logged in for this page.
require_login();
// Get parameters.
$edit = optional_param('edit', null, PARAM_BOOL);
$company = optional_param('company', '', PARAM_TEXT);
// Check we are allowed to view this page.
$systemcontext = context_system::instance();
iomad::require_capability('local/iomad_dashboard:view', $systemcontext);
// Set the session to a user if they are editing a company other than their own.
if (!empty($company)) {
    $SESSION->currenteditingcompany = $company;
}
// Check if there are any companies.
if (!($companycount = $DB->count_records('company'))) {
    // If not redirect to create form.
    redirect(new moodle_url('/blocks/iomad_company_admin/company_edit_form.php', array('createnew' => 1)));
}
// Page setup stuff.
// The page layout for my moodle does the job here
// as it allows blocks in the centre column.
$PAGE->requires->js_init_call('M.local_iomad_dashboard.init');
$PAGE->blocks->add_region('content');
$blockpage = new blockpage($PAGE, $OUTPUT, 'iomad_dashboard', 'local', 'name');
        $datatype = optional_param('datatype', '', PARAM_ALPHA);
        profile_edit_field($id, $datatype, $redirect, $companyid);
        die;
        break;
    default:
        // Normal form.
}
$urlparams = array('companyid' => $companyid, 'action' => $action);
if (!empty($returnurl)) {
    $urlparams['returnurl'] = $returnurl;
}
require_login(null, false);
// Adds to $PAGE, creates $OUTPUT.
$context = $PAGE->context;
$blockpage->display_header();
iomad::require_capability('block/iomad_company_admin:company_user_profiles', $context);
//echo $OUTPUT->heading(get_string('companyprofilefields', 'block_iomad_company_admin')); // GWL : Remove Optional Field Heading
// Check that we have at least one category defined.
if ($DB->count_records('user_info_category') == 0) {
    $defaultcategory = new stdClass();
    $defaultcategory->name = $strdefaultcategory;
    $defaultcategory->sortorder = 1;
    $DB->insert_record('user_info_category', $defaultcategory);
    redirect($redirect);
}
// Check if we have a company ID, if so just pull that one back.
if (!empty($companyid)) {
    $company = $DB->get_record('company', array('id' => $companyid), '*', MUST_EXIST);
    // Get the company category.
    $categories = array();
    $profileinfo = new stdclass();
}
if ($page) {
    $params['page'] = $page;
}
if ($perpage) {
    $params['perpage'] = $perpage;
}
if ($search) {
    $params['search'] = $search;
}
if ($courseid) {
    $params['courseid'] = $courseid;
}
$systemcontext = context_system::instance();
require_login();
iomad::require_capability('block/iomad_company_admin:managecourses', $systemcontext);
$PAGE->set_context($systemcontext);
$PAGE->requires->jquery();
$PAGE->requires->js('/blocks/iomad_company_admin/js/custom.js');
// Code by sumit
admin_externalpage_setup('managecoursenotificationsetting');
// End of code
// Set the url.
$linkurl = new moodle_url('/blocks/iomad_company_admin/iomad_courses_form.php');
$linktext = get_string('iomad_courses_title', 'block_iomad_company_admin');
// Build the nav bar.
// Code by sumit
//company_admin_fix_breadcrumb($PAGE, $linktext, $linkurl);
// End of code
// Print the page header.
$blockpage = new blockpage($PAGE, $OUTPUT, 'iomad_company_admin', 'block', 'iomad_company_courses_title');
                redirect($returnurl);
            } else {
                $transaction->rollback();
                echo $OUTPUT->header();
                echo $OUTPUT->notification($returnurl, get_string('deletednot', '', $template->name));
                die;
            }
            $transaction->rollback();
        }
    }
}
$blockpage->display_header();
$company = new company($companyid);
echo get_string('email_templates_for', $block, $company->get_name());
// Check we can actually do anything on this page.
iomad::require_capability('local/email:list', $context);
// Get the number of templates.
$objectcount = $DB->count_records('email_template');
echo $OUTPUT->paging_bar($objectcount, $page, $perpage, $baseurl);
flush();
// Sort the keys of the global $email object, the make sure we have that and the
// recordset we'll get next in the same order.
$configtemplates = array_keys($email);
sort($configtemplates);
$ntemplates = count($configtemplates);
// Returns true if user is allowed to send emails using a particular template.
function allow_sending_to_template($templatename)
{
    return in_array($templatename, array('advertise_classroom_based_course', ''));
}
function create_default_template_row($templatename, $strdefault, $stradd, $strsend)
        return $data;
    }
}
$returnurl = optional_param('returnurl', '', PARAM_LOCALURL);
$departmentid = optional_param('deptid', 0, PARAM_INT);
$parentdepartmentid = optional_param('departmentid', 0, PARAM_INT);
$deleteids = optional_param_array('locationids', null, PARAM_INT);
$createnew = optional_param('createnew', 0, PARAM_INT);
$context = context_system::instance();
require_login();
$PAGE->set_context($context);
$PAGE->requires->jquery();
$PAGE->requires->js('/blocks/iomad_company_admin/js/company_region_location_management.js');
$PAGE->requires->js_init_call('obj.company_region_location_init', array($CFG->wwwroot));
$PAGE->requires->strings_for_js(array('loadingerror', 'notallowedmultipleedit', 'notitemselected', 'suretodelete'), 'block_iomad_company_admin');
iomad::require_capability('block/iomad_company_admin:edit_departments', $context);
$urlparams = array();
if ($returnurl) {
    $urlparams['returnurl'] = $returnurl;
}
$companylist = new moodle_url('/local/iomad_dashboard/index.php', $urlparams);
$linktext = get_string('editlocation', 'block_iomad_company_admin');
// Set the url.
$linkurl = new moodle_url('/blocks/iomad_company_admin/company_location_create_form.php');
// Build the nav bar.
//company_admin_fix_breadcrumb($PAGE, $linktext, $linkurl);
require_once $CFG->libdir . '/adminlib.php';
/*GWL : Add condition to provide access for Site admin*/
if (!has_capability('block/iomad_company_admin:manageallcompany', context_system::instance())) {
    admin_externalpage_setup('managecompanylocationsetting');
}
}
// end of code
// Print the page header.
$blockpage = new blockpage($PAGE, $OUTPUT, 'iomad_company_admin', 'block', 'company_edit_advanced_title');
$blockpage->setup();
if ($id == -1) {
    // Creating new user.
    iomad::require_capability('block/iomad_company_admin:editusers', $systemcontext);
    $user = new object();
    $user->id = -1;
    $user->auth = 'manual';
    $user->confirmed = 1;
    $user->deleted = 0;
} else {
    // Editing existing user.
    iomad::require_capability('block/iomad_company_admin:editusers', $systemcontext);
    if (!($user = $DB->get_record('user', array('id' => $id)))) {
        print_error('invaliduserid');
    }
    //GWL changes
    if (!company::check_canedit_user($companyid, $id)) {
        print_error('invaliduserid');
    }
}
// Remote users cannot be edited.
if ($user->id != -1 and is_mnet_remote_user($user)) {
    redirect($CFG->wwwroot . "/user/view.php?id={$id}&course={$course->id}");
}
/* GWL : Hide Below */
/*
 if ($user->id != $USER->id and is_primary_admin($user->id)) {  // Can't edit primary admin.
示例#17
0
        return $err;
    }
}
$returnurl = optional_param('returnurl', '', PARAM_LOCALURL);
$departmentid = optional_param('deptid', 0, PARAM_INT);
$deleteids = optional_param_array('departmentids', null, PARAM_INT);
$createnew = optional_param('createnew', 0, PARAM_INT);
$context = context_system::instance();
require_login();
$PAGE->set_context($context);
$PAGE->set_url(new moodle_url('/local/manage_company_dept_title/manage_dept.php'));
$PAGE->requires->jquery();
$PAGE->requires->js('/blocks/iomad_company_admin/js/company_region_location_management.js');
//$PAGE->requires->js_init_call('obj.company_region_location_init', array($CFG->wwwroot));
$PAGE->requires->strings_for_js(array('loadingerror', 'notallowedmultipleedit', 'notitemselected', 'suretodelete'), 'block_iomad_company_admin');
iomad::require_capability('local/manage_company_dept_title:edit', $context);
$urlparams = array();
if ($returnurl) {
    $urlparams['returnurl'] = $returnurl;
}
$companylist = new moodle_url('/local/iomad_dashboard/index.php', $urlparams);
$linktext = get_string('editdepartment', 'block_iomad_company_admin');
// Set the url.
$linkurl = new moodle_url('/local/manage_company_dept_title/manage_dept.php');
// Build the nav bar.
//company_admin_fix_breadcrumb($PAGE, $linktext, $linkurl);
require_once $CFG->libdir . '/adminlib.php';
/* GWL : Add condition to provide access for Site admin */
if (!has_capability('block/iomad_company_admin:manageallcompany', context_system::instance())) {
    admin_externalpage_setup('managecompanydepartmentsetting');
}
        $optionsyes = array('delete' => $delete, 'confirm' => md5($delete), 'sesskey' => sesskey());
        echo $OUTPUT->confirm(get_string('companydeletelicensecheckfull', 'block_iomad_company_admin', "'{$name}'"), new moodle_url('company_license_list.php', $optionsyes), 'company_license_list.php');
        echo $OUTPUT->footer();
        die;
    } else {
        if (data_submitted()) {
            // Actually delete license.
            if (!$DB->delete_records('companylicense', array('id' => $delete))) {
                print_error('error while deleting license');
            }
        }
    }
}
$blockpage->display_header();
// Check we can actually do anything on this page.
iomad::require_capability('block/iomad_company_admin:view_licenses', $context);
$company = new company($companyid);
echo "<h3>" . $company->get_name() . "</h3>";
// Get the number of companies.
$objectcount = $DB->count_records('companylicense', array('companyid' => $companyid));
echo $OUTPUT->paging_bar($objectcount, $page, $perpage, $baseurl);
flush();
$stredit = get_string('edit');
$strdelete = get_string('delete');
$straddlicense = get_string('licenseaddnew', 'block_iomad_company_admin');
$strlicensename = get_string('licensename', 'block_iomad_company_admin');
$strcoursesname = get_string('allocatedcourses', 'block_iomad_company_admin');
$strlicenseshelflife = get_string('licenseexpires', 'block_iomad_company_admin');
$strlicenseduration = get_string('licenseduration', 'block_iomad_company_admin');
$strlicenseallocated = get_string('licenseallocated', 'block_iomad_company_admin');
$strlicenseremaining = get_string('licenseremaining', 'block_iomad_company_admin');
            if (!empty($foundcourses)) {
                foreach ($foundcourses as $foundcourse) {
                    $foundcoursenames[] = $foundcourse->fullname;
                }
                $foundcoursenamestring = implode(',', $foundcoursenames);
                $errors['shortname'] = get_string('shortnametaken', '', $foundcoursenamestring);
            }
        }
        return $errors;
    }
}
$returnurl = optional_param('returnurl', '', PARAM_LOCALURL);
$companyid = optional_param('companyid', 0, PARAM_INTEGER);
$context = context_system::instance();
require_login();
iomad::require_capability('block/iomad_company_admin:createcourse', $context);
$PAGE->set_context($context);
// Correct the navbar.
// Set the name for the page.
$linktext = get_string('createcourse', 'block_iomad_company_admin');
// Set the url.
$linkurl = new moodle_url('/blocks/iomad_company_admin/company_course_create_form.php');
// Build the nav bar.
company_admin_fix_breadcrumb($PAGE, $linktext, $linkurl);
$blockpage = new blockpage($PAGE, $OUTPUT, 'iomad_company_admin', 'block', 'createcourse_title');
$blockpage->setup();
// Set the companyid
if (!iomad::has_capability('block/iomad_company_admin:manageallcompanycourses', $context)) {
    $companyid = iomad::get_my_companyid($context);
}
$urlparams = array('companyid' => $companyid);
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Process ajax requests
 *
 * @copyright Andreas Grabs
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
 * @package mod_feedback
 */
/*if (!defined('AJAX_SCRIPT')) {
    define('AJAX_SCRIPT', true);
}*/
require_once dirname(__FILE__) . '/../../../config.php';
require_once '../lib.php';
$licenseid = required_param('licenseid', PARAM_INT);
$context = context_system::instance();
require_login();
iomad::require_capability('block/iomad_company_admin:user_create', $context);
$return = '';
if ($license = $DB->get_record('companylicense', array('id' => $licenseid))) {
    if ($courses = $DB->get_records_sql_menu("SELECT c.id, c.fullname FROM {companylicense_courses} clc\n                                                         JOIN {course} c ON (clc.courseid = c.id\n                                                         AND clc.licenseid = :licenseid)", array('licenseid' => $licenseid))) {
        $return = '<select id="licensecourseselector" name="licensecourses[]" multiple="multiple">';
        $return .= '<optgroup label="' . $license->name . ' (' . $license->used . '/' . $license->allocation . ')">';
        foreach ($courses as $id => $course) {
            $return .= '<option value="' . $id . '">' . $course . '</option>';
        }
        $return .= '</optgroup></select>';
    }
}
echo $return;
die;
$blockpage->setup();
if (!$new) {
    // Set the companyid
    //GWL
    if (!has_capability('block/iomad_company_admin:manageallcompany', $context)) {
        $companyid = iomad::get_my_companyid($context);
    }
    // end of code
    $isadding = false;
    $companyrecord = $DB->get_record('company', array('id' => $companyid), '*', MUST_EXIST);
    iomad::require_capability('block/iomad_company_admin:company_edit', $context);
} else {
    $isadding = true;
    $companyid = 0;
    $companyrecord = new stdClass();
    iomad::require_capability('block/iomad_company_admin:company_add', $context);
}
$urlparams = array('companyid' => $companyid);
if ($returnurl) {
    $urlparams['returnurl'] = $returnurl;
}
$companylist = new moodle_url('/local/iomad_dashboard/index.php', $urlparams);
// Get the form data.
$draftitemid = file_get_submitted_draft_itemid('companylogo');
file_prepare_draft_area($draftitemid, $context->id, 'theme_' . $companyrecord->theme, 'companylogo', $companyid, array('subdirs' => 0, 'maxbytes' => 15 * 1024, 'maxfiles' => 1));
$companyrecord->companylogo = $draftitemid;
if ($domains = $DB->get_records('company_domains', array('companyid' => $companyid))) {
    $companyrecord->companydomains = '';
    foreach ($domains as $domain) {
        $companyrecord->companydomains .= $domain->domain . "\n";
    }
示例#22
0
$perpage = optional_param('perpage', 30, PARAM_INT);
// How many per page.
$acl = optional_param('acl', '0', PARAM_INT);
// Id of user to tweak mnet ACL (requires $access).
$search = optional_param('search', '', PARAM_CLEAN);
// Search string.
$departmentid = optional_param('departmentid', 0, PARAM_INTEGER);
$vantage = optional_param('profile_field_VANTAGE', '', PARAM_CLEAN);
$compfromraw = optional_param_array('compfrom', null, PARAM_INT);
$comptoraw = optional_param_array('compto', null, PARAM_INT);
$completiontype = optional_param('completiontype', 0, PARAM_INT);
$charttype = optional_param('charttype', '', PARAM_CLEAN);
$showchart = optional_param('showchart', false, PARAM_BOOL);
require_login($SITE);
$context = context_system::instance();
iomad::require_capability('local/report_completion:view', $context);
if ($firstname) {
    $params['firstname'] = $firstname;
}
if ($lastname) {
    $params['lastname'] = $lastname;
}
if ($email) {
    $params['email'] = $email;
}
if ($sort) {
    $params['sort'] = $sort;
}
if ($dir) {
    $params['dir'] = $dir;
}
示例#23
0
// Set the name for the page.
$linktext = get_string('orders', 'block_iomad_commerce');
// Set the url.
$linkurl = new moodle_url('/blocks/iomad_commerce/orderlist.php');
// Build the nav bar.
company_admin_fix_breadcrumb($PAGE, $linktext, $linkurl);
$blockpage = new blockpage($PAGE, $OUTPUT, 'iomad_commerce', 'block', 'orders');
$blockpage->setup();
require_login(null, false);
// Adds to $PAGE, creates $OUTPUT.
$context = $PAGE->context;
$baseurl = new moodle_url(basename(__FILE__), array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage));
$returnurl = $baseurl;
$blockpage->display_header();
//  Check we can actually do anything on this page.
iomad::require_capability('block/iomad_commerce:admin_view', $context);
// Get the number of orders.
$objectcount = $DB->count_records_sql("SELECT COUNT(*) FROM {invoice} WHERE Status != '" . INVOICESTATUS_BASKET . "'");
echo $OUTPUT->paging_bar($objectcount, $page, $perpage, $baseurl);
flush();
if ($orders = $DB->get_recordset_sql("SELECT\n                                        i.*,\n                                        (SELECT COUNT(*) FROM {invoiceitem} ii WHERE ii.invoiceid = i.id AND processed = 0)\n                                         AS unprocesseditems\n                                      FROM {invoice} i\n                                      WHERE i.Status != '" . INVOICESTATUS_BASKET . "'\n                                      ORDER BY i.Status DESC, i.id DESC", null, $page, $perpage)) {
    if (count($orders)) {
        $stredit = get_string('edit');
        $strhide = get_string('hide', 'block_iomad_commerce');
        $strshow = get_string('show', 'block_iomad_commerce');
        $table = new html_table();
        $table->head = array(get_string('reference', 'block_iomad_commerce'), get_string('paymentprovider', 'block_iomad_commerce'), get_string('status', 'block_iomad_commerce'), get_string('company', 'block_iomad_company_admin'), get_string('unprocesseditems', 'block_iomad_commerce'), '');
        $table->align = array("left", "center", "center", "center");
        $table->width = "95%";
        foreach ($orders as $order) {
            if (iomad::has_capability('block/iomad_commerce:admin_view', $context)) {
示例#24
0
$previewrows = optional_param('previewrows', 10, PARAM_INT);
$readcount = optional_param('readcount', 0, PARAM_INT);
$uploadtype = optional_param('uutype', 0, PARAM_INT);
$montharray = array('jan' => '01', 'feb' => '02', 'mar' => 03, 'apr' => 04, 'may' => '05', 'jun' => '06', 'jul' => '07', 'aug' => '08', 'sep' => 00, 'oct' => '10', 'nov' => '11', 'dec' => '12');
$context = context_system::instance();
require_login();
define('UU_ADDNEW', 0);
define('UU_ADDINC', 1);
define('UU_ADD_UPDATE', 2);
define('UU_UPDATE', 3);
$choices = array(UU_ADDNEW => get_string('uuoptype_addnew', 'tool_uploaduser'), UU_ADDINC => get_string('uuoptype_addinc', 'tool_uploaduser'), UU_ADD_UPDATE => get_string('uuoptype_addupdate', 'tool_uploaduser'), UU_UPDATE => get_string('uuoptype_update', 'tool_uploaduser'));
@set_time_limit(3600);
// 1 hour should be enough.
raise_memory_limit(MEMORY_EXTRA);
require_login();
iomad::require_capability('block/iomad_company_admin:user_upload', context_system::instance());
// Correct the navbar .
// Set the name for the page.
$linktext = get_string('user_upload_title', 'block_iomad_company_admin');
// Set the url.
$linkurl = new moodle_url('/blocks/iomad_company_admin/uploaduser.php');
// Build the nav bar.
company_admin_fix_breadcrumb($PAGE, $linktext, $linkurl);
$blockpage = new blockpage($PAGE, $OUTPUT, 'iomad_company_admin', 'block', 'user_upload_title');
$blockpage->setup();
// Set the companyid
$companyid = iomad::get_my_companyid($context);
$companyshortname = '';
if ($companyid) {
    $company = new company($companyid);
    $companyshortname = $company->get_shortname();