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


PHP AjaxResponse::addData方法代码示例

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


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

示例1: actionDrop

 /**
  * Drops trigger.
  */
 public function actionDrop()
 {
     // Get post vars
     $triggerName = Yii::app()->request->getPost('trigger');
     $response = new AjaxResponse();
     try {
         $trigger = Trigger::model()->findByPk(array('TRIGGER_SCHEMA' => $this->schema, 'TRIGGER_NAME' => $triggerName));
         $sql = $trigger->delete();
         $response->addNotification('success', Yii::t('core', 'successDropTrigger', array('{trigger}' => $trigger->TRIGGER_NAME)), null, $sql);
         $response->addData('success', true);
     } catch (DbException $ex) {
         $response->addNotification('error', Yii::t('core', 'errorDropTrigger', array('{trigger}' => $triggerName)), $ex->getText(), $ex->getSql());
         $response->addData('success', false);
     }
     $this->sendJSON($response);
 }
开发者ID:cebe,项目名称:chive,代码行数:19,代码来源:TriggerController.php

示例2: actionDrop

 public function actionDrop()
 {
     // Get post vars
     $indexName = Yii::app()->request->getPost('index');
     $response = new AjaxResponse();
     try {
         $index = Index::model()->findByAttributes(array('TABLE_SCHEMA' => $this->schema, 'TABLE_NAME' => $this->table, 'INDEX_NAME' => $indexName));
         $index->throwExceptions = true;
         $sql = $index->delete();
         $response->addNotification('success', Yii::t('core', 'successDropIndex', array('{index}' => $index->INDEX_NAME)), null, $sql);
         $response->addData('success', true);
     } catch (DbException $ex) {
         $response->addNotification('error', Yii::t('core', 'errorDropIndex', array('{index}' => $indexName)), $ex->getText(), $ex->getSql());
         $response->addData('success', false);
     }
     $this->sendJSON($response);
 }
开发者ID:cebe,项目名称:chive,代码行数:17,代码来源:IndexController.php

示例3: runImport

 public function runImport()
 {
     $response = new AjaxResponse();
     $response->refresh = true;
     $response->executeJavaScript('sideBar.loadTables("' . $this->schema . '")');
     $this->mimeType = CFileHelper::getMimeType($this->file);
     $filesize = filesize($this->file);
     // Open file and set position to last position
     switch ($this->mimeType) {
         // GZip - Files
         case 'application/x-gzip':
             $handle = gzopen($this->file, 'r');
             $content = gzread($handle, $filesize);
             gzclose($handle);
             break;
             // BZip - Files
         // BZip - Files
         case 'application/x-bzip2':
             $handle = bzopen($this->file, 'r');
             $content = bzread($handle, $filesize);
             bzclose($handle);
             break;
             // All other files (plain text)
         // All other files (plain text)
         default:
             $content = file_get_contents($this->file);
             break;
     }
     $sqlSplitter = new SqlSplitter($content);
     $queries = $sqlSplitter->getQueries();
     foreach ($queries as $query) {
         try {
             $cmd = $this->db->createCommand($query);
             # Do NOT prepare the statement, because of double quoting
             $cmd->execute();
         } catch (CDbException $ex) {
             $dbException = new DbException($cmd);
             if (!in_array(@$dbException->getNumber(), $this->ignoreErrorNumbers)) {
                 $dbException = new DbException($cmd);
                 $response->addNotification('error', Yii::t('core', 'errorExecuteQuery'), $dbException->getText() . '  ' . $dbException->getNumber(), StringUtil::cutText($dbException->getSql(), 100));
                 $response->addData('error', true);
                 $response->refresh = true;
                 @unlink($this->file);
                 return $response;
             }
         }
     }
     $response->addNotification('success', Yii::t('core', 'successImportFile'), Yii::t('core', 'executedQueries') . ":" . count($queries));
     // We cannot output json here, see: http://jquery.malsup.com/form/#file-upload
     Yii::app()->end($response);
 }
开发者ID:cebe,项目名称:chive,代码行数:51,代码来源:ImportPage.php


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