예제 #1
0
             $interactQuery->setEnable(init('enable'));
             $interactQuery->save();
         }
     }
     ajax::success();
 }
 if (init('action') == 'execute') {
     ajax::success(interactQuery::tryToReply(init('query')));
 }
 if (init('action') == 'test') {
     $return = array();
     $interactQuery = interactQuery::recognize(init('query'));
     if ($interactQuery == null) {
         ajax::success(array('interactQuery' => null));
     }
     $interactDef = interactDef::byId($interactQuery->getInteractDef_id());
     $return['interactQuery'] = utils::o2a($interactQuery);
     if ($interactQuery->getLink_type() == 'cmd') {
         $return['cmd'] = '';
         foreach (explode('&&', $interactQuery->getLink_id()) as $cmd_id) {
             $cmd = cmd::byId($cmd_id);
             if (is_object($cmd)) {
                 $return['cmd'] .= '#' . $cmd->getHumanName() . '# && ';
             }
         }
         $return['cmd'] = trim($return['cmd'], '&& ');
         $reply = $interactDef->selectReply();
         if (trim($reply) == '') {
             $reply = interactQuery::replyOk();
         }
         $return['reply'] = $reply;
예제 #2
0
 public function getInteractDef()
 {
     return interactDef::byId($this->interactDef_id);
 }
예제 #3
0
     if (!isset($interact) || !is_object($interact)) {
         $interact = new interactDef();
     }
     utils::a2o($interact, $interact_json);
     $interact->save();
     ajax::success(utils::o2a($interact));
 }
 if (init('action') == 'regenerateInteract') {
     interactDef::regenerateInteract();
     ajax::success();
 }
 if (init('action') == 'remove') {
     if (!isConnect('admin')) {
         throw new Exception(__('401 - Accès non autorisé', __FILE__));
     }
     $interact = interactDef::byId(init('id'));
     if (!is_object($interact)) {
         throw new Exception(__('Interaction inconnu verifié l\'id', __FILE__));
     }
     $interact->remove();
     ajax::success();
 }
 if (init('action') == 'changeState') {
     $interactQuery = interactQuery::byId(init('id'));
     if (!is_object($interactQuery)) {
         throw new Exception(__('InteractQuery ID inconnu', __FILE__));
     }
     $interactQuery->setEnable(init('enable'));
     $interactQuery->save();
     ajax::success();
 }