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


PHP Wizard::disableWizardMode方法代码示例

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


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

示例1: edit

 public function edit()
 {
     $this->assertLoggedIn();
     $this->set('area', 'bots');
     try {
         //how do we find them?
         if ($this->args('id')) {
             $bot = new Bot($this->args('id'));
         } else {
             throw new Exception("Could not find that bot.");
         }
         //did we really get someone?
         if (!$bot->isHydrated()) {
             throw new Exception("Could not find that bot.");
         }
         if (!$bot->isMine()) {
             throw new Exception("You cannot view that bot.");
         }
         $this->setTitle('Edit Bot - ' . $bot->getName());
         $wizard = new Wizard('bot', $this->args());
         if (!$this->args('setup')) {
             $wizard->disableWizardMode();
         }
         // Create our forms
         $infoForm = $this->_createInfoForm($bot);
         $queuesForm = $this->_createQueueForm($bot);
         $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')) {
//.........这里部分代码省略.........
开发者ID:eric116,项目名称:BotQueue,代码行数:101,代码来源:bot_edit.php


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