当前位置: 首页>>代码示例>>PHP>>正文


PHP Button::addAttribute方法代码示例

本文整理汇总了PHP中Button::addAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP Button::addAttribute方法的具体用法?PHP Button::addAttribute怎么用?PHP Button::addAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Button的用法示例。


在下文中一共展示了Button::addAttribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addButton

 /**
  * Add a new button to this bar. This method creates a new instance of the
  * button class and adds it to the button bar.
  * 
  * @param $label The label for this button
  * @return ButtonBar
  */
 public function addButton($label, $onClick = null)
 {
     $button = new Button($label);
     if ($onClick !== null) {
         $button->addAttribute('onclick', $onClick);
     }
     $this->buttons[] = $button;
     return $this;
 }
开发者ID:ekowabaka,项目名称:cfx,代码行数:16,代码来源:ButtonBar.php

示例2: updateRequest

 public function updateRequest(array $params)
 {
     $this->checkXP();
     $themeDto = $this->getThemeDtoByName($params);
     $language = OW::getLanguage();
     $remoteThemeInfo = (array) $this->themeService->getThemeInfoForUpdate($themeDto->getName(), $themeDto->getDeveloperKey());
     if (empty($remoteThemeInfo) || !empty($remoteThemeInfo['error'])) {
         $this->assign('mode', 'error');
         $this->assign('text', $language->text('admin', 'theme_update_request_error'));
         $this->assign('returnUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Themes', 'chooseTheme'));
     } else {
         if ((bool) $remoteThemeInfo['freeware']) {
             $this->assign('mode', 'free');
             $this->assign('text', $language->text('admin', 'free_theme_request_text', array('oldVersion' => $themeDto->getBuild(), 'newVersion' => $remoteThemeInfo['build'], 'name' => $themeDto->getTitle())));
             $this->assign('redirectUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Themes', 'update', $params));
             $this->assign('returnUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Themes', 'chooseTheme'));
         } else {
             if ($remoteThemeInfo['build'] === null) {
                 $query = "UPDATE `" . OW_DB_PREFIX . "base_theme` SET `update` = 0 WHERE `name` = :name";
                 OW::getDbo()->query($query, array('name' => $params['name']));
                 $this->assign('mode', 'error');
                 $this->assign('text', $language->text('admin', 'theme_update_not_available_error'));
                 $this->assign('returnUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Themes', 'chooseTheme'));
             } else {
                 $this->assign('text', $language->text('admin', 'com_theme_request_text', array('oldVersion' => $themeDto->getBuild(), 'newVersion' => $remoteThemeInfo['build'], 'name' => $themeDto->getTitle())));
                 $form = new Form('license-key');
                 $licenseKey = new TextField('key');
                 $licenseKey->setValue($themeDto->getLicenseKey());
                 $licenseKey->setRequired();
                 $licenseKey->setLabel($language->text('admin', 'com_theme_request_name_label'));
                 $form->addElement($licenseKey);
                 $submit = new Submit('submit');
                 $submit->setValue($language->text('admin', 'license_form_submit_label'));
                 $form->addElement($submit);
                 $button = new Button('button');
                 $button->setValue($language->text('admin', 'license_form_leave_label'));
                 $button->addAttribute('onclick', "window.location='" . OW::getRouter()->urlFor('ADMIN_CTRL_Themes', 'chooseTheme') . "'");
                 $form->addElement($button);
                 $this->addForm($form);
                 if (OW::getRequest()->isPost()) {
                     if ($form->isValid($_POST)) {
                         $data = $form->getValues();
                         $params['licenseKey'] = $data['key'];
                         $result = $this->themeService->checkLicenseKey($themeDto->getName(), $themeDto->getDeveloperKey(), $data['key']);
                         if ($result === true) {
                             $this->redirect(OW::getRouter()->urlFor('ADMIN_CTRL_Themes', 'update', $params));
                         } else {
                             OW::getFeedback()->error($language->text('admin', 'themes_manage_invalid_license_key_error_message'));
                             $this->redirect();
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:vazahat,项目名称:dudex,代码行数:56,代码来源:themes.php

示例3: updateRequest

 public function updateRequest(array $params)
 {
     $this->checkXP();
     $pluginDto = $this->getPluginDtoByKey($params);
     $language = OW::getLanguage();
     $remotePluginInfo = (array) $this->pluginService->getItemInfoForUpdate($pluginDto->getKey(), $pluginDto->getDeveloperKey());
     if (empty($remotePluginInfo) || !empty($remotePluginInfo['error'])) {
         $this->assign('mode', 'error');
         $this->assign('text', $language->text('admin', 'plugin_update_request_error'));
         $this->assign('returnUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'index'));
     } else {
         if ((bool) $remotePluginInfo['freeware']) {
             $this->assign('mode', 'free');
             $this->assign('text', $language->text('admin', 'free_plugin_request_text', array('oldVersion' => $pluginDto->getBuild(), 'newVersion' => $remotePluginInfo['build'], 'name' => $pluginDto->getTitle())));
             $this->assign('redirectUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'update', $params));
             $this->assign('returnUrl', OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'index'));
         } else {
             if ($pluginDto->getLicenseKey() != null) {
                 $result = $this->pluginService->checkLicenseKey($pluginDto->getKey(), $pluginDto->getDeveloperKey(), $pluginDto->getLicenseKey());
                 if ($result === true) {
                     $params['licenseKey'] = $pluginDto->getLicenseKey();
                     $this->redirect(OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'update', $params));
                     return;
                 }
             }
             $this->assign('text', $language->text('admin', 'com_plugin_request_text', array('oldVersion' => $pluginDto->getBuild(), 'newVersion' => $remotePluginInfo['build'], 'name' => $pluginDto->getTitle())));
             $form = new Form('license-key');
             $licenseKey = new TextField('key');
             $licenseKey->setValue($pluginDto->getLicenseKey());
             $licenseKey->setRequired();
             $licenseKey->setLabel($language->text('admin', 'com_plugin_request_key_label'));
             $form->addElement($licenseKey);
             $submit = new Submit('submit');
             $submit->setValue($language->text('admin', 'license_form_submit_label'));
             $form->addElement($submit);
             $button = new Button('button');
             $button->setValue($language->text('admin', 'license_form_leave_label'));
             $button->addAttribute('onclick', "window.location='" . OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'index') . "'");
             $form->addElement($button);
             $this->addForm($form);
             if (OW::getRequest()->isPost()) {
                 if ($form->isValid($_POST)) {
                     $data = $form->getValues();
                     $params['licenseKey'] = $data['key'];
                     $result = $this->pluginService->checkLicenseKey($pluginDto->getKey(), $pluginDto->getDeveloperKey(), $data['key']);
                     if ($result === true) {
                         $pluginDto->setLicenseKey($data['key']);
                         BOL_PluginService::getInstance()->savePlugin($pluginDto);
                         $this->redirect(OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'update', $params));
                     } else {
                         OW::getFeedback()->error($language->text('admin', 'plugins_manage_invalid_license_key_error_message'));
                         $this->redirect();
                     }
                 }
             }
         }
     }
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:58,代码来源:plugins.php

示例4: checkItemLicense

 /**
  * Generic action to get the license key for items.
  */
 public function checkItemLicense()
 {
     $params = $_GET;
     $language = OW::getLanguage();
     $params[BOL_StorageService::URI_VAR_LICENSE_CHECK_COMPLETE] = 0;
     $params[BOL_StorageService::URI_VAR_LICENSE_CHECK_RESULT] = 0;
     if (empty($params[BOL_StorageService::URI_VAR_KEY]) || empty($params[BOL_StorageService::URI_VAR_ITEM_TYPE]) || empty($params[BOL_StorageService::URI_VAR_DEV_KEY])) {
         $errMsg = $language->text("admin", "check_license_invalid_params_err_msg");
         OW::getFeedback()->error($errMsg);
         $this->redirectToBackUri($params);
         $this->assign("message", $errMsg);
         return;
     }
     $key = trim($params[BOL_StorageService::URI_VAR_KEY]);
     $devKey = trim($params[BOL_StorageService::URI_VAR_DEV_KEY]);
     $type = trim($params[BOL_StorageService::URI_VAR_ITEM_TYPE]);
     $data = $this->storageService->getItemInfoForUpdate($key, $devKey);
     if (!$data) {
         $this->assign("backButton", true);
         $errMsg = $language->text("admin", "check_license_invalid_server_responce_err_msg");
         OW::getFeedback()->error($errMsg);
         $this->redirectToBackUri($params);
         $this->assign("message", $errMsg);
         return;
     }
     // if item is freeware reset check ts and redirect to back uri
     if ((bool) $data[BOL_StorageService::URI_VAR_FREEWARE]) {
         $params[BOL_StorageService::URI_VAR_LICENSE_CHECK_COMPLETE] = 1;
         $params[BOL_StorageService::URI_VAR_LICENSE_CHECK_RESULT] = 1;
         $params[BOL_StorageService::URI_VAR_FREEWARE] = 1;
         $this->assign("message", $language->text("admin", "check_license_item_is_free_msg"));
         $dto = $this->storageService->findStoreItem($key, $devKey, $params[BOL_StorageService::URI_VAR_ITEM_TYPE]);
         if ($dto != null) {
             $dto->setLicenseCheckTimestamp(null);
             $this->storageService->saveStoreItem($dto);
         }
         $this->redirectToBackUri($params);
         return;
     }
     $this->assign("text", $language->text("admin", "license_request_text", array("type" => $type, "title" => $data["title"])));
     $form = new Form("license-key");
     $licenseKey = new TextField("key");
     $licenseKey->setRequired();
     $licenseKey->setLabel($language->text("admin", "com_plugin_request_key_label"));
     $form->addElement($licenseKey);
     $submit = new Submit("submit");
     $submit->setValue($language->text("admin", "license_form_button_label"));
     $form->addElement($submit);
     if (isset($params["back-button-uri"])) {
         $button = new Button("button");
         $button->setValue($language->text("admin", "license_form_back_label"));
         $redirectUrl = UTIL_HtmlTag::escapeJs(OW_URL_HOME . urldecode($params["back-button-uri"]));
         $button->addAttribute("onclick", "window.location='{$redirectUrl}'");
         $form->addElement($button);
         $this->assign("backButton", true);
     }
     $this->addForm($form);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             $licenseKey = $data["key"];
             $result = $this->storageService->checkLicenseKey($key, $devKey, $licenseKey);
             $params[BOL_StorageService::URI_VAR_LICENSE_CHECK_COMPLETE] = 1;
             if ($result) {
                 $params[BOL_StorageService::URI_VAR_LICENSE_CHECK_RESULT] = 1;
                 $params[BOL_StorageService::URI_VAR_LICENSE_KEY] = urlencode($licenseKey);
                 $dto = $this->storageService->findStoreItem($key, $devKey, $params[BOL_StorageService::URI_VAR_ITEM_TYPE]);
                 if ($dto != null) {
                     $dto->setLicenseKey($licenseKey);
                     $dto->setLicenseCheckTimestamp(null);
                     $this->storageService->saveStoreItem($dto);
                 }
                 OW::getFeedback()->info($language->text("admin", "plugins_manage_license_key_check_success"));
                 $this->redirectToBackUri($params);
                 $this->redirect();
             } else {
                 OW::getFeedback()->error($language->text('admin', 'plugins_manage_invalid_license_key_error_message'));
                 $this->redirect();
             }
         }
     }
 }
开发者ID:ZyXelP,项目名称:oxwall,代码行数:85,代码来源:storage.php


注:本文中的Button::addAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。