}
$user = User::get_logged_user();
if ($user == null) {
    die(Language::string(85));
}
$file = $_FILES['file'];
$f = new File();
$f->temp_id = $_POST['temp_id'];
$f->file_name = $file['name'];
$f->Module_id = $_POST['Module_id'];
$f->object_id = $_POST['object_id'];
$f->temp_name = $file['tmp_name'];
$f->file_size = $file['size'];
$code = 0;
$can_upload = true;
$module = DS_Module::from_mysql_id($_POST['Module_id']);
$class_name = $module->value;
$max_num = $class_name::$max_files_num;
$obj = $class_name::from_mysql_id($_POST['object_id']);
if ($obj == null) {
    $files = File::from_property(array("temp_id" => $_POST['temp_id']));
} else {
    $files = $obj->get_files();
}
$cur_num = count($files);
if ($cur_num >= $max_num && $max_num != -1) {
    $can_upload = false;
}
if ($can_upload) {
    $f->mysql_save();
} else {
Beispiel #2
0
 public function upload($name, $author, $revision, $description)
 {
     $client = new nusoap_client(Ini::$path_online_library_ws . "?wsdl", true);
     $result = $client->call("upload", array("Module_id" => DS_Module::from_property(array("value" => static::get_mysql_table()), false)->id, "name" => $name, "author" => $author, "revision" => $revision, "description" => $description, "xml" => base64_encode(gzcompress($this->export(), 1)), "version" => Ini::$version));
     return $result;
 }
 public function get_files()
 {
     return File::from_property(array("Module_id" => DS_Module::from_value(static::get_mysql_table())->id, "object_id" => $this->id));
 }
echo $class_name;
?>
.extraFileUploadCallback();
                return $('');
            }
        });
    });

</script>

<form id="form<?php 
echo $class_name;
?>
FileUploadForm" action="query/file_upload.php" method="POST" enctype="multipart/form-data">
    <input type="hidden" name="Module_id" value="<?php 
echo DS_Module::from_value($class_name)->id;
?>
" />
    <input type="hidden" name="object_id" value="<?php 
echo $oid;
?>
" />
    <input type="hidden" name="temp_id" value="<?php 
echo $temp_id;
?>
" />
    <input type="file" name="file">
    <button>Upload</button>
    <div class="ui-widget-header ui-corner-all">Upload file</div>
</form>
<table class="fullWidth ui-widget-content ui-corner-all" id="form<?php 
        echo Language::string(164);
        ?>
</th>
                            <th class="noWrap ui-widget-header"><?php 
        echo Language::string(165);
        ?>
</th>
                            <th class="noWrap ui-widget-header"><?php 
        echo Language::string(166);
        ?>
</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
        $modules = DS_Module::get_all("`name` ASC");
        foreach ($modules as $module) {
            ?>
                            <tr>
                                <td class="noWrap ui-widget-content"><?php 
            echo $module->name;
            ?>
</td>
                                <td class="noWrap ui-widget-content">
                                    <select class="fullWidth ui-widget-content ui-corner-all form<?php 
            echo $class_name;
            ?>
ModuleRights" id="form<?php 
            echo $class_name;
            ?>
ModuleRights_r_<?php 
 public function get_rights_by_module_table($table_name)
 {
     $Module_id = 0;
     $module = DS_Module::from_value($table_name);
     if ($module != null) {
         $Module_id = $module->id;
     }
     return $this->get_rights_by_module($Module_id);
 }
/*
 Concerto Platform - Online Adaptive Testing Platform
 Copyright (C) 2011-2013, The Psychometrics Centre, Cambridge University

 This program 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; version 2
 of the License, and not any of the later versions.

 This program 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 this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
if (!isset($ini)) {
    require_once '../../Ini.php';
    $ini = new Ini();
}
$logged_user = User::get_logged_user();
if ($logged_user == null) {
    echo json_encode(array());
    exit;
}
$client = new nusoap_client(Ini::$path_online_library_ws . "?wsdl", true);
$result = $client->call("get_list", array("Module_id" => DS_Module::from_property(array("value" => $_GET['class_name']), false)->id, "version" => Ini::$version));
echo $result;
Beispiel #8
0
 public static function reset_db()
 {
     CustomSection::create_db(true);
     CustomSectionVariable::create_db(true);
     DS_Module::create_db(true);
     DS_Right::create_db(true);
     DS_Sharing::create_db(true);
     DS_TestSectionType::create_db(true);
     DS_UserInstitutionType::create_db(true);
     Setting::create_db(true);
     Table::create_db(true);
     TableColumn::create_db(true);
     Template::create_db(true);
     Test::create_db(true);
     TestSection::create_db(true);
     TestSectionValue::create_db(true);
     TestSession::create_db(true);
     TestSessionReturn::create_db(true);
     TestTemplate::create_db(true);
     TestVariable::create_db(true);
     User::create_db(true);
     UserGroup::create_db(true);
     UserType::create_db(true);
     UserTypeRight::create_db(true);
 }