Beispiel #1
0
 function __construct($is_installed)
 {
     // Settings Tendoo Core Vars
     set_core_vars('tendoo_core_permissions', array('name' => __('Tendoo Permissions'), 'declared_actions' => array(array('action' => 'manage_themes', 'action_name' => __('Manage Themes'), 'action_description' => __('This permissions allow user to manage themes (activate, uninstall)'), 'mod_namespace' => 'system'), array('action' => 'manage_modules', 'action_name' => __('Manage Modules'), 'action_description' => __('This permissions allow user to manage modules (activate, uninstall)'), 'mod_namespace' => 'system'), array('action' => 'manage_controllers', 'action_name' => __('Manage Modules'), 'action_description' => __('This permissions allow user to manage controller (create, delete)'), 'mod_namespace' => 'system'), array('action' => 'manage_settings', 'action_name' => __('Manage Settings'), 'action_description' => __('This permissions allow user to manage site settings'), 'mod_namespace' => 'system'), array('action' => 'install_app', 'action_name' => __('Install App'), 'action_description' => __('This permissions allow user to install app'), 'mod_namespace' => 'system'), array('action' => 'manage_roles', 'action_name' => __('Manage Roles'), 'action_description' => __('This permissions allow user to manage roles'), 'mod_namespace' => 'system'), array('action' => 'manage_users', 'action_name' => __('Manage Users'), 'action_description' => __('This permissions allow user to manage users'), 'mod_namespace' => 'system'), array('action' => 'manage_tools', 'action_name' => __('Manage Tools'), 'action_description' => __('This permissions allow user to manage tools'), 'mod_namespace' => 'system'), array('action' => 'manage_media', 'action_name' => __('Manage Media'), 'action_description' => __('This permissions allow user to manage media'), 'mod_namespace' => 'system'))), 'read_only');
     $pseudo = array('name' => 'admin_pseudo');
     if ($is_installed) {
         $this->db_vars();
     }
     // Can be filtered using "user_fields"
     register_fields('user_form_fields', array('name' => 'admin_bio'));
     bind_filter('user_form_fields', array($this, 'user_form_fields'));
     bind_filter('declare_notices', array($this, 'declare_notices'));
     $this->default_notices();
 }
/**
* @param $element has the values of the different lines of a Job block
* example:
* $element->jobid
* $element->SourceFile=zip:/var/WebApps/moodle_prod/moodledata/259/moddata/blended/Folder-2011-10-25-22-30-07-33/JobName.zip#JobName/JobName (14).jpg
* $element->PageIndex=2
* $element->OutputImagePath=/var/WebApps/moodle_prod/moodledata/259/moddata/blended/Folder-2011-10-25-22-30-07-33/Scans/OMR_original_marked4098364334116568820.jpg
* $element->activitycode=749
* $element->ParsedResults=/var/WebApps/moodle_prod/moodledata/259/moddata/blended/Folder-2011-10-25-22-30-07-33/Scans/omr_result[749].txt
*/
function register_template_fields($element, $fieldspath)
{
    $field = new stdClass();
    $activitycode = $element->activitycode;
    $jobid = $element->jobid;
    //avoid previous records
    delete_records($table = 'blended_results', $field1 = 'activitycode', $value1 = $element->activitycode, $field2 = 'jobid', $value2 = $jobid);
    $fieldsfile = $fieldspath . "/fieldset_OMR[{$activitycode}].fields";
    // array, cada elemento es una página del fieldset.
    try {
        $telements = read_templatefield_file($fieldsfile);
        if (count($telements) == 0) {
            throw new OMRError("Templatefield file is empty", OMRError::FIELDS_FILE_IS_EMPTY);
        }
    } catch (OMRError $e) {
        throw $e;
    }
    //print_object($telements);
    //cada fieldelement es una página del archivo fieldset
    //JPC: WARNING: May not be some pages in the log file (i.e. unrecongnized labels)
    foreach ($telements as $fieldelement) {
        if (substr($fieldelement, 0, 10) == 'TemplateId') {
            continue;
        }
        // ignore field outside page definition
        $labels = analyse_fields_elements($fieldelement);
        //print "labels: ";
        //print_object($labels);
        $field->activitycode = $activitycode;
        $field->jobid = $jobid;
        $field->page = $labels['PageNumber']->value;
        try {
            register_fields($field, $labels);
        } catch (ResultsError $e) {
            print 'ResultsError: ' . $e->getMessage() . '<BR>';
        }
    }
    return;
}