Esempio n. 1
0
    $i++;
    $t[$i]->type = 'data';
    $t[$i]->desc = $l['reg-template'];
    $t[$i]->value = $st;
    $i++;
    $t[$i]->type = 'submit';
    $t[$i]->value = $l['submit'];
    $t[$i]->center = true;
    //$t[$i]->desc = " ";
    // check for errors
    $errors = '';
    if ($baddata) {
        $errors = '<div class="error">' . $l['data-problems'] . '<br />';
        foreach ($problems as $p) {
            $errors .= '<li>' . $p . "</li>\n";
        }
        $errors .= "</div> \n";
    }
    $ets->page_body = $errors . build_form($t, $form, $table, $clean);
}
$ets_outter->main_title = $config->get('site_name') . ': ' . $l['title-newuser'];
$ets_outter->page_title = $l['title-newuser'];
$ets_outter->sitenav = buildMainNav($l, $user);
$ets_outter->script_path = script_path;
$ets_outter->recent_blogs = $blog->getRecent($config);
$ets_outter->query_count = $db->getQueryCount();
$ets_outter->gen_time = mymicrotime($start, 5);
$ets_outter->welcome[] = $user->getWelcomeTags();
printt($ets_outter, skin_header);
printt($ets, skin_basic);
printt($ets_outter, skin_footer);
Esempio n. 2
0
    $f[$i]->name = 'mood';
    $f[$i]->desc = $l['ucp-mood'];
    // CUSTOM ?
    if (!empty($user->data['custom'])) {
        $i++;
        $f[$i]->type = 'text';
        $f[$i]->name = 'custom';
        $f[$i]->desc = $user->data['custom'];
    }
    // ACCESS
    $i++;
    $f[$i]->type = 'select';
    $f[$i]->name = 'access';
    $f[$i]->desc = $l['ucp-access'];
    $f[$i]->value = array(1 => $l['access-public'], 2 => $l['access-friends'], 3 => $l['access-private']);
    // OPTIONS
    $i++;
    $options = array(array('name' => 'bb', 'value' => 'x', 'desc' => $l['ucp-opt-bb']), array('name' => 'html', 'value' => 'x', 'desc' => $l['ucp-opt-html']), array('name' => 'smiles', 'value' => 'x', 'desc' => $l['ucp-opt-smiles']), array('name' => 'comments', 'value' => 'x', 'desc' => $l['ucp-opt-comments']));
    $f[$i]->type = 'checkboxes';
    $f[$i]->desc = $l['ucp-options'];
    $f[$i]->value = $options;
    badHtmlFirst($merge['body']);
    // SUBMIT
    $i++;
    $f[$i]->type = 'submit';
    $f[$i]->desc = $l['submit'];
    $f[$i]->value = $l['submit'];
    // Output.
    $ets->page_body .= $js_insert_window . "\n";
    $ets->page_body .= build_form($f, $form, $table, $merge);
}
Esempio n. 3
0
    if (!empty($problems)) {
        $ets->page_body .= '<div class="error">' . $l['data-problems'] . '<br />';
        foreach ($problems as $p) {
            $ets->page_body .= "<li>{$p}</li>\n";
        }
        $ets->page_body .= '</div>';
    }
    $form->action = 'admincp.php?action=ban_user';
    $form->method = 'post';
    $form->class = 'nlb_config_form';
    $table->class = 'nlb_table';
    $table->width = "100%";
    $f = array();
    $i = 0;
    $f[$i]->name = 'name';
    $f[$i]->type = 'text';
    $f[$i]->desc = $l['acp-ban-fld-name'];
    $i++;
    $f[$i]->name = 'reason';
    $f[$i]->type = 'text';
    $f[$i]->desc = $l['acp-ban-fld-reason'];
    $i++;
    $f[$i]->name = 'until';
    $f[$i]->type = 'text';
    $f[$i]->desc = $l['acp-ban-fld-until'];
    $i++;
    $f[$i]->type = 'submit';
    $f[$i]->value = $l['submit'];
    $f[$i]->desc = $l['submit'];
    $ets->page_body .= build_form($f, $form, $table, $_POST);
}
Esempio n. 4
0
            $split->setStatus('todo');
            insert_into_array($sections[$sectionsid], $changed_splits, $split->getShellName());
        } else {
            $split = new CoursePrefsSplit($user->getId(), $sectionsid, $i, $data->{'bucket_' . $i . '_name'}, 'todo');
            insert_into_array($sections[$sectionsid], $new_splits, $split->getShellName());
        }
        // Try to save
        try {
            $split->save();
        } catch (Exception $e) {
            $errors[] = 'Error trying to insert a split record.';
        }
    }
}
$params = array($changed_splits, $new_splits, $errors);
build_form('finished_content', $params, 'Next', '');
print_footer();
function insert_into_array($object, &$array, $key = null)
{
    if ($key) {
        if (!array_key_exists($key, $array)) {
            $array[$key] = array();
        }
        $array[$key][] = $object;
    } else {
        $array[] = $object;
    }
}
function array_get_or_else($key, $array, $value)
{
    if (array_key_exists($key, $array)) {
/**
 * Builds out the content of a page based on the type of elements passed to it.
 */
function build_page($elements)
{
    $output = '';
    foreach ($elements as $id => $values) {
        switch ($values['type']) {
            case 'html':
                $output .= '<div id="' . $id . '">' . $values['value'] . '</div>';
                break;
            case 'form':
                $output .= build_form($values['value']);
                break;
        }
    }
    return $output;
}
Esempio n. 6
0
{
    foreach ($value as $k => $v) {
        echo "<option value='{$k}'>" . $v . "</option>";
    }
}
// END funcion build_form
?>
            
            <?php 
build_form($ngay);
?>
        </select>
        
        <select>
            <option>Chọn thang</option>
            <?php 
build_form($thang);
?>
        </select>
        
        <select>
            <option>Chọn nam</option>
            <?php 
build_form($nam);
?>
        </select>
  
    </form>
       
    </body>
</html>
Esempio n. 7
0
         $show_insert_form_after_error = 0;
         $show_edit_form_after_error = 0;
         // display the form
         $form = build_form($table_name, $action, $fields_labels_ar, $form_type, $res_details, "", "", $show_insert_form_after_error, $show_edit_form_after_error);
         echo $form;
     }
     // end if
     break;
 case "show_search_form":
     txt_out("<h3>" . $normal_messages_ar["search_records"] . "</h3>");
     $form_type = "search";
     $res_details = "";
     $show_insert_form_after_error = 0;
     $show_edit_form_after_error = 0;
     // display the form
     $form = build_form($table_name, $action, $fields_labels_ar, $form_type, $res_details, "", "", $show_insert_form_after_error, $show_edit_form_after_error);
     echo $form;
     break;
 case "choose_next_record":
     if (isset($where_clause) && isset($order) && isset($order_type)) {
         // could be not set if the session has expired
         // rebuild the query for the current results
         $sql = build_select_part($fields_labels_ar, $table_name);
         if ($where_clause !== '') {
             $sql .= " WHERE " . $where_clause;
         }
         // end if
         $sql .= " ORDER BY `{$table_name}`.`{$order}` {$order_type}";
         // execute the query
         $res = $db->send_query($sql);
         // loop through the recordset, when find the current record, read another one and save its where_value
Esempio n. 8
0
        if ($mode == 'reset') {
            $split = $splits[$semestersid][$coursesid];
            build_form('reset_content', $split, 'Reset', 'Back', "POST");
        } else {
            if ($number && $number == $splits[$semestersid][$coursesid]->count) {
                // if they have already split, then tell them to reset first
                // they would only get this message if they tried to hack it
                if (!array_key_exists($coursesid, $splits[$semestersid])) {
                    redirect_error('');
                }
                $new_splits = array();
                $sections = $user->getSectionsForCourse($semestersid, $coursesid, false);
                $count = 0;
                foreach ($sections as $sectionsid => $section) {
                    $split = new CoursePrefsSplit($user->getId(), $sectionsid, ++$count, "Section {$section->getSectionNumber()}", 'todo');
                    $split->save();
                    $new_splits[$split->getShellName()] = $sections[$sectionsid];
                }
                $params = array(array(), $new_splits, array());
                build_form('finished_content', $params, 'Next', '');
            } else {
                $params = array($semestersid, $coursesid, $number, $user, $current_splits);
                build_form('numbered_content', $params, get_string('submit'), "", "POST", "post_split.php", 'onsubmit="return validate();"');
            }
        }
    }
}
print_footer();
?>
 
Esempio n. 9
0
//-- Build Schemas
if ($command == 'build' && $arg1 == 'schemas') {
    if (isset($arg2)) {
        build_schemas($arg2);
    } else {
        global $enabled_modules;
        foreach ($enabled_modules as $module) {
            build_schemas($module);
        }
    }
}
//-- Build Form
if ($command == 'build' && $arg1 == 'form' && isset($arg2)) {
    $model = $arg2;
    $override = isset($arg3) && ($arg3 == "--force" || $arg3 == "-f");
    build_form($model, $override);
}
//-- Clone a module
if ($command == 'clone') {
    echo "We now start to create a new module from an existing module:\n";
    echo "Which module do you like to clone?\n";
    $handle = fopen("php://stdin", "r");
    $line = fgets($handle);
    $from = trim($line);
    if (!module_exists($from)) {
        echo "Error: The module '{$from}' does not exist. \n";
        exit;
    }
    echo "What is the name your cloned new module will be? Please use single lower case word, e.g. 'product'\n";
    $line = fgets($handle);
    $to = trim($line);
Esempio n. 10
0
function cat_feed($fields)
{
    global $CONFIG;
    if (isset($_GET['catf'])) {
        $fields['feed_type']['value'] = "Category";
        $fields['feed_parameter']['value'] = $_GET['catf'];
        $data = cpg_db_fetch_row(cpg_db_query("SELECT name FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid ={$_GET['catf']}"));
        $fields['feed_name']['value'] = $fields['feed_title']['value'] = $data['name'];
    }
    if (isset($_GET['albf'])) {
        $fields['feed_type']['value'] = "Album";
        $fields['feed_parameter']['value'] = $_GET['albf'];
        $data = cpg_db_fetch_row(cpg_db_query("SELECT title FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid ={$_GET['albf']}"));
        $fields['feed_name']['value'] = $fields['feed_title']['value'] = $data['title'];
    }
    if (isset($_GET['specf'])) {
        $situation = $_GET['specf'];
        switch ($situation) {
            case 'lastup':
                $fields['feed_type']['value'] = "Any";
                $fields['feed_parameter']['value'] = "";
                $fields['feed_random']['value'] = "Last";
                $fields['feed_name']['value'] = "Last uploaded";
                $fields['feed_title']['value'] = "The newest pictures from " . $CONFIG['gallery_name'];
            case 'topn':
                $fields['feed_type']['value'] = "Hits";
                $fields['feed_parameter']['value'] = "";
                $fields['feed_random']['value'] = "Last";
                $fields['feed_name']['value'] = "Most viewed";
                $fields['feed_title']['value'] = "The most viewed pictures from " . $CONFIG['gallery_name'];
            case 'toprated':
                $fields['feed_type']['value'] = "Rating";
                $fields['feed_parameter']['value'] = "";
                $fields['feed_random']['value'] = "Last";
                $fields['feed_name']['value'] = "Top rated";
                $fields['feed_title']['value'] = "The toprated pictures from " . $CONFIG['gallery_name'];
            case 'random':
                $fields['feed_type']['value'] = "Any";
                $fields['feed_parameter']['value'] = "";
                $fields['feed_random']['value'] = "Random";
                $fields['feed_name']['value'] = "Random pictures";
                $fields['feed_title']['value'] = "Random pictures from " . $CONFIG['gallery_name'];
        }
    }
    echo "\n    <table align=\"center\" width=\"100%\" cellspacing=\"1\" cellpadding=\"0\" class=\"maintable\">\n        <TR>\n\t<TD class=\"tableh2\" colspan =\"2\">Edit channel-parameters</TD></TR>\n<TR>";
    echo build_form("insert", $fields);
    echo "</table>";
}
}
if ($_GET['allow_new_from'] === 'all') {
    $allow_new_from = array('core', 'local');
}
if ($_GET['allow_new_from'] === 'core') {
    $allow_new_from = array('core');
}
if ($_GET['allow_new_from'] === 'local') {
    $allow_new_from = array('local');
}
if (!empty($_GET['limit_to_field'])) {
    $fields = array($_GET['limit_to_field'] => $fields[$_GET['limit_to_field']]);
}
$status = find_type_localization($fields);
$new_options = find_options($fields, $allow_new_from);
build_form($status, $new_options, $fields_referencing);
/**
 * find type localization
 * 
 * iterate through types and find .php and .php3 file locations and values for content managers, custom deleters,
 * custom post deleters, custom previewers, custom sorters, and finish actions.
 * 
 */
function find_type_localization($fields)
{
    $type_status = array();
    $es = new entity_selector(id_of('master_admin'));
    $es->add_type(id_of('type'));
    $es->set_order('entity.name ASC');
    $types = $es->run_one();
    foreach ($types as $k => $v) {
Esempio n. 12
0
    echo '<div class="cps_error">' . get_string('error_preference_may', 'block_courseprefs');
    if (!empty($keys)) {
        $course_names = array();
        foreach ($crosslistable as $course) {
            if (in_array($course->coursesid, $keys)) {
                $course_names[] = $course->year . ' ' . $course->name . ' ' . $course->department . ' ' . $course->course_number;
            }
        }
        echo implode(' and ', $course_names);
    } else {
        echo get_string('error_preference_any', 'block_courseprefs');
    }
    echo '<p class="cps_smallerror">' . get_string('error_preference_sub', 'block_courseprefs') . '</p>';
    echo '</div>';
}
build_form($callback, $params, $next, $back, "POST", $action, $script);
print_footer();
function find_sections($key)
{
    global $CFG, $USER, $SESSION;
    $semestersid = $SESSION->crosslist_preferences['semestersid'];
    $coursesid = $key;
    $sql = "SELECT sec.*, sm.year, sm.name,\n                cou.department, cou.course_number\n                FROM\n                {$CFG->prefix}block_courseprefs_sections sec,\n                {$CFG->prefix}block_courseprefs_courses  cou,\n                {$CFG->prefix}block_courseprefs_semesters sm,\n                {$CFG->prefix}block_courseprefs_teachers t,\n                {$CFG->prefix}block_courseprefs_users    u\n              WHERE u.username='******'\n                AND t.usersid = u.id\n                AND t.sectionsid = sec.id\n                AND sec.semestersid = sm.id\n                AND sec.coursesid = cou.id\n                AND t.primary_flag = 1\n                AND t.status != 'unenrolled'\n                AND cou.id = {$coursesid}\n                AND sm.id = {$semestersid}\n                AND sec.status != 'unwant'\n                AND sec.status != 'unwanted'\n              ORDER BY sec.section_number";
    return get_records_sql($sql);
}
function is_set_null($key, $arr)
{
    return isset($arr[$key]) ? $arr[$key] : null;
}
function findCrosslist($keys, $semestersid, $crosslists)
{
Esempio n. 13
0
    }
    exit;
}
xoops_cp_header();
include "mymenu.php";
switch ($op) {
    case 'delete':
        $res = $xoopsDB->query("SELECT title FROM " . FORMS . " WHERE formid=" . $formid);
        list($title) = $xoopsDB->fetchRow($res);
        xoops_confirm(array('op' => 'delform', 'formid' => $formid), '', _AM_DELETE_FORM . ' - ' . htmlspecialchars($title, ENT_QUOTES) . " (ID:{$formid})", _DELETE);
        break;
    default:
        if ($formid == 0) {
            list_forms();
        }
        build_form($formid);
}
xoops_cp_footer();
function post_optvars()
{
    $items = get_form_attribute(_CC_OPTDEFS, '', 'optvar');
    $errors = assign_post_values($items);
    $vars = array();
    foreach ($items as $item) {
        $fname = $item['name'];
        if ($fname == "others") {
            foreach (unserialize_vars($item['value']) as $k => $v) {
                $vars[$k] = $v;
            }
        } else {
            if ($item['value']) {
Esempio n. 14
0
                $cr->setShellName($data->{'bucket_' . $i . '_name'});
                $cr->setStatus('todo');
            } else {
                reset_prefs(array($cr));
            }
            insert_into_array($section, $changed_cr, $cr->getShellName());
        } else {
            $cr = new CoursePrefsCrosslist($user->getId(), $sectionsid, 'todo', $data->{'bucket_' . $i . '_name'}, $suggested_idnumber);
            insert_into_array($section, $new_cr, $cr->getShellName());
        }
        try {
            $cr->save();
        } catch (Exception $e) {
            $errors[] = 'Could not save a cross list entry!';
        }
    }
}
$params = array($changed_cr, $new_cr, $errors);
build_form('finished_content', $params, 'Next', '', 'GET', 'crosslist.php');
print_footer();
function insert_into_array($object, &$array, $key = null)
{
    if ($key) {
        if (!array_key_exists($key, $array)) {
            $array[$key] = array();
        }
        $array[$key][] = $object;
    } else {
        $array[] = $object;
    }
}