mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
attendance card
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user