public function install() { Base_ThemeCommon::install_default_theme($this->get_type()); ModuleManager::include_common($this->get_type(), 0); Base_PrintCommon::register_document_type(new Base_Print_Document_HTML()); Base_PrintCommon::register_document_type(new Base_Print_Document_PDF()); return true; }
/** * Get Printer object, that will be used to print data. * * @return Base_Print_Printer * @throws ErrorException When you won't call set_printer before, then this * method will try to create printer object using get_printer_classname. * If returned string is not a proper printer class name, then you'll get * an exception. */ public function get_printer() { if (!isset($this->printer)) { $printer_classname = $this->get_printer_classname(); $printer = Base_PrintCommon::printer_instance($printer_classname); $this->set_printer($printer); } return $this->printer; }
public function uninstall() { DB::DropTable('recordbrowser_clipboard_pattern'); DB::DropTable('recordbrowser_browse_mode_definitions'); DB::DropTable('recordbrowser_addon'); DB::DropTable('recordbrowser_table_properties'); DB::DropTable('recordbrowser_datatype'); Base_PrintCommon::unregister_printer('Utils_RecordBrowser_RecordPrinter'); Base_ThemeCommon::uninstall_default_theme('Utils/RecordBrowser'); return true; }
public function admin() { if ($this->is_back()) { $this->parent->reset(); return; } Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href()); $form = $this->init_module('Libs/QuickForm'); foreach (Base_PrintCommon::get_registered_printers_translated() as $class_name => $printer_name) { $printer = Base_PrintCommon::printer_instance($class_name); $form->addElement('header', $printer_name, $printer_name); foreach ($printer->default_templates() as $tpl_name => $tpl) { $field_id = "{$class_name}::{$tpl_name}"; $field_id = preg_replace('/[^A-Za-z0-9_:]/', '_', $field_id); $form->addElement('checkbox', $field_id, _V($tpl_name)); $state = !Base_PrintCommon::is_template_disabled($class_name, $tpl_name); $form->setDefaults(array($field_id => $state)); } } if ($form->validate()) { $values = $form->exportValues(); foreach (Base_PrintCommon::get_registered_printers_translated() as $class_name => $printer_name) { $printer = Base_PrintCommon::printer_instance($class_name); foreach ($printer->default_templates() as $tpl_name => $tpl) { $field_id = "{$class_name}::{$tpl_name}"; $field_id = preg_replace('/[^A-Za-z0-9_:]/', '_', $field_id); $active = isset($values[$field_id]) ? $values[$field_id] : false; Base_PrintCommon::set_template_disabled($class_name, $tpl_name, $active); } } $this->parent->reset(); } else { Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href()); $this->display_module($form); } }
public static function unset_printer($tab) { $printer_class = DB::GetOne('SELECT printer FROM recordbrowser_table_properties WHERE tab=%s', $tab); if ($printer_class) { Base_PrintCommon::unregister_printer($printer_class); DB::Execute('UPDATE recordbrowser_table_properties SET printer=%s WHERE tab=%s', array('', $tab)); return $printer_class; } return false; }
/** * Get href to call a print method * * Example: * <code> * $printer = new Some_Printer_class(); * Base_ActionBarCommon::add('print', __('Print'), $printer->get_href($data)); * </code> * * @param mixed $data Data that will be passed to print_document method * * @return mixed|string By default it should be a string with href="...", * but you can override returned value by registering your own callback * with Base_PrintCommon::set_print_href_callback method */ public function get_href($data) { $printer = get_class($this); $href = Base_PrintCommon::get_print_href($data, $printer); return $href; }
<?php defined("_VALID_ACCESS") || die('Direct access forbidden'); Base_PrintCommon::register_printer(new Utils_RecordBrowser_RecordPrinter());