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


PHP ModuleManager::new_instance方法代码示例

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


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

示例1: format_values

 protected function format_values($tab, $record_id)
 {
     $rb_obj = new RBO_RecordsetAccessor($tab);
     $record = $rb_obj->get_record($record_id);
     if (!$record) {
         return array();
     }
     $access = Utils_RecordBrowserCommon::get_access($tab, 'view', $record);
     if (!$access) {
         return array();
     }
     // use RB object instance for better display callback compatibility
     // some of them uses Utils_RecordBrowser::$rb_obj instance
     $rb = ModuleManager::new_instance('Utils_RecordBrowser', null, 'rb');
     $rb->construct($tab);
     $rb->init($tab);
     $fields = Utils_RecordBrowserCommon::init($tab);
     $printable_data = array();
     foreach ($fields as $f) {
         if ($access[$f['id']]) {
             $printable_data[] = array('label' => _V($f['name']), 'value' => $record->get_val($f['id'], true));
         }
     }
     // fill rows - it's easier here than in template
     if ($this->fill_empty_rows()) {
         while (count($printable_data) % $this->cols() != 0) {
             $printable_data[] = array('label' => '', 'value' => '');
         }
     }
     return $printable_data;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:31,代码来源:RecordPrinter.php

示例2: set_time_limit

$crits = $_SESSION['client']['utils_recordbrowser'][$key]['crits'];
$cols = $_SESSION['client']['utils_recordbrowser'][$key]['cols'];
$order = $_SESSION['client']['utils_recordbrowser'][$key]['order'];
$admin = $_SESSION['client']['utils_recordbrowser'][$key]['admin'];
$tab = $_SESSION['client']['utils_recordbrowser'][$key]['tab'];
$more_table_properties = $_SESSION['client']['utils_recordbrowser'][$key]['more_table_properties'];
$limit = $_SESSION['client']['utils_recordbrowser'][$key]['limit'];

ModuleManager::load_modules();
if (!Utils_RecordBrowserCommon::get_access($tab, 'print') && !Base_AclCommon::i_am_admin())
	die('Access denied');

set_time_limit(0);

$rb = ModuleManager::new_instance('Utils_RecordBrowser', null, 'print_rb');
$rb->construct($tab);
$rb->set_inline_display();
$rb->set_header_properties($more_table_properties);
$rb->disable_pagination();

ob_start();
$rb->show_data($crits, $cols, $order, $admin, false, true, $limit);
$html = ob_get_clean();

$limit_info = '';
if (is_array($limit)) {
    $offset = $limit['offset'];
    $per_page = $limit['numrows'];
    $start = $offset + 1;
    $end = $offset + $per_page;
开发者ID:62BRAINS,项目名称:EPESI,代码行数:30,代码来源:print.php

示例3: create_root

 /**
  * Creates root(first) module instance.
  *
  * Do not use directly.
  */
 public static function create_root()
 {
     ob_start();
     try {
         $default_module = Variable::get('default_module');
         self::$root = ModuleManager::new_instance($default_module, null, '0');
     } catch (Exception $e) {
         self::$root = ModuleManager::new_instance(FIRST_RUN, null, '0');
     }
     $ret = trim(ob_get_contents());
     if (strlen($ret) > 0 || self::$root == null) {
         trigger_error($ret, E_USER_ERROR);
     }
     ob_end_clean();
     return self::$root;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:21,代码来源:module_manager.php

示例4: init_module

 /**
  * Creates module instance which name is given as first parameter.
  *
  * Created module instance will be a child to the module which called this function.
  *
  * @param string $module_type module name
  * @param mixed $args arguments for module constructor
  * @param string $name unique name for the instance, will be assigned automatically by default
  * @param boolean $clear_vars clean module variables
  * @return mixed if access denied returns null, else child module object
  */
 public final function init_module($module_type, $args = null, $name = null, $clear_vars = false)
 {
     if (strpos($module_type, '#') === 0) {
         $module_type = $this->get_type() . $module_type;
     }
     $module_type = str_replace('/', '_', $module_type);
     $m =& ModuleManager::new_instance($module_type, $this, $name, $clear_vars || $this->clear_child_vars);
     if ($args === null) {
         $args = array();
     } elseif (!is_array($args)) {
         $args = array($args);
     }
     if (method_exists($m, 'construct')) {
         ob_start();
         call_user_func_array(array($m, 'construct'), $args);
         ob_end_clean();
     }
     return $m;
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:30,代码来源:module.php

示例5: copy_company_data_subroutine

 private static function copy_company_data_subroutine($values)
 {
     $access = Utils_RecordBrowserCommon::get_access('contact', 'edit', $values);
     if (!$access) {
         return;
     }
     /* First click should generate html code for leightbox and show it.
      * This function is rarely used and we don't want to increase page size.
      * To do this we use REQUEST variable UCD.
      *
      * We use module variable UCD to indicate that form was shown and we
      * must check if it was submitted. If yes - do action. If it wasn't
      * we should come back to initial state - do not print LB.
      */
     if (!(isset($_REQUEST['UCD']) || Module::static_get_module_variable('CRM/Contacts', 'UCD', 0))) {
         if (isset($values['company_name']) && $values['company_name']) {
             Base_ActionBarCommon::add('edit', __('Copy company data'), Module::create_href(array('UCD' => true)));
         }
     }
     if (isset($_REQUEST['UCD']) || Module::static_get_module_variable('CRM/Contacts', 'UCD', 0)) {
         $ucd = Module::static_get_module_variable('CRM/Contacts', 'UCD', 0);
         $ucd++;
         if ($ucd > 1) {
             Module::static_unset_module_variable('CRM/Contacts', 'UCD');
         } else {
             Module::static_set_module_variable('CRM/Contacts', 'UCD', $ucd);
         }
         $lid = 'UCDprompt';
         $form = ModuleManager::new_instance('Libs_QuickForm', null, 'QFUCDprompt');
         $form->construct();
         $sel_val = array();
         foreach (array_merge(array($values['company_name']), is_array($values['related_companies']) ? $values['related_companies'] : array()) as $id) {
             $sel_val[$id] = self::company_format_default(self::get_company($id), true);
         }
         $form->addElement('select', 'company', __('Select company:'), $sel_val);
         unset($sel_val);
         $form->addElement('html', __('Select which fields should be copied:'));
         $data = array(array('sid' => 'address_1', 'tid' => 'address_1', 'text' => __('Address 1'), 'checked' => true), array('sid' => 'address_2', 'tid' => 'address_2', 'text' => __('Address 2'), 'checked' => true), array('sid' => 'city', 'tid' => 'city', 'text' => __('City'), 'checked' => true), array('sid' => 'country', 'tid' => 'country', 'text' => __('Country'), 'checked' => true), array('sid' => 'zone', 'tid' => 'zone', 'text' => __('Zone'), 'checked' => true), array('sid' => 'postal_code', 'tid' => 'postal_code', 'text' => __('Postal Code'), 'checked' => true), array('sid' => 'phone', 'tid' => 'work_phone', 'text' => __('Phone as Work Phone'), 'checked' => false), array('sid' => 'fax', 'tid' => 'fax', 'text' => __('Fax'), 'checked' => false));
         foreach ($data as $row) {
             if (is_array($access) && isset($access[$row['tid']]) && $access[$row['tid']]) {
                 $form->addElement('checkbox', $row['sid'], $row['text'], '', $row['checked'] ? array('checked' => 'checked') : array());
             }
         }
         $ok = $form->createElement('submit', 'submit', __('Confirm'), array('onclick' => 'leightbox_deactivate("' . $lid . '")'));
         $cancel = $form->createElement('button', 'cancel', __('Cancel'), array('onclick' => 'leightbox_deactivate("' . $lid . '")'));
         $form->addGroup(array($ok, $cancel));
         if ($form->validate()) {
             $Uvalues = $form->exportValues();
             $fields = array();
             foreach ($data as $row) {
                 if (array_key_exists($row['sid'], $Uvalues)) {
                     $fields[$row['tid']] = $row['sid'];
                 }
             }
             if (isset($Uvalues['company'])) {
                 $company = CRM_ContactsCommon::get_company($Uvalues['company']);
                 $new_data = array();
                 foreach ($fields as $k => $v) {
                     $new_data[$k] = $company[$v];
                 }
                 Utils_RecordBrowserCommon::update_record('contact', $values['id'], $new_data);
             }
             Module::static_unset_module_variable('CRM/Contacts', 'UCD');
             location(array());
         }
         // set default to main company
         if ($mc = self::get_main_company()) {
             $form->setDefaults(array('company' => $mc));
         }
         $html = $form->toHtml();
         Libs_LeightboxCommon::display($lid, $html);
         Base_ActionBarCommon::add('edit', __('Copy company data'), Libs_LeightboxCommon::get_open_href($lid));
         if (isset($_REQUEST['UCD'])) {
             eval_js('leightbox_activate(\'' . $lid . '\')');
         }
         unset($_REQUEST['UCD']);
     }
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:78,代码来源:ContactsCommon_0.php


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