Example #1
0
$blank_joint = array('joint' => '', 'joint_class' => '', 'option' => '');
if ($pipe_id == 0) {
    // LIST
    $template = 'admin_pipe_list.html';
    $pipe4edit = array();
} else {
    if (isset($pipes4assign[$pipe_id])) {
        // EDIT (DETAIL)
        $template = 'admin_pipe_edit.html';
        $pipe4edit = $pipes4assign[$pipe_id];
        $pipe4edit['joints'] = array_merge($pipe4edit['joints'], array_fill(0, 3, $blank_joint));
    } else {
        // NEW
        $pipe_id = -1;
        $template = 'admin_pipe_edit.html';
        $pipe4edit = array('id' => -1, 'name' => '', 'joints' => array(array('joint' => 'fetch', 'joint_class' => d3pipes_common_get_default_joint_class($mydirname, 'fetch'), 'option' => ''), array('joint' => 'parse', 'joint_class' => d3pipes_common_get_default_joint_class($mydirname, 'parse'), 'option' => ''), array('joint' => 'utf8to', 'joint_class' => d3pipes_common_get_default_joint_class($mydirname, 'utf8to'), 'option' => $xoopsModuleConfig['internal_encoding']), array('joint' => 'clip', 'joint_class' => d3pipes_common_get_default_joint_class($mydirname, 'clip'), 'option' => '')));
        $pipe4edit['joints'] = array_merge($pipe4edit['joints'], array_fill(0, 3, $blank_joint));
    }
}
// joint_classes options
$joint_classes_options = array();
foreach ($all_joints as $joint_type => $joint_type_name) {
    $joint_classes_options[$joint_type_name] = array();
    foreach (d3pipes_admin_fetch_classes($mydirname, $joint_type) as $joint_class) {
        $joint_classes_options[$joint_type_name][$joint_type . '::' . $joint_class] = defined('_MD_D3PIPES_CLASS_' . strtoupper($joint_type . $joint_class)) ? constant('_MD_D3PIPES_CLASS_' . strtoupper($joint_type . $joint_class)) : $joint_class;
    }
}
$joint_classes_options[_NONE] = array('::' => '----');
//
// display stage
//
Example #2
0
function &d3pipes_common_get_joint_object_default($mydirname, $joint_type, $option = '')
{
    $class_name = 'D3pipes' . ucfirst($joint_type) . ucfirst(d3pipes_common_get_default_joint_class($mydirname, $joint_type));
    require_once dirname(dirname(__FILE__)) . '/joints/' . $joint_type . '/' . $class_name . '.class.php';
    $ret = new $class_name($mydirname, 0, $option);
    return $ret;
}
Example #3
0
//
if (!empty($_POST['do_update'])) {
    foreach (array_keys($all_joints) as $joint_type) {
        $valid_classes = d3pipes_admin_fetch_classes($mydirname, $joint_type);
        if (!empty($_POST['jointclass'][$joint_type])) {
            $joint_class = $_POST['jointclass'][$joint_type];
            if (isset($valid_classes[$joint_class])) {
                $db->query("DELETE FROM " . $db->prefix($mydirname . "_joints") . " WHERE joint_type='" . mysql_real_escape_string($joint_type) . "'");
                $db->query("INSERT INTO " . $db->prefix($mydirname . "_joints") . " (joint_type,default_class) VALUES ('" . mysql_real_escape_string($joint_type) . "','" . mysql_real_escape_string($joint_class) . "')");
            }
        }
    }
    redirect_header(XOOPS_URL . "/modules/{$mydirname}/admin/index.php?page=joint", 3, _MD_A_D3PIPES_MSG_CACHEDELETED);
    exit;
}
//
// form stage
//
$joints4assign = array();
foreach ($all_joints as $joint_type => $joint_name4disp) {
    $joints4assign[$joint_type] = array('type' => $joint_type, 'name' => $joint_name4disp, 'classes' => d3pipes_admin_fetch_classes($mydirname, $joint_type), 'selected_class' => d3pipes_common_get_default_joint_class($mydirname, $joint_type));
}
//
// display stage
//
xoops_cp_header();
include dirname(__FILE__) . '/mymenu.php';
$tpl = new D3Tpl();
$tpl->assign(array('mydirname' => $mydirname, 'mod_name' => $xoopsModule->getVar('name'), 'mod_url' => XOOPS_URL . '/modules/' . $mydirname, 'mod_imageurl' => XOOPS_URL . '/modules/' . $mydirname . '/' . $xoopsModuleConfig['images_dir'], 'mod_config' => $xoopsModuleConfig, 'joints' => $joints4assign));
$tpl->display('db:' . $mydirname . '_admin_joint.html');
xoops_cp_footer();