Пример #1
0
<?php

// Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt
/**
* load the active plugins and then include the objects
*/
$do_crm_plugins = new CRMPluginBase();
$do_crm_plugins->load_active_plugins();
$active_plugins = $do_crm_plugins->get_active_plugins();
if (is_array($active_plugins) && count($active_plugins) > 0) {
    foreach ($active_plugins as $key => $plugins) {
        include_once $cfg_project_directory . 'plugins/' . $plugins["name"] . '/' . $plugins["name"] . '.class.php';
    }
}
    /**
     * process the list view action plugin 
     * @param integer $idmodule
     * @param mix $active_plugins
     * @return void
     */
    public function process_listview_action_plugin($idmodule, $active_plugins = null)
    {
        if ($active_plugins == null) {
            parent::load_active_plugins();
            $active_plugins = parent::get_active_plugins();
        }
        if (is_array($active_plugins) && count($active_plugins) > 0) {
            usort($active_plugins, function ($a, $b) {
                return $a['display_priority'] - $b['display_priority'];
            });
            foreach ($active_plugins as $key => $plugin) {
                $plugin_object = new $plugin["name"]();
                if (in_array($idmodule, $plugin_object->get_plugin_modules()) && in_array(8, $plugin_object->get_plugin_type()) && in_array(1, $plugin_object->get_list_view_plugin_position())) {
                    echo '<a href="#" class="btn btn-primary btn-mini bs-prompt" id="' . $plugin["name"] . '">';
                    echo '</a>';
                    echo '
					<script>
						$(document).ready(function() {
							load_list_view_action_plugin(\'' . $plugin["name"] . '\',\'' . $plugin_object->get_resource_name() . '\',' . $idmodule . ');
						});
					</script>';
                }
            }
        }
    }