/**
  * TODO comment this
  */
 function definition()
 {
     global $USER, $CFG;
     $dbc = new ilp_db();
     $mform =& $this->_form;
     //get all of the installed form element plugins
     $formelementplugins = $dbc->get_form_element_plugins();
     $frmplugins = array('' => get_string('addpromptdots', 'block_ilp'));
     //if no elements installed pass an empty array
     if (empty($formelementplugins)) {
         $formelementplugins = array();
     }
     //append _description to the name field so there description can be picked up from lang file
     foreach ($formelementplugins as $plg) {
         $frmplugins[$plg->id] = get_string($plg->name . '_description', 'block_ilp');
     }
     $fieldsettitle = get_string('addfield', 'block_ilp');
     //create a new fieldset
     $mform->addElement('html', '<fieldset id="reportfieldset" class="clearfix ilpfieldset">');
     $mform->addElement('html', '<legend class="ftoggler">' . $fieldsettitle . '</legend>');
     $mform->addElement('hidden', 'report_id', $this->report_id);
     $mform->setType('report_id', PARAM_INT);
     $mform->addElement('select', 'plugin_id', get_string('addfield', 'block_ilp'), $frmplugins);
     $mform->addRule('plugin_id', null, 'required', null, 'client');
     $mform->setType('plugin_id', PARAM_INT);
     $buttonarray[] =& $mform->createElement('submit', 'submitbutton', get_string('addfield', 'block_ilp'));
     $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
     //close the fieldset
     $mform->addElement('html', '</fieldset>');
 }
예제 #2
0
$string['ilp_user_status_item'] = "ilp user status item";
$string['entrydata'] = "Entry Data";
$string['userstatus'] = "User Status";
//ATENDENCE REPORT
$string['attendenceconfiguration'] = "MIS Report Configuration";
$string['mis_configuration_settings'] = "MIS Configuration Settings";
$string['not_applicable'] = "n/a";
//MESSAGE PROVIDER
$string['messageprovider:ilp_comment'] = 'New report comment';
global $CFG;
// Include ilp db class
require_once $CFG->dirroot . '/blocks/ilp/db/ilp_db.php';
$dbc = new ilp_db();
$plugins = $CFG->dirroot . '/blocks/ilp/classes/form_elements/plugins';
// get all the currently installed form element plugins
$form_element_plugins = ilp_records_to_menu($dbc->get_form_element_plugins(), 'id', 'name');
//this section gets language strings for all plugins
foreach ($form_element_plugins as $plugin_file) {
    if (file_exists($plugins . '/' . $plugin_file . ".php")) {
        require_once $plugins . '/' . $plugin_file . ".php";
        // instantiate the object
        $class = basename($plugin_file, ".php");
        $resourceobj = new $class();
        $method = array($resourceobj, 'language_strings');
        //check whether the language string element has been defined
        if (is_callable($method, true)) {
            $resourceobj->language_strings($string);
        }
    }
}
//import tab plugin language strings
 /**
  * Installs any new plugins
  */
 public static function install_new_plugins()
 {
     global $CFG;
     // instantiate the assmgr db
     $dbc = new ilp_db();
     // get all the currently installed evidence resource types
     $plugins = ilp_records_to_menu($dbc->get_form_element_plugins(), 'id', 'name');
     $plugins_directory = $CFG->dirroot . '/blocks/ilp/classes/form_elements/plugins';
     // get the folder contents of the resource plugin directory
     $files = scandir($plugins_directory);
     foreach ($files as $file) {
         // look for plugins
         if (preg_match('/^([a-z_]+)\\.php$/i', $file, $matches)) {
             if (!in_array($matches[1], $plugins) && substr($matches[1], -5) != 'mform') {
                 // include the class
                 require_once $plugins_directory . '/' . $file;
                 // instantiate the object
                 $class = basename($file, ".php");
                 $formelementobj = new $class();
                 // install the plugin
                 $formelementobj->install();
                 // update the resource_types table
                 $dbc->create_form_element_plugin($formelementobj->get_name(), $formelementobj->get_tablename());
             }
         }
     }
 }