/** * Set default data for the form. */ public function __construct() { $this->packageName = 'com.keosu.demo'; $this->description = 'Keosu demo'; $this->author = 'keosu team'; $this->website = 'http://keosu.com'; $this->email = '*****@*****.**'; $this->version = '1.0'; $this->theme = array_keys(ThemeUtil::getThemeList())[0]; $this->preferences = array(array("key" => "permissions", "value" => "none"), array("key" => "phonegap-version", "value" => "cli-5.2.0"), array("key" => "orientation", "value" => "default"), array("key" => "target-device", "value" => "universal"), array("key" => "Fullscreen", "value" => "true"), array("key" => "webviewbounce", "value" => "true"), array("key" => "prerendered-icon", "value" => "true"), array("key" => "stay-in-webview", "value" => "false"), array("key" => "ios-statusbarstyle", "value" => "black-opaque"), array("key" => "detect-data-types", "value" => "true"), array("key" => "exit-on-suspend", "value" => "true"), array("key" => "Show-splash-screen-spinner", "value" => "true"), array("key" => "auto-hide-splash-screen", "value" => "false"), array("key" => "disable-cursor", "value" => "false"), array("key" => "android-minSdkVersion", "value" => "7"), array("key" => "android-installLocation", "value" => "auto"), array("key" => "disallowOverscroll", "value" => "true"), array("key" => "SplashScreenDelay", "value" => "3000")); }
/** * Edit App form */ private function buildAppForm($formBuilder) { $formBuilder->add('name', 'text')->add('packageName', 'text')->add('version', 'text')->add('description', 'textarea')->add('author', 'text', array('required' => false))->add('website', 'url', array('required' => false))->add('email', 'email', array('required' => false))->add('debugMode', 'checkbox', array('required' => false))->add('theme', 'choice', array('choices' => ThemeUtil::getThemeList(), 'expanded' => true))->add('configPackages', new ConfigPackageType($this->container, $this->get('request')), array('label' => false))->add('splashscreens', new SplashscreensType())->add('icons', new IconsType())->add('preferences', 'collection', array('type' => new PreferenceType(), 'required' => false, 'label' => "Edit preference", 'allow_add' => true, 'allow_delete' => true, 'by_reference' => true, 'options' => array('label' => false))); }
/** * Shared function to edit/add an app */ private function editTheme($theme) { // Find existing app to know if it's the first one $error = null; $em = $this->get('doctrine')->getManager(); // page edit form $formBuilder = $this->createFormBuilder($theme, array('label' => 'Edit Theme')); $this->buildThemeForm($formBuilder); $form = $formBuilder->getForm(); $request = $this->get('request'); // If we are in POST method, form is submit if ($request->getMethod() == 'POST') { $form->bind($request); if ($form->isValid()) { // Storing pag if (($error = $theme->upload()) !== null) { return $this->render('KeosuCoreBundle:Theme:edit.html.twig', array('form' => $form->createView(), 'theme' => $theme, 'error' => $error)); } $themesData = $em->getRepository('KeosuCoreBundle:Theme')->findAll(); $themes = ThemeUtil::getThemeList(); foreach ($themes as $themetmp) { if ($this->themeExists($themetmp, $themesData, FALSE) === FALSE) { $theme->setName($themetmp); $session = $this->get("session"); $session->set("themeid", $theme->getId()); $em->persist($theme); } } $em->flush(); $themesData = $em->getRepository('KeosuCoreBundle:Theme')->findAll(); return $this->render('KeosuCoreBundle:Theme:manage.html.twig', array('themes' => $themesData, 'msg' => "Your upload succeeded.")); } } return $this->render('KeosuCoreBundle:Theme:edit.html.twig', array('form' => $form->createView(), 'theme' => $theme, 'error' => $error)); }