Exemplo n.º 1
0
 public function dobatcheditAction()
 {
     list($word, $checkAll) = $this->getInput(array('word', 'checkall'), 'post');
     if ($checkAll) {
         $wordService = $this->_getWordService();
         $word['replace'] = $this->_getWordDS()->isReplaceWord($word['type']) ? $word['replace'] ? $word['replace'] : '****' : '';
         $this->_getWordDS()->updateAllByTypeAndRelpace($word['type'], $word['replace']);
         $this->showMessage('success');
     }
     $ids = $word['ids'] ? explode(',', $word['ids']) : array();
     $ids = array_unique($ids);
     if (empty($ids) || !is_array($ids)) {
         $this->showError('operate.fail');
     }
     $wordService = $this->_getWordService();
     if ($this->_getWordDS()->isReplaceWord($word['type']) && !$word['replace']) {
         $this->showError('WORD:replaceword.empty');
     }
     Wind::import('SRV:word.dm.PwWordDm');
     $dm = new PwWordDm();
     /* @var $dm PwWordDm */
     $dm->setWordType($word['type'] ? $word['type'] : 1);
     $word['replace'] && $dm->setWordReplace($word['replace']);
     if (($result = $this->_getWordDS()->batchUpdate($ids, $dm)) instanceof PwError) {
         $this->showError($result->getError());
     }
     $this->_getWordFilter()->updateCache();
     $this->showMessage('success');
 }