Changeset 5548 for extensions/lmt/lmt_aip.class.inc.php
- Timestamp:
- Apr 1, 2010, 9:05:29 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/lmt/lmt_aip.class.inc.php
r5431 r5548 15 15 16 16 include_once('lmt_root.class.inc.php'); 17 include_once(PHPWG_PLUGINS_PATH.' grum_plugins_classes-2/translate.class.inc.php');18 include_once(PHPWG_PLUGINS_PATH.' grum_plugins_classes-2/tables.class.inc.php');19 include_once(PHPWG_PLUGINS_PATH.' grum_plugins_classes-2/genericjs.class.inc.php');20 include_once(PHPWG_PLUGINS_PATH.' grum_plugins_classes-2/pages_navigation.class.inc.php');17 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTranslate.class.inc.php'); 18 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php'); 19 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/genericjs.class.inc.php'); 20 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCPagesNavigation.class.inc.php'); 21 21 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 22 22 … … 26 26 protected $tabsheet; 27 27 28 public function LMT_AIP($prefixeTable, $filelocation)28 public function __construct($prefixeTable, $filelocation) 29 29 { 30 30 parent::__construct($prefixeTable, $filelocation); 31 $this->load _config();32 $this->init _events();31 $this->loadConfig(); 32 $this->initEvents(); 33 33 34 34 $this->tabsheet = new tabsheet(); 35 35 $this->tabsheet->add('list', 36 36 l10n('lmt_list'), 37 $this-> page_link."&f_tabsheet=list");37 $this->getAdminLink()."&f_tabsheet=list"); 38 38 $this->tabsheet->add('manage', 39 39 l10n('lmt_manage'), 40 $this-> page_link."&f_tabsheet=manage");40 $this->getAdminLink()."&f_tabsheet=manage"); 41 41 $this->tabsheet->add('manageaut', 42 42 l10n('lmt_manageaut'), 43 $this-> page_link."&f_tabsheet=manageaut");43 $this->getAdminLink()."&f_tabsheet=manageaut"); 44 44 $this->tabsheet->add('config', 45 45 l10n('lmt_config'), 46 $this-> page_link."&f_tabsheet=config");46 $this->getAdminLink()."&f_tabsheet=config"); 47 47 $this->tabsheet->add('help', 48 48 l10n('lmt_help'), 49 $this->page_link."&f_tabsheet=help"); 50 51 // don't create this object inside root classe otherwise header is modified 52 // everywhere in admin pages 53 $this->ajax = new Ajax(); 49 $this->getAdminLink()."&f_tabsheet=help"); 50 54 51 55 52 // don't create the google_translate object everytime, otherwise google's js … … 59 56 /*if((isset($_POST['fmypolls_gomodify_translation'])||isset($_POST['fmypolls_goadd_translation']))) 60 57 { 61 $this->google_translate = new translate();58 $this->google_translate = new GPCTranslate(); 62 59 } 63 60 */ 61 } 62 63 public function __destruct() 64 { 65 unset($this->google_translate); 66 unset($this->tabsheet); 67 parent::__destruct(); 64 68 } 65 69 … … 67 71 initialize events call for the plugin 68 72 */ 69 public function init _events()70 { 71 parent::init _events();72 add_event_handler('loc_end_page_header', array(&$this->css, 'apply _CSS'));73 add_event_handler('loc_end_page_header', array(&$this->css_icn, 'apply _CSS'));73 public function initEvents() 74 { 75 parent::initEvents(); 76 add_event_handler('loc_end_page_header', array(&$this->css, 'applyCSS')); 77 add_event_handler('loc_end_page_header', array(&$this->css_icn, 'applyCSS')); 74 78 } 75 79 … … 117 121 $template->assign($this->tabsheet->get_titlename(), "[".$selected_tab['caption']."]"); 118 122 119 $template_plugin["LMT_VERSION"] = "<i>".$this-> plugin_name."</i> ".l10n('lmt_release').LMT_VERSION;123 $template_plugin["LMT_VERSION"] = "<i>".$this->getPluginName()."</i> ".l10n('lmt_release').LMT_VERSION; 120 124 $template_plugin["LMT_PAGE"] = $_REQUEST['f_tabsheet']; 121 125 $template_plugin["LMT_TITLE"] = ""; … … 146 150 break; 147 151 } 148 //$template-> 149 $this->ajax->return_result($result); 152 GPCAjax::returnResult($result); 150 153 } 151 154 } … … 163 166 if(isset($_POST['submit_save_config'])) 164 167 { 165 foreach($this-> my_config as $key => $val)168 foreach($this->config as $key => $val) 166 169 { 167 170 if(is_array($val)) … … 171 174 if(isset($_REQUEST[str2url('f_'.$key.'_'.$key2)])) 172 175 { 173 $this-> my_config[$key][$key2] = htmlspecialchars(stripslashes($_REQUEST[str2url('f_'.$key.'_'.$key2)]), ENT_QUOTES);176 $this->config[$key][$key2] = htmlspecialchars(stripslashes($_REQUEST[str2url('f_'.$key.'_'.$key2)]), ENT_QUOTES); 174 177 } 175 178 } … … 179 182 if(isset($_REQUEST['f_'.$key])) 180 183 { 181 $this-> my_config[$key] = $_REQUEST['f_'.$key];184 $this->config[$key] = $_REQUEST['f_'.$key]; 182 185 } 183 186 } 184 187 185 188 } 186 $this->display _result(l10n('lmt_save_config'), $this->save_config());189 $this->displayResult(l10n('lmt_save_config'), $this->saveConfig()); 187 190 } 188 191 } … … 199 202 200 203 $template->set_filename('body_page', 201 dirname($this-> filelocation).'/admin/plugin_admin_help.tpl');204 dirname($this->getFileLocation()).'/admin/plugin_admin_help.tpl'); 202 205 203 206 $template->assign('imgdir', LMT_PATH."img/"); … … 213 216 214 217 $template->set_filename('body_page', 215 dirname($this-> filelocation).'/admin/plugin_admin_list.tpl');218 dirname($this->getFileLocation()).'/admin/plugin_admin_list.tpl'); 216 219 217 220 if(!isset($_REQUEST['filter']) || … … 230 233 231 234 $datas=array( 232 "LMT_AJAX_URL_LIST" => $this-> page_link.'&ajaxfct=img_list&numpage='235 "LMT_AJAX_URL_LIST" => $this->getAdminLink().'&ajaxfct=img_list&numpage=' 233 236 ); 234 237 … … 247 250 $filter_list_values = array_merge(array(''), $filter_list_values); 248 251 $filter_list_labels = array_merge(array(l10n('lmt_nofilter')), $filter_list_labels); 249 $default_licence = l10n("lmt_lbl_cc-".strtolower($this-> my_config['lmt_licence_default']));250 $default_licence_img =LMT_PATH."img/".strtolower($this-> my_config['lmt_licence_default'])."_80x15.png";252 $default_licence = l10n("lmt_lbl_cc-".strtolower($this->config['lmt_licence_default'])); 253 $default_licence_img =LMT_PATH."img/".strtolower($this->config['lmt_licence_default'])."_80x15.png"; 251 254 252 255 $results=true; … … 272 275 if((!$results)||(!$result)) 273 276 { 274 $this->display _result(l10n("lmt_caddie_not_updated"), false);277 $this->displayResult(l10n("lmt_caddie_not_updated"), false); 275 278 } 276 279 else 277 280 { 278 $this->display _result(l10n("lmt_caddie_updated"), true);281 $this->displayResult(l10n("lmt_caddie_updated"), true); 279 282 } 280 283 } … … 347 350 if($results[0]!="") 348 351 { 349 $this->display _result($results[0], true);352 $this->displayResult($results[0], true); 350 353 } 351 354 352 355 if($results[1]!="") 353 356 { 354 $this->display _result($results[1], false);357 $this->displayResult($results[1], false); 355 358 } 356 359 } 357 360 else 358 361 { 359 $this->display _result(l10n("lmt_no_element_selected"), false);362 $this->displayResult(l10n("lmt_no_element_selected"), false); 360 363 } 361 364 } … … 363 366 364 367 $template->set_filename('body_page', 365 dirname($this-> filelocation).'/admin/plugin_admin_manage.tpl');368 dirname($this->getFileLocation()).'/admin/plugin_admin_manage.tpl'); 366 369 367 370 $datas=array( 368 "LMT_AJAX_URL_LIST" => $this-> page_link.'&ajaxfct=manage_list&numpage='371 "LMT_AJAX_URL_LIST" => $this->getAdminLink().'&ajaxfct=manage_list&numpage=' 369 372 ); 370 373 … … 435 438 436 439 $template->set_filename('body_page', 437 dirname($this-> filelocation).'/admin/plugin_admin_config.tpl');440 dirname($this->getFileLocation()).'/admin/plugin_admin_config.tpl'); 438 441 439 442 … … 441 444 "img_directory" => LMT_PATH."img/" 442 445 ); 443 foreach($this-> my_config as $key => $val)446 foreach($this->config as $key => $val) 444 447 { 445 448 if(!is_array($val)) … … 489 492 $datas['lmt_warning_texts'][]=array( 490 493 'lang' => str2url($key), 491 'text' => $this-> my_config['lmt_warning_texts'][$key]494 'text' => $this->config['lmt_warning_texts'][$key] 492 495 ); 493 496 … … 495 498 { 496 499 $datas['lmt_redirect_urls'][str2url('lmt_redirect_url-'.strToLower($val2))]['langs'][str2url($key)]= 497 $this-> my_config['lmt_redirect_url-'.strToLower($val2)][$key];500 $this->config['lmt_redirect_url-'.strToLower($val2)][$key]; 498 501 } 499 502 } … … 565 568 if($result) 566 569 { 567 $this->display _result(l10n("lmt_author_added"), true);570 $this->displayResult(l10n("lmt_author_added"), true); 568 571 $_REQUEST['action']="list"; 569 572 } 570 573 else 571 574 { 572 $this->display _result(l10n("lmt_cannot_add_author"), false);575 $this->displayResult(l10n("lmt_cannot_add_author"), false); 573 576 } 574 577 } 575 578 else 576 579 { 577 $this->display _result(l10n("lmt_no_text"), false);580 $this->displayResult(l10n("lmt_no_text"), false); 578 581 } 579 582 } … … 593 596 if($result) 594 597 { 595 $this->display _result(l10n("lmt_author_modified"), true);598 $this->displayResult(l10n("lmt_author_modified"), true); 596 599 $_REQUEST['action']="list"; 597 600 } 598 601 else 599 602 { 600 $this->display _result(l10n("lmt_cannot_modify_author"), false);603 $this->displayResult(l10n("lmt_cannot_modify_author"), false); 601 604 } 602 605 } 603 606 else 604 607 { 605 $this->display _result(l10n("lmt_no_text"), false);608 $this->displayResult(l10n("lmt_no_text"), false); 606 609 } 607 610 } … … 618 621 if(pwg_db_changes()==1) 619 622 { 620 $this->display _result(l10n("lmt_author_deleted"), true);623 $this->displayResult(l10n("lmt_author_deleted"), true); 621 624 622 625 $sql="UPDATE ".$this->tables["images"]." SET author_id = NULL … … 628 631 if($nbimages>0) 629 632 { 630 $this->display _result($nbimages." ".l10n("lmt_author_nb_images_updated"), true);633 $this->displayResult($nbimages." ".l10n("lmt_author_nb_images_updated"), true); 631 634 } 632 635 } 633 636 else 634 637 { 635 $this->display _result(l10n("lmt_cannot_delete_author"), false);638 $this->displayResult(l10n("lmt_cannot_delete_author"), false); 636 639 } 637 640 } 638 641 else 639 642 { 640 $this->display _result(l10n("lmt_cannot_delete_author"), false);643 $this->displayResult(l10n("lmt_cannot_delete_author"), false); 641 644 } 642 645 } 643 646 else 644 647 { 645 $this->display _result(l10n("lmt_cannot_delete_author"), false);648 $this->displayResult(l10n("lmt_cannot_delete_author"), false); 646 649 } 647 650 $this->display_manageaut_page_list(); … … 667 670 668 671 $template->set_filename('body_page', 669 dirname($this-> filelocation).'/admin/plugin_admin_manageaut.tpl');672 dirname($this->getFileLocation()).'/admin/plugin_admin_manageaut.tpl'); 670 673 671 674 $datas=array( 672 675 "author_list" => array(), 673 676 "img_directory" => LMT_PATH."img/", 674 "default_licencepublished" => l10n("lmt_lbl_under-".strToLower($this-> my_config['lmt_licence_default'])),675 "default_licenceL" => strToLower($this-> my_config['lmt_licence_default']),676 "default_licenceU" => l10n("lmt_lbl_cc_s-".strToLower($this-> my_config['lmt_licence_default'])),677 "lmt_licence_logo" => $this-> my_config['lmt_licence_logo'],677 "default_licencepublished" => l10n("lmt_lbl_under-".strToLower($this->config['lmt_licence_default'])), 678 "default_licenceL" => strToLower($this->config['lmt_licence_default']), 679 "default_licenceU" => l10n("lmt_lbl_cc_s-".strToLower($this->config['lmt_licence_default'])), 680 "lmt_licence_logo" => $this->config['lmt_licence_logo'], 678 681 "nbauthor" => 0, 679 "add_link" => $this-> page_link.'&f_tabsheet=manageaut&action=add'682 "add_link" => $this->getAdminLink().'&f_tabsheet=manageaut&action=add' 680 683 ); 681 684 … … 690 693 "text1" => $row['text1'], 691 694 "text2" => $row['text2'], 692 "lnk_delete" => $this-> page_link.'&f_tabsheet=manageaut&action=delete&id='.$row['id'],693 "lnk_edit" => $this-> page_link.'&f_tabsheet=manageaut&action=edit&id='.$row['id']695 "lnk_delete" => $this->getAdminLink().'&f_tabsheet=manageaut&action=delete&id='.$row['id'], 696 "lnk_edit" => $this->getAdminLink().'&f_tabsheet=manageaut&action=edit&id='.$row['id'] 694 697 ); 695 698 } … … 707 710 708 711 $template->set_filename('body_page', 709 dirname($this-> filelocation).'/admin/plugin_admin_manageaut_edit.tpl');712 dirname($this->getFileLocation()).'/admin/plugin_admin_manageaut_edit.tpl'); 710 713 711 714 if($_REQUEST["action"]=="edit") … … 745 748 } 746 749 747 $datas["urllist"] = $this-> page_link.'&f_tabsheet=manageaut';750 $datas["urllist"] = $this->getAdminLink().'&f_tabsheet=manageaut'; 748 751 749 752 $template->assign('datas', $datas); … … 761 764 if(is_adviser()) 762 765 { 763 $this->display _result(l10n("lmt_adviser_not_allowed"), false);766 $this->displayResult(l10n("lmt_adviser_not_allowed"), false); 764 767 return(true); 765 768 } … … 775 778 $local_tpl = new Template(LMT_PATH."admin/", ""); 776 779 $local_tpl->set_filename('body_page', 777 dirname($this-> filelocation).'/admin/lmt_js.tpl');780 dirname($this->getFileLocation()).'/admin/lmt_js.tpl'); 778 781 779 782 $lmt_licence_default_values=array_slice($this->licences,0,count($this->licences)-1); … … 833 836 $local_tpl = new Template(LMT_PATH."admin/", ""); 834 837 $local_tpl->set_filename('body_page', 835 dirname($this-> filelocation).'/admin/plugin_admin_listitems.tpl');838 dirname($this->getFileLocation()).'/admin/plugin_admin_listitems.tpl'); 836 839 837 840 if(!isset($_REQUEST['filter']) || … … 870 873 $sql.=" GROUP BY lmti.image_id ORDER BY cat.id, img.id "; 871 874 872 if($this-> my_config['lmt_list_maxitems']>0)873 { 874 $refdbt = ($pagenum-1)*$this-> my_config['lmt_list_maxitems'];875 $sql.=" LIMIT ".$refdbt.", ".$this-> my_config['lmt_list_maxitems'];875 if($this->config['lmt_list_maxitems']>0) 876 { 877 $refdbt = ($pagenum-1)*$this->config['lmt_list_maxitems']; 878 $sql.=" LIMIT ".$refdbt.", ".$this->config['lmt_list_maxitems']; 876 879 } 877 880 … … 921 924 $nb=pwg_db_fetch_row($result); 922 925 923 $ pages_navigation = new pages_navigation();924 $ pages_navigation->set_nb_items($nb[0]);925 $ pages_navigation->set_nb_items_per_page($this->my_config['lmt_list_maxitems']);926 $ pages_navigation->set_current_page($pagenum);927 $ pages_navigation->set_options(array(926 $GPCPagesNavigation = new GPCPagesNavigation(); 927 $GPCPagesNavigation->setNbItems($nb[0]); 928 $GPCPagesNavigation->setNbItemsPerPage($this->config['lmt_list_maxitems']); 929 $GPCPagesNavigation->setCurrentPage($pagenum); 930 $GPCPagesNavigation->setOptions(array( 928 931 "text_prev" => l10n("lmt_nav_prev"), 929 932 "text_next" => l10n("lmt_nav_next"), … … 931 934 "text_last" => l10n("lmt_nav_last") 932 935 )); 933 $navbar=$ pages_navigation->make_navigation("loadpage");936 $navbar=$GPCPagesNavigation->makeNavigation("loadpage"); 934 937 if($navbar!="") 935 938 { … … 947 950 $local_tpl = new Template(LMT_PATH."admin/", ""); 948 951 $local_tpl->set_filename('body_page', 949 dirname($this-> filelocation).'/admin/plugin_admin_manageitems.tpl');952 dirname($this->getFileLocation()).'/admin/plugin_admin_manageitems.tpl'); 950 953 951 954 if(!isset($_REQUEST['select'])) … … 972 975 ORDER BY cat.id, img.id "; 973 976 974 if($this-> my_config['lmt_list_maxitems']>0)975 { 976 $refdbt = ($pagenum-1)*$this-> my_config['lmt_list_maxitems'];977 $sql.=" LIMIT ".$refdbt.", ".$this-> my_config['lmt_list_maxitems'];977 if($this->config['lmt_list_maxitems']>0) 978 { 979 $refdbt = ($pagenum-1)*$this->config['lmt_list_maxitems']; 980 $sql.=" LIMIT ".$refdbt.", ".$this->config['lmt_list_maxitems']; 978 981 } 979 982 … … 1023 1026 $nb=pwg_db_fetch_row($result); 1024 1027 1025 $ pages_navigation = new pages_navigation();1026 $ pages_navigation->set_nb_items($nb[0]);1027 $ pages_navigation->set_nb_items_per_page($this->my_config['lmt_list_maxitems']);1028 $ pages_navigation->set_current_page($pagenum);1029 $ pages_navigation->set_options(array(1028 $GPCPagesNavigation = new GPCPagesNavigation(); 1029 $GPCPagesNavigation->setNbItems($nb[0]); 1030 $GPCPagesNavigation->setNbItemsPerPage($this->config['lmt_list_maxitems']); 1031 $GPCPagesNavigation->setCurrentPage($pagenum); 1032 $GPCPagesNavigation->setOptions(array( 1030 1033 "text_prev" => l10n("lmt_nav_prev"), 1031 1034 "text_next" => l10n("lmt_nav_next"), … … 1033 1036 "text_last" => l10n("lmt_nav_last") 1034 1037 )); 1035 $navbar=$ pages_navigation->make_navigation("loadpage");1038 $navbar=$GPCPagesNavigation->makeNavigation("loadpage"); 1036 1039 if($navbar!="") 1037 1040 { … … 1045 1048 } //class 1046 1049 1050 1047 1051 ?>
Note: See TracChangeset
for help on using the changeset viewer.