diff --git a/front/packagetimeslot.form.php b/front/packagetimeslot.form.php deleted file mode 100644 index 24de8fb..0000000 --- a/front/packagetimeslot.form.php +++ /dev/null @@ -1,22 +0,0 @@ -addStandardTab(PackageAction::getType(), $ong, $options) ->addStandardTab(PackageTarget::getType(), $ong, $options) ->addStandardTab(PackageJob::getType(), $ong, $options) - ->addStandardTab(PackageTimeslot::getType(), $ong, $options) ->addStandardTab(__CLASS__, $ong, $options); return $ong; diff --git a/src/PackageTimeslot.php b/src/PackageTimeslot.php deleted file mode 100644 index 4ad96f2..0000000 --- a/src/PackageTimeslot.php +++ /dev/null @@ -1,115 +0,0 @@ -request([ - 'FROM' => self::getTable(), - 'WHERE' => [ - 'plugin_deploy_packages_id' => $package->fields['id'] - ] - ]); - - return $iterator; - } - - public static function showForPackage(Package $package) - { - TemplateRenderer::getInstance()->display('@deploy/package/timeslot.html.twig', [ - 'package_id' => $package->fields['id'], - ]); - } - - public static function getDayNumber(string $day): int - { - $days = [ - 'monday' => 1, - 'tuesday' => 2, - 'wednesday' => 3, - 'thursday' => 4, - 'friday' => 5, - 'saturday' => 6, - 'sunday' => 7, - ]; - - return $days[strtolower($day)]; - } - - public static function chooseUpdateOrAdd(array $input) - { - $timeslot = new self(); - $timeslot->getFromDBByCrit( - [ - 'plugin_deploy_packages_id' => $input['plugin_deploy_packages_id'], - 'weekday' => $input['weekday'], - ] - ); - if (isset($timeslot->fields['id'])) { - $input['id'] = $timeslot->fields['id']; - $timeslot->update($input); - } else { - $timeslot->add($input); - } - } - - public static function install(Migration $migration) - { - global $DB; - - $table = self::getTable(); - if (!$DB->tableExists($table)) { - $migration->displayMessage("Installing $table"); - - $default_charset = DBConnection::getDefaultCharset(); - $default_collation = DBConnection::getDefaultCollation(); - - $query = "CREATE TABLE {$table} ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `plugin_deploy_packages_id` int unsigned NOT NULL DEFAULT '0', - `weekday` tinyint NOT NULL DEFAULT '1', - `time_start` time NULL DEFAULT NULL, - `time_end` time NULL DEFAULT NULL, - `entities_id` int unsigned NOT NULL DEFAULT '0', - `is_active` tinyint(1) NOT NULL DEFAULT '1', - `is_recursive` tinyint(1) NOT NULL DEFAULT '0', - `date_mod` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - KEY `entities_id` (`entities_id`), - KEY `is_active` (`is_active`), - KEY `is_recursive` (`is_recursive`), - KEY `date_mod` (`date_mod`) - ) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;"; - $DB->request($query); - } - } - - public static function uninstall(Migration $migration) - { - $table = self::getTable(); - $migration->displayMessage("Uninstalling $table"); - $migration->dropTable($table); - } -}