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


PHP hook_handle_callback函数代码示例

本文整理汇总了PHP中hook_handle_callback函数的典型用法代码示例。如果您正苦于以下问题:PHP hook_handle_callback函数的具体用法?PHP hook_handle_callback怎么用?PHP hook_handle_callback使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: foreach

    foreach ($plugins_to_init as $plugin_name) {
        if (class_exists('module_' . $plugin_name, false)) {
            eval('$plugins[$plugin_name] = new module_' . $plugin_name . '();');
            // this is a hack for php 5.2 to get the can_i() thing working
            //eval('module_'.$plugin_name.'::$module_name_hack = module_'.$plugin_name.'::get_class();');
            if (_UCM_INSTALLED && $plugins[$plugin_name]->is_plugin_enabled()) {
                $plugins[$plugin_name]->init();
                //if(!$plugins[$plugin_name]->get_installed_plugin_version()){
                //$uninstalled_plugins[$plugin_name] = &$plugins[$plugin_name];
                //unset($plugins[$plugin_name]);
                //}
            }
        }
    }
}
hook_handle_callback('plugins_loaded');
/*foreach($plugins as $plugin_name => &$p){
    echo $plugin_name.'<br>';
    eval('echo module_'.$plugin_name.'::$module_name_hack;');
    echo '<br>';
}*/
if (!function_exists('sort_plugins')) {
    function sort_plugins($a, $b)
    {
        return $a->module_position > $b->module_position;
    }
}
uasort($plugins, 'sort_plugins');
if (isset($_REQUEST['auto_login'])) {
    if ($_REQUEST['auto_login'] == 123) {
        $_REQUEST['auto_login'] = module_security::get_auto_login_string(1);
开发者ID:sgh1986915,项目名称:php-crm,代码行数:31,代码来源:init.php

示例2: _e

            echo module_config::c('customer_signup_on_login_url', '') ?: '?signup';
            ?>
"><?php 
            _e('Sign Up');
            ?>
</a>
                                    <?php 
        }
        ?>

                                </p>
                            </td>
                        </tr>
                    </table>
                    <?php 
        hook_handle_callback('login_screen');
        ?>

                </form>
            </td>
        </tr>
      </table>

        <script type="text/javascript">
            $(function(){
                $('#email')[0].focus();
                setTimeout(function(){
                    if($('#email').val() != ''){
                        $('#password')[0].focus();
                    }
                },100);
开发者ID:sgh1986915,项目名称:php-crm,代码行数:31,代码来源:login.php

示例3: forum_text

        ?>
 style="display:block;" <?php 
    }
    ?>
><?php 
    echo forum_text(trim($task_data['long_description']));
    ?>
</div>
            <?php 
} else {
    ?>
                &nbsp;
            <?php 
}
if (function_exists('hook_handle_callback') && $task_data['task_id']) {
    hook_handle_callback('job_task_after', $task_data['job_id'], $task_data['task_id'], $job, $task_data);
}
?>
        </td>
        <td valign="top" class="task_drag_handle">
            <?php 
if ($task_data[$hours_prefix . 'hours'] == 0 && $task_data['manual_task_type'] == _TASK_TYPE_AMOUNT_ONLY) {
    // only amount, no hours or qty
} else {
    // are the logged hours different to the billed hours?
    // are we completed too?
    if ($task_data[$hours_prefix . 'hours'] != 0) {
        if ($task_data['manual_task_type'] == _TASK_TYPE_HOURS_AMOUNT && function_exists('decimal_time_out')) {
            $hours_value = decimal_time_out($task_data[$hours_prefix . 'hours']);
        } else {
            $hours_value = number_out($task_data[$hours_prefix . 'hours'], true);
开发者ID:sgh1986915,项目名称:php-crm,代码行数:31,代码来源:ajax_task_preview.php

示例4: _format_invoice_payment

 private static function _format_invoice_payment($invoice_payment_data, $finance_data)
 {
     if (isset($invoice_payment_data['invoice_payment_id']) && $invoice_payment_data['invoice_payment_id'] > 0 && isset($invoice_payment_data['invoice_id']) && $invoice_payment_data['invoice_id'] > 0) {
         $invoice_data = module_invoice::get_invoice($invoice_payment_data['invoice_id']);
         $invoice_payment_data['url'] = module_finance::link_open('new', false) . '&invoice_payment_id=' . $invoice_payment_data['invoice_payment_id'];
         if ($invoice_payment_data['amount'] < 0 && (isset($invoice_payment_data['payment_type']) && $invoice_payment_data['payment_type'] == _INVOICE_PAYMENT_TYPE_OVERPAYMENT_CREDIT)) {
             $invoice_payment_data['name'] = !isset($invoice_payment_data['name']) ? _l('Assigning Credit') : $invoice_payment_data['name'];
             $invoice_payment_data['description'] = !isset($invoice_payment_data['description']) ? _l('Assigning Overpayment Credit from invoice <a href="%s">#%s</a>', module_invoice::link_open($invoice_payment_data['invoice_id'], false), $invoice_data['name'], $invoice_payment_data['method']) : $invoice_payment_data['description'];
             // refund
             $invoice_payment_data['amount'] = abs($invoice_payment_data['amount']);
             $invoice_payment_data['debit'] = abs($invoice_payment_data['amount']);
             $invoice_payment_data['sub_amount'] = abs($invoice_payment_data['amount']);
             $invoice_payment_data['taxable_amount'] = abs($invoice_payment_data['amount']);
             $invoice_payment_data['credit'] = 0;
             $invoice_payment_data['type'] = 'e';
         } else {
             if ($invoice_payment_data['amount'] < 0 || isset($invoice_payment_data['payment_type']) && $invoice_payment_data['payment_type'] == _INVOICE_PAYMENT_TYPE_REFUND) {
                 $invoice_payment_data['name'] = !isset($invoice_payment_data['name']) ? _l('Invoice Refund') : $invoice_payment_data['name'];
                 $invoice_payment_data['description'] = !isset($invoice_payment_data['description']) ? _l('Refund against invoice <a href="%s">#%s</a> via "%s" method', module_invoice::link_open($invoice_payment_data['invoice_id'], false), $invoice_data['name'], $invoice_payment_data['method']) : $invoice_payment_data['description'];
                 // refund
                 $invoice_payment_data['amount'] = abs($invoice_payment_data['amount']);
                 $invoice_payment_data['debit'] = abs($invoice_payment_data['amount']);
                 $invoice_payment_data['sub_amount'] = abs($invoice_payment_data['amount']);
                 $invoice_payment_data['taxable_amount'] = abs($invoice_payment_data['amount']);
                 $invoice_payment_data['credit'] = 0;
                 $invoice_payment_data['type'] = 'e';
             } else {
                 $invoice_payment_data['name'] = !isset($invoice_payment_data['name']) ? _l('Invoice Payment') : $invoice_payment_data['name'];
                 $invoice_payment_data['description'] = !isset($invoice_payment_data['description']) ? _l('Payment against invoice <a href="%s">#%s</a> via "%s" method', module_invoice::link_open($invoice_payment_data['invoice_id'], false), $invoice_data['name'], $invoice_payment_data['method']) : $invoice_payment_data['description'];
                 $invoice_payment_data['credit'] = $invoice_payment_data['amount'];
                 $invoice_payment_data['sub_amount'] = $invoice_payment_data['amount'];
                 $invoice_payment_data['taxable_amount'] = $invoice_payment_data['amount'];
                 $invoice_payment_data['debit'] = 0;
                 $invoice_payment_data['type'] = 'i';
             }
         }
         if (isset($invoice_payment_data['data']) && strlen($invoice_payment_data['data'])) {
             $details = @unserialize($invoice_payment_data['data']);
             if ($details && isset($details['custom_notes']) && strlen($details['custom_notes'])) {
                 $invoice_payment_data['description'] .= " \n(" . $details['custom_notes'] . ')';
             }
         }
         $invoice_payment_data['account_name'] = '';
         $invoice_payment_data['categories'] = '';
         if (module_config::c('finance_date_type', 'payment') == 'invoice') {
             $invoice_payment_data['transaction_date'] = $invoice_data['date_create'];
         } else {
             $invoice_payment_data['transaction_date'] = $invoice_payment_data['date_paid'];
         }
         $invoice_payment_data['invoice_name'] = $invoice_data['name'];
         $invoice_payment_data['taxes'] = $invoice_data['taxes'];
         // calculate the sub amount based on taxes.
         if ($invoice_payment_data['amount'] >= $invoice_data['total_amount']) {
             // user overpaid this invoice amount.
             // check if there hasn't been any refunds or anything or assigning deposits.
         } else {
             if ($invoice_payment_data['amount'] == $invoice_data['total_amount']) {
                 // then we can work out any sub non taxable items.
                 if ($invoice_data['total_tax'] > 0) {
                     //$finance['sub_amount'] = $finance['amount'] - $invoice_data['total_tax'];
                     // todo: cache these and do a get_invoice basic above so we don't calculate each time.
                     $invoice_payment_data['sub_amount'] = $invoice_data['total_sub_amount'];
                     $invoice_payment_data['taxable_amount'] = $invoice_data['total_sub_amount_taxable'];
                 }
             } else {
                 // todo: average out the difference between invoice payments and the total amount? spread the tax over all payments maybe?
                 if (count($invoice_payment_data['taxes'])) {
                     $tax_percents = 0;
                     $increment = false;
                     foreach ($invoice_payment_data['taxes'] as $tax_id => $tax) {
                         if ($tax['increment']) {
                             $increment = true;
                         }
                     }
                     foreach ($invoice_payment_data['taxes'] as $tax_id => $tax) {
                         // the 'amount' of tax here will be incorrect, because this is a part payment against an invoice
                         // the 'amount' in here is the FULL amount of tax that has been charged against the invoice
                         $invoice_payment_data['taxes'][$tax_id]['amount'] = 0;
                         if ($increment) {
                             $invoice_payment_data['taxable_amount'] = $invoice_payment_data['taxable_amount'] / (1 + $tax['percent'] / 100);
                         } else {
                             $tax_percents += $tax['percent'] / 100;
                         }
                     }
                     $invoice_payment_data['taxable_amount'] = round($invoice_payment_data['taxable_amount'] / (1 + $tax_percents) * 100, 2) / 100;
                     $invoice_payment_data['sub_amount'] = $invoice_payment_data['taxable_amount'];
                 }
             }
         }
         $new_finance = hook_handle_callback('finance_invoice_listing', $invoice_payment_data['invoice_id'], $finance_data);
         if (is_array($new_finance) && count($new_finance)) {
             foreach ($new_finance as $n) {
                 $invoice_payment_data = array_merge($invoice_payment_data, $n);
             }
         }
     }
     return $invoice_payment_data;
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:98,代码来源:finance.php

示例5: array

 
                    </tr>
                <?php 
        }
        ?>
                </tbody>
            </table>
            </div>

        <?php 
        $fieldset_data = array('heading' => array('title' => $table_name, 'type' => 'h3'), 'elements_before' => ob_get_clean());
        echo module_form::generate_fieldset($fieldset_data);
        unset($fieldset_data);
        hook_handle_callback('layout_column_thirds', 'col_end');
    }
    hook_handle_callback('layout_column_thirds', 'end');
    if (get_display_mode() != 'mobile') {
        ?>
	<script type="text/javascript">
	$(function() {
	    $("#summary-form").dialog({
	        autoOpen: false,
	        height: 550,
	        width: 750,
	        modal: true,
	        buttons: {
	            '<?php 
        _e('Close');
        ?>
': function() {
	                $(this).dialog('close');
开发者ID:sgh1986915,项目名称:php-crm,代码行数:30,代码来源:dashboard_summary.php

示例6: print_search_bar

    public static function print_search_bar($owner_table, $options = array())
    {
        // let the themes override this search bar function.
        if (self::can_i('view', 'Extra Fields')) {
            $result = hook_handle_callback('extra_fields_search_bar', $owner_table, $options);
            if (is_array($result)) {
                // has been handed by a theme.
                echo current($result);
            } else {
                $defaults = self::get_defaults($owner_table);
                $searchable_fields = array();
                foreach ($defaults as $default) {
                    if (isset($default['searchable']) && $default['searchable']) {
                        $searchable_fields[$default['key']] = $default;
                    }
                }
                foreach ($searchable_fields as $searchable_field) {
                    ?>

                    <td class="search_title">
                        <?php 
                    echo htmlspecialchars($searchable_field['key']);
                    ?>
:
                    </td>
                    <td class="search_input">
                        <?php 
                    module_form::generate_form_element(array('type' => 'text', 'name' => 'search[extra_fields][' . htmlspecialchars($searchable_field['key']) . ']'));
                    ?>

                    </td>
                    <?php 
                }
            }
        }
    }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:36,代码来源:extra.php

示例7: htmlspecialchars

?>
">
    <td>
       <textarea name="quote_task[<?php 
echo $quote_task_id;
?>
][long_description]" class="edit_task_long_description" tabindex="11" id="task_long_desc_<?php 
echo $quote_task_id;
?>
"><?php 
echo htmlspecialchars($task_data['long_description']);
?>
</textarea>
        <?php 
if (function_exists('hook_handle_callback')) {
    hook_handle_callback('quote_task_after', $task_data['quote_id'], $task_data['quote_task_id'], $quote, $task_data);
}
?>
    </td>
    <td colspan="<?php 
echo $colspan;
?>
" valign="top">

        <div>
        <?php 
_e('Task Type:');
?>
 <?php 
$types = module_quote::get_task_types();
$types['-1'] = _l('Default (%s)', $types[$quote['default_task_type']]);
开发者ID:sgh1986915,项目名称:php-crm,代码行数:31,代码来源:ajax_task_edit.php

示例8: delete_job

 public static function delete_job($job_id)
 {
     $job_id = (int) $job_id;
     if (_DEMO_MODE && $job_id == 1) {
         return;
     }
     if ((int) $job_id > 0) {
         $original_job_data = self::get_job($job_id);
         if (!$original_job_data || $original_job_data['job_id'] != $job_id) {
             return false;
         }
     }
     if (!self::can_i('delete', 'Jobs')) {
         return false;
     }
     $sql = "DELETE FROM " . _DB_PREFIX . "job WHERE job_id = '" . $job_id . "' LIMIT 1";
     $res = query($sql);
     $sql = "DELETE FROM " . _DB_PREFIX . "task WHERE job_id = '" . $job_id . "'";
     $res = query($sql);
     $sql = "DELETE FROM " . _DB_PREFIX . "task_log WHERE job_id = '" . $job_id . "'";
     $res = query($sql);
     $sql = "UPDATE " . _DB_PREFIX . "job SET renew_job_id = NULL WHERE renew_job_id = '" . $job_id . "'";
     $res = query($sql);
     if (class_exists('module_file', false)) {
         $sql = "UPDATE " . _DB_PREFIX . "file SET job_id = 0 WHERE job_id = '" . $job_id . "'";
         query($sql);
     }
     if (class_exists('module_group', false)) {
         module_group::delete_member($job_id, 'job');
     }
     foreach (module_invoice::get_invoices(array('job_id' => $job_id)) as $val) {
         // only delete this invoice if it has no tasks left
         // it could be a combined invoice with other jobs now.
         $invoice_items = module_invoice::get_invoice_items($val['invoice_id']);
         if (!count($invoice_items)) {
             module_invoice::delete_invoice($val['invoice_id']);
         }
     }
     if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
         module_note::note_delete("job", $job_id);
     }
     if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
         module_extra::delete_extras('job', 'job_id', $job_id);
     }
     hook_handle_callback('job_delete', $job_id);
     module_cache::clear('job');
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:47,代码来源:job.php

示例9: listCalendarByRange

function listCalendarByRange($sd, $ed)
{
    $ret = array();
    $ret['events'] = array();
    $ret["issort"] = true;
    $ret["start"] = php2JsTime($sd);
    $ret["end"] = php2JsTime($ed);
    $ret['error'] = null;
    $calendar_data_access = module_calendar::get_calendar_data_access();
    // hook into things like jobs and stuff who want to return calendar entries.
    $hook_results = hook_handle_callback('calendar_events', $sd, $ed);
    if (is_array($hook_results) && count($hook_results)) {
        foreach ($hook_results as $hook_result) {
            if (is_array($hook_result)) {
                foreach ($hook_result as $result) {
                    // format our hook results to match our bad (indexed) array,
                    // will update that array in the future
                    /*$calendar_events[] = array(
                          'subject' => $job['name'],
                          'customer_id' => $job['customer_id'],
                          'start_time' => $job['date_start'],
                          'user_id' => $job['user_id'],
                          'description' => 'Test Description',
                          'link' => module_job::link_open($job['job_id'],true,$job),
                      );*/
                    $staff_names = array();
                    if (isset($result['staff_ids']) && count($result['staff_ids'])) {
                        switch ($calendar_data_access) {
                            case _CALENDAR_ACCESS_ALL:
                                break;
                            case _CALENDAR_ACCESS_ASSIGNED:
                            default:
                                $current_user = module_security::get_loggedin_id();
                                if (!in_array($current_user, $result['staff_ids'])) {
                                    continue 2;
                                }
                                break;
                        }
                        foreach ($result['staff_ids'] as $staff_id) {
                            $staff_names[] = module_user::link_open($staff_id, true);
                        }
                    }
                    $staff_names = implode(', ', $staff_names);
                    $result[0] = false;
                    // no calendar ID at the moment
                    $result[1] = $result['subject'];
                    $result[2] = php2JsTime($result['start_time']);
                    $result[3] = php2JsTime(isset($result['end_time']) ? $result['end_time'] : $result['start_time']);
                    $result[4] = !isset($result['all_day']) || $result['all_day'];
                    $result[5] = 0;
                    $result[6] = 0;
                    $result[7] = 0;
                    //col
                    $result[8] = 2;
                    $result[9] = 0;
                    $result[10] = 0;
                    $result[13] = $result['customer_id'];
                    $result[12] = $result['link'];
                    $result[14] = isset($_REQUEST['customer_id']) && $_REQUEST['customer_id'] != $result['customer_id'] ? 'chip-fade' : '';
                    $result['staff'] = $staff_names;
                    $ret['events'][] = $result;
                }
            }
        }
    }
    try {
        $sql = "select * from `" . _DB_PREFIX . "calendar` where `start` >= '" . mysql_real_escape_string($sd) . "' AND `start` <= '" . mysql_real_escape_string($ed) . "'";
        //  echo $sql;
        $rows = qa($sql);
        foreach ($rows as $row) {
            //$ret['events'][] = $row;
            //$attends = $row->AttendeeNames;
            //if($row->OtherAttendee){
            //  $attends .= $row->OtherAttendee;
            //}
            //echo $row->StartTime;
            $more_than_1_day = date('Ymd', $row['start']) == date('Ymd', $row['end']) ? 0 : 1;
            $customer_name = $customer_link = '';
            if ($row['customer_id'] > 0) {
                $customer_data = module_customer::get_customer($row['customer_id'], true, true);
                if (!$customer_data || $customer_data['customer_id'] != $row['customer_id']) {
                    $row['customer_id'] = 0;
                } else {
                    switch ($calendar_data_access) {
                        case _CALENDAR_ACCESS_ALL:
                            break;
                        case _CALENDAR_ACCESS_ASSIGNED:
                        default:
                            if (isset($customer_data['_no_access'])) {
                                continue 2;
                            }
                            break;
                    }
                    $customer_name = $customer_data['customer_name'];
                    $customer_link = module_customer::link_open($row['customer_id'], true, $customer_data);
                }
            }
            $calendar_event = module_calendar::get_calendar($row['calendar_id']);
            $staff_names = array();
            if (count($calendar_event['staff_ids'])) {
//.........这里部分代码省略.........
开发者ID:sgh1986915,项目名称:php-crm,代码行数:101,代码来源:calendar.php

示例10: array

        }
    });
}
if (module_job::is_plugin_enabled() && module_job::can_i('view', 'Jobs')) {
    $columns['invoice_job'] = array('title' => 'Job', 'callback' => function ($invoice) {
        foreach ($invoice['job_ids'] as $job_id) {
            if ((int) $job_id > 0) {
                echo module_job::link_open($job_id, true);
                $job_data = module_job::get_job($job_id);
                if ($job_data['date_start'] && $job_data['date_start'] != '0000-00-00' && $job_data['date_renew'] && $job_data['date_renew'] != '0000-00-00') {
                    _e(' (%s to %s)', print_date($job_data['date_start']), print_date(strtotime("-1 day", strtotime($job_data['date_renew']))));
                }
                echo "<br/>\n";
            }
        }
        hook_handle_callback('invoice_admin_list_job', $invoice['invoice_id']);
    });
}
if (!isset($_REQUEST['customer_id']) && module_customer::can_i('view', 'Customers')) {
    $colspan++;
    $columns['invoice_customer'] = array('title' => 'Customer', 'callback' => function ($invoice) {
        echo module_customer::link_open($invoice['customer_id'], true);
    });
}
$columns['c_invoice_total'] = array('title' => 'Invoice Total', 'callback' => function ($invoice) {
    echo dollar($invoice['total_amount'], true, $invoice['currency_id']);
});
$columns['c_invoice_total_due'] = array('title' => 'Amount Due', 'callback' => function ($invoice) {
    echo dollar($invoice['total_amount_due'], true, $invoice['currency_id']);
    ?>
开发者ID:sgh1986915,项目名称:php-crm,代码行数:30,代码来源:invoice_admin_list.php

示例11: delete_vendor

 public function delete_vendor($vendor_id, $remove_linked_data = true)
 {
     $vendor_id = (int) $vendor_id;
     if ($vendor_id > 0) {
         if (_DEMO_MODE && $vendor_id == 1) {
             set_error('Sorry this is a Demo Vendor. It cannot be changed.');
             redirect_browser(self::link_open($vendor_id));
         }
         $vendor = self::get_vendor($vendor_id);
         if ($vendor && $vendor['vendor_id'] == $vendor_id) {
             // todo: Delete emails (wack these in this vendor_deleted hook)
             hook_handle_callback('vendor_deleted', $vendor_id, $remove_linked_data);
             if (class_exists('module_group', false)) {
                 // remove the vendor from his groups
                 module_group::delete_member($vendor_id, 'vendor');
             }
             if (class_exists('module_extra', false)) {
                 module_extra::delete_extras('vendor', 'vendor_id', $vendor_id);
             }
             // remove the contacts from this vendor
             foreach (module_user::get_contacts(array('vendor_id' => $vendor_id)) as $val) {
                 if ($val['vendor_id'] && $val['vendor_id'] == $vendor_id) {
                     module_user::delete_user($val['user_id']);
                 }
             }
             if (class_exists('module_note', false)) {
                 module_note::note_delete("vendor", 'vendor_id', $vendor_id);
             }
             handle_hook("address_delete", $this, 'all', "vendor", 'vendor_id', $vendor_id);
             // finally delete the main vendor record
             // (this is so the above code works with its sql joins)
             $sql = "DELETE FROM " . _DB_PREFIX . "vendor WHERE vendor_id = '" . $vendor_id . "' LIMIT 1";
             query($sql);
         }
     }
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:36,代码来源:vendor.php

示例12: delete_website

 public static function delete_website($website_id)
 {
     $website_id = (int) $website_id;
     if (_DEMO_MODE && $website_id == 1) {
         set_error('Sorry this is a Demo Website. It cannot be deleted.');
         return;
     }
     if ((int) $website_id > 0) {
         $original_website_data = self::get_website($website_id);
         if (!$original_website_data || $original_website_data['website_id'] != $website_id) {
             return false;
         }
     }
     if (!self::can_i('delete', 'Websites')) {
         return false;
     }
     hook_handle_callback('website_deleted', $website_id);
     $sql = "DELETE FROM " . _DB_PREFIX . "website WHERE website_id = '" . $website_id . "' LIMIT 1";
     query($sql);
     if (class_exists('module_group', false)) {
         module_group::delete_member($website_id, 'website');
     }
     foreach (module_job::get_jobs(array('website_id' => $website_id)) as $val) {
         module_job::delete_job($val['website_id']);
     }
     module_note::note_delete("website", $website_id);
     module_extra::delete_extras('website', 'website_id', $website_id);
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:28,代码来源:website.php

示例13: new_table_manager

 public static function new_table_manager()
 {
     require_once module_theme::include_ucm('includes/plugin_theme/class.table_manager.php');
     // return our new table manager class.
     // but we allow individual themes to provide their own table manager class.
     $result = hook_handle_callback('get_table_manager');
     if (is_array($result) && isset($result[0])) {
         return $result[0];
     }
     return new ucm_table_manager();
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:11,代码来源:theme.php

示例14: process_pagination

function process_pagination($rows, $per_page = 20, $page_number = 0, $table_id = 'table')
{
    $data = array();
    $data['rows'] = array();
    $data['links'] = '';
    if ($per_page !== false && $per_page <= 0) {
        $per_page = 20;
    }
    hook_handle_callback('pagination_hook_init');
    if (isset($GLOBALS['pagination_group_hack'])) {
        module_group::run_pagination_hook($rows);
    }
    if (isset($GLOBALS['pagination_import_export_hack'])) {
        module_import_export::run_pagination_hook($rows);
    }
    if (class_exists('module_table_sort', false)) {
        module_table_sort::run_pagination_hook($rows, $per_page);
    }
    $db_resource = false;
    if (is_resource($rows)) {
        // have the db handle for the sql query
        $db_resource = $rows;
        unset($rows);
        $total = mysql_num_rows($db_resource);
    } else {
        if (is_array($rows)) {
            // we have the rows in an array.
            $total = count($rows);
        } else {
            print_header_message();
            echo 'Pagination failed. Please try going to Settings > Update and click the Manual Update button. If that does not fix this error please report this bug.';
            exit;
        }
    }
    // pagination hooks
    ob_start();
    if ($total > 0) {
        // group hack addition
        hook_handle_callback('pagination_hook_display');
        if (isset($GLOBALS['pagination_group_hack']) && module_group::groups_enabled()) {
            module_group::display_pagination_hook();
        }
        if (get_display_mode() != 'mobile') {
            // export hack addition
            if (isset($GLOBALS['pagination_import_export_hack'])) {
                module_import_export::display_pagination_hook();
            }
            if (class_exists('module_table_sort', false)) {
                module_table_sort::display_pagination_hook($per_page);
            }
        }
    }
    $pagination_hooks = ob_get_clean();
    // default summary/links content
    ob_start();
    echo '<div class="pagination_summary"><p>';
    if ($total > 0) {
        _e('Showing records %s to %s of %s', $page_number * $per_page + 1, $total, $total);
        echo $pagination_hooks;
    } else {
        _e('No results found');
    }
    echo '</p></div>';
    $data['summary'] = ob_get_clean();
    ob_start();
    echo '<div class="pagination_links">';
    //echo "\n<p>";
    echo _l('Page %s of %s', 1, 1);
    //echo '</p>';
    echo '</div>';
    $data['links'] = ob_get_clean();
    $data['page_numbers'] = 1;
    if ($per_page === false || $total <= $per_page) {
        if ($db_resource) {
            $rows = array();
            //if($per_page !== false && $total<=$per_page){
            // pull out all records.
            while ($row = mysql_fetch_assoc($db_resource)) {
                $rows[] = $row;
            }
            if (mysql_num_rows($db_resource) > 0) {
                mysql_data_seek($db_resource, 0);
            }
            //}
        }
        $data['rows'] = $rows;
    } else {
        if (isset($_REQUEST['pg' . $table_id])) {
            $page_number = $_REQUEST['pg' . $table_id];
        }
        if ($table_id && $table_id != 'table' && $total > $per_page) {
            // we remember the last page number we were on.
            if (!isset($_SESSION['_table_page_num'])) {
                $_SESSION['_table_page_num'] = array();
            }
            if (!isset($_SESSION['_table_page_num'][$table_id])) {
                $_SESSION['_table_page_num'][$table_id] = array('total_count' => 0, 'page_number' => 0);
            }
            $_SESSION['_table_page_num'][$table_id]['total_count'] = $total;
            if (isset($_REQUEST['pg' . $table_id])) {
//.........这里部分代码省略.........
开发者ID:sgh1986915,项目名称:php-crm,代码行数:101,代码来源:functions.php

示例15: delete_customer

 public function delete_customer($customer_id, $remove_linked_data = true)
 {
     $customer_id = (int) $customer_id;
     if ($customer_id > 0) {
         if (_DEMO_MODE && $customer_id == 1) {
             set_error('Sorry this is a Demo Customer. It cannot be changed.');
             redirect_browser(self::link_open($customer_id));
         }
         $customer = self::get_customer($customer_id);
         if ($customer && $customer['customer_id'] == $customer_id) {
             // todo: Delete emails (wack these in this customer_deleted hook)
             hook_handle_callback('customer_deleted', $customer_id, $remove_linked_data);
             if (class_exists('module_group', false)) {
                 // remove the customer from his groups
                 module_group::delete_member($customer_id, 'customer');
             }
             if (class_exists('module_extra', false)) {
                 module_extra::delete_extras('customer', 'customer_id', $customer_id);
             }
             // remove the contacts from this customer
             foreach (module_user::get_contacts(array('customer_id' => $customer_id)) as $val) {
                 if ($val['customer_id'] && $val['customer_id'] == $customer_id) {
                     module_user::delete_user($val['user_id']);
                 }
             }
             // remove staff
             delete_from_db('customer_user_rel', 'customer_id', $customer_id);
             if (class_exists('module_note', false)) {
                 module_note::note_delete("customer", 'customer_id', $customer_id);
             }
             handle_hook("address_delete", $this, 'all', "customer", 'customer_id', $customer_id);
             // todo, check the 'delete' permission on each one of these 'delete' method calls
             // do that better when we remove each of these and put them into the customer delete hook
             if ($remove_linked_data) {
                 if (class_exists('module_website', false) && module_website::is_plugin_enabled()) {
                     foreach (module_website::get_websites(array('customer_id' => $customer_id)) as $val) {
                         if ($val['customer_id'] && $val['customer_id'] == $customer_id) {
                             module_website::delete_website($val['website_id']);
                         }
                     }
                 }
                 if (class_exists('module_job', false) && module_job::is_plugin_enabled()) {
                     foreach (module_job::get_jobs(array('customer_id' => $customer_id)) as $val) {
                         if ($val['customer_id'] && $val['customer_id'] == $customer_id) {
                             module_job::delete_job($val['job_id']);
                         }
                     }
                 }
                 if (class_exists('module_invoice', false) && module_invoice::is_plugin_enabled()) {
                     foreach (module_invoice::get_invoices(array('customer_id' => $customer_id)) as $val) {
                         if ($val['customer_id'] && $val['customer_id'] == $customer_id) {
                             module_invoice::delete_invoice($val['invoice_id']);
                         }
                     }
                 }
                 if (class_exists('module_quote', false) && module_quote::is_plugin_enabled()) {
                     foreach (module_quote::get_quotes(array('customer_id' => $customer_id)) as $val) {
                         if ($val['customer_id'] && $val['customer_id'] == $customer_id) {
                             module_quote::delete_quote($val['quote_id']);
                         }
                     }
                 }
                 //handle_hook("file_delete",$this,"customer",'customer_id',$customer_id);
             } else {
                 // instead of deleting these records we just update them to customer_id = 0
                 if (class_exists('module_website', false) && module_website::is_plugin_enabled()) {
                     foreach (module_website::get_websites(array('customer_id' => $customer_id)) as $val) {
                         if ($val['customer_id'] && $val['customer_id'] == $customer_id) {
                             update_insert('website_id', $val['website_id'], 'website', array('customer_id' => 0));
                         }
                     }
                 }
                 if (class_exists('module_job', false) && module_job::is_plugin_enabled()) {
                     foreach (module_job::get_jobs(array('customer_id' => $customer_id)) as $val) {
                         if ($val['customer_id'] && $val['customer_id'] == $customer_id) {
                             update_insert('job_id', $val['job_id'], 'job', array('customer_id' => 0));
                         }
                     }
                 }
                 if (class_exists('module_invoice', false) && module_invoice::is_plugin_enabled()) {
                     foreach (module_invoice::get_invoices(array('customer_id' => $customer_id)) as $val) {
                         if ($val['customer_id'] && $val['customer_id'] == $customer_id) {
                             update_insert('invoice_id', $val['invoice_id'], 'invoice', array('customer_id' => 0));
                         }
                     }
                 }
                 if (class_exists('module_quote', false) && module_quote::is_plugin_enabled()) {
                     foreach (module_quote::get_quotes(array('customer_id' => $customer_id)) as $val) {
                         if ($val['customer_id'] && $val['customer_id'] == $customer_id) {
                             update_insert('quote_id', $val['quote_id'], 'quote', array('customer_id' => 0));
                         }
                     }
                 }
                 if (class_exists('module_file', false) && module_file::is_plugin_enabled()) {
                     foreach (module_file::get_files(array('owner_id' => $customer_id, 'owner_table' => 'customer')) as $val) {
                         if ($val['customer_id'] && $val['customer_id'] == $customer_id) {
                             update_insert('file_id', $val['file_id'], 'file', array('owner_id' => 0, 'owner_table' => ''));
                         }
                     }
                 }
//.........这里部分代码省略.........
开发者ID:sgh1986915,项目名称:php-crm,代码行数:101,代码来源:customer.php


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