public function actionShowScreen($user, $message) { $remote = new GoAutodialRemote(); $res = $remote->sendNote($user, $message); if (stripos($res, "SUCCESS") !== false) { Yii::app()->user->setFlash("success", "Message sent"); if (Yii::app()->request->isAjaxRequest) { header("Content-Type: application/json"); echo new SuccessJsonResponse(); Yii::app()->end(); } else { $this->redirect(array('site/index')); } } else { if (stripos($res, "ERROR") !== false) { Yii::app()->user->setFlash("error", "Cant send message"); if (Yii::app()->request->isAjaxRequest) { header("Content-Type: application/json"); echo new FailedJsonResponse(); Yii::app()->end(); } else { $this->redirect(array('site/index')); } } } }
public function actionAgent($agent) { $remote = new GoAutodialRemote(); $res = $remote->hungUp($agent); if (stripos($res, "SUCCESS") !== false) { Yii::app()->user->setFlash("success", "Success"); if (Yii::app()->request->isAjaxRequest) { header("Content-Type: application/json"); echo new SuccessJsonResponse(); Yii::app()->end(); } else { $this->redirect(array('site/index')); } } else { if (stripos($res, "ERROR") !== false) { Yii::app()->user->setFlash("error", "Action failed"); if (Yii::app()->request->isAjaxRequest) { header("Content-Type: application/json"); echo new FailedJsonResponse(); Yii::app()->end(); } else { $this->redirect(array('site/index')); } } } }
public function actionChangePauseCode($user_agent, $pause_code) { $remote = new GoAutodialRemote(); $res = $remote->changePauseCode($agent, "pause_code", $pause_code); if (stripos($res, "SUCCESS") !== false) { Yii::app()->user->setFlash("success", "Pause code updated"); if (Yii::app()->request->isAjaxRequest) { header("Content-Type: application/json"); echo new SuccessJsonResponse(); Yii::app()->end(); } else { $this->redirect(array('site/index')); } } else { if (stripos($res, "ERROR") !== false) { Yii::app()->user->setFlash("error", "Pause code update failed"); if (Yii::app()->request->isAjaxRequest) { header("Content-Type: application/json"); echo new FailedJsonResponse(); Yii::app()->end(); } else { $this->redirect(array('site/index')); } } } }
public function actionAgent($agent) { $remote = new GoAutodialRemote(); $remote->disconnectAll($agent); if (stripos($res, "SUCCESS") !== false) { Yii::app()->user->setFlash("success", "All Agents are logged out"); } else { if (stripos($res, "ERROR") !== false) { Yii::app()->user->setFlash("error", "'Logout all' action failed"); } } $this->redirect(array('site/index')); }