Exemplo n.º 1
0
 public function deleteZone($domain, Modules_SlaveDnsManager_Slave $slave = null)
 {
     $slaves = null === $slave ? Modules_SlaveDnsManager_Slave::getList() : [$slave];
     foreach ($slaves as $slave) {
         $this->_call($slave, "delzone {$domain}");
     }
 }
 public function removeAction()
 {
     $configs = $this->_getParam('config');
     if (!$configs || !is_array($configs)) {
         $this->_status->addMessage('error', $this->lmsg('emptySelection'));
         $this->_redirect('/');
     }
     foreach ($configs as $config) {
         try {
             $slave = new Modules_SlaveDnsManager_Slave($config);
             $slave->remove();
             $this->_status->addMessage('info', $this->lmsg('slaveRemoved'));
         } catch (pm_Exception $e) {
             $this->_status->addMessage('error', $e->getMessage());
         }
     }
     $this->_redirect('/');
 }
Exemplo n.º 3
0
 public function __construct(Zend_View $view, Zend_Controller_Request_Abstract $request)
 {
     parent::__construct($view, $request);
     $data = array();
     foreach (Modules_SlaveDnsManager_Slave::getList() as $slave) {
         try {
             $rndc = new Modules_SlaveDnsManager_Rndc();
             $details = $rndc->checkStatus($slave);
             $icon = 'ok';
         } catch (Exception $e) {
             $details = $e->getMessage();
             $icon = 'warning';
         }
         $ip = $view->escape((string) $slave->getIp());
         $config = $view->escape((string) $slave->getConfig());
         $data[] = array('select' => '<input type="checkbox" class="checkbox" name="listCheckbox[]" value="' . $config . '"/>', 'status' => '<img class="slave-status" src="/theme/icons/16/plesk/' . $icon . '.png" title="' . $view->escape($details) . '"/>', 'config' => '<a href="' . $view->getHelper('baseUrl')->moduleUrl(array('action' => 'view')) . '?config=' . $config . '">' . $ip . '</a>');
     }
     $this->setData($data);
     $this->setColumns(array('select' => array('title' => '<input type="checkbox" class="checkbox" name="listGlobalCheckbox"/>', 'sortable' => false, 'noEscape' => true), 'status' => array('title' => $this->lmsg('statusColumnTitle'), 'noEscape' => true), 'config' => array('title' => $this->lmsg('configColumnTitle'), 'noEscape' => true)));
     $this->setTools(array(array('title' => $this->lmsg('addToolTitle'), 'description' => $this->lmsg('addToolDescription'), 'class' => 'sb-add-new', 'link' => $view->getHelper('baseUrl')->moduleUrl(array('action' => 'add'))), array('title' => $this->lmsg('refreshToolTitle'), 'description' => $this->lmsg('refreshToolDescription'), 'class' => 'sb-refresh', 'link' => pm_Context::getBaseUrl()), array('title' => $this->lmsg('removeToolTitle'), 'description' => $this->lmsg('removeToolDescription'), 'class' => 'sb-remove-selected', 'link' => 'javascript:removeSlaves()')));
     $this->setDataUrl(array('action' => 'list-data'));
 }
Exemplo n.º 4
0
 public function process()
 {
     $slave = new Modules_SlaveDnsManager_Slave();
     $slave->save($this->getValues());
 }