public function mysql_save_from_post($post) { $post['oid'] = parent::mysql_save_from_post($post); $obj = self::from_mysql_id($post['oid']); if (array_key_exists('ids', $post) && array_key_exists('values', $post) && array_key_exists('rws', $post)) { for ($i = 0; $i < count($post['ids']); $i++) { $id = $post['ids'][$i]; $val = $post['values'][$i]; $rw = $post['rws'][$i]; if ($id != "" && $val != "" && $rw != "") { $right = UserTypeRight::from_property(array("UserType_id" => $obj->id, "Module_id" => $id), false); if ($right == null) { $right = new UserTypeRight(); $right->UserType_id = $obj->id; $right->Module_id = $id; } if ($rw == "r") { $right->read = $val; } if ($rw == "w") { $right->write = $val; } if ($rw == "o") { $right->ownership = $val; } $right->mysql_save(); } } } return $post['oid']; }
public function mysql_delete() { $utr = UserTypeRight::from_property(array("Module_id" => $this->id)); foreach ($utr as $obj) { $obj->mysql_delete(); } $this->mysql_delete_object(); }
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); }