Example #1
0
function showColumnstructure($columnid, $classindex = 0)
{
    $query = "select childcolumn from I_column where id={$columnid}";
    $result = getresult($query);
    $count = getresultNumrows($result);
    if ($count > 0) {
        $childColumnId = getresultData($result, 0, "childcolumn");
        //没有子栏目即返回
        //echo $childColumnId."<br>";
        if ($childColumnId == NULL || $childColumnId == 0 || $childColumnId == "") {
            if ($classindex == 0) {
                echo "<tr style=\"height:24px;\">\n";
                echo "<td align='center' colspan='3'>" . gettext_r("haveNot") . gettext_r("column") . "</td>";
                echo "</tr>\n";
            }
            return false;
        }
        $childId = explode("|", $childColumnId);
        foreach ($childId as $id) {
            echo "<tr class='list'>\n";
            $getchildcolumnQuery = "select columnname,childcount from I_column where id={$id}";
            $childColumn = getresult($getchildcolumnQuery);
            $childColumnname = getresultData($childColumn, 0, "columnname");
            $childCount = getresultData($childColumn, 0, "childcount");
            echo "<td> " . $id . "</td>\n";
            echo "<td> " . space($classindex) . $childColumnname . "</td>\n";
            echo "<td align='center'>";
            echo " ";
            //如果为大栏目调整,不出现添子栏目菜单
            if ($columnid != 0) {
                echo "<a href=\"admin_column.php?action=add&columnid=" . $id . "\">" . gettext_r("add") . gettext_r("child") . gettext_r("column") . "</a>";
                echo " | ";
            }
            echo "<a href=\"javascript:jump('admin_column.php','modify'," . $id . ")\">" . gettext_r("update") . gettext_r("column") . gettext_r("attribute") . "</a>";
            echo " | ";
            if ($columnid != 0) {
                echo "<a href=\"admin_article.php?action=add&columnid=" . $id . "\">" . gettext_r("add") . gettext_r("article") . "</a>";
                echo " | ";
            }
            echo "<a href=\"javascript:if(confirm('" . gettext_r("deleteColumnTip") . "'))jump('admin_column.php','delete'," . $id . ")\">" . gettext_r("delete") . "</a>";
            //echo " | ";
            //如果有子栏目则显示管理子栏目
            /*					if($childCount > 0)
            						echo "<a href=\"admin_column.php?columnid=".$id."\">管理子栏目($childCount)</a>\n";
            					else
            						echo "<a href=\"#\">管理子栏目($childCount)</a>\n";*/
            echo "</tr>\n";
            //如果为大栏目调整,则不递归显示子栏目
            if ($columnid != 0) {
                showColumnstructure($id, $classindex + 1);
            }
        }
    } else {
        return false;
    }
}
Example #2
0
 /**
  *    Describe object/array structure. If an object is specified, this method will return or output it's own
  *    method names or properties.
  *
  * @param ReflectionClass $ref_class        target class
  * @param integer $indent                   indent count
  */
 public static function describeParentClass(ReflectionClass $ref_class, $indent)
 {
     $result = '';
     $result .= space($indent * 4) . $ref_class->getName() . eol();
     $ref_parent = $ref_class->getParentClass();
     if ($ref_parent) {
         $result .= self::describeParentClass($ref_parent, $indent++);
     }
     return $result;
 }
Example #3
0
 /**
  * Calculate the space.
  *
  * @param string $algorithm
  *
  * @return string
  */
 public function getSpace($algorithm, $binary = false)
 {
     $adapter = $this->file->internalPathname()->localAdapter();
     if ($adapter instanceof SpaceAwareAdapterInterface) {
         return $adapter->getSpace($this->file->internalPathname(), $algorithm, $binary);
     }
     $file = $this->getFile();
     return Util::executeFunction(function () use($algorithm, $file, $binary) {
         return space($algorithm, $file->getContents(), $binary);
     }, 'Filicious\\Exception\\PluginException', 0, 'Could not calculate %s space of file %s', $algorithm, $file->getPathname());
 }
Example #4
0
/**
 * Print the expect section.
 * 
 * @param  string    $expect 
 * @param  string    $tag        expect|expectx
 * @access public
 * @return void
 */
function expect($expect, $tag = 'expect')
{
    $expect = trim($expect);
    $lines = explode("\n", $expect);
    if (count($lines) == 1) {
        return print space(4) . "{$tag}: {$expect}\n";
    }
    echo space(4) . "{$tag}: |\n";
    foreach ($lines as $line) {
        echo space(6) . trim($line) . "\n";
    }
}
Example #5
0
function recur_dir($dir)
{
    clearstatcache();
    $htmldirlist = '';
    $htmlfilelist = '';
    $dirlist = opendir($dir);
    while ($file = readdir($dirlist)) {
        if ($file != '.' && $file != '..') {
            $newpath = $dir . '/' . $file;
            $level = explode('/', $newpath);
            if (is_dir($newpath)) {
                /*$mod_array[] = array(
                          'level'=>count($level)-1,
                          'path'=>$newpath,
                          'name'=>end($level),
                          'type'=>'dir',
                          'mod_time'=>filemtime($newpath),
                          'size'=>'');
                          $mod_array[] = recur_dir($newpath);
                  */
                $dirname = end($level);
                $htmldirlist .= space(count($level)) . "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap><A onClick=\"Toggle(this, '" . $newpath . "');\"><IMG SRC=\"images/plus.gif\"> <IMG SRC=\"images/folder.gif\" border='0'> {$dirname} </a><DIV style='display:none'>\n";
                //$htmldirlist .= space(count($level))."   <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap><A onClick=\"Toggle(this)\"><IMG SRC=\"images/plus.gif\"> <IMG SRC=\"images/gear.png\"> Tools </A><DIV style='display:none'>\n";
                //$htmldirlist .= space(count($level))."       <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><IMG SRC=\"images/file.png\"><a href='foldernew.php?folder=".urlencode($newpath)."' title=''>New Folder </a><DIV style='display:none'>\n"; //parent.document.getElementById('file').value='".urlencode($newpath)."'
                //$htmldirlist .= space(count($level))."       </DIV></TD></TR></TABLE>\n";
                //$htmldirlist .= space(count($level))."       <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><IMG SRC=\"images/file.png\"><a href='filenew.php?folder=".urlencode($newpath)."' title=''>New File </a><DIV style='display:none'>\n"; //parent.document.getElementById('file').value='".urlencode($newpath)."'
                //$htmldirlist .= space(count($level))."       </DIV></TD></TR></TABLE>\n";
                //$htmldirlist .= space(count($level))."   </DIV></TD></TR></TABLE>\n";
                //$htmldirlist .= space(count($level))."       <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><IMG SRC=\"images/gear.png\"><a href='fileoptions.php?folder=".urlencode($newpath)."' title=''>Options </a><DIV style='display:none'>\n"; //parent.document.getElementById('file').value='".urlencode($newpath)."'
                //$htmldirlist .= space(count($level))."       </DIV></TD></TR></TABLE>\n";
                $htmldirlist .= recur_dir($newpath);
                $htmldirlist .= space(count($level)) . "</DIV></TD></TR></TABLE>\n";
            } else {
                /*$mod_array[] = array(
                         'level'=>count($level)-1,
                         'path'=>$newpath,
                         'name'=>end($level),
                         'type'=>'file',
                         'mod_time'=>filemtime($newpath),
                         'size'=>filesize($newpath));
                  */
                $filename = end($level);
                $filesize = round(filesize($newpath) / 1024, 2);
                $newpath = str_replace($filename, "", $newpath);
                $htmlfilelist .= space(count($level)) . "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><a href='javascript:void(0);' onclick=\"parent.document.getElementById('filename').value='" . $filename . "'; parent.document.getElementById('folder').value='" . $newpath . "';\" title='{$filesize} KB'><IMG SRC=\"images/file.png\" border='none'>{$filename}</a><DIV style='display:none'>\n";
                $htmlfilelist .= space(count($level)) . "</DIV></TD></TR></TABLE>\n";
            }
        }
    }
    closedir($dirlist);
    return $htmldirlist . "\n" . $htmlfilelist;
}
Example #6
0
    echo "  " . $argv[0] . " HOST --auto\r\n";
    echo "  " . $argv[0] . " www.shopwaredemo.de --auto\r\n\r\n";
    echo "  " . $argv[0] . " HOST QUERY\r\n";
    echo "  " . $argv[0] . " www.shopwaredemo.de \"SELECT COUNT(`id`) FROM `s_user`\"\r\n";
    echo "  " . $argv[0] . " www.shopwaredemo.de \"SELECT `email` FROM `s_user` LIMIT 0,1\"\r\n\r\n";
    exit(1);
}
if ($argv[2] != '--auto') {
    $x = http_req($argv[1], $argv[2]);
    if (!($x = mask($x))) {
        exit("Your query failed!\r\n\r\n");
    }
    echo "Query:\r\n  " . $argv[2] . "\r\nReturn:\r\n  " . $x . "\r\n\r\n";
} else {
    $task = array(array('Amount of registered users', 'SELECT COUNT(`id`) FROM `s_user`', null), array('E- Mail from first user', 'SELECT `email` FROM `s_user` ORDER BY `id` LIMIT 0,1', null), array('Password from first user', 'SELECT `password` FROM `s_user` LIMIT 0,1', null), array('Amount of orders', 'SELECT COUNT(`id`) FROM `s_order`', null));
    for ($i = 0; $i < count($task); $i++) {
        echo "[ .. ] Task: \"" . $task[$i][0] . "\"";
        $x = http_req($argv[1], $task[$i][1]);
        if (!($x = mask($x))) {
            echo "\r[fail] Task: \"" . $task[$i][0] . "\"\r\n";
        } else {
            echo "\r[ ok ] Task: \"" . $task[$i][0] . "\"\r\n";
            $task[$i][2] = $x;
        }
    }
    echo "\r\n";
    for ($i = 0; $i < count($task); $i++) {
        echo $task[$i][0] . space(26 - strlen($task[$i][0])) . ' : ' . $task[$i][2] . "\r\n";
    }
    echo "\r\n";
}
Example #7
0
function strr($strx = '', $count = 10)
{
    $strx = Trim($strx);
    $len = strlen($strx);
    return space($count - $len) . $strx;
}
Example #8
0
function recur_dir($dir)
{
    clearstatcache();
    $htmldirlist = '';
    $htmlfilelist = '';
    $dirlist = opendir($dir);
    $dir_array = array();
    while (false !== ($file = readdir($dirlist))) {
        if ($file != "." and $file != "..") {
            $newpath = $dir . '/' . $file;
            $level = explode('/', $newpath);
            if (substr($newpath, -4) == ".svn") {
                //ignore .svn dir and subdir
            } elseif (substr($newpath, -3) == ".db") {
                //ignore .db files
            } else {
                $dir_array[] = $newpath;
            }
            if ($x > 1000) {
                break;
            }
            $x++;
        }
    }
    asort($dir_array);
    foreach ($dir_array as $newpath) {
        $level = explode('/', $newpath);
        if (is_dir($newpath)) {
            /*$mod_array[] = array(
            			'level'=>count($level)-1,
            			'path'=>$newpath,
            			'name'=>end($level),
            			'type'=>'dir',
            			'mod_time'=>filemtime($newpath),
            			'size'=>'');
            			$mod_array[] = recur_dir($newpath);
            		*/
            $dirname = end($level);
            $htmldirlist .= space(count($level)) . "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap><a onClick=\"Toggle(this)\"><IMG SRC=\"images/plus.gif\"> <IMG SRC=\"images/folder.gif\" border='0'> {$dirname} </a><DIV style='display:none'>\n";
            //$htmldirlist .= space(count($level))."   <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap><A onClick=\"Toggle(this)\"><IMG SRC=\"images/plus.gif\"> <IMG SRC=\"images/gear.png\"> Tools </A><DIV style='display:none'>\n";
            //$htmldirlist .= space(count($level))."       <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><IMG SRC=\"images/file.png\"><a href='foldernew.php?folder=".urlencode($newpath)."' title=''>New Folder </a><DIV style='display:none'>\n"; //parent.document.getElementById('file').value='".urlencode($newpath)."'
            //$htmldirlist .= space(count($level))."       </DIV></TD></TR></TABLE>\n";
            //$htmldirlist .= space(count($level))."       <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><IMG SRC=\"images/file.png\"><a href='filenew.php?folder=".urlencode($newpath)."' title=''>New File </a><DIV style='display:none'>\n"; //parent.document.getElementById('file').value='".urlencode($newpath)."'
            //$htmldirlist .= space(count($level))."       </DIV></TD></TR></TABLE>\n";
            //$htmldirlist .= space(count($level))."   </DIV></TD></TR></TABLE>\n";
            //$htmldirlist .= space(count($level))."       <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><IMG SRC=\"images/gear.png\"><a href='fileoptions.php?folder=".urlencode($newpath)."' title=''>Options </a><DIV style='display:none'>\n"; //parent.document.getElementById('file').value='".urlencode($newpath)."'
            //$htmldirlist .= space(count($level))."       </DIV></TD></TR></TABLE>\n";
            $htmldirlist .= recur_dir($newpath);
            $htmldirlist .= space(count($level)) . "</DIV></TD></TR></TABLE>\n";
        } else {
            /*$mod_array[] = array(
            			'level'=>count($level)-1,
            			'path'=>$newpath,
            			'name'=>end($level),
            			'type'=>'file',
            			'mod_time'=>filemtime($newpath),
            			'size'=>filesize($newpath));
            		*/
            $filename = end($level);
            $filesize = round(filesize($newpath) / 1024, 2);
            $htmlfilelist .= space(count($level)) . "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><a href='javascript:void(0);' onclick=\"parent.document.title='" . $newpath . "';parent.document.getElementById('file').value='" . urlencode($newpath) . "'; parent.window.frames['frame_'+'edit1'].editArea.previous= new Array(); parent.window.frames['frame_'+'edit1'].editArea.switchClassSticky(document.getElementById('undo'), 'editAreaButtonDisabled', true); makeRequest('fileread.php','file=" . urlencode($newpath) . "'); window.setTimeout('parent.my_setSelectionRange(\\'edit1\\')','100');\" title='{$filesize} KB'><IMG SRC=\"images/file.png\" border='none'> {$filename} </a><DIV style='display:none'>\n";
            $htmlfilelist .= space(count($level)) . "</DIV></TD></TR></TABLE>\n";
        }
    }
    //end foreache
    closedir($dirlist);
    return $htmldirlist . "\n" . $htmlfilelist;
}
Example #9
0
<?php

/**
 * @return string
 */
function space()
{
    return ' ';
}
?>
<!DOCTYPE html>
<html>
  <?php 
echo space();
?>
</html>
<?php 
// maybe more stuff
Example #10
0
function js_beautify($js_source_text, $tab_size = 4)
{
    global $output, $token_text, $last_type, $last_text, $in, $ins, $indent, $tab_string;
    global $input, $input_length;
    $tab_string = str_repeat(' ', $tab_size);
    $input = $js_source_text;
    $input_length = strlen($input);
    $last_word = '';
    // last TK_WORD passed
    $last_type = TK_START_EXPR;
    // last token type
    $last_text = '';
    // last token text
    $output = '';
    // words which should always start on new line.
    // simple hack for cases when lines aren't ending with semicolon.
    // feel free to tell me about the ones that need to be added.
    $line_starters = explode(',', 'continue,try,throw,return,var,if,switch,case,default,for,while,break,function');
    // states showing if we are currently in expression (i.e. "if" case) - IN_EXPR, or in usual block (like, procedure), IN_BLOCK.
    // some formatting depends on that.
    $in = IN_BLOCK;
    $ins = array($in);
    $indent = 0;
    $pos = 0;
    // parser position
    $in_case = false;
    // flag for parser that case/default has been processed, and next colon needs special attention
    while (true) {
        list($token_text, $token_type) = get_next_token($pos);
        if ($token_type == TK_EOF) {
            break;
        }
        // $output .= " [$token_type:$last_type]";
        switch ($token_type) {
            case TK_START_EXPR:
                in(IN_EXPR);
                if ($last_type == TK_END_EXPR or $last_type == TK_START_EXPR) {
                    // do nothing on (( and )( and ][ and ]( ..
                } elseif ($last_type != TK_WORD and $last_type != TK_OPERATOR) {
                    space();
                } elseif (in_array($last_word, $line_starters) and $last_word != 'function') {
                    space();
                }
                token();
                break;
            case TK_END_EXPR:
                token();
                in_pop();
                break;
            case TK_START_BLOCK:
                in(IN_BLOCK);
                if ($last_type != TK_OPERATOR and $last_type != TK_START_EXPR) {
                    if ($last_type == TK_START_BLOCK) {
                        nl();
                    } else {
                        space();
                    }
                }
                token();
                indent();
                break;
            case TK_END_BLOCK:
                if ($last_type == TK_END_EXPR) {
                    unindent();
                    nl();
                } elseif ($last_type == TK_END_BLOCK) {
                    unindent();
                    nl();
                } elseif ($last_type == TK_START_BLOCK) {
                    // nothing
                    unindent();
                } else {
                    unindent();
                    nl();
                }
                token();
                in_pop();
                break;
            case TK_WORD:
                if ($token_text == 'case' or $token_text == 'default') {
                    if ($last_text == ':') {
                        // switch cases following one another
                        remove_indent();
                    } else {
                        $indent--;
                        nl();
                        $indent++;
                    }
                    token();
                    $in_case = true;
                    break;
                }
                $prefix = PRINT_NONE;
                if ($last_type == TK_END_BLOCK) {
                    if (!in_array($token_text, array('else', 'catch', 'finally'))) {
                        $prefix = PRINT_NL;
                    } else {
                        $prefix = PRINT_SPACE;
                        space();
                    }
                } elseif ($last_type == TK_END_COMMAND && $in == IN_BLOCK) {
                    $prefix = PRINT_NL;
                } elseif ($last_type == TK_END_COMMAND && $in == IN_EXPR) {
                    $prefix = PRINT_SPACE;
                } elseif ($last_type == TK_WORD) {
                    if ($last_word == 'else') {
                        // else if
                        $prefix = PRINT_SPACE;
                    } else {
                        $prefix = PRINT_SPACE;
                    }
                } elseif ($last_type == TK_START_BLOCK) {
                    $prefix = PRINT_NL;
                } elseif ($last_type == TK_END_EXPR) {
                    space();
                }
                if (in_array($token_text, $line_starters) or $prefix == PRINT_NL) {
                    if ($last_text == 'else') {
                        // no need to force newline on else break
                        // DONOTHING
                        space();
                    } elseif (($last_type == TK_START_EXPR or $last_text == '=') and $token_text == 'function') {
                        // no need to force newline on 'function': (function
                        // DONOTHING
                    } elseif ($last_type == TK_WORD and ($last_text == 'return' or $last_text == 'throw')) {
                        // no newline between 'return nnn'
                        space();
                    } else {
                        if ($last_type != TK_END_EXPR) {
                            if (($last_type != TK_START_EXPR or $token_text != 'var') and $last_text != ':') {
                                // no need to force newline on 'var': for (var x = 0...)
                                if ($token_text == 'if' and $last_type == TK_WORD and $last_word == 'else') {
                                    // no newline for } else if {
                                    space();
                                } else {
                                    nl();
                                }
                            }
                        }
                    }
                } elseif ($prefix == PRINT_SPACE) {
                    space();
                }
                token();
                $last_word = $token_text;
                break;
            case TK_END_COMMAND:
                token();
                break;
            case TK_STRING:
                if ($last_type == TK_START_BLOCK or $last_type == TK_END_BLOCK) {
                    nl();
                } elseif ($last_type == TK_WORD) {
                    space();
                }
                token();
                break;
            case TK_OPERATOR:
                $start_delim = true;
                $end_delim = true;
                if ($token_text == ':' and $in_case) {
                    token();
                    // colon really asks for separate treatment
                    nl();
                    $expecting_case = false;
                    break;
                }
                $in_case = false;
                if ($token_text == ',') {
                    if ($last_type == TK_END_BLOCK) {
                        token();
                        nl();
                    } else {
                        if ($in == IN_BLOCK) {
                            token();
                            nl();
                        } else {
                            token();
                            space();
                        }
                    }
                    break;
                } elseif ($token_text == '--' or $token_text == '++') {
                    // unary operators special case
                    if ($last_text == ';') {
                        // space for (;; ++i)
                        $start_delim = true;
                        $end_delim = false;
                    } else {
                        $start_delim = false;
                        $end_delim = false;
                    }
                } elseif ($token_text == '!' and $last_type == TK_START_EXPR) {
                    // special case handling: if (!a)
                    $start_delim = false;
                    $end_delim = false;
                } elseif ($last_type == TK_OPERATOR) {
                    $start_delim = false;
                    $end_delim = false;
                } elseif ($last_type == TK_END_EXPR) {
                    $start_delim = true;
                    $end_delim = true;
                } elseif ($token_text == '.') {
                    // decimal digits or object.property
                    $start_delim = false;
                    $end_delim = false;
                } elseif ($token_text == ':') {
                    // zz: xx
                    // can't differentiate ternary op, so for now it's a ? b: c; without space before colon
                    $start_delim = false;
                }
                if ($start_delim) {
                    space();
                }
                token();
                if ($end_delim) {
                    space();
                }
                break;
            case TK_BLOCK_COMMENT:
                nl();
                token();
                nl();
                break;
            case TK_COMMENT:
                //if ($last_type != TK_COMMENT) {
                nl();
                //}
                token();
                nl();
                break;
            case TK_UNKNOWN:
                token();
                break;
        }
        if ($token_type != TK_COMMENT) {
            $last_type = $token_type;
            $last_text = $token_text;
        }
    }
    // clean empty lines from redundant spaces
    $output = preg_replace('/^ +$/m', '', $output);
    return $output;
}
Example #11
0
function newsItem($data)
{
    $r[] = "<div class=\"news\">";
    $r[] = space(2) . "<h4 class=\"lang\">" . $data['header'] . "</h4>";
    $r[] = space(2) . "<div class=\"lang-edge\">";
    $r[] = space(4) . "<p>" . $data['text'] . "</p>";
    $r[] = space(4) . "<a href=\"?page=news\">читать далее...</a>";
    $r[] = space(2) . "</div>";
    $r[] = "</div>";
    return $r;
}
Example #12
0
function end_form()
{
    return '' . NL . space() . NL . '</table>' . NL . '</form>' . NL . '</div>' . NL . '<div class=clear></div>' . NL . '</div id="cont_body">' . NL;
}
Example #13
0
    }
    //	}
}
//-------------------------------FORM-----------------------------------------
start_form();
//form input
if (isset($_POST['AddNew'])) {
    start_table("class='form'");
    text_field('Store Name: ', 'store_name', $val_selected['store_name'], true);
    text_area('Description: ', 'description', $val_selected['description']);
    text_field('Address: ', 'address', $val_selected['address'], false);
    text_field('Contact: ', 'contact', $val_selected['contact'], false);
    text_with_list_users("Person: ", "person_id", $val_selected['person_id'], false, true, "-", "level='" . USER_STORE . "'");
    start_row();
    start_column();
    space();
    //spasi
    end_column();
    start_column();
    if ($_POST['AddNew'] != 'update') {
        //add new
        submit_button('submit', 'Add');
    } else {
        //update
        input_hidden('id', $val_selected['id']);
        submit_button('submit_update', 'Update');
    }
    end_column();
    end_row();
    end_table();
    link_text("?" . $parameter_key . "kd_tabel=tb_stores", '<- kembali');
Example #14
0
 public function get_opt_rekening()
 {
     $query = $this->mma->_opt_rekening();
     $opt = '<option value="">Pilih Rekening</option>';
     foreach ($query->result() as $key => $value) {
         $opt .= '<option value="' . $value->code . '">' . space($value->space) . ' ' . $value->code . ' ' . $value->name . '</option>';
     }
     echo $opt;
 }
    */
    return (int) $b[3] - (int) $a[3];
}
usort($employes, "cmp");
function space($spaces_needed, $a, $b = null)
{
    $str = "   {$a} {$b}";
    if (!isset($b)) {
        $str = "   {$a}";
    }
    $strlen = strlen($str);
    $total = $spaces_needed - $strlen;
    for ($i = 0; $i < $total; $i++) {
        $str = $str . " ";
    }
    return $str;
}
/*
 *	Display the table 
 */
echo "There are {$num_employes} on record" . PHP_EOL;
echo "There are {$num_sales} total sales" . PHP_EOL;
echo "The Average number of units sold per employe is: {$ave_sales}" . PHP_EOL . PHP_EOL;
echo "Units   |              Full Name                 |     Employe Number" . PHP_EOL;
echo '==================================================================' . PHP_EOL;
foreach ($employes as $employe) {
    $a = space(8, $employe[3]);
    $b = space(40, $employe[1], $employe[2]);
    $c = space(20, $employe[0]);
    echo $a . '|' . $b . '|' . $c . PHP_EOL;
}
Example #16
0
function showcolumnlist($columnid, $columnofarticleid = -1, $classindex = 0)
{
    $query = "select childcolumn from I_column where id={$columnid}";
    $result = getresult($query);
    $count = getresultNumrows($result);
    if ($classindex == 0) {
        $tempresult = getresult("select * from I_column where id={$columnid}");
        $columnname = getresultData($tempresult, 0, "columnname");
        //echo $columnname;
        if ($columnid == $columnofarticleid) {
            echo "<option selected=\"true\" value='" . $columnid . "'>\n";
        } else {
            echo "<option value='" . $columnid . "'>\n";
        }
        echo "{$columnname}</option>";
    }
    if ($count > 0) {
        $childColumnId = getresultData($result, 0, "childcolumn");
        //没有子栏目即返回
        //echo $childColumnId."<br>";
        if ($childColumnId == NULL || $childColumnId == 0 || $childColumnId == "") {
            if ($classindex == 0) {
                //echo "<option value='-1'>暂无栏目</option>";
            }
            return false;
        }
        $childId = explode("|", $childColumnId);
        foreach ($childId as $id) {
            $getchildcolumnQuery = "select columnname,childcount from I_column where id={$id}";
            $childColumn = getresult($getchildcolumnQuery);
            $childColumnname = getresultData($childColumn, 0, "columnname");
            $childCount = getresultData($childColumn, 0, "childcount");
            if ($id == $columnofarticleid) {
                echo "<option selected=\"true\" value='" . $id . "'>\n";
            } else {
                echo "<option value='" . $id . "'>\n";
            }
            echo space($classindex + 1) . $childColumnname . "</option>\n";
            //如果为大栏目调整,则不递归显示子栏目
            if ($columnid != 0) {
                showcolumnlist($id, $columnofarticleid, $classindex + 1);
            }
        }
    } else {
        return false;
    }
}