/** * @param $config SliceConfig * @return Form */ public function _createSliceConfigUploadForm($config) { $form = new Form('upload'); //load up our engines. if (User::isAdmin()) { $engines = SliceEngine::getAllEngines()->getAll(); } else { $engines = SliceEngine::getPublicEngines()->getAll(); } $engs = array(); foreach ($engines as $row) { /* @var $e SliceEngine */ $e = $row['SliceEngine']; $engs[$e->id] = $e->getName(); } $form->add(SelectField::name('engine_id')->label('Slice Engine')->help('Which slicing engine does this config use?')->required(true)->value($config->get('engine_id'))->options($engs)); $form->add(TextField::name('config_name')->label('Config Name')->help('What is the name of this slicing configuration.')->required(true)->value($config->get('config_name'))); if ($config->isHydrated()) { $form->add(CheckboxField::name('expire_slicejobs')->label('Expire Old Slice Jobs')->help('If checked, old slice jobs will be expired and never re-used.')->value(1)); } $form->add(UploadField::name('config_file')->label('Configuration File')->help('The configuration file to use (.ini for Slic3r)')->required(true)); return $form; }
/** * @param $bot Bot is the selected bot * @return Form the form we return */ private function _createInfoForm($bot) { $form = new Form('info'); if ($this->args('setup')) { $form->action = $bot->getUrl() . "/edit/setup"; } else { $form->action = $bot->getUrl() . "/edit"; } $form->add(DisplayField::name('title')->label('')->value('<h2>Information / Details</h2>')); $form->add(TextField::name('name')->label('Bot Name')->help('What should humans call your bot?')->required(true)->value($bot->get('name'))); $form->add(TextField::name('manufacturer')->label('Manufacturer')->help('Which company (or person) built your bot?')->required(true)->value($bot->get('manufacturer'))); $form->add(TextField::name('model')->label('Model')->help('What is the model or name of your bot design?')->required(true)->value($bot->get('model'))); $form->add(TextField::name('electronics')->label('Electronics')->help('What electronics are you using to control your bot?')->value($bot->get('electronics'))); $form->add(TextField::name('firmware')->label('Firmware')->help('What firmware are you running on your electronics?')->value($bot->get('firmware'))); $form->add(TextField::name('extruder')->label('Extruder')->help('What extruder are you using to print with?')->value($bot->get('extruder'))); return $form; }
public function _createLoginForm() { $form = new Form("login"); $form->action = "/login"; if (!$this->args('username')) { $username = ''; } else { $username = $this->args('username'); } $form->add(HiddenField::name('action')->value('login')->required(true)); $form->add(TextField::name('username')->label('Username')->value($username)->required(true)); $form->add(PasswordField::name('password')->label('Password')->required(true)); $form->add(CheckboxField::name('remember_me')->label("Remember me on this computer.")->checked(true)); $form->setSubmitText("Sign into your account"); $form->setSubmitClass("btn btn-primary btn-large"); return $form; }
/** * @param $queue Queue * @return Form */ public function _createQueueForm($queue) { $form = new Form(); $form->add(TextField::name('name')->label('Name')->help('What is the name of this queue?')->required(true)->value($queue->getName())); $form->add(NumericField::name('delay')->label('Delay')->help('What is the delay between starting prints in seconds?')->required(true)->min(0)->value($queue->get('delay'))); return $form; }
/** * @param $token OAuthToken * @return Form */ public function _editAccessTokenForm($token) { $form = new Form(); $form->action = $token->getUrl() . "/edit"; $form->submitText = "Manage App Token"; $form->add(TextField::name('name')->label('Name')->help("A nickname for this token such as the name the computer it's running on or the machine it's intended to control.")); return $form; }
/** * @param $queue Queue * @return Form */ public function _createQueueForm($queue) { $form = new Form(); $form->add(TextField::name('name')->label('Name')->help('What is the name of this queue?')->required(true)->value($queue->get('name'))); return $form; }
/** * @param $file StorageInterface * @param $queue_id int * @return Form */ private function _createJobForm($file, $queue_id) { //load up our queues. $queues = User::$me->getQueues()->getAll(); $qs = array(); foreach ($queues as $row) { /* @var $q Queue */ $q = $row['Queue']; $qs[$q->id] = $q->getName(); } $form = new Form(); $form->add(DisplayField::name('file_name')->label('File')->help('The file that will be printed.')->value($file->getLink())); $form->add(SelectField::name('queue_id')->label('Queue')->help('Which queue are you adding this job to?')->required(true)->options($qs)->value($queue_id)); $form->add(TextField::name('quantity')->label('Quantity')->help('How many copies? Minimum 1, Maximum 100')->required(true)->value(1)); $form->add(CheckboxField::name('priority')->label('Is this a priority job?')->help('Check this box to push this job to the top of the queue')->checked(false)); return $form; }
/** * @param $consumer OAuthConsumer * @return Form */ private function _AppConsumerForm($consumer) { $form = new Form(); $form->action = $consumer->getUrl() . "/edit"; $form->submitText = "Save"; $form->add(TextField::name('name')->label('Name')->value($consumer->getName())->required(true)->help("What do you call your app?")); $form->add(TextField::name('url')->label('App URL / Website')->value($consumer->get('app_url'))->help("Homepage with more information about your app.")); return $form; }