attendance card

This commit is contained in:
xiaomlove
2022-04-03 16:03:47 +08:00
parent 4172f7c07c
commit 9af8e5e442
100 changed files with 2806 additions and 65 deletions
+13
View File
@@ -198,6 +198,19 @@ class Update extends Install
}
}
/**
* @since 1.7.0
*
* add attendance_card to users
*/
if (WITH_LARAVEL && !NexusDB::schema()->hasColumn('users', 'attendance_card')) {
$this->runMigrate('database/migrations/2022_04_02_163930_create_attendance_logs_table.php');
$this->runMigrate('database/migrations/2022_04_03_041642_add_attendance_card_to_users_table.php');
$rep = new AttendanceRepository();
$count = $rep->migrateAttendanceLogs();
$this->doLog("[ADD_ATTENDANCE_CARD_TO_USERS], migrateAttendanceLogs: $count");
}
}
public function runExtraMigrate()
+47
View File
@@ -17,6 +17,10 @@ final class Nexus
private static ?Nexus $instance = null;
private static array $appendHeaders = [];
private static array $appendFooters = [];
const PLATFORM_USER = 'user';
const PLATFORM_ADMIN = 'admin';
const PLATFORM_TRACKER = 'tracker';
@@ -179,5 +183,48 @@ final class Nexus
$this->platform = $platform;
}
public static function js(string $js, string $position, bool $isFile)
{
if ($isFile) {
$append = sprintf('<script type="text/javascript" src="%s"></script>', $js);
} else {
$append = sprintf('<script type="text/javascript">%s</script>', $js);
}
if ($position == 'header') {
self::$appendHeaders[] = $append;
} elseif ($position == 'footer') {
self::$appendFooters[] = $append;
} else {
throw new \InvalidArgumentException("Invalid position: $position");
}
}
public static function css(string $css, string $position, bool $isFile)
{
if ($isFile) {
$append = sprintf('<link rel="stylesheet" href="%s" type="text/css">', $css);
} else {
$append = sprintf('<style type="text/css">%s</style>', $css);
}
if ($position == 'header') {
self::$appendHeaders[] = $append;
} elseif ($position == 'footer') {
self::$appendFooters[] = $append;
} else {
throw new \InvalidArgumentException("Invalid position: $position");
}
}
public static function getAppendHeaders(): array
{
return self::$appendHeaders;
}
public static function getAppendFooters(): array
{
return self::$appendFooters;
}
}