本文整理汇总了PHP中Button::onClick方法的典型用法代码示例。如果您正苦于以下问题:PHP Button::onClick方法的具体用法?PHP Button::onClick怎么用?PHP Button::onClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Button
的用法示例。
在下文中一共展示了Button::onClick方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Load
public function Load()
{
parent::$PAGE_TITLE = __(MANAGE_TRANSLATIONS);
$content = new Object();
// Search in all translation files the labels
// Features :
// - get the list of the labels for a page / language
// - display for each label if there is a translation in all the language of the website
// - enter a new label
// - update a label
// - delete a label
$translate_table = new Table();
$translate_table->setDefaultValign(RowTable::VALIGN_TOP);
if (!isset($_GET['language'])) {
$_GET['language'] = $this->getLanguage();
}
$this->form = new Form($this);
$this->form->setAction($this->getCurrentURLWithoutParameters() . "?language=" . $_GET['language']);
$this->hdn_old_file = new Hidden($this->form, "hdn_old_file");
$content->add($this->hdn_old_file);
$tree = new TreeView("wsp_lang_files");
$array_path = explode("/", $this->getRootWspDirectory());
$root = new TreeViewFolder($array_path[sizeof($array_path) - 1]);
$tree_page_items = new TreeViewItems();
$dir = $this->getRootWspDirectory() . "/lang/" . $_GET['language'] . "/";
$array_files = $this->loadFiles($dir, '', $_GET['language']);
foreach ($array_files as $key => $value) {
$tree_page_type = new TreeViewFolder($key);
$tree_page_type->expand();
$tree_page_items->add($tree_page_type);
$tree_items = new TreeViewItems();
$array_folder = array();
for ($i = 0; $i < sizeof($value); $i++) {
$file = $value[$i];
$expand = false;
if ($file == $_GET['file']) {
$expand = true;
}
$array_path = explode('/', $file);
$file_name = $array_path[sizeof($array_path) - 1];
$array_path[sizeof($array_path) - 1] = null;
$folder = implode('/', $array_path);
if ($folder == "") {
$parent_tree_items = $tree_items;
} else {
if (isset($array_folder[$folder])) {
$parent_tree_items = $array_folder[$folder];
$tree_folder = $parent_tree_items->getTreeViewItemParent();
if (!$tree_folder->isExpand()) {
if ($expand) {
$tree_folder->expand();
} else {
$tree_folder->collapse();
}
}
} else {
$tree_folder = new TreeViewFolder($folder);
if ($expand) {
$tree_folder->expand();
} else {
$tree_folder->collapse();
}
$tree_items->add($tree_folder);
$parent_tree_items = new TreeViewItems();
$tree_folder->setTreeViewItems($parent_tree_items);
$array_folder[$folder] = $parent_tree_items;
}
}
$file_link = new Button($this->form);
$file_name_label = new Label($file_name);
$file_name_label->setId("file_label_" . str_replace("/", "_slashsep_", str_replace(".", "_", str_replace("-", "_", $file))));
$this->array_files_label[$file] = $file_name_label;
$file_link->setValue($file_name_label)->setIsLink();
$file_link->onClick("loadTranslation", $file, $this->hdn_old_file, $_GET['language'], 1)->setAjaxEvent();
$tree_file = new TreeViewFile($file_link);
$parent_tree_items->add($tree_file);
}
$tree_page_type->setTreeViewItems($tree_items);
}
$root->setTreeViewItems($tree_page_items);
$root_items = new TreeViewItems();
$root_items->add($root);
$tree->setTreeViewItems($root_items);
$language_selector = new Object();
$array_lang_dir = scandir($this->getRootWspDirectory() . "/lang", 0);
for ($i = 0; $i < sizeof($array_lang_dir); $i++) {
if (is_dir($this->getRootWspDirectory() . "/lang/" . $array_lang_dir[$i]) && $array_lang_dir[$i] != "" && $array_lang_dir[$i] != "." && $array_lang_dir[$i] != ".." && $array_lang_dir[$i] != ".svn" && strlen($array_lang_dir[$i]) == 2) {
$lang_link = $this->getCurrentURLWithoutParameters() . "?language=" . $array_lang_dir[$i];
$language_link = new Link($lang_link, Link::TARGET_NONE, new Picture("wsp/img/lang/" . $array_lang_dir[$i] . ".png", 24, 24, 0, Picture::ALIGN_ABSMIDDLE));
if ($array_lang_dir[$i] == $_GET['language']) {
$language_link->setStyle("border:1px solid red;padding-bottom: 4px;");
}
$language_link->setId("lang_link_" . $array_lang_dir[$i]);
$this->array_lang_link[] = $language_link;
$language_selector->add($language_link);
}
}
$lang_tree_obj = new Object($language_selector, "<br/>");
$tree_obj = new Object($tree);
$tree_obj->setAlign(Object::ALIGN_LEFT)->setWidth(200)->setHeight(608)->setMaxHeight(608);
//.........这里部分代码省略.........
示例2: Load
public function Load()
{
parent::$PAGE_TITLE = __(MANAGE_PAGES);
$content = new Object();
// Search all php files in the folder pages with the synstax "class * extends Page"
$code_editor_table = new Table();
$code_editor_table->setDefaultValign(RowTable::VALIGN_TOP);
$form = new Form($this);
$this->hdn_old_file = new Hidden($this);
$content->add($this->hdn_old_file);
$tree = new TreeView("wsp_files");
$array_path = explode("/", $this->getRootWspDirectory());
$root = new TreeViewFolder($array_path[sizeof($array_path) - 1]);
$tree_page_items = new TreeViewItems();
$dir = $this->getRootWspDirectory() . "/pages/";
$array_files = $this->loadFiles($dir);
foreach ($array_files as $key => $value) {
$tree_page_type = new TreeViewFolder($key);
if ($key == "Page classes") {
$tree_page_type->expand();
} else {
$tree_page_type->collapse();
}
$tree_page_items->add($tree_page_type);
$tree_items = new TreeViewItems();
$array_folder = array();
for ($i = 0; $i < sizeof($value); $i++) {
$file = $value[$i];
$array_path = explode('/', $file);
$file_name = $array_path[sizeof($array_path) - 1];
$array_path[sizeof($array_path) - 1] = null;
$folder = implode('/', $array_path);
if ($folder == "") {
$parent_tree_items = $tree_items;
} else {
if (isset($array_folder[$folder])) {
$parent_tree_items = $array_folder[$folder];
} else {
$tree_folder = new TreeViewFolder($folder);
$tree_folder->collapse();
$tree_items->add($tree_folder);
$parent_tree_items = new TreeViewItems();
$tree_folder->setTreeViewItems($parent_tree_items);
$array_folder[$folder] = $parent_tree_items;
}
}
$file_link = new Button($this);
$file_name_label = new Label($file_name);
$file_name_label->setId("file_label_" . str_replace("/", "_slashsep_", str_replace(".", "_", str_replace("-", "_", $file))));
$this->array_files_label[$file] = $file_name_label;
$file_link->setValue($file_name_label)->setIsLink();
$file_link->onClick("loadFile", $file, $this->hdn_old_file)->setAjaxEvent();
$tree_file = new TreeViewFile($file_link);
$parent_tree_items->add($tree_file);
}
$tree_page_type->setTreeViewItems($tree_items);
}
$root->setTreeViewItems($tree_page_items);
$root_items = new TreeViewItems();
$root_items->add($root);
$tree->setTreeViewItems($root_items);
$tree_obj = new Object($tree);
$tree_obj->setAlign(Object::ALIGN_LEFT)->setWidth(220)->setHeight(630)->setMaxHeight(630);
$this->code_editor = new TextArea($form);
$this->code_editor->setWidth(600)->setHeight(620)->allowTabulation()->activateSourceCodeEdit("php")->noWrap();
$code_editor_table->addRowColumns($tree_obj, $this->code_editor);
$this->btn_save = new Button($form);
$this->btn_save->setValue(__(BTN_SAVE))->setAjaxEvent()->hide();
$this->btn_save->forceSpanTag();
if (Page::getInstance("wsp-admin/manage/manage-translations")->userHaveRights()) {
$this->tranlate_links_obj = new Object(__(MANAGE_TRANSLATIONS) . ": ");
$this->tranlate_links_obj->setId("tranlate_links_obj");
}
$code_editor_table->addRow(new Object($this->tranlate_links_obj, " ", $this->btn_save))->setColspan(2);
$code_editor_table->addRow();
$form->setContent($code_editor_table);
// Create a link to the labels of this page
// TODO
$this->render = new AdminTemplateForm($this, $content->add($form));
if (isset($_GET['file'])) {
$this->loadFile(null, $_GET['file'], "");
} else {
if (!$this->isAjaxPage()) {
$this->loadFile(null, "home.php", "");
}
}
}