コード例 #1
0
ファイル: functions.php プロジェクト: trabisdementia/xuups
function mypoints_pluginExecute($dirname, $items, $since, $func = 'useritems_count')
{
    global $xoopsUser, $xoopsConfig, $xoopsDB;
    $ret = array();
    $plugins_path = XOOPS_ROOT_PATH . '/modules/mypoints/plugins';
    $plugin_info = mypoints_getPluginInfo($dirname, $func);
    if (empty($plugin_info) || empty($plugin_info['plugin_path'])) {
        return false;
    }
    include_once $plugin_info['plugin_path'];
    // call the plugin
    if (function_exists(@$plugin_info['func'])) {
        // get the list of items
        $ret = $plugin_info['func']($items, $since);
    }
    return $ret;
}
コード例 #2
0
ファイル: index.php プロジェクト: trabisdementia/xuups
function mypoints_index()
{
    global $xoopsUser, $xoopsModule, $xoopsModuleConfig;
    $plugin_handler = xoops_getmodulehandler('plugin');
    xoops_cp_header();
    mypoints_adminmenu(0);
    $module_handler = xoops_gethandler('module');
    $since = $xoopsModuleConfig['countsince'];
    $criteria = new CriteriaCompo(new Criteria('isactive', 1));
    $modules = $module_handler->getObjects($criteria, true);
    unset($criteria);
    //get list of useritems_count plugins
    $items_plugins = array();
    foreach ($modules as $moduleid => $module) {
        $info = array();
        $info = mypoints_getPluginInfo($module->getVar('dirname'), 'useritems_count');
        if (is_array($info) && count($info) > 0) {
            include_once $info['plugin_path'];
            if (function_exists(@$info['func'])) {
                $items_plugins[$moduleid] = $module;
            }
        }
        unset($info);
    }
    //get list of uservotes_count plugins
    $votes_plugins = array();
    foreach ($modules as $moduleid => $module) {
        $info = array();
        $info = mypoints_getPluginInfo($module->getVar('dirname'), 'uservotes_count');
        if (is_array($info) && count($info) > 0) {
            include_once $info['plugin_path'];
            if (function_exists(@$info['func'])) {
                $votes_plugins[$moduleid] = $module;
            }
        }
        unset($info);
    }
    echo "<h3>" . _AM_MYPOINTS_PLUGINS . "</h3>";
    echo "<form action ='index.php?op=submit' method=post>";
    echo "<table border = '0' cellpadding = '2' cellspacing = '1' width=100% class = outer>";
    echo "<tr class = bg3><td>" . _AM_MYPOINTS_MODULENAME . "</td><td>" . _AM_MYPOINTS_PLUGINTYPE . "</td><td>" . _AM_MYPOINTS_PLUGINNAME . "</td><td>" . _AM_MYPOINTS_STATUS . "</td><td>&nbsp;</td><td>" . _AM_MYPOINTS_POINTS . "</td></tr>";
    foreach ($items_plugins as $moduleid => $module) {
        $plugin = $plugin_handler->getByModuleType($moduleid, 'items');
        $actif = is_object($plugin) ? $plugin->getVar('pluginisactive') : 0;
        $multi = is_object($plugin) ? $plugin->getVar('pluginmulti') : 1;
        $name = is_object($plugin) ? $plugin->getVar('pluginname') : $module->getVar('name');
        unset($plugin);
        echo "<tr>";
        echo "<td class = head>" . $module->getVar('name') . "</td>";
        echo "<td class = head>" . _AM_MYPOINTS_PLUGINITEMS . "</td>";
        echo "<td class = 'even'><input type='text' name='items_name[" . $module->getVar('mid') . "]' size=20 value='" . $name . "'></td>";
        echo "<td class = 'even'><select name=items_actif[" . $module->getVar('mid') . "]>";
        $sel = "";
        if ($actif == "1") {
            $sel = "SELECTED";
        }
        echo "<option " . $sel . " value=\"1\">" . _AM_MYPOINTS_ACTIVE . "\n</option>\n";
        $sel = "";
        if ($actif == "0") {
            $sel = "SELECTED";
        }
        echo "<option " . $sel . " value=\"0\">" . _AM_MYPOINTS_INACTIVE . "\n</option>\n";
        echo "</select></td>";
        echo "<td class = 'even'>" . _AM_MYPOINTS_MULTI . "</td>";
        echo "<td class = 'even'><input type='text' name='items_multi[" . $module->getVar('mid') . "]' size=2 value='" . $multi . "'></td>";
        echo "</tr>";
    }
    foreach ($votes_plugins as $moduleid => $module) {
        $plugin = $plugin_handler->getByModuleType($moduleid, 'votes');
        $actif = is_object($plugin) ? $plugin->getVar('pluginisactive') : 0;
        $multi = is_object($plugin) ? $plugin->getVar('pluginmulti') : 1;
        $name = is_object($plugin) ? $plugin->getVar('pluginname') : $module->getVar('name');
        unset($plugin);
        echo "<tr>";
        echo "<td class = head>" . $module->getVar('name') . "</td>";
        echo "<td class = head>" . _AM_MYPOINTS_PLUGINVOTES . "</td>";
        echo "<td class = 'even'><input type='text' name='votes_name[" . $module->getVar('mid') . "]' size=20 value='" . $name . "'></td>";
        echo "<td class = 'even'><select name=votes_actif[" . $module->getVar('mid') . "]>";
        $sel = "";
        if ($actif == "1") {
            $sel = "SELECTED";
        }
        echo "<option " . $sel . " value=\"1\">" . _AM_MYPOINTS_ACTIVE . "\n</option>\n";
        $sel = "";
        if ($actif == "0") {
            $sel = "SELECTED";
        }
        echo "<option " . $sel . " value=\"0\">" . _AM_MYPOINTS_INACTIVE . "\n</option>\n";
        echo "</select></td>";
        echo "<td class = 'even'>" . _AM_MYPOINTS_MULTI . "</td>";
        echo "<td class = 'even'><input type='text' name='votes_multi[" . $module->getVar('mid') . "]' size=2 value='" . $multi . "'></td>";
        echo "</tr>";
    }
    echo "</table><p>";
    echo "<input type='hidden' name='ok' VALUE='1'>";
    echo "<input type='submit' value='" . _AM_MYPOINTS_GO . "'>";
    echo "</form>";
    xoops_cp_footer();
}