LoginForm is the data structure for keeping user login form data. It is used by the 'login' action of 'SiteController'.
Inheritance: extends User
Example #1
0
 public function load()
 {
     $this->headline = $GLOBALS['language']->getString("SETTINGS") . " (" . $GLOBALS['language']->getString("FOLDER") . ")";
     $settings = new SettingsForm();
     $settings->role = 3;
     $settings->template = "plugin_settingswidget_widget";
     if (isset($_SESSION['dir'])) {
         $settings->dir = $_SESSION['dir'];
     }
     if (isset($_GET['dir'])) {
         $settings->url = UrlRewriting::GetUrlByAlias($_GET['include'], "dir=" . $_GET['dir']);
     } else {
         $settings->url = UrlRewriting::GetUrlByAlias($_GET['include']);
     }
     if (isset($_GET['areatype'])) {
         $settings->areaType = $_GET['areatype'];
     }
     if (isset($_GET['area'])) {
         $settings->area = $_GET['area'];
     }
     if (isset($_GET['role'])) {
         $settings->role = $_GET['role'];
     }
     $this->content = $settings->getCode();
 }
Example #2
0
 public function actionIndex()
 {
     if (!Yii::app()->user->checkAccess('store.update')) {
         $this->redirect(array('site/ErrorException', 'err_no' => 403));
     }
     $settings = Yii::app()->settings;
     $model = new SettingsForm();
     if (isset($_POST['SettingsForm'])) {
         $model->setAttributes($_POST['SettingsForm']);
         $settings->deleteCache();
         foreach ($model->attributes as $category => $values) {
             $settings->set($category, $values);
         }
         Yii::app()->user->setFlash('success', '<strong>Well done!</strong> Site settings were updated..');
         $this->refresh();
     }
     foreach ($model->attributes as $category => $values) {
         $cat = $model->{$category};
         foreach ($values as $key => $val) {
             $cat[$key] = $settings->get($category, $key);
         }
         $model->{$category} = $cat;
     }
     $this->render('index', array('model' => $model));
 }
Example #3
0
 public function actionIndex()
 {
     $settings = Yii::app()->settings;
     $model = new SettingsForm();
     if (isset($_POST['SettingsForm'])) {
         $model->setAttributes($_POST['SettingsForm']);
         $settings->deleteCache();
         foreach ($model->attributes as $category => $values) {
             if ($category === 'logo') {
                 continue;
             }
             $settings->set($category, $values);
         }
         Yii::app()->user->setFlash('success', 'Site settings were updated.');
         $this->refresh();
     }
     foreach ($model->attributes as $category => $values) {
         if ($category === 'logo') {
             continue;
         }
         $cat = $model->{$category};
         foreach ($values as $key => $val) {
             $cat[$key] = $settings->get($category, $key);
         }
         $model->{$category} = $cat;
     }
     $this->render('index', array('model' => $model));
 }
Example #4
0
 public function actionIndex()
 {
     $settings = Yii::app()->settings;
     // 多个客户端同时操作时,每个客户端的缓存不一致,导致数据不一致,
     // 故删除cache, 统一从数据库取数据
     $settings->deleteCache();
     $model = new SettingsForm();
     if (isset($_POST['SettingsForm'])) {
         $model->setAttributes($_POST['SettingsForm']);
         //$settings->deleteCache();
         foreach ($model->attributes as $category => $values) {
             $settings->set($category, $values);
         }
         Yii::app()->user->setFlash('success', 'Site settings were updated.');
         $this->refresh();
     }
     foreach ($model->attributes as $category => $values) {
         $cat = $model->{$category};
         foreach ($values as $key => $val) {
             $cat[$key] = $settings->get($category, $key);
         }
         $model->{$category} = $cat;
     }
     $this->render('index', array('model' => $model));
 }
Example #5
0
 public function actionUpdate($id)
 {
     $model = new SettingsForm();
     if (isset($_POST['SettingsForm'])) {
         $model->attributes = $_POST['SettingsForm'];
         if ($model->validate() && $model->save()) {
             $this->redirect(array('index'));
         }
     } else {
         $model->loadDataFromStore($id);
     }
     $directories = glob(Yii::getPathOfAlias('webroot.themes') . "/*", GLOB_ONLYDIR);
     $themes = array();
     foreach ($directories as $directory) {
         $themes[] = basename($directory);
     }
     $layouts = CHtml::listData(Layout::model()->findAll(), 'layout_id', 'name');
     $countries = CHtml::listData(Country::model()->findAll(), 'country_id', 'name');
     $zones = CHtml::listData(Zone::model()->findAllByAttributes(array('country_id' => $model->country)), 'zone_id', 'name');
     $languages = CHtml::listData(Language::model()->findAll(), 'language_id', 'name');
     $currencies = CHtml::listData(Currency::model()->findAll(), 'currency_id', 'title');
     $yesNoOptions = array(0 => Yii::t('settings', 'No'), 1 => Yii::t('settings', 'Yes'));
     $lengthClasses = CHtml::listData(LengthClassDescription::model()->findAll(), 'length_class_id', 'title');
     $weightClasses = CHtml::listData(WeightClassDescription::model()->findAll(), 'weight_class_id', 'title');
     $taxesOptions = array("" => Yii::t("settings", "--- None ---"), "shipping" => Yii::t("settings", "Shipping Address"), "payment" => Yii::t("settings", "Payment Address"));
     $customerGroups = CHtml::listData(CustomerGroupDescription::model()->findAll(), 'customer_group_id', 'name');
     $informations = array_merge(array(0 => Yii::t("settings", "--- None ---")), CHtml::listData(InformationDescription::model()->findAll(), 'information_id', 'title'));
     // TODO: localisation
     $orderStatuses = CHtml::listData(OrderStatus::model()->findAllByAttributes(array('language_id' => 1)), 'order_status_id', 'name');
     // TODO: localisation
     $returnStatuses = CHtml::listData(ReturnStatus::model()->findAllByAttributes(array('language_id' => 1)), 'return_status_id', 'name');
     $mailProtocols = array("mail" => Yii::t("settings", "Mail"), "smtp" => Yii::t("settings", "SMTP"));
     $this->render('update', array('model' => $model, 'themes' => $themes, 'layouts' => $layouts, 'countries' => $countries, 'zones' => $zones, 'languages' => $languages, 'currencies' => $currencies, 'yesNoOptions' => $yesNoOptions, 'lengthClasses' => $lengthClasses, 'weightClasses' => $weightClasses, 'taxesOptions' => $taxesOptions, 'customerGroups' => $customerGroups, 'informations' => $informations, 'orderStatuses' => $orderStatuses, 'returnStatuses' => $returnStatuses, 'mailProtocols' => $mailProtocols));
 }
 public function SettingsForm()
 {
     $form = new SettingsForm($this, 'SettingsForm');
     $member_id = Member::currentUserID();
     $back_url = isset($_POST['RedirectURL']) ? $_POST['RedirectURL'] : $_GET['RedirectURL'];
     $form->loadDataFrom(array("MemberID" => $member_id, "RedirectURL" => $back_url));
     return $form;
 }
Example #7
0
 /**
  * Default action
  */
 public function index()
 {
     $form = new SettingsForm($this);
     if (!empty($_POST) && $form->isValid($_POST)) {
         $data = $form->getValues();
         OW::getConfig()->saveConfig('blogs', 'results_per_page', $data['results_per_page']);
     }
     $this->addForm($form);
 }
Example #8
0
 /**
  * Default action
  */
 public function index()
 {
     $form = new SettingsForm($this);
     if (!empty($_POST) && $form->isValid($_POST)) {
         $data = $form->getValues();
         OW::getConfig()->saveConfig('links', 'results_per_page', $data['results_per_page']);
         OW::getConfig()->saveConfig('links', 'result_mode', $data['mode']);
         OW::getFeedback()->info(OW::getLanguage()->text('links', 'updated'));
         $this->redirect(OW::getRouter()->getBaseUrl() . OW::getRouter()->getUri());
     }
     $this->addForm($form);
 }
Example #9
0
    public function display()
    {
        $settings = new SettingsForm();
        $settings->role = 3;
        $settings->url = UrlRewriting::GetUrlByAlias($_GET['include']);
        if (isset($_GET['areatype'])) {
            $settings->areaType = $_GET['areatype'];
        }
        if (isset($_GET['area'])) {
            $settings->area = $_GET['area'];
        }
        if (isset($_GET['role'])) {
            $settings->role = $_GET['role'];
        }
        $settings->display();
        ?>
        <div style="margin-left:500px;">
        <h2>Skins</h2>
      <?php 
        $skins = DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}skins WHERE LOWER(name) IN (SELECT DISTINCT name FROM {'dbprefix'}settings WHERE areaType = 'skins' AND area = {'dbprefix'}skins.name)");
        if ($skins) {
            foreach ($skins as $skin) {
                $url = UrlRewriting::GetUrlByAlias("admin/settings", "areatype=skins&area=" . urlencode($skin->name));
                echo "<a href=\"" . $url . "\">" . $skin->name . "</a><br />";
            }
        }
        ?>
        <h2>Plugins</h2>
      <?php 
        $plugins = new PluginList();
        $plugins->loadAll();
        foreach ($plugins->plugins as $plugin) {
            if ($plugin->configurationFile != '') {
                $url = UrlRewriting::GetUrlByAlias("admin/pluginsettings", "plugin=" . $plugin->path);
                ?>
              <a href="<?php 
                echo $url;
                ?>
"><?php 
                echo $plugin->name;
                ?>
</a><br />
            <?php 
            }
        }
        ?>
        </div>
      <?php 
    }
 public function actionSettings()
 {
     $model = new SettingsForm();
     // collect user input data
     if (isset($_POST['SettingsForm'])) {
         if ($_POST['SettingsForm']['BITLY_API_KEY'] && $_POST['SettingsForm']['BITLY_LOGIN']) {
             $model->setScenario('validate_bitly');
         }
         $model->attributes = $_POST['SettingsForm'];
         if ($model->validate()) {
             $model->save();
         }
     }
     $this->render('settings', array('formModel' => $model));
 }
 function manage($verb, $args)
 {
     if (parent::manage($verb, $args)) {
         return true;
     }
     if (!$this->getEnabled()) {
         return false;
     }
     switch ($verb) {
         case 'settings':
             $journal =& Request::getJournal();
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, null, 'plugins');
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             break;
         default:
             return false;
     }
     return true;
 }
/**
 * Shows the settings page for the plugin, shown just for the network page.
 */
function WPCW_showPage_Settings_Network_load()
{
    $page = new PageBuilder(true);
    $page->showPageHeader(__('WP Courseware - Settings', 'wp_courseware'), '75%', WPCW_icon_getPageIconURL());
    $settingsFields = array('section_access_key' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML(__('Licence Key Settings', 'wp_courseware'), false, true)), 'licence_key' => array('label' => __('Licence Key', 'wp_courseware'), 'type' => 'text', 'desc' => __('Your licence key for the WP Courseware plugin.', 'wp_courseware'), 'validate' => array('type' => 'string', 'maxlen' => 32, 'minlen' => 32, 'regexp' => '/^[A-Za-z0-9]+$/', 'error' => __('Please enter your 32 character licence key, which contains only letters and numbers.', 'wp_courseware'))));
    $settings = new SettingsForm($settingsFields, WPCW_DATABASE_SETTINGS_KEY, 'wpcw_form_settings_general');
    // Set strings and messages
    $settings->setAllTranslationStrings(WPCW_forms_getTranslationStrings());
    $settings->setSaveButtonLabel('Save ALL Settings', 'wp_courseware');
    // Form event handlers - processes the saved settings in some way
    $settings->afterSaveFunction = 'WPCW_showPage_Settings_afterSave';
    $settings->show();
    // RHS Support Information
    $page->showPageMiddle('23%');
    WPCW_docs_showSupportInfo($page);
    WPCW_docs_showSupportInfo_News($page);
    WPCW_docs_showSupportInfo_Affiliate($page);
    $page->showPageFooter();
}
/**
 * Show the page where the user can set up the certificate settings. 
 */
function WPCW_showPage_Certificates_load()
{
    $page = new PageBuilder(true);
    $page->showPageHeader(__('Training Courses - Certificate Settings', 'wp_courseware'), '75%', WPCW_icon_getPageIconURL());
    $settingsFields = array('section_certificates_defaults' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML(__('Certificate Settings', 'wp_courseware'))), 'cert_signature_type' => array('label' => __('Signature Type', 'wp_courseware'), 'type' => 'radio', 'cssclass' => 'wpcw_cert_signature_type', 'required' => 'true', 'data' => array('text' => sprintf('<b>%s</b> - %s', __('Text', 'wp_courseware'), __('Just use text for the signature.', 'wp_courseware')), 'image' => sprintf('<b>%s</b> - %s', __('Image File', 'wp_courseware'), __('Use an image for the signature.', 'wp_courseware')))), 'cert_sig_text' => array('label' => __('Name to use for signature', 'wp_courseware'), 'type' => 'text', 'cssclass' => 'wpcw_cert_signature_type_text', 'desc' => __('The name to use for the signature area.', 'wp_courseware'), 'validate' => array('type' => 'string', 'maxlen' => 150, 'minlen' => 1, 'regexp' => '/^[^<>]+$/', 'error' => __('Please enter the name to use for the signature area.', 'wp_courseware'))), 'cert_sig_image_url' => array('label' => __('Your Signature Image', 'wp_courseware'), 'cssclass' => 'wpcw_image_upload_field wpcw_cert_signature_type_image', 'type' => 'text', 'desc' => '&bull;&nbsp;' . __('The URL of your signature image. Using a transparent image is recommended.', 'wp_courseware') . '<br/>&bull;&nbsp;' . sprintf(__('The image must be <b>%d pixels wide, and %d pixels high</b> to render correctly. ', 'wp_courseware'), WPCW_CERTIFICATE_SIGNATURE_WIDTH_PX * 2, WPCW_CERTIFICATE_SIGNATURE_HEIGHT_PX * 2), 'validate' => array('type' => 'url', 'maxlen' => 300, 'minlen' => 1, 'error' => __('Please enter the URL of your signature image.', 'wp_courseware')), 'extrahtml' => sprintf('<a id="cert_sig_image_url_btn" href="#" class="wpcw_insert_image button-secondary" data-uploader_title="%s" data-uploader_btn_text="%s" data-target="cert_sig_image_url"><span class="wpcw_insert_image_img"></span> %s</a>', __('Choose an image to use for the signature image...', 'wp_courseware'), __('Select Image', 'wp_courseware'), __('Select Image', 'wp_courseware'))), 'cert_logo_enabled' => array('label' => __('Show your logo?', 'wp_courseware'), 'cssclass' => 'wpcw_cert_logo_enabled', 'type' => 'radio', 'required' => 'true', 'data' => array('cert_logo' => sprintf('<b>%s</b> - %s', __('Yes', 'wp_courseware'), __('Use your logo on the certificate.', 'wp_courseware')), 'no_cert_logo' => sprintf('<b>%s</b> - %s', __('No', 'wp_courseware'), __('Don\'t show a logo on the certificate.', 'wp_courseware')))), 'cert_logo_url' => array('label' => __('Your Logo Image', 'wp_courseware'), 'type' => 'text', 'cssclass' => 'wpcw_cert_logo_url wpcw_image_upload_field', 'desc' => '&bull;&nbsp;' . __('The URL of your logo image. Using a transparent image is recommended.', 'wp_courseware') . '<br/>&bull;&nbsp;' . sprintf(__('The image must be <b>%d pixels wide, and %d pixels</b> high to render correctly. ', 'wp_courseware'), WPCW_CERTIFICATE_LOGO_WIDTH_PX * 2, WPCW_CERTIFICATE_LOGO_HEIGHT_PX * 2), 'validate' => array('type' => 'url', 'maxlen' => 300, 'minlen' => 1, 'error' => __('Please enter the URL of your logo image.', 'wp_courseware')), 'extrahtml' => sprintf('<a id="cert_logo_url_btn" href="#" class="wpcw_insert_image button-secondary" data-uploader_title="%s" data-uploader_btn_text="%s" data-target="cert_logo_url"><span class="wpcw_insert_image_img"></span> %s</a>', __('Choose an image to use for your logo on the certificate...', 'wp_courseware'), __('Select Image', 'wp_courseware'), __('Select Image', 'wp_courseware'))), 'cert_background_type' => array('label' => __('Certificate Background', 'wp_courseware'), 'cssclass' => 'wpcw_cert_background_type', 'type' => 'radio', 'required' => 'true', 'data' => array('use_default' => sprintf('<b>%s</b> - %s', __('Built-in', 'wp_courseware'), __('Use the built-in certificate background.', 'wp_courseware')), 'use_custom' => sprintf('<b>%s</b> - %s', __('Custom', 'wp_courseware'), __('Use your own certificate background.', 'wp_courseware')))), 'cert_background_custom_url' => array('label' => __('Custom Background Image', 'wp_courseware'), 'type' => 'text', 'cssclass' => 'wpcw_cert_background_custom_url wpcw_image_upload_field', 'desc' => '&bull;&nbsp;' . __('The URL of your background image.', 'wp_courseware') . '<br/>&bull;&nbsp;' . sprintf(__('The background image must be <b>%d pixels wide, and %d pixels</b> high at <b>72 dpi</b> to render correctly. ', 'wp_courseware'), WPCW_CERTIFICATE_BG_WIDTH_PX, WPCW_CERTIFICATE_BG_HEIGHT_PX), 'validate' => array('type' => 'url', 'maxlen' => 300, 'minlen' => 1, 'error' => __('Please enter the URL of your certificate background image.', 'wp_courseware')), 'extrahtml' => sprintf('<a id="cert_background_custom_url_btn" href="#" class="wpcw_insert_image button-secondary" data-uploader_title="%s" data-uploader_btn_text="%s" data-target="cert_background_custom_url"><span class="wpcw_insert_image_img"></span> %s</a>', __('Choose an image to use for the certificate background...', 'wp_courseware'), __('Select Image', 'wp_courseware'), __('Select Image', 'wp_courseware'))));
    $settings = new SettingsForm($settingsFields, WPCW_DATABASE_SETTINGS_KEY, 'wpcw_form_settings_certificates');
    $settings->setSaveButtonLabel(__('Save ALL Settings', 'wp_courseware'));
    $settings->msg_settingsSaved = __('Settings successfully saved.', 'wp_courseware');
    $settings->msg_settingsProblem = __('There was a problem saving the settings.', 'wp_courseware');
    $settings->setAllTranslationStrings(WPCW_forms_getTranslationStrings());
    $settings->show();
    // RHS Support Information
    $page->showPageMiddle('23%');
    // Create a box where the admin can preview the certificates to see what they look like.
    $page->openPane('wpcw-certificates-preview', __('Preview Certificate', 'wp_courseware'));
    printf('<p>%s</p>', __('After saving the settings, you can preview the certificate using the button below. The preview opens in a new window.', 'wp_courseware'));
    printf('<div class="wpcw_btn_centre"><a href="%spdf_create_certificate.php?certificate=preview" target="_blank" class="button-primary">%s</a></div>', WPCW_plugin_getPluginPath(), __('Preview Certificate', 'wp_courseware'));
    $page->closePane();
    WPCW_docs_showSupportInfo($page);
    WPCW_docs_showSupportInfo_News($page);
    WPCW_docs_showSupportInfo_Affiliate($page);
    $page->showPageFooter();
}
/**
 * Show the page where the user can set up the certificate settings. 
 */
function WPCW_showPage_Certificates_load()
{
    $page = new PageBuilder(true);
    $page->showPageHeader(__('Training Courses - Certificate Settings', 'wp_courseware'), '75%', WPCW_icon_getPageIconURL());
    $settingsFields = array('section_certificates_defaults' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML(__('Certificate Settings', 'wp_courseware'))), 'cert_signature_type' => array('label' => __('Signature Type', 'wp_courseware'), 'type' => 'radio', 'cssclass' => 'wpcw_cert_signature_type', 'required' => 'true', 'data' => array('text' => sprintf('<b>%s</b> - %s', __('Text', 'wp_courseware'), __('Just use text for the signature.', 'wp_courseware')), 'image' => sprintf('<b>%s</b> - %s', __('Image File', 'wp_courseware'), __('Use an image for the signature.', 'wp_courseware')))), 'cert_sig_text' => array('label' => __('Name to use for signature', 'wp_courseware'), 'type' => 'text', 'cssclass' => 'wpcw_cert_signature_type_text', 'desc' => __('The name to use for the signature area.', 'wp_courseware'), 'validate' => array('type' => 'string', 'maxlen' => 150, 'minlen' => 1, 'regexp' => '/^[^<>]+$/', 'error' => __('Please enter the name to use for the signature area.', 'wp_courseware'))), 'cert_sig_image_url' => array('label' => __('Your Signature Image', 'wp_courseware'), 'cssclass' => 'wpcw_image_upload_field wpcw_cert_signature_type_image', 'type' => 'text', 'desc' => '&bull;&nbsp;' . __('The URL of your signature image. Using a transparent image is recommended.', 'wp_courseware') . '<br/>&bull;&nbsp;' . sprintf(__('The image must be <b>%d pixels wide, and %d pixels high</b> to render correctly. ', 'wp_courseware'), WPCW_CERTIFICATE_SIGNATURE_WIDTH_PX * 2, WPCW_CERTIFICATE_SIGNATURE_HEIGHT_PX * 2), 'validate' => array('type' => 'url', 'maxlen' => 300, 'minlen' => 1, 'error' => __('Please enter the URL of your signature image.', 'wp_courseware')), 'extrahtml' => sprintf('<a id="cert_sig_image_url_btn" href="#" class="wpcw_insert_image button-secondary" data-uploader_title="%s" data-uploader_btn_text="%s" data-target="cert_sig_image_url"><span class="wpcw_insert_image_img"></span> %s</a>', __('Choose an image to use for the signature image...', 'wp_courseware'), __('Select Image', 'wp_courseware'), __('Select Image', 'wp_courseware'))), 'cert_logo_enabled' => array('label' => __('Show your logo?', 'wp_courseware'), 'cssclass' => 'wpcw_cert_logo_enabled', 'type' => 'radio', 'required' => 'true', 'data' => array('cert_logo' => sprintf('<b>%s</b> - %s', __('Yes', 'wp_courseware'), __('Use your logo on the certificate.', 'wp_courseware')), 'no_cert_logo' => sprintf('<b>%s</b> - %s', __('No', 'wp_courseware'), __('Don\'t show a logo on the certificate.', 'wp_courseware')))), 'cert_logo_url' => array('label' => __('Your Logo Image', 'wp_courseware'), 'type' => 'text', 'cssclass' => 'wpcw_cert_logo_url wpcw_image_upload_field', 'desc' => '&bull;&nbsp;' . __('The URL of your logo image. Using a transparent image is recommended.', 'wp_courseware') . '<br/>&bull;&nbsp;' . sprintf(__('The image must be <b>%d pixels wide, and %d pixels</b> high to render correctly. ', 'wp_courseware'), WPCW_CERTIFICATE_LOGO_WIDTH_PX * 2, WPCW_CERTIFICATE_LOGO_HEIGHT_PX * 2), 'validate' => array('type' => 'url', 'maxlen' => 300, 'minlen' => 1, 'error' => __('Please enter the URL of your logo image.', 'wp_courseware')), 'extrahtml' => sprintf('<a id="cert_logo_url_btn" href="#" class="wpcw_insert_image button-secondary" data-uploader_title="%s" data-uploader_btn_text="%s" data-target="cert_logo_url"><span class="wpcw_insert_image_img"></span> %s</a>', __('Choose an image to use for your logo on the certificate...', 'wp_courseware'), __('Select Image', 'wp_courseware'), __('Select Image', 'wp_courseware'))), 'cert_background_type' => array('label' => __('Certificate Background', 'wp_courseware'), 'cssclass' => 'wpcw_cert_background_type', 'type' => 'radio', 'required' => 'true', 'data' => array('use_default' => sprintf('<b>%s</b> - %s', __('Built-in', 'wp_courseware'), __('Use the built-in certificate background.', 'wp_courseware')), 'use_custom' => sprintf('<b>%s</b> - %s', __('Custom', 'wp_courseware'), __('Use your own certificate background.', 'wp_courseware')))), 'cert_background_custom_url' => array('label' => __('Custom Background Image', 'wp_courseware'), 'type' => 'text', 'cssclass' => 'wpcw_cert_background_custom_url wpcw_image_upload_field', 'desc' => '&bull;&nbsp;' . __('The URL of your background image.', 'wp_courseware') . '<br/>&bull;&nbsp;' . sprintf(__('The background image must be <b>%d pixels wide, and %d pixels</b> high at <b>72 dpi</b> to render correctly. ', 'wp_courseware'), WPCW_CERTIFICATE_BG_WIDTH_PX, WPCW_CERTIFICATE_BG_HEIGHT_PX), 'validate' => array('type' => 'url', 'maxlen' => 300, 'minlen' => 1, 'error' => __('Please enter the URL of your certificate background image.', 'wp_courseware')), 'extrahtml' => sprintf('<a id="cert_background_custom_url_btn" href="#" class="wpcw_insert_image button-secondary" data-uploader_title="%s" data-uploader_btn_text="%s" data-target="cert_background_custom_url"><span class="wpcw_insert_image_img"></span> %s</a>', __('Choose an image to use for the certificate background...', 'wp_courseware'), __('Select Image', 'wp_courseware'), __('Select Image', 'wp_courseware'))), 'section_encodings' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML(__('Language and Encoding Settings', 'wp_courseware'))), 'certificate_encoding' => array('label' => __('Certificate Encoding', 'wp_courseware'), 'type' => 'select', 'required' => true, 'desc' => __('Choose a codepage encoding that matches your language to ensure certificates render correctly. You may need an encoding other than <code>ISO-8859-1</code> if you are using a non-English language.', 'wp_courseware'), 'data' => array('ISO-8859-1' => __('ISO-8859-1 - Latin alphabet - North America, Western Europe, Latin America, etc. (Default)', 'wp_courseware'), 'ISO-8859-2' => __('ISO-8859-2 - Latin alphabet 2 - Eastern Europe.', 'wp_courseware'), 'ISO-8859-3' => __('ISO-8859-3 - Latin alphabet 3 - SE Europe, Esperanto', 'wp_courseware'), 'ISO-8859-4' => __('ISO-8859-4 - Latin alphabet 4 - Scandinavia/Baltics', 'wp_courseware'), 'ISO-8859-5' => __('ISO-8859-5 - Latin/Cyrillic - Bulgarian, Belarusian, Russian and Macedonian', 'wp_courseware'), 'ISO-8859-6' => __('ISO-8859-6 - Latin/Arabic - Arabic languages', 'wp_courseware'), 'ISO-8859-7' => __('ISO-8859-7 - Latin/Greek - modern Greek language', 'wp_courseware'), 'ISO-8859-8' => __('ISO-8859-8 - Latin/Hebrew - Hebrew languages', 'wp_courseware'), 'ISO-8859-9' => __('ISO-8859-9 - Latin 5 part 9 - Turkish languages', 'wp_courseware'), 'ISO-8859-10' => __('ISO-8859-10 - Latin 6 Lappish, Nordic, Eskimo - The Nordic languages', 'wp_courseware'), 'ISO-8859-15' => __('ISO-8859-15 - Latin 9 (aka Latin 0) - Similar to ISO 8859-1', 'wp_courseware'))));
    $settings = new SettingsForm($settingsFields, WPCW_DATABASE_SETTINGS_KEY, 'wpcw_form_settings_certificates');
    $settings->setSaveButtonLabel(__('Save ALL Settings', 'wp_courseware'));
    $settings->msg_settingsSaved = __('Settings successfully saved.', 'wp_courseware');
    $settings->msg_settingsProblem = __('There was a problem saving the settings.', 'wp_courseware');
    $settings->setAllTranslationStrings(WPCW_forms_getTranslationStrings());
    $settings->show();
    // RHS Support Information
    $page->showPageMiddle('23%');
    // Create a box where the admin can preview the certificates to see what they look like.
    $page->openPane('wpcw-certificates-preview', __('Preview Certificate', 'wp_courseware'));
    printf('<p>%s</p>', __('After saving the settings, you can preview the certificate using the button below. The preview opens in a new window.', 'wp_courseware'));
    printf('<div class="wpcw_btn_centre"><a href="%spdf_create_certificate.php?certificate=preview" target="_blank" class="button-primary">%s</a></div>', WPCW_plugin_getPluginPath(), __('Preview Certificate', 'wp_courseware'));
    $page->closePane();
    WPCW_docs_showSupportInfo($page);
    WPCW_docs_showSupportInfo_News($page);
    WPCW_docs_showSupportInfo_Affiliate($page);
    $page->showPageFooter();
}
 /**
  * Execute a management verb on this plugin
  * @param $verb string
  * @param $args array
  * @param $message string Result status message
  * @param $messageParams array Parameters for the message key
  * @return boolean
  */
 function manage($verb, $args, &$message, &$messageParams)
 {
     if (!parent::manage($verb, $args, $message, $messageParams)) {
         return false;
     }
     switch ($verb) {
         case 'settings':
             $journal =& Request::getJournal();
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     return false;
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             return true;
         default:
             // Unknown management verb
             assert(false);
             return false;
     }
 }
Example #16
0
    function SettingsForm()
    {
        parent::MailForm();
        $this->parseSettings('inc/app/devnotes/forms/settings/settings.php');
        $this->widgets['notes']->setValues(array('on' => intl_get('On'), 'off' => intl_get('Off'), 'date' => intl_get('Until date')));
        $this->widgets['submit_button']->setValues(intl_get('Save Changes'));
        $this->widgets['notes_date']->setValue(date('Y-m-d'));
        if (DEVNOTES === true) {
            $this->widgets['notes']->setValue('on');
        } elseif (DEVNOTES === false) {
            $this->widgets['notes']->setValue('off');
        } else {
            $this->widgets['notes']->setValue('date');
            $this->widgets['notes_date']->setValue(DEVNOTES);
        }
        $this->widgets['contact']->setValue(appconf('contact'));
        $this->widgets['ignore_list']->setValue(join(', ', appconf('ignore')));
    }
    function onSubmit($vals)
    {
        // update devnotes_config table and respond
        if ($vals['notes'] == 'date') {
            $vals['notes'] = $vals['notes_date'];
        }
        db_execute('update devnotes_config set notes = ?, contact = ?, ignore_list = ?', $vals['notes'], $vals['contact'], $vals['ignore_list']);
        header('Location: ' . site_prefix() . '/index/devnotes-admin-action');
        exit;
    }
}
$form = new SettingsForm();
echo $form->run();
 /**
  * @see GenericPlugin::manage()
  */
 function manage($verb, $args, &$message, &$messageParams)
 {
     if (!parent::manage($verb, $args, $message, $messageParams)) {
         return false;
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
     $journal =& Request::getJournal();
     switch ($verb) {
         case 'connect':
             $this->import('classes.form.DataverseAuthForm');
             $form = new DataverseAuthForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'select'));
                     return false;
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             return true;
         case 'select':
             $this->import('classes.form.DataverseSelectForm');
             $form = new DataverseSelectForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'settings'));
                     return false;
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             return true;
         case 'settings':
             $this->import('classes.form.SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, 'manager', 'plugin', array('generic'));
                     return false;
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             return true;
         default:
             // Unknown management verb
             assert(false);
             return false;
     }
 }
Example #18
0
 /**
  * @see PKPPlugin::manage()
  */
 function manage($verb, $args, &$message, &$messageParams, &$pluginModalContent = null)
 {
     $returner = true;
     $request = $this->getRequest();
     $journal = $request->getJournal();
     $this->addLocaleData();
     switch ($verb) {
         case 'settings':
             AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON, LOCALE_COMPONENT_PKP_MANAGER);
             $templateMgr = TemplateManager::getManager($request);
             $templateMgr->register_function('plugin_url', array($this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             if ($request->getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     $request->redirect(null, null, 'plugins');
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             break;
         case 'enable':
             $this->updateSetting($journal->getId(), 'enabled', true);
             $message = NOTIFICATION_TYPE_SWORD_ENABLED;
             $returner = false;
             break;
         case 'disable':
             $this->updateSetting($journal->getId(), 'enabled', false);
             $message = NOTIFICATION_TYPE_PLUGIN_DISABLED;
             $messageParams = array('pluginName' => $this->getDisplayName());
             $returner = false;
             break;
         case 'createDepositPoint':
         case 'editDepositPoint':
             $templateMgr = TemplateManager::getManager($request);
             $templateMgr->register_function('plugin_url', array($this, 'smartyPluginUrl'));
             $depositPointId = array_shift($args);
             if ($depositPointId == '') {
                 $depositPointId = null;
             } else {
                 $depositPointId = (int) $depositPointId;
             }
             $this->import('DepositPointForm');
             $form = new DepositPointForm($this, $journal->getId(), $depositPointId);
             if ($request->getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     $request->redirect(null, null, null, array('generic', $this->getName(), 'settings'));
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             break;
         case 'deleteDepositPoint':
             $journalId = $journal->getId();
             $depositPointId = (int) array_shift($args);
             $depositPoints = $this->getSetting($journalId, 'depositPoints');
             unset($depositPoints[$depositPointId]);
             $this->updateSetting($journalId, 'depositPoints', $depositPoints);
             $request->redirect(null, null, null, array('generic', 'SwordPlugin', 'settings'));
             break;
     }
     return $returner;
 }
Example #19
0
 function manage($verb, $args, &$message)
 {
     $returner = true;
     $journal =& Request::getJournal();
     $this->addLocaleData();
     switch ($verb) {
         case 'settings':
             Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_MANAGER));
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, null, 'plugins');
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             break;
         case 'enable':
             $this->updateSetting($journal->getId(), 'enabled', true);
             $message = Locale::translate('plugins.generic.sword.enabled');
             $returner = false;
             break;
         case 'disable':
             $this->updateSetting($journal->getId(), 'enabled', false);
             $message = Locale::translate('plugins.generic.sword.disabled');
             $returner = false;
             break;
         case 'createDepositPoint':
         case 'editDepositPoint':
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $depositPointId = array_shift($args);
             if ($depositPointId == '') {
                 $depositPointId = null;
             } else {
                 $depositPointId = (int) $depositPointId;
             }
             $this->import('DepositPointForm');
             $form = new DepositPointForm($this, $journal->getId(), $depositPointId);
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, null, null, array('generic', $this->getName(), 'settings'));
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             break;
         case 'deleteDepositPoint':
             $journalId = $journal->getId();
             $depositPointId = (int) array_shift($args);
             $depositPoints = $this->getSetting($journalId, 'depositPoints');
             unset($depositPoints[$depositPointId]);
             $this->updateSetting($journalId, 'depositPoints', $depositPoints);
             Request::redirect(null, null, null, array('generic', 'SwordPlugin', 'settings'));
             break;
     }
     return $returner;
 }
Example #20
0
 function manage($verb, $args, &$message)
 {
     $returner = true;
     $journal =& Request::getJournal();
     switch ($verb) {
         case 'settings':
             Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_MANAGER));
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, null, 'plugins');
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             break;
         case 'enable':
             $this->updateSetting($journal->getId(), 'enabled', true);
             $message = Locale::translate('plugins.generic.webfeed.enabled');
             $returner = false;
             break;
         case 'disable':
             $this->updateSetting($journal->getId(), 'enabled', false);
             $message = Locale::translate('plugins.generic.webfeed.disabled');
             $returner = false;
             break;
     }
     return $returner;
 }
 /**
  * @see PKPPlugin::manage()
  */
 function manage($verb, $args, &$message, &$messageParams, &$pluginModalContent = null)
 {
     if (!parent::manage($verb, $args, $message, $messageParams)) {
         return false;
     }
     $request =& $this->getRequest();
     switch ($verb) {
         case 'settings':
             $journal = $request->getJournal();
             $templateMgr = TemplateManager::getManager($request);
             $templateMgr->register_function('plugin_url', array($this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             $form->readInputData();
             if ($request->getUserVar('addBlock')) {
                 // Add a block
                 $editData = true;
                 $blocks = $form->getData('blocks');
                 array_push($blocks, '');
                 $form->_data['blocks'] = $blocks;
             } else {
                 if (($delBlock = $request->getUserVar('delBlock')) && count($delBlock) == 1) {
                     // Delete an block
                     $editData = true;
                     list($delBlock) = array_keys($delBlock);
                     $delBlock = (int) $delBlock;
                     $blocks = $form->getData('blocks');
                     if (isset($blocks[$delBlock]) && !empty($blocks[$delBlock])) {
                         $deletedBlocks = explode(':', $form->getData('deletedBlocks'));
                         array_push($deletedBlocks, $blocks[$delBlock]);
                         $form->setData('deletedBlocks', join(':', $deletedBlocks));
                     }
                     array_splice($blocks, $delBlock, 1);
                     $form->_data['blocks'] = $blocks;
                 } else {
                     if ($request->getUserVar('save')) {
                         $editData = true;
                         $form->execute();
                     } else {
                         $form->initData();
                     }
                 }
             }
             if (!isset($editData) && $form->validate()) {
                 $form->execute();
                 $form->display();
                 exit;
             } else {
                 $form->display();
                 exit;
             }
             return true;
         default:
             // Unknown management verb
             assert(false);
             return false;
     }
 }
Example #22
0
 function manage($verb, $args, &$message)
 {
     $returner = true;
     $conference =& Request::getConference();
     switch ($verb) {
         case 'settings':
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $conference->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     $returner = false;
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             break;
         case 'enable':
             $this->updateSetting($conference->getId(), 0, 'enabled', true);
             $message = __('plugins.generic.announcementfeed.enabled');
             $returner = false;
             break;
         case 'disable':
             $this->updateSetting($conference->getId(), 0, 'enabled', false);
             $message = __('plugins.generic.announcementfeed.enabled');
             $returner = false;
             break;
     }
     return $returner;
 }
Example #23
0
 public function actionSettings()
 {
     $app = Yii::app();
     if ($app->user->isGuest) {
         $this->render('settings-guest', array('app' => $app));
         return;
     }
     $model = new SettingsForm();
     $user = $this->loadUser($app->user->id);
     $view = 'settings';
     if ($app->user->id == 1) {
         $settings = Settings::model()->loadSettings();
         if (!is_null($settings) && isset($settings[Settings::SETTINGS_MAIN_VIDEO])) {
             $model->video = $settings[Settings::SETTINGS_MAIN_VIDEO];
         } else {
             $model->video = '';
         }
         $view = 'settings-admin';
     }
     //echo'<pre>';var_dump($settings);echo'</pre>';die;
     if (isset($_POST['SettingsForm'])) {
         if ($app->user->id == 1 && $_POST['SettingsForm']['video'] != '') {
             $model->scenario = 'admin_settings';
         }
         if ($_POST['SettingsForm']['email'] != '') {
             $model->scenario = 'email_change';
         }
         if ($_POST['SettingsForm']['password'] != '') {
             $model->scenario = 'password_change';
         }
         $model->attributes = $_POST['SettingsForm'];
         if ($model->validate()) {
             $is_saved = false;
             switch ($model->scenario) {
                 case 'email_change':
                     if ($model->email != $user->email) {
                         $user->username = $model->email;
                         $user->email = $model->email;
                     }
                     if ($user->save()) {
                         $is_saved = true;
                     }
                     break;
                 case 'password_change':
                     $user->password = UserModule::encrypting($model->password);
                     if ($user->save()) {
                         $is_saved = true;
                     }
                     break;
                 case 'admin_settings':
                     $settings[Settings::SETTINGS_MAIN_VIDEO] = $model->video;
                     if (Settings::model()->saveSettings($settings)) {
                         $is_saved = true;
                     }
                     break;
             }
             if ($is_saved === true) {
                 Yii::app()->user->setFlash('success', 'Сохранено');
             } else {
                 Yii::app()->user->setFlash('error', 'Ошибка сохранения параметров');
             }
             //удаляем из кеша старые данные
             if ($app->user->id == 1) {
                 $app->cache->delete(Settings::CACHE_SETTINGS);
             }
             $this->redirect(array('my/settings'));
         }
     }
     $this->render($view, array('model' => $model));
 }
Example #24
0
 /**
  * Updates system settings.
  */
 public function actionSettings()
 {
     $model = new SettingsForm();
     if (isset($_POST['SettingsForm'])) {
         $model->attributes = $_POST['SettingsForm'];
         if ($model->validate()) {
             $model->save(false);
             Yii::app()->audit->log('Updated settings');
             $this->refresh();
         }
     } else {
         $model->load();
     }
     $this->render('settings', array('model' => $model));
 }
Example #25
0
<?
	/**********************************************************************
	 * @module Application
	 **********************************************************************/
	require_once "../../config.inc.php";

	$auth = new auth("Administrator");
	$page = new page("Designs");
	require_once "menudef.inc.php";
	
	$form = new SettingsForm($lang->get("designs", "Website Designs"));
	$ar = createNameValueArray('sitemap', 'NAME', 'MENU_ID');
	$designclasses = getDCFileList('designs');	
	$form->addRadioSetting($lang->get('sel_design', 'Select Design'), 'CDS/MENU', $designclasses);
	
	$mclass = reg_load('CDS/MENU');
	if ((value("set0", "", "") != $mclass) && (value("set0", "", "") != ""))
	  $mclass = value("set0");
	if ($mclass != "") {
	  $form->addHeadline($lang->get('adjust/desugb', 'Adjust Design'));
	  $ref = createDCRef($c["basepath"]."designs/".$mclass);
	  $ref->editConfiguration(&$form);
	  $form->add(new Spacer(2));
	}
	$page->add($form);	
	$page->draw();
	$db->close();
?>
 /**
  * Perform management functions
  */
 function manage($verb, $args)
 {
     $returner = true;
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
     $pageCrumbs = array(array(Request::url(null, null, 'user'), 'navigation.user'), array(Request::url(null, null, 'manager'), 'user.role.manager'));
     $conference =& Request::getConference();
     switch ($verb) {
         case 'enable':
             $this->setEnabled(true);
             break;
         case 'disable':
             $this->setEnabled(false);
             break;
         case 'settings':
             $pageCrumbs[] = array(Request::url(null, null, 'manager', 'plugins'), Locale::translate('manager.plugins'), true);
             $templateMgr->assign('pageHierarchy', $pageCrumbs);
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $conference->getId());
             $form->readInputData();
             if (Request::getUserVar('addBlock')) {
                 // Add a block
                 $editData = true;
                 //$blocks = is_null($form->getData('blocks'))?array():$form->getData('blocks');
                 $blocks = $form->getData('blocks');
                 array_push($blocks, '');
                 $form->_data['blocks'] = $blocks;
             } else {
                 if (($delBlock = Request::getUserVar('delBlock')) && count($delBlock) == 1) {
                     // Delete an block
                     $editData = true;
                     list($delBlock) = array_keys($delBlock);
                     $delBlock = (int) $delBlock;
                     $blocks = $form->getData('blocks');
                     if (isset($blocks[$delBlock]) && !empty($blocks[$delBlock])) {
                         $deletedBlocks = explode(':', $form->getData('deletedBlocks'));
                         array_push($deletedBlocks, $blocks[$delBlock]);
                         $form->setData('deletedBlocks', join(':', $deletedBlocks));
                     }
                     array_splice($blocks, $delBlock, 1);
                     $form->_data['blocks'] = $blocks;
                 } else {
                     if (Request::getUserVar('save')) {
                         $editData = true;
                         $form->execute();
                     } else {
                         $form->initData();
                     }
                 }
             }
             if (!isset($editData) && $form->validate()) {
                 $form->execute();
                 $form->display();
                 exit;
             } else {
                 $form->display();
                 exit;
             }
             $returner = true;
             break;
     }
     $returner = false;
 }
Example #27
0
 function manage($verb, $args, &$message)
 {
     if (!parent::manage($verb, $args, $message)) {
         return false;
     }
     switch ($verb) {
         case 'settings':
             $journal =& Request::getJournal();
             Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_MANAGER));
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, null, 'plugins');
                     return false;
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             return true;
         default:
             // Unknown management verb
             assert(false);
             return false;
     }
 }
 /**
  * Perform management functions
  */
 function manage($verb, $args, &$message, &$messageParams)
 {
     if (!parent::manage($verb, $args, $message, $messageParams)) {
         return false;
     }
     switch ($verb) {
         case 'settings':
             $journal =& Request::getJournal();
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $pageCrumbs = array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, 'manager'), 'user.role.manager'), array(Request::url(null, 'manager', 'plugins'), __('manager.plugins'), true));
             $templateMgr->assign('pageHierarchy', $pageCrumbs);
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             $form->readInputData();
             if (Request::getUserVar('addBlock')) {
                 // Add a block
                 $editData = true;
                 $blocks = $form->getData('blocks');
                 array_push($blocks, '');
                 $form->_data['blocks'] = $blocks;
             } else {
                 if (($delBlock = Request::getUserVar('delBlock')) && count($delBlock) == 1) {
                     // Delete an block
                     $editData = true;
                     list($delBlock) = array_keys($delBlock);
                     $delBlock = (int) $delBlock;
                     $blocks = $form->getData('blocks');
                     if (isset($blocks[$delBlock]) && !empty($blocks[$delBlock])) {
                         $deletedBlocks = explode(':', $form->getData('deletedBlocks'));
                         array_push($deletedBlocks, $blocks[$delBlock]);
                         $form->setData('deletedBlocks', join(':', $deletedBlocks));
                     }
                     array_splice($blocks, $delBlock, 1);
                     $form->_data['blocks'] = $blocks;
                 } else {
                     if (Request::getUserVar('save')) {
                         $editData = true;
                         $form->execute();
                     } else {
                         $form->initData();
                     }
                 }
             }
             if (!isset($editData) && $form->validate()) {
                 $form->execute();
                 $form->display();
                 exit;
             } else {
                 $form->display();
                 exit;
             }
             return true;
         default:
             // Unknown management verb
             assert(false);
             return false;
     }
 }
 /**
  * @see Plugin::manage()
  */
 function manage($args, $request)
 {
     switch ($request->getUserVar('verb')) {
         case 'settings':
             $context = $request->getContext();
             AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON, LOCALE_COMPONENT_PKP_MANAGER);
             $templateMgr = TemplateManager::getManager($request);
             $templateMgr->register_function('plugin_url', array($this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $context->getId());
             if ($request->getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     return new JSONMessage(true);
                 }
             } else {
                 $form->initData();
             }
             return new JSONMessage(true, $form->fetch($request));
     }
     return parent::manage($args, $request);
 }
Example #30
0
 /**
  * Method called when settings form details are being saved.
  * @param Array $formValues The list of settings being saved.
  * @see wplib/SettingsForm::handleSave()
  */
 protected function handleSave($formValues)
 {
     // Do default saving
     parent::handleSave($formValues);
 }