当前位置: 首页>>代码示例>>PHP>>正文


PHP Wizard::isFinished方法代码示例

本文整理汇总了PHP中Wizard::isFinished方法的典型用法代码示例。如果您正苦于以下问题:PHP Wizard::isFinished方法的具体用法?PHP Wizard::isFinished怎么用?PHP Wizard::isFinished使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Wizard的用法示例。


在下文中一共展示了Wizard::isFinished方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: edit


//.........这里部分代码省略.........
         $slicingForm = $this->_createSlicingForm($bot);
         $driverForm = $this->_createDriverForm($bot);
         // Add them to the wizard
         $wizard->add("Information / Details", $infoForm);
         $wizard->add("Queues", $queuesForm);
         $wizard->add("Slicing Setup", $slicingForm);
         $wizard->add("Driver Configuration", $driverForm);
         //handle our forms
         if ($infoForm->checkSubmitAndValidate($this->args())) {
             $bot->set('name', $infoForm->data('name'));
             $bot->set('manufacturer', $infoForm->data('manufacturer'));
             $bot->set('model', $infoForm->data('model'));
             $bot->set('electronics', $infoForm->data('electronics'));
             $bot->set('firmware', $infoForm->data('firmware'));
             $bot->set('extruder', $infoForm->data('extruder'));
             $bot->save();
             Activity::log("edited the information for bot " . $bot->getLink() . ".");
         } else {
             if ($queuesForm->checkSubmitAndValidate($this->args())) {
                 $sql = "DELETE FROM bot_queues WHERE bot_id = ?";
                 db()->execute($sql, array($bot->id));
                 $priority = 1;
                 $used = array();
                 foreach ($this->args() as $key => $value) {
                     if (substr($key, 0, 6) === "queue-" && $value != 0) {
                         if (in_array($value, $used)) {
                             continue;
                         } else {
                             $used[] = $value;
                         }
                         $sql = "INSERT INTO bot_queues VALUES(?, ?, ?)";
                         $data = array($value, $bot->id, $priority);
                         $priority++;
                         db()->execute($sql, $data);
                     }
                 }
             } else {
                 if ($slicingForm->checkSubmitAndValidate($this->args())) {
                     $bot->set('slice_engine_id', $slicingForm->data('slice_engine_id'));
                     $bot->set('slice_config_id', $slicingForm->data('slice_config_id'));
                     $config = $bot->getDriverConfig();
                     $config->can_slice = (bool) $slicingForm->data('can_slice');
                     $bot->set('driver_config', json::encode($config));
                     $bot->save();
                     Activity::log("edited the slicing info for bot " . $bot->getLink() . ".");
                 } else {
                     if ($driverForm->checkSubmitAndValidate($this->args())) {
                         $bot->set('oauth_token_id', $driverForm->data('oauth_token_id'));
                         $bot->set('driver_name', $driverForm->data('driver_name'));
                         //create and save our config
                         $config = $bot->getDriverConfig();
                         $config->driver = $bot->get('driver_name');
                         if ($bot->get('driver_name') == 'dummy') {
                             if ($this->args('delay')) {
                                 $config->delay = $this->args('delay');
                             }
                         } elseif ($bot->get('driver_name') == 'printcore' || $bot->get('driver_name') == 's3g') {
                             $config->port = $this->args('serial_port');
                             $config->port_id = $this->args('port_id');
                             $config->baud = $this->args('baudrate');
                         }
                         //did we get webcam info?
                         if ($this->args('webcam_device')) {
                             if (!isset($config->webcam)) {
                                 $config->webcam = new stdClass();
                             }
                             $config->webcam->device = $this->args('webcam_device');
                             if ($this->args('webcam_id')) {
                                 $config->webcam->id = $this->args('webcam_id');
                             }
                             if ($this->args('webcam_name')) {
                                 $config->webcam->name = $this->args('webcam_name');
                             }
                             if ($this->args('webcam_brightness')) {
                                 $config->webcam->brightness = (int) $this->args('webcam_brightness');
                             }
                             if ($this->args('webcam_contrast')) {
                                 $config->webcam->contrast = (int) $this->args('webcam_contrast');
                             }
                         } else {
                             unset($config->webcam);
                         }
                         //save it all to the bot as json.
                         $bot->set('driver_config', json::encode($config));
                         $bot->save();
                         Activity::log("edited the driver configuration for bot " . $bot->getLink() . ".");
                     }
                 }
             }
         }
         if ($wizard->isFinished()) {
             $this->forwardToURL($bot->getUrl());
         }
         $this->set('bot_id', $bot->id);
         $this->set('wizard', $wizard);
     } catch (Exception $e) {
         $this->set('megaerror', $e->getMessage());
         $this->setTitle("Bot Edit - Error");
     }
 }
开发者ID:eric116,项目名称:BotQueue,代码行数:101,代码来源:bot_edit.php


注:本文中的Wizard::isFinished方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。