/** * @param GetEditModeButtonsEvent $event */ public function getMigrateButtons(GetEditModeButtonsEvent $event) { if ($event->getEnvironment()->getDataDefinition()->getName() != 'mem_avisota_recipient_migrate') { return; } $translator = $event->getEnvironment()->getTranslator(); $buttons = array('migrate' => sprintf('<input type="submit" name="save" id="save" class="tl_submit" accesskey="s" value="%s" />', $translator->translate('submit', 'mem_avisota_recipient_migrate'))); $event->setButtons($buttons); }
/** * @param GetEditModeButtonsEvent $objEvent */ public function addButton(GetEditModeButtonsEvent $objEvent) { if (!$this->isRightContext($objEvent->getEnvironment())) { return; } // Check the file cache. $strInitFilePath = '/system/config/initconfig.php'; if (file_exists(TL_ROOT . $strInitFilePath)) { $strFile = new \File($strInitFilePath); $arrFileContent = $strFile->getContentAsArray(); foreach ($arrFileContent as $strContent) { if (!preg_match("/(\\/\\*|\\*|\\*\\/|\\/\\/)/", $strContent)) { //system/tmp. if (preg_match("/system\\/tmp/", $strContent)) { // Set data. \Message::addInfo($GLOBALS['TL_LANG']['MSC']['disabled_cache']); } } } } // Update a field with last sync information $objSyncTime = \Database::getInstance()->prepare("SELECT cl.syncFrom_tstamp as syncFrom_tstamp, user.name as syncFrom_user, user.username as syncFrom_alias\n FROM tl_synccto_clients as cl\n INNER JOIN tl_user as user\n ON cl.syncTo_user = user.id\n WHERE cl.id = ?")->limit(1)->execute(\Input::get("id")); if ($objSyncTime->syncFrom_tstamp != 0 && strlen($objSyncTime->syncFrom_user) != 0 && strlen($objSyncTime->syncFrom_alias) != 0) { $strLastSync = vsprintf($GLOBALS['TL_LANG']['MSC']['last_sync'], array(date($GLOBALS['TL_CONFIG']['timeFormat'], $objSyncTime->syncFrom_tstamp), date($GLOBALS['TL_CONFIG']['dateFormat'], $objSyncTime->syncFrom_tstamp), $objSyncTime->syncFrom_user, $objSyncTime->syncFrom_alias)); // Set data \Message::addInfo($strLastSync); } // Set buttons. $objEvent->setButtons(array('start_sync' => '<input type="submit" name="start_sync" id="start_sync" class="tl_submit" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['sync']) . '" />', 'start_sync_all' => '<input type="submit" name="start_sync_all" id="start_sync_all" class="tl_submit" accesskey="o" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['syncAll']) . '" />')); }
/** * @param GetEditModeButtonsEvent $objEvent */ public function addButtonRestore(GetEditModeButtonsEvent $objEvent) { if (!$this->isRightContext($objEvent->getEnvironment(), 'tl_syncCto_restore_file')) { return; } $objEvent->setButtons(array('start_backup' => '<input type="submit" name="restore_backup" id="restore_backup" class="tl_submit" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['MSC']['restore']) . '" />')); }