Ejemplo n.º 1
0
 public function formAction()
 {
     // Display simple text in view
     $this->view->test = 'This is index action for testing module.';
     // Init form here
     $form = new pm_Form_Simple();
     $form->addElement('text', 'exampleText', array('label' => 'Example Text', 'value' => pm_Settings::get('exampleText'), 'required' => true, 'validators' => array(array('NotEmpty', true))));
     $form->addElement('password', 'examplePassword', array('label' => 'Example Password', 'value' => '', 'description' => 'Password: '******'examplePassword'), 'validators' => array(array('StringLength', true, array(5, 255)))));
     $form->addElement('textarea', 'exampleTextarea', array('label' => 'Example TextArea', 'value' => pm_Settings::get('exampleTextarea'), 'class' => 'f-middle-size', 'rows' => 4, 'required' => true, 'validators' => array(array('StringLength', true, array(0, 255)))));
     $form->addElement('simpleText', 'exampleSimpleText', array('label' => 'Example SimpleText', 'escape' => false, 'value' => '<a href="#">Link</a>'));
     $form->addElement('select', 'exampleSelect', array('label' => 'Example Select', 'multiOptions' => array('opt-0' => 'Option 0', 'opt-1' => 'Option 1'), 'value' => pm_Settings::get('exampleSelect'), 'required' => true));
     $form->addElement('radio', 'exampleRadio', array('label' => 'Example Radio', 'multiOptions' => array('opt-0' => 'Option 0', 'opt-1' => 'Option 1'), 'value' => pm_Settings::get('exampleRadio'), 'required' => true));
     $form->addElement('checkbox', 'exampleCheckbox', array('label' => 'Example Checkbox', 'value' => pm_Settings::get('exampleCheckbox')));
     $form->addElement('hidden', 'exampleHidden', array('value' => 'example'));
     $form->addControlButtons(array('cancelLink' => pm_Context::getModulesListUrl()));
     if ($this->getRequest()->isPost() && $form->isValid($this->getRequest()->getPost())) {
         // Form proccessing here
         pm_Settings::set('exampleText', $form->getValue('exampleText'));
         if ($form->getValue('examplePassword')) {
             pm_Settings::set('examplePassword', $form->getValue('examplePassword'));
         }
         pm_Settings::set('exampleTextarea', $form->getValue('exampleTextarea'));
         pm_Settings::set('exampleSelect', $form->getValue('exampleSelect'));
         pm_Settings::set('exampleRadio', $form->getValue('exampleRadio'));
         pm_Settings::set('exampleCheckbox', $form->getValue('exampleCheckbox'));
         $this->_status->addMessage('info', 'Data was successfully saved.');
         $this->_helper->json(array('redirect' => pm_Context::getBaseUrl()));
     }
     $this->view->form = $form;
 }
Ejemplo n.º 2
0
 public function init()
 {
     $this->addElement('description', 'description', array('description' => 'You can protect statistics information or make it public available.'));
     $useAuth = (bool) pm_Settings::get('useAuth');
     $this->addElement('checkbox', 'useAuth', array('label' => 'Protect access using auth token', 'value' => $useAuth));
     $authToken = pm_Settings::get('authToken');
     $this->addElement('text', 'authToken', array('label' => 'Auth token', 'value' => $authToken));
     $authToken = $useAuth ? $authToken : '';
     $baseUrl = pm_Context::getBaseUrl() . "public/?authToken={$authToken}";
     $this->addElement('simpleText', 'link_xml', array('label' => 'Statistics in XML format', 'escape' => false, 'value' => "<a href='{$baseUrl}&format=xml' target='_blank'>Link</a>"));
     $this->addElement('simpleText', 'link_json', array('label' => 'Statistics in JSON format', 'escape' => false, 'value' => "<a href='{$baseUrl}&format=json' target='_blank'>Link</a>"));
     $this->addElement('simpleText', 'link_plain', array('label' => 'Statistics in plain text format', 'escape' => false, 'value' => "<a href='{$baseUrl}&format=plain' target='_blank'>Link</a>"));
     $this->addControlButtons(array('cancelHidden' => true));
 }
Ejemplo n.º 3
0
 public function getButtonUrl()
 {
     return pm_Settings::get('news_link');
 }
Ejemplo n.º 4
0
<?php

require_once 'pm/Loader.php';
pm_Loader::registerAutoload();
pm_Bootstrap::init();
pm_Context::init('panel-stats');
if (pm_Settings::get('useAuth') && @$_GET['authToken'] != pm_Settings::get('authToken')) {
    die('Invalid auth token supplied.');
}
$reporter = new Modules_PanelStats_Reporter();
$format = isset($_GET['format']) ? $_GET['format'] : 'xml';
if ('plain' == $format) {
    echo $reporter->getResultsPlain();
} else {
    if ('json' == $format) {
        header("Content-Type: application/json");
        echo $reporter->getResultsJson();
    } else {
        header("Content-Type: text/xml");
        echo $reporter->getResultsXml();
    }
}
Ejemplo n.º 5
0
<?php

pm_Context::init('example');
$id = pm_Settings::get('customButtonId');
$request = <<<APICALL
<ui>
    <delete-custombutton>
        <filter>
            <custombutton-id>{$id}</custombutton-id>
        </filter>
    </delete-custombutton>
</ui>
APICALL;
try {
    $response = pm_ApiRpc::getService()->call($request);
    $result = $response->ui->{"delete-custombutton"}->result;
    if (true || 'ok' == $result->status) {
        echo "done\n";
        exit(0);
    } else {
        echo "error {$result->errcode}: {$result->errtext}\n";
        exit(1);
    }
} catch (PleskAPIParseException $e) {
    echo $e->getMessage() . "\n";
    exit(1);
}
Ejemplo n.º 6
0
<?php

pm_Context::init('panel-news');
$taskId = pm_Settings::get('periodic_task_id');
$task = pm_Scheduler::getInstance()->getTaskById($taskId);
pm_Scheduler::getInstance()->removeTask($task);