package ONO::FW::Edu::Apps::Modules::FolderGenerator;
################################################################################
# COPYRIGHT / LICENSE #
################################################################################
#
# This file is part of the ONO Software Project.
#
# Copyright (C) 2022-2026 Jos Kirps and The Joopita Project [ASBL]
# Copyright (C) 2011-2022 Jos Kirps and Joopita Research ASBL
# Copyright (C) 2006-2011 Jos Kirps and The Joopita Project
# Copyright (C) 2001-2006 Jos Kirps and The WobbleWolf Project
#
# This file, as well as many other parts of the ONO Software Project or
# related elements, are FREE SOFTWARE available under the ARTISTIC LICENSE 2.0.
#
# 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.
#
# For the full license, see /ono/osr/license/LICENSE.txt, or write to
# jos_AT_kirps_DOT_com or contact_AT_joopita_DOT_com.
#
################################################################################
# END OF COPYRIGHT / LICENSE, HERE COMES THE CODE ... #
################################################################################
#: This module is a front end application module wrapper that has been
#: created for the Morzino Project (morzino.com) and that has been released
#: as Open Source software.
#:
#: Note that this is NOT a self-contained application, it is only a wrapper
#: that makes heavy use of the ONO Perl Framework application engine.
use strict;
use ONO::FW::Edu::Apps::ToolBox;
use ONO::FW::Apps::ToolBox;
use ONO::Lib::PDF::Draw;
use ONO::Lib::PDF::ToolBox;
use ONO::FW::Apps::Core;
use ONO::FW::Apps::Core::Graphics;
use ONO::FW::Apps::Core::Lang;
use ONO::Lib::Parser;
use ONO::FW::Apps::PDF;
use ONO::IO;
use ONO::DB;
use ONO::Lib::SQL::TableCreate;
use ONO::Lib::Basic;
use ONO::Lib::Lang::ToolBox;
use ONO::Lib::Data::Letters;
use ONO::FW::Edu::Apps::Modules::LangTrainer;
use ONO::Lib::UI::Check;
sub learn {
my (
$self,
$option,
$vars_ref,
$HTTP,
$BASE,
) = @_;
################################################################
# INIT - BEGIN
################################################################
my (
$db,
$community,
$action_url,
$form,
$format,
$canvas,
$pdfkey,
$sec,$min,$hour,
$mday,$mon,$year,
$wday,$yday,$timestamp,
$lang,
$BLK_ref,
$vars_ref,
) = ONO::FW::Apps::Core->init($vars_ref);
my %vars = %$vars_ref;
my %BLK = %$BLK_ref;
my $app = "folder_generator";
my $WEB;
ONO::FW::Apps::Core->now("",$app,$vars{'app_lang'});
my @txt = (
"Worksheet Folder Generator",
"Here you can...",
"Select...",
"Math Folder<br>Generator",
"Language Folder<br>Generator",
"generate worksheets",
);
if ($lang eq "de") {
@txt = (
"Arbeitsmappen-Generator",
);
}
if ($lang eq "lu") {
@txt = (
"Aarbechtsmapp-Generator",
);
}
if ($lang eq "fr") {
@txt = (
"Générer un dossier de fiches",
);
}
my $NAME = $txt[0];
$vars{'app_input_print_options_title_default'} = $txt[0];
if (ONO::IO->devstation) {
# $vars{'username'} = "jos";
}
if ($vars{'username'} && (ONO::FW::Apps::Core->running(\%vars,$db) || $vars{'folder_generator_run'})) {
#############################################################
# ONLINE TRAINING
#############################################################
$WEB .= ONO::FW::Apps::Core->blockbackbutton($BASE,$vars_ref);
my $DATA;
foreach my $key (keys %vars) {
$DATA .= qq~FG_VAR:$key:$vars{$key}\n~;
}
ONO::IO->store();
$WEB .= "RUNNING";
$WEB .= ONO::FW::Apps::Core->vardump($vars_ref);
$WEB = ONO::FW::Edu::Apps::ToolBox->apps_gate($WEB,$vars_ref);
} else {
#############################################################
# EXERCISE SETUP
#############################################################
$vars{'software_base'} = $BASE;
# $WEB .= ONO::FW::Apps::Core->infopics(
# "screen:320:50:50::vocabulary_screenshot_1.jpg",
# "sheet:168:180:110:15:vocabulary_sheet_1.jpg",
# "sheet:168:40:140:-10:vocabulary_sheet_1.jpg",
# );
if (!$vars{'app_input_folder'}) {
my $SEL = qq~<table class="default_table auto">
<tr>
<td class="w50"><a href="$action_url&app_input_folder=math"><img class="block88 auto" src="/images/apps/collection_math_128.png" alt=""></a></td>
<td class="w50"><a href="$action_url&app_input_folder=lang"><img class="block88 auto" src="/images/apps/collection_lang_128.png" alt=""></a></td>
<td><div class="block32"></div></td>
</tr>
<tr>
<td class="center"><a href="$action_url&app_input_folder=math" class="col6"><div class="lh125 large">$txt[3]</div></a></td>
<td class="center"><a href="$action_url&app_input_folder=lang" class="col6"><div class="lh125 large">$txt[4]</div></a></td>
<td></td>
</tr>
</table>
~;
my $CONF = ONO::FW::Apps::ToolBox->conf_input("tip", $BLK_ref,\%vars,"",$txt[1]);
$CONF .= ONO::FW::Apps::ToolBox->conf_input("txt", $BLK_ref,\%vars,"",$txt[2]);
$CONF .= ONO::FW::Apps::ToolBox->conf_input("spacer", $BLK_ref,\%vars);
$CONF .= ONO::FW::Apps::ToolBox->conf_input("html", $BLK_ref,\%vars,"",$SEL);
$WEB .= ONO::FW::Apps::Core->conf_box(
$db,
$community,
$app,
$form,
"",
$action_url,
$CONF,
$lang,
$BLK_ref,
\%vars,
"F",
);
} else {
my $CONF;
if ($vars{'app_input_folder'} eq "math") {
$CONF .= ONO::FW::Apps::ToolBox->conf_input("range", $BLK_ref,\%vars,"",1,100,9999999);
$CONF .= ONO::FW::Apps::ToolBox->conf_input("spacer", $BLK_ref,\%vars);
$CONF .= ONO::FW::Apps::ToolBox->conf_input("ops", $BLK_ref,\%vars,"","asmd-ASM");
$CONF .= ONO::FW::Apps::ToolBox->conf_input("spacer", $BLK_ref,\%vars);
$CONF .= ONO::FW::Apps::ToolBox->conf_input("comma", $BLK_ref,\%vars,"C",3);
$CONF .= ONO::FW::Apps::ToolBox->conf_input("negative", $BLK_ref,\%vars,"");
$CONF .= ONO::FW::Apps::ToolBox->conf_input("tensbarrier",$BLK_ref,\%vars,"","S");
$CONF .= ONO::FW::Apps::ToolBox->conf_input("spacer", $BLK_ref,\%vars);
my @app_opts = ONO::FW::Edu::Apps::Modules::LangTrainer->app_opts();
my @app_opts_names = ONO::FW::Edu::Apps::Modules::LangTrainer->app_opts_names($vars{'app_lang'});
my @app_opts_names = (
"Arithmetic",
"Written",
"Muliply",
"Houses",
"Walls",
"Compare",
"Fractions",
"",
"",
"",
);
my $HTML = &app_list("",\@app_opts,\@app_opts_names);
$CONF .= ONO::FW::Apps::ToolBox->conf_input("html", $BLK_ref,\%vars,"",$HTML);
}
if ($vars{'app_input_folder'} eq "lang") {
my (
$default_ref,$default_lessons,$all_lessons,$custom_lessons,$LU,
) = ONO::FW::Apps::Core::Lang->lang_default_setup_config(\%vars);
my @default = @$default_ref;
$CONF .= ONO::FW::Apps::ToolBox->conf_input("lang", $BLK_ref,\%vars,"ips","$default[0];en:de:fr$LU");
$CONF .= ONO::FW::Apps::ToolBox->conf_input("spacer", $BLK_ref,\%vars);
$CONF .= ONO::FW::Apps::ToolBox->conf_input("selections", $BLK_ref,\%vars,"Nl",$BLK{'lists'},$default_lessons,$all_lessons,"$BLK{'Add_a_list'}::$custom_lessons");
$CONF .= ONO::FW::Apps::ToolBox->conf_input("difficulty", $BLK_ref,\%vars,"i",5,3);
$CONF .= ONO::FW::Apps::ToolBox->conf_input("spacer", $BLK_ref,\%vars);
my @app_opts = (
ONO::FW::Edu::Apps::Modules::LangTrainer->app_opts(),
'word_search',
'crosswords',
);
my @app_opts_names = (
ONO::FW::Edu::Apps::Modules::LangTrainer->app_opts_names($vars{'app_lang'}),
'Search Words',
'Crosswords',
);
my $HTML = &app_list("",\@app_opts,\@app_opts_names);
$HTML = qq~<div class="ml20">$HTML</div>~;
$CONF .= ONO::FW::Apps::ToolBox->conf_input("html", $BLK_ref,\%vars,"",$HTML);
}
$CONF .= ONO::FW::Apps::ToolBox->conf_input("spacer", $BLK_ref,\%vars);
$CONF .= ONO::FW::Apps::ToolBox->conf_input("html", $BLK_ref,\%vars,"",qq~<input type="submit" name="folder_generator_run" value="$txt[5]" class="button_green">~);
$WEB .= ONO::FW::Apps::Core->conf_box(
$db,
$community,
$app,
$form,
"",
$action_url,
$CONF,
$lang,
$BLK_ref,
\%vars,
"F",
);
}
$WEB .= ONO::FW::Apps::Core->vardump($vars_ref);
$WEB = ONO::FW::Edu::Apps::ToolBox->apps_gate($WEB,$vars_ref);
}
my ($status,$WEB) = ONO::Lib::Parser->parse($WEB,$vars_ref);
return $WEB;
}
sub app_list {
my (
$self,
$app_opts_ref,
$app_opts_names_ref,
) = @_;
my @app_opts = @$app_opts_ref;
my @app_opts_names = @$app_opts_names_ref;
my $num = @app_opts;
my $HTML;
for (my $a = 0; $a < $num; $a++) {
my $SWITCH = ONO::Lib::UI::Check->switch("app_input_$app_opts[$a]",1,"r");
my $SEL;
for (my $s = 1; $s < 4; $s++) {
$SEL .= qq~<option value="$s">$s</option>~;
}
$HTML .= qq~<table class="default_table"><tr><td>$SWITCH</td><td><div class="select"><select name="app_input_$app_opts[$a]_num">$SEL</select></div></td><td class="pad5_2">$app_opts_names[$a]</td></tr></table>~;
if ($a == int($num/2)) {
$HTML .= qq~</td><td class="w50 p0">~;
}
}
return qq~<table class="wide_table"><tr class="vtop"><td class="w50 p0">$HTML</td></tr></table>~;
}
###################################################################
#### THAT'S IT :-D
###################################################################
1;
__END__